element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Autodesk EAGLE
  • Products
  • More
Autodesk EAGLE
EAGLE User Chat (English) Cadsoft Eagle with Python Scripting
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Autodesk EAGLE to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 54 replies
  • Subscribers 183 subscribers
  • Views 9841 views
  • Users 0 members are here
Related

Cadsoft Eagle with Python Scripting

Former Member
Former Member over 12 years ago

Hi,

 

I've only started using Eagle a few weeks ago, and as much as I like it, I have found what I consider some pretty fundamental features just missing. As the built in scripting language is extremely restrictive (when compared to a 'real' language like python, lua or ruby), I made an attempt to get python running with Eagle.

 

http://www.youtube.com/watch?v=_w7CECR7Dv8

 

The above is a video of a project I have been working on for the pas 3-4 days, which basically involves exposing the Cadsoft ULP and SCR to python (albeit in not the fastest way). But it does allow me to now use 90% of the ULP and all of the SCR directly from python, including the Object Heirarchies, board.grid... schematic... which have all be exposed in a pythonic way.

 

as an example, to get all the Instances in the schematic..

 

instances = Eaglepy.ULSchematic().instances()

 

or loop,

 

for instance in Eaglepy.ULSchematic().instances():

     print instance.name()

 

etc..

 

The tools in the video were very quick to knock out.. the slowest bit was figuring out the papers for approximating cubic/quadratic bezier curves with arcs, for the DXF Importer. These should be the first of many tools to come, next on the list is a group manager so I can save my selectsion.

 

Hopefully when I have had time to test this a bit more I will release the code to the community, along with any tools I have built. for others who might want this funtionality. (something that should be out of the box with proper bindings to a proper language imo...)

 

Cheers

 

Rob.

  • Sign in to reply
  • Cancel
