Renaming things quickly in Eagle

I use Eagle for my PCB design and I generally find it to be a nice piece of software. One annoyance that I came across recently was the seemingly hard task of doing a “bulk rename” of components on a schematic.

I tried searching for how to do this, but couldn’t find an answer that did what I want.

As an example, here’s what I wanted to do:

  • Create six red LEDs (RED1 through RED6) with cathodes connected to GND
  • Create six green LEDs (GRN1 through GRN6) with cathodes connected to GND
  • Create six blue LEDs (BLU1 through BLU6) with cathodes connected to GND

So I’m aiming for this, with LEDs ready for connecting to a driver:

rgb_leds_example

The really slow way to do this is to:

  1. Create all 18 LEDs
  2. Rename them individually
  3. Connect up the cathodes

This is boring, slow and error-prone (about 5 minutes).

The slightly faster way is to:

  1. Create an LED, rename it to RED1
  2. Copy five times, which creates RED2 through 6
  3. Repeat 1 and 2 for GRN and BLU LEDs
  4. Connect up cathodes

This is slightly less boring and error prone (about 2 minutes 30 seconds).

Here’s what I want to do:

  • Create six LEDs, join up cathodes to GND
  • Copy this group twice
  • Rename each group of LEDs in one operation

I couldn’t find any way to perform the last bit (a bulk rename), so I looked into writing my own ULP (User Language Program) to rename a group. The ULP would take a prefix, number and optional suffix as input. Then with the currently selected group of components, rename each using the fixed prefix and suffix, with the number incrementing each time.

For example, the inputs “RED, 1” would rename the selected group “RED1, RED2, RED3, …, REDx”, where x is the last component in the group. The inputs “U, 10, A” would rename the selected group “U10A, U11A, U12A, …, UxA”, where x is the last component in the group.

The ULP for this only took 45 minutes to write by referencing (copying from) the examples and existing ULPs. It shows a confirmation box before committing (the individual rename operations go into the undo history as well).

This script reduced the time it took to create the schematic in the picture above to 1 minute 15 seconds.

I think this will save me a lot of time. The ULP is available my Eagle github repo.

Advertisements
This entry was posted in Electronics, Uncategorized and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s