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 Support (English) Assigning different library to device in schematic using ULP
  • 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
  • State Not Answered
  • Replies 3 replies
  • Subscribers 180 subscribers
  • Views 479 views
  • Users 0 members are here
Related

Assigning different library to device in schematic using ULP

bobbeird
bobbeird over 7 years ago

Hi,

I'm new to Eagle(v7.7) and new to these forums as well. I've searched for an answer to my question but have not had much luck so here I am.

 

Our current process, during development, is to use an unverified library for any new components, and a verified library for components already in use in our other products (we've used them, the footprints are correct, the part numbers are correct, etc etc).  Part of the release process is to review those new components and move them into the verified library. To avoid duplication and errors, the version in the unverified library gets deleted at this time. This is all well and good, except the component on the schematic will still reference the unverified library, where the device no longer exists. Manually replacing each component on the schematic with one from the verified library would work, but it doesn't sound like a whole lot of fun. My thought was to write a ULP to handle this. I can successfully identify every device using the unverified library using :

 

schematic(S)

{

     S.parts(P)

     {

          if(P.device.library == "Unverified")     <<~~~~~ Unverified is the actual name of the library in this example...   Unverified.lbr

 

 

I tested this and it successfully identified every component referencing that library. My logical next step (that is apparently not so logical) was to simply assign the new library name after the if statement. So I did this:

schematic(S)

{

     S.parts(P)

     {

          if(P.device.library == "Unverified")

          {

               P.device.library = "Verified";

          }

     }

}

 

Unfortunately, I get a syntax error on the line P.device.library = "Verified";        but I don't know why. Any help would be greatly appreciated.

 

Best regards,

Bob

  • Sign in to reply
  • Cancel
  • dukepro
    0 dukepro over 7 years ago

    On 8/17/18 11:20, Bob Beird wrote:

    Hi,

    I'm new to Eagle(v7.7) and new to these forums as well. I've searched for an answer to my question but have not had much luck so here I am.

     

    Our current process, during development, is to use an unverified library for any new components, and a verified library for components already in use in our other products (we've used them, the footprints are correct, the part numbers are correct, etc etc).  Part of the release process is to review those new components and move them into the verified library. To avoid duplication and errors, the version in the unverified library gets deleted at this time. This is all well and good, except the component on the schematic will still reference the unverified library, where the device no longer exists. Manually replacing each component on the schematic with one from the verified library would work, but it doesn't sound like a whole lot of fun. My thought was to write a ULP to handle this. I can successfully identify every device using the unverified library using :

     

    schematic(S)

    {

         S.parts(P)

         {

              if(P.device.library == "Unverified")     <<~~~~~ Unverified is the actual name of the library in this example...   Unverified.lbr

     

     

    I tested this and it successfully identified every component referencing that library. My logical next step (that is apparently not so logical) was to simply assign the new library name after the if statement. So I did this:

    schematic(S)

    {

         S.parts(P)

         {

              if(P.device.library == "Unverified")

              {

                   P.device.library = "Verified";

              }

         }

    }

     

    Unfortunately, I get a syntax error on the line P.device.library = "Verified";        but I don't know why. Any help would be greatly appreciated.

     

    The limitation is that you can not modify any data from within a ULP.

     

    The concept is to use a ULP to extract or analyze data, then produce a

    script file (.scr) to effect any change to the data.  In this manner,

    one should collect all the script commands to be executed in a string,

    where each command ends with a semicolon, and is separated from the next

    command with a newline.

    string cmds;

     

        string cmds;

        cmds = "group all;\n";

        cmds += "smash (C>0 0);\n";

        cmds += "group all;\n";

        cmds += "change font vector (C>0 0);\n";

     

    Once all the the commands are collected, they can be executed upon exit

    from the ULP:

     

        exit(cmds);

     

     

    Unfortunately, I do not believe one can change the source of a library. 

     

    A three-step approach may be needed, and it can all be done from within

    a single ULP.

     

    1. Identify all the devices that need to be copied from the unverified

        to the verified library, and place these device names in an array.

    2. Open the Verified library:

        cmds += "open Verified.lbr;\n";

    3. For each device in the array: Copy the device from the unverified

        library:

        for ... {

            cmds += "copy mydevice.dev@Unverified.lbr;\n";

        }

    4. Open the unverified library

        cmds += "open Unverified.lbr;\n";

    5. Delete the devices that were copied:

        for ... {

            cmds += "remove mydevice.dev;\n";

        }

    6. Execute the commands:

        exit(cmds);

     

     

    As for updating the schematic, for each of the parts that were moved to

    Verified.lbr, you'll need to do a "replace (click coords)

    device@Verified.lbr;\n".

     

    That's a rough outline.  I've never had occasion to open different

    windows and execute script commands from within a single script, but it

    might work.  If that doesn't work, you'll have to split the script up

    into multiple segments.  In the first script, you'll have to emit the

    devices of interest to a text file, then in subsequent scripts, load

    them into an array.

     

    I know this is not complete, but it should provide some ideas on how to

    automate this process, at least partially if not completely.

     

    HTH,

        - Chuck

     

     

    Attachments:
    3113.att1.html.zip
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • WarrenBrayshaw
    0 WarrenBrayshaw over 7 years ago

    Hi Bob

    Give the attached ULP a try.(zipped)

    It assumes that all unverified parts used on the schematic are now in the verified folder.

    Assuming "unverified" and "verified"are not the real names, you get to select from the list of library names used in the schematic. Then you choose the destination library name. If its not already in use in the schematic you can "Browse" for it .

    When displayed along side the browse button, that library will be the new name used . If you want to change your mind at this point, click in the right hand 'target' list and the browsed for selection will be cleared and you will be using the one selected in the right hand list.

     

    Enjoy

    Warren

    Attachments:
    change_library_name _of_verified_part.zip
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • bobbeird
    0 bobbeird over 7 years ago in reply to WarrenBrayshaw

    Thanks Warren! I was hoping for a point in the right direction....a working ulp is even better! I'll give it a shot asap.

     

    Just a follow-up... I tested the ULP and it works perfectly for what I wanted to do. Thanks again!

    Bob

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • 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