Parents
  • rick_b
    rick_b over 8 years ago

    Does anyone know if this works with eagle 7.7?

     

    Rick

    --

    EAGLE support forums at http://www.eaglecentral.ca :: Where the EAGLE community meets.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • autodeskguest
    autodeskguest over 8 years ago in reply to rick_b

    rickb wrote on Fri, 17 February 2017 14:43

    Does anyone know if this works with eagle 7.7?

     

    Do you mean the Python scripting?  I've mainly used it with version 5 and

    6.  I'll try to test it with version 7 this weekend...

    --

    EAGLE support forums at http://www.eaglecentral.ca :: Where the EAGLE community meets.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • autodeskguest
    autodeskguest over 8 years ago in reply to rick_b

    rickb wrote on Mon, 20 February 2017 15:47

    Quote:

    Do you mean the Python scripting?

     

    Yes, thanks.

     

    Sorry mate, I didn't get to try it out.  We had a (late) Chinese New Year

    celebration at the Bagua school Saturday and the little lady and I spent

    most of Sunday out of town with family.

     

    I'm now on the fence about how much more effort to put into the Python

    thing.  I had started a book on advanced EAGLE use and I was including

    writing scripts and ULPs and how to manipulate the XML files externally.

    With the changes in the EAGLE world lately, part of me is angry enough to

    motivate me to finish up the external program that lets you directly

    manipulate the XML files, but the other part of me is disgusted enough to

    want to drop it all and just walk away.  End of an era.  Sigh...

    --

    EAGLE support forums at http://www.eaglecentral.ca :: Where the EAGLE community meets.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • rick_b
    rick_b over 8 years ago in reply to autodeskguest

    I understand your frustration. I bought 7.7 before the official

    announcement and feel the same way. I will continue to use it until it no

    longer meets my needs or until Kicad meets my expectations, which ever

    happens first. I would like to see what you have written, however rough it

    may be for educational purposes.

     

    Rick

    --

    EAGLE support forums at http://www.eaglecentral.ca :: Where the EAGLE community meets.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • autodeskguest
    autodeskguest over 8 years ago in reply to rick_b

    rickb wrote on Mon, 20 February 2017 19:48

    I understand your frustration. I bought 7.7 before the official

    announcement and feel the same way. I will continue to use it until it no

    longer meets my needs or until Kicad meets my expectations, which ever

    happens first.

     

    I see that there is a python scripting API for KiCad.  I'm going to work

    with that a bit.  Also, while I'm not a huge scheme fan, gEDA does have

    guile scripting.  In particular, this page about hierarchical blocks in

    gEDA looks very interesting to me:

    http://www.bourbonstreetsoftware.com/GEDABlocks.html.  He even uses "make"

    which for me as a Unix guy is very appealing!

     

    Quote:

    I would like to see what you have written, however rough it may be for

    educational purposes.

     

    The general outline of the book is to talk about command line use and

    scripting, then how to make menu changes and key assignments, followed by a

    couple chapters on writing ULPs to create scripts.  Then I used Python to

    take a look at the XML files directly.  For my example code, I

    reimplemented my arrange and distribute ULPs in a Python script you run

    from the command line.

     

    In the next chapter, I started building a graphical interface to view the

    files.  This turned into mostly a library and BOM manipulation tool, sort

    of an external http://www.bobstarr.net/pages/downloads.html if you will.  I

    considered using PyQt for the GUI, but the licensing didn't work for me, so

    at that point, I switched to using Java.  I've got quite a few of the basic

    functions implemented, so you can open an EAGLE file, change attributes,

    move items, lock and unlock, save, etc.  Next, I was going to render the

    board file and display it in 3D space so that you could fly by and see the

    back side.  I've done this kind of thing before with POV-RAY, Sketchup,

    Blender, TurboCAD, and Lightwave, but it would be nice to simplify that

    process.

     

    I think the last thing I'm going to do is implement some export function so

    that I can convert all of my current designs to KiCad or gEDA.  And I have

    to say, the http://www.altium.com/eagle-switch/circuitstudio/ deal is

    sounding mighty nice - for less than the cost of a year of EAGLE Premium

    subscription, you can get a perpetual license.  At the end of the year,

    I'll have saved $5 and have a usable copy of Circuit Studio...

    --

    EAGLE support forums at http://www.eaglecentral.ca :: Where the EAGLE community meets.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • autodeskguest
    autodeskguest over 8 years ago in reply to autodeskguest

    On 21.02.2017 19:17, Doug Wellington wrote:

    I considered using PyQt for the GUI, but the licensing didn't work for me, so

    at that point, I switched to using Java.

    For a more liberal license, you should have considered wxPython instead.

    Python seems a much more natural choice for these tasks than Java.

    Also, it would allow for easier integration if you really want to

    migrate to KiCad. The PCB part of KiCad has a Python console already.

    I would expect the Schematic part to follow sooner or later.

     

    Regards,

     

    Dietmar

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • autodeskguest
    autodeskguest over 8 years ago in reply to autodeskguest

    On 21.02.2017 19:17, Doug Wellington wrote:

    I considered using PyQt for the GUI, but the licensing didn't work for me, so

    at that point, I switched to using Java.

    For a more liberal license, you should have considered wxPython instead.

    Python seems a much more natural choice for these tasks than Java.

    Also, it would allow for easier integration if you really want to

    migrate to KiCad. The PCB part of KiCad has a Python console already.

    I would expect the Schematic part to follow sooner or later.

     

    Regards,

     

    Dietmar

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • autodeskguest
    autodeskguest over 8 years ago in reply to autodeskguest

    Dietmar Schwertberger wrote on Wed, 22 February 2017 12:32

    For a more liberal license, you should have considered wxPython

    instead.

     

    Thanks, part of my issue is that I was also writing in C++ and I didn't

    want to have to release that source code.  It's my code, I wrote it and I

    want to keep it private.  Over the years I have grown weary of people

    contacting me demanding my source code, my schematic and board files, and

    my gerbers.  It's hard to make your investment back when someone can grab

    your work and match or beat your time to market and undermine your pricing.

    Anything with GPL licensing is out for me because of that

     

    Quote:

    Python seems a much more natural choice for these tasks than Java.

     

    For scripting, rapid prototyping and as a language to use for teaching,

    Python is fantastic.  Because of it being interpreted though, there is no

    way to effectively control your IP.

     

    --

    EAGLE support forums at http://www.eaglecentral.ca :: Where the EAGLE community meets.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • autodeskguest
    autodeskguest over 8 years ago in reply to autodeskguest

    Dietmar Schwertberger wrote on Wed, 22 February 2017 12:32

    For a more liberal license, you should have considered wxPython

    instead.

     

    Thanks, part of my issue is that I was also writing in C++ and I didn't

    want to have to release that source code.  It's my code, I wrote it and I

    want to keep it private.  Over the years I have grown weary of people

    contacting me demanding my source code, my schematic and board files, and

    my gerbers.  It's hard to make your investment back when someone can grab

    your work and match or beat your time to market and undermine your pricing.

    Anything with GPL licensing is out for me because of that

     

    Quote:

    Python seems a much more natural choice for these tasks than Java.

     

    For scripting, rapid prototyping and as a language to use for teaching,

    Python is fantastic.  Because of it being interpreted though, there is no

    way to effectively control your IP.

     

    --

    EAGLE support forums at http://www.eaglecentral.ca :: Where the EAGLE community meets.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • autodeskguest
    autodeskguest over 8 years ago in reply to autodeskguest

    Also, switching to the Java world lets me use Groovy, Scala, Clojure, and

    even Jython or JRuby all together...

     

    FWIW, the Java ecosystem is fantastic.  The build, test, code analysis,

    continuous integration, etc., tools are great!

    --

    EAGLE support forums at http://www.eaglecentral.ca :: Where the EAGLE community meets.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • autodeskguest
    autodeskguest over 8 years ago in reply to autodeskguest

    Also, switching to the Java world lets me use Groovy, Scala, Clojure, and

    even Jython or JRuby all together...

     

    FWIW, the Java ecosystem is fantastic.  The build, test, code analysis,

    continuous integration, etc., tools are great!

    --

    EAGLE support forums at http://www.eaglecentral.ca :: Where the EAGLE community meets.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • autodeskguest
    autodeskguest over 8 years ago in reply to autodeskguest

    On 22.02.2017 20:55, Doug Wellington wrote:

    Dietmar Schwertberger wrote on Wed, 22 February 2017 12:32

    Thanks, part of my issue is that I was also writing in C++ and I didn' > want to have to release that source code.  It's my code, I wrote it

    and I> want to keep it private.  Over the years I have grown weary of people

    Put your core C++ code into a .pyd (i.e. actually a DLL).

    Still you can control your code from Python, offering a scripting

    interface without much effort.

     

     

    contacting me demanding my source code, my schematic and board files, and

    my gerbers.  It's hard to make your investment back when someone can grab

    your work and match or beat your time to market and undermine your pricing.

    Anything with GPL licensing is out for me because of that

    The wx license is not GPL. It is LGPL, but even allows to distribute

    binaries on your own terms. So basically, it's not much different from

    MIT, BSD or similar licenses for any practical application.

     

     

    For scripting, rapid prototyping and as a language to use for teaching,

    Python is fantastic.

    It's also a great language to implement large applications, either GUI

    or web based. Implementing GUIs in C++ seems to be a huge waste of

    resources. The learning curve for GUIs is a bit steep, just as for C++.

    For this reason I started improving the wxGlade GUI builder last year.

    If you go for wx, you should have a look at the current wxGlade version

    from the repository.

    (Documentation update is work in progress and not yet online.)

     

     

    Because of it being interpreted though, there is no

    way to effectively control your IP.

    Well, there are ways, but these are a bit complicated. I have one

    application where I'm using a dongle for Python code and .pyd extensions.

    But protection of the Python code requires a custom Python runtime.

    For extension of other people's code, that's probably not an option.

    On the other hand, don't forget that Python bytecode might be easier

    to decompile, but it's also possible for C++ code. I think there are

    quite powerful reverse engineering tools for compiled binaries.

     

     

    Regards,

     

    Dietmar

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • autodeskguest
    autodeskguest over 8 years ago in reply to autodeskguest

    On 22.02.2017 20:55, Doug Wellington wrote:

    Dietmar Schwertberger wrote on Wed, 22 February 2017 12:32

    Thanks, part of my issue is that I was also writing in C++ and I didn' > want to have to release that source code.  It's my code, I wrote it

    and I> want to keep it private.  Over the years I have grown weary of people

    Put your core C++ code into a .pyd (i.e. actually a DLL).

    Still you can control your code from Python, offering a scripting

    interface without much effort.

     

     

    contacting me demanding my source code, my schematic and board files, and

    my gerbers.  It's hard to make your investment back when someone can grab

    your work and match or beat your time to market and undermine your pricing.

    Anything with GPL licensing is out for me because of that

    The wx license is not GPL. It is LGPL, but even allows to distribute

    binaries on your own terms. So basically, it's not much different from

    MIT, BSD or similar licenses for any practical application.

     

     

    For scripting, rapid prototyping and as a language to use for teaching,

    Python is fantastic.

    It's also a great language to implement large applications, either GUI

    or web based. Implementing GUIs in C++ seems to be a huge waste of

    resources. The learning curve for GUIs is a bit steep, just as for C++.

    For this reason I started improving the wxGlade GUI builder last year.

    If you go for wx, you should have a look at the current wxGlade version

    from the repository.

    (Documentation update is work in progress and not yet online.)

     

     

    Because of it being interpreted though, there is no

    way to effectively control your IP.

    Well, there are ways, but these are a bit complicated. I have one

    application where I'm using a dongle for Python code and .pyd extensions.

    But protection of the Python code requires a custom Python runtime.

    For extension of other people's code, that's probably not an option.

    On the other hand, don't forget that Python bytecode might be easier

    to decompile, but it's also possible for C++ code. I think there are

    quite powerful reverse engineering tools for compiled binaries.

     

     

    Regards,

     

    Dietmar

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
  • autodeskguest
    autodeskguest over 8 years ago in reply to autodeskguest

    Dietmar Schwertberger wrote on Wed, 22 February 2017 13:16

    Put your core C++ code into a .pyd (i.e. actually a DLL).  Still you

    can control your code from Python, offering a scripting interface without

    much effort.

     

    Yes, I use Python for the GUI and scripting, and the C++ is for the

    rendering and math functions (using a GPU).

     

    Quote:

    The wx license is not GPL. It is LGPL, but even allows to distribute

    binaries on your own terms. So basically, it's not much different from

    MIT, BSD or similar licenses for any practical application.

     

    That is very nice.

     

    Quote:

    (Python is) also a great language to implement large applications,

    either GUI or web based.

     

    Yes, I agree.  At my "real" job during the day, I use Python and QT for

    large applications every day.

     

     

    Quote:

    If you go for wx, you should have a look at the current wxGlade version

    from the repository.

     

    I will definitely look at that.  Thank you...

     

    Quote:

    I think there are quite powerful reverse engineering tools for compiled

    binaries.

     

    I have no illusions that a determined person would not be able to reverse

    engineer my work.  If they wish to go through that effort, that is up to

    them, but since I either give my tools away for free or charge a very small

    amount of money, I hope it is not worth their trouble.

     

    --

    EAGLE support forums at http://www.eaglecentral.ca :: Where the EAGLE community meets.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube