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
    About the element14 Community
  • 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
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • 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) Rename wires
  • 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 Suggested Answer
  • Replies 34 replies
  • Answers 2 answers
  • Subscribers 188 subscribers
  • Views 5502 views
  • Users 0 members are here
Related

Rename wires

e14 Contributor
e14 Contributor over 12 years ago

Hello,

 

In an Eagle-shematic (50 pages) I need to change quite a lot of wire names. Select every single and change the name would do the job, but is quite time consuming...

 

The wires can have diferent names, some examples:

W500/01

W500/02

W500/xx

...

W501/01

W501/02

...

W502/01

...

W600/01

W600/02

...

W601/01

...

W700/BN

W700/BU

...

W135/1.5RD

...

 

Now as writen before, a lot of wire names should be changed. For example all W500/xx will be renamed to W512/xx and so on. Can somebody tell me how I can do that a bit more eficient? I tried this one: Renaming parts in Eagle CAD by editing the XML directly

Works quite well for part names, but the wire names are not recognised by this tool. I would have to change the source code (I think I'd be able to do that) and then recompile that, but I have no Idea about C++ and how to compile...

 

So it would be great if somebody had another simple and working idea how to do that.

 

Thank you

 

My configuration:

Eagle 6.5.2 Hobbyist licence

Win 8.1

  • Sign in to reply
  • Cancel
Parents
  • AnalogNotes
    0 AnalogNotes over 12 years ago

    Well, I'm going to show my Unix bias here, but there are a *lot* of tools available to do things like this built in to Linux and OS X and available for Windows.  It depends how deep you want to go down the rabbit hole!

     

    My first reaction would be to use "sed" the stream editor.  (Do a search for "sed for windows".)  Sed is used at the command line, and takes some input, modifies it, and sends it to some output.  For example,

     

    sed 's/W500/W512' schematic.sch > newschematic.sch

     

    which would change occurrences of W500 to W512 and create a new file called newschematic.sch without changing the original schematic.sch.  To make sure things look good, you could use the "diff" command on the two files to see exactly what was changed.  Of course, you wouldn't want to have to change that command line and re-run it for every substitution you want to make, so it's better to create a sed script file with all the commands you want (somewhat analogous to that CSV file in the referenced article), and then run the command:

     

    sed -f script.file schematic.sch > newschematic.sch

     

    Sed is a great tool and can be used over and over again without having to modify and recompile.  Now, if you want to learn something a little more sophisticated, there is a simple, yet amazing text processing language called AWK.  AWK knows how to read in a text file line by line, split the line into words and do things to those words.  You can do more testing and manipulating than you can in sed.  AWK is very much like the C programming language, so you can do things like printf to create new output.  Then, if you want to really go down the rabbit hole and get into more powerful scripting languages, the big three in my book are PERL, Python and Ruby.  Each has strengths and weaknesses and each has devout followers and detractors.  Let me know if you're interested or do a search to learn more...

     

    BTW, if you don't want to download and install any of these unix tools, you might consider using Windows PowerShell too...

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • e14 Contributor
    0 e14 Contributor over 12 years ago in reply to AnalogNotes

    Thank you for your help.

     

    after some tests I found out that Win doesn't like the following command:

    sed 's/W500/W5000' 30c.sch 30d.sch

    But the following seems to work so far (thank you google):

    sed "s/W500/W5000/" 30c.sch 30d.sch


    Well, first everything seems to work fine, it reads and schows all data in the 30c file, but after everything has finished, the 30d.sch is still empty. Any idea what I am doing wrong? Sorry I have to admit that I'm not the shell-guy...

     

    As for the advice with the inconsistent board: Thank you for your advice, but there is no board, only the schematic. It is the shematic of my newly build camper. I know, eagle may not be the best solution for doing that, but works so far ok for me...

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • AnalogNotes
    0 AnalogNotes over 12 years ago in reply to e14 Contributor

    You need a greater than sign before the last file name.  The greater than sign is basically an arrow pointing to where the output should go...

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • AnalogNotes
    0 AnalogNotes over 12 years ago in reply to AnalogNotes

    Well, the gist looks very nice on the Element14 site, but it doesn't get through to NNTP.  image

     

    You can see what I posted at: https://gist.github.com/AnalogNotes/9377478

     

    At the top right of the code display is a button with "<>" on it.  That will let you view the "raw" code in a form that is very easy to copy and paste.  Let me know if that works for you...

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • AnalogNotes
    0 AnalogNotes over 12 years ago in reply to AnalogNotes

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • AnalogNotes
    0 AnalogNotes over 12 years ago in reply to e14 Contributor

    Well, something I didn't tell you before...  "//" means that anything after this on a line is a comment.  A comment is something only for humans to read.  The computer (EAGLE) ignores everything in the comment.  There is another kind of comment too, a multi-line comment that starts with "/*" and ends with "*/".  For example:

     

    /*

    this is a comment and EAGLE will ignore everything in it

    */

     

    // this is also a comment, but it only lasts until the end of this one line.

     

    I'm going to try to use the Github Gist function for the ULP code.  I will do that in the next message...

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • e14 Contributor
    0 e14 Contributor over 12 years ago in reply to AnalogNotes

    Hi,

     

    I tried to put that new code to the old one. Not sure if it could work like that. That is what I tried:

     

    int minimum = 100;

    int maximum = 199;

     

    string sheetname;

    string message;

    string oldname;

    string newname;

    string lastpart;

    char c = '/';

    //int number = 100;

    //int position;

     

    schematic(S){

      S.sheets(SH){

           sprintf(sheetname, "Sheet: %d\n", SH.number);

           message += sheetname;

           SH.nets(N){

                oldname = N.name;

                     int position = strchr(oldname, c);

                     string number = strsub(oldname, 1, position);

                     int test = strtol(number);

                     if ( (test >= minimum) && (test <= maximum) )

                     // in range, do something

                     // position = strchr(oldname, c);

                     // lastpart = strsub(oldname, position);

                     // sprintf(newname, "W%d", number);

                     // newname += lastpart;

                     // number += 1;

                message += "Rename old: ";

                message += oldname;

                message += " to new: ";

                message += newname;

                message += "\n";

                }

           }

    }

    dlgMessageBox(message);

     

    Now the Message-Box shows me all nets like it did with the old code, but now only the nets matching the test criteria have the "Rename old:" at the beginning...and none of them have a new name after "to new:" somehow hard to explain...It looks like that:

     

    (...)

    Sheet: 4

    N$96 to new:

    N$97 to new:

    (...)

    Rename old: W190/50RD to new:

    Rename old: W191/50BK to new:

    (...)

     

    So I think something is wrong, but I have no Idea what.

     

    As for the regular expressions...thank you for your explanations, but I think I'll put that on hold until I have learned lesson 1 for beginners ;-)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • AnalogNotes
    0 AnalogNotes over 12 years ago in reply to e14 Contributor

    Ursicin Caminada wrote:

    The simplest would probably be to look for all wires starting with W1xx (W100 up to W199). I tried to use wildcards like * and ?? (I changed the N.name command to something like W1* or W1?? or W1##) but that doesn't seem to work...I think there is a trivial solution for that?

     

    One (simple) way is to add this as a test after oldname = N.name;:

     

    string startpart = "W1";

    int position = strstr(oldname, startpart);

    if (pos >= 0)

      // It starts with W1 and it should be renamed...

     

    Even beter would be if i could chose a range of numbers to change (only if it doesn't gets to complex!): For example from W100/xxxx up to W299/xxxx, or W100-W199 plus some unnamed wires (N$1 to N$150 for example)

     

    strxstr? Will that be ULP for beginners lesson 2?

     

    Yes, strxstr might be a good answer for this because you could write a regular expression that would match the W, then the number, then the slash, or the N$ and the number.

     

    ^[ \t]+|[ \t]+$...hmm that looks for me like: You have a roof, you spent time repairing it + you spend more time on repairing it and that costs you more $...am I right?

     

    LOL!  In a regular expression, "^" means the beginning of a line, and "$" means the end of a line.  (They even use "$" as a command in the vim editor to move the cursor to the end of the line.)  The square brackets [] are used for specifying a group, in this case a space and a "\t" which means a tab character.  A regular expression matches anything in the group, so it can be either a space or a tab.  The "+" means one or more of what is right before it.  ("?" is zero or one of the previous thing, and "*" is zero or more of the previous thing.  This is different from the ? and * wildcards.)  The "|" is used to mean the test "or".  So,

     

    ^[ \t]+ means one or more spaces or tabs at the beginning of a line

    |  or

    [ \t]+$ means one or more spaces at the end of the line

     

    Simple, yes?  image

     

    So, to match your wire name, the regular expression would be W\d+ which means a "W" followed by one or more digits.  If you wanted to get all W1xx and W2xx numbers, you could use W[12]\d+ which means one or more digits after either W1 or W2.  You can keep trying to modify the regular expression to test for the range of numbers you want to use, or you might want to just use oldname, get rid of the "W" and use strtol() to convert the digits to a number that you can test with some combination of =, < or >.  It would be easy to put a couple variables at the top of your script instead of trying to modify a regular expression every time:

     

    int minimum = 100;

    int maximum = 299;

     

    char c = '/';

    int position = strchr(oldname, c);

    string number = strsub(oldname, 1, position);

    int test = strtol(number);

    if ( (test >= minimum) && (test <= maximum) )

    // in range, do something

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • e14 Contributor
    0 e14 Contributor over 12 years ago in reply to e14 Contributor

    Thanks a lot for your help. So far everything seems to work verry nice. Just one thing: With oldname = N.name; we look for all net names. If possible I'd like to change only a range of names, because for example W300/xx-W900/xx are already in the correct order and should not be changed anymore.

     

    The simplest would probably be to look for all wires starting with W1xx (W100 up to W199). I tried to use wildcards like * and ?? (I changed the N.name command to something like W1* or W1?? or W1##) but that doesn't seem to work...I think there is a trivial solution for that?

     

    Even beter would be if i could chose a range of numbers to change (only if it doesn't gets to complex!): For example from W100/xxxx up to W299/xxxx, or W100-W199 plus some unnamed wires (N$1 to N$150 for example)

     

    strxstr? Will that be ULP for beginners lesson 2? image

    ^[ \t]+|[ \t]+$...hmm that looks for me like: You have a roof, you spent time repairing it + you spend more time on repairing it and that costs you more $...am I right? image


    thanks and good night

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • autodeskguest
    0 autodeskguest over 12 years ago in reply to AnalogNotes

    On 04/03/14 20:02, Doug Wellington wrote:

     

     

    That's English for "wise man who speaks truth"

    image

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • AnalogNotes
    0 AnalogNotes over 12 years ago in reply to autodeskguest

    Sorry to continue the off-topic hijack, but that's how these forum things seem to work...  image

    Lorenz wrote:

    There is a nice quote regarding nntp vs. web bases forums:

    Web based forums are like subscribing to 10 different newspapers and

    having to visit 10 different news stands to pickup each one. Email

    list-server groups and USENET are like having all of those newspapers

    delivered to your door every morning.

    I follow about 30-40 news groups and mailing list (using gmane.org as

    mailing list to nntp bridge) regularly.

     

    That wouldn't be possible using web based forums.

    Using my new client I can skim over the new posts during my morning

    coffee break.

     

    [curmudgeon]

    Indeed.  I've always hated forums, but it's the way of the world now for most of the topics I seem to be interested in.  I used to, and still do, love listservs (remember Bitnet?) and newsgroups because, as you say, they come to you instead of you having to remember to go to them.  It all seemed so simple back then.  I'm an old MH user too, so I have a *huge* directory structure of messages from both email and nntp.  Of course, for me at least, email isn't the best answer any more, as most people don't edit much, they just pile answers on top of the previous message(s) and most of them are RTF or HTML (in other words, much larger than they need to be).  How many times have you gotten a 90k message that only adds "+1" to all the previous quotes?  image  Forums like this seem to be nicer in that regard, as you have to explicitly click a button to quote the previous message...

    [/curmudgeon]

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • autodeskguest
    0 autodeskguest over 12 years ago in reply to AnalogNotes

    Doug Wellington wrote:

     

    CadSoft Guest (aka Lorenz) wrote:

     

    since when is element14 suppressing the sender of newsgroup post?

     

    Yeah, this site is a bit wonky, eh?  Do you post from the Stratford

    Digital EagleCentral site or do you post directly via NNTP?  I finally

    gave up on those and use Element14 because I can edit posts.  The down

    side is that the Jive software Element14 uses really just seems to

    suck.  For example, when I click on the "CadSoft Guest" title at the top

    of your message, it is linked to Drew Fustini, and I'm guessing you

    aren't Drew!  As far as I can tell, post edits don't propagate off this

    site, and in general, things are hard to find, which may be more of an

    organization thing than a Jive thing, but it doesn't reflect well on

    either.  There's a webinar about the site in less than an hour, so maybe

    things will clear up a bit...

     

    I'm posting directly via nntp (since I started using eagle, long long

    before farnell bought cadsoft).

     

     

    There is a nice quote regarding nntp vs. web bases forums:

     

    Web based forums are like subscribing to 10 different newspapers and

    having to visit 10 different news stands to pickup each one. Email

    list-server groups and USENET are like having all of those newspapers

    delivered to your door every morning.

     

     

    I follow about 30-40 news groups and mailing list (using gmane.org as

    mailing list to nntp bridge) regularly.

     

    That wouldn't be possible using web based forums.

    Using my new client I can skim over the new posts during my morning

    coffee break.

    --

     

    Lorenz

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • AnalogNotes
    0 AnalogNotes over 12 years ago in reply to autodeskguest

    CadSoft Guest wrote:

    since when is element14 suppressing the sender of newsgroup post?

     

    Yeah, this site is a bit wonky, eh?  Do you post from the Stratford Digital EagleCentral site or do you post directly via NNTP?  I finally gave up on those and use Element14 because I can edit posts.  The down side is that the Jive software Element14 uses really just seems to suck.  For example, when I click on the "CadSoft Guest" title at the top of your message, it is linked to Drew Fustini, and I'm guessing you aren't Drew!  As far as I can tell, post edits don't propagate off this site, and in general, things are hard to find, which may be more of an organization thing than a Jive thing, but it doesn't reflect well on either.  There's a webinar about the site in less than an hour, so maybe things will clear up a bit...

     

    strxstr?  Do we want to give this poor guy a brain cramp already?

    LOL!!! [...]

     

    I know 8-)

     

    I only mentioned it for completeness sake while pointing out that

    there are more possibilities beside strchr and substr

     

    Thanks.  Yeah, TIMTOWTDI as the Perl guys say...

     

    The fun thing is, when we come full circle in this discussion, we'll get back to sed, which is actually a great regular expression tool...  image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Reply
  • AnalogNotes
    0 AnalogNotes over 12 years ago in reply to autodeskguest

    CadSoft Guest wrote:

    since when is element14 suppressing the sender of newsgroup post?

     

    Yeah, this site is a bit wonky, eh?  Do you post from the Stratford Digital EagleCentral site or do you post directly via NNTP?  I finally gave up on those and use Element14 because I can edit posts.  The down side is that the Jive software Element14 uses really just seems to suck.  For example, when I click on the "CadSoft Guest" title at the top of your message, it is linked to Drew Fustini, and I'm guessing you aren't Drew!  As far as I can tell, post edits don't propagate off this site, and in general, things are hard to find, which may be more of an organization thing than a Jive thing, but it doesn't reflect well on either.  There's a webinar about the site in less than an hour, so maybe things will clear up a bit...

     

    strxstr?  Do we want to give this poor guy a brain cramp already?

    LOL!!! [...]

     

    I know 8-)

     

    I only mentioned it for completeness sake while pointing out that

    there are more possibilities beside strchr and substr

     

    Thanks.  Yeah, TIMTOWTDI as the Perl guys say...

     

    The fun thing is, when we come full circle in this discussion, we'll get back to sed, which is actually a great regular expression tool...  image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
Children
  • autodeskguest
    0 autodeskguest over 12 years ago in reply to AnalogNotes

    On 04/03/14 20:02, Doug Wellington wrote:

     

     

    That's English for "wise man who speaks truth"

    image

     

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • AnalogNotes
    0 AnalogNotes over 12 years ago in reply to autodeskguest

    Sorry to continue the off-topic hijack, but that's how these forum things seem to work...  image

    Lorenz wrote:

    There is a nice quote regarding nntp vs. web bases forums:

    Web based forums are like subscribing to 10 different newspapers and

    having to visit 10 different news stands to pickup each one. Email

    list-server groups and USENET are like having all of those newspapers

    delivered to your door every morning.

    I follow about 30-40 news groups and mailing list (using gmane.org as

    mailing list to nntp bridge) regularly.

     

    That wouldn't be possible using web based forums.

    Using my new client I can skim over the new posts during my morning

    coffee break.

     

    [curmudgeon]

    Indeed.  I've always hated forums, but it's the way of the world now for most of the topics I seem to be interested in.  I used to, and still do, love listservs (remember Bitnet?) and newsgroups because, as you say, they come to you instead of you having to remember to go to them.  It all seemed so simple back then.  I'm an old MH user too, so I have a *huge* directory structure of messages from both email and nntp.  Of course, for me at least, email isn't the best answer any more, as most people don't edit much, they just pile answers on top of the previous message(s) and most of them are RTF or HTML (in other words, much larger than they need to be).  How many times have you gotten a 90k message that only adds "+1" to all the previous quotes?  image  Forums like this seem to be nicer in that regard, as you have to explicitly click a button to quote the previous message...

    [/curmudgeon]

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • autodeskguest
    0 autodeskguest over 12 years ago in reply to AnalogNotes

    Doug Wellington wrote:

     

    CadSoft Guest (aka Lorenz) wrote:

     

    since when is element14 suppressing the sender of newsgroup post?

     

    Yeah, this site is a bit wonky, eh?  Do you post from the Stratford

    Digital EagleCentral site or do you post directly via NNTP?  I finally

    gave up on those and use Element14 because I can edit posts.  The down

    side is that the Jive software Element14 uses really just seems to

    suck.  For example, when I click on the "CadSoft Guest" title at the top

    of your message, it is linked to Drew Fustini, and I'm guessing you

    aren't Drew!  As far as I can tell, post edits don't propagate off this

    site, and in general, things are hard to find, which may be more of an

    organization thing than a Jive thing, but it doesn't reflect well on

    either.  There's a webinar about the site in less than an hour, so maybe

    things will clear up a bit...

     

    I'm posting directly via nntp (since I started using eagle, long long

    before farnell bought cadsoft).

     

     

    There is a nice quote regarding nntp vs. web bases forums:

     

    Web based forums are like subscribing to 10 different newspapers and

    having to visit 10 different news stands to pickup each one. Email

    list-server groups and USENET are like having all of those newspapers

    delivered to your door every morning.

     

     

    I follow about 30-40 news groups and mailing list (using gmane.org as

    mailing list to nntp bridge) regularly.

     

    That wouldn't be possible using web based forums.

    Using my new client I can skim over the new posts during my morning

    coffee break.

    --

     

    Lorenz

     

    • 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 © 2026 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.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube