Enginursday: Configuring EAGLE PCB Design Software with a ULP

A ULP to customize Eagle like the SparkFun engineers

Some people don't like spending the time configuring software and would rather get to work. We've written a drag-and-drop solution to configure Cadsoft's EAGLE to work the way we use it internally.

We provide this functionality with an EAGLE ULP. ULP stands for user language program. It's an interpreted C like language used to write custom features in EAGLE. By default our ULP will download all of our libraries and other useful EAGLE files. It will then configure all of the keyboard short cuts and colors to what we use internally. It will also setup EAGLE to only use our libraries. Don't worry, all of the stock libraries will be left alone. You can still find them in the control panel, but they won't be in the way when it comes time to add parts to designs.

One-Minute Guide

If you want to quickly test out this script, here is a super quick and easy way try it out.

  • The first step is to Download The ULP (On some browsers you will have to right-click this download button and manually save the file.)

It doesn't really matter where it downloads, as long as you know where it is.

  • Now launch EAGLE and open any schematic or board, or even use a new blank one.
  • Drag and drop the ULP you downloaded onto the window. A dialog similar to the following one should pop up.

SparkFun EAGLE Configuration Tool Dialog

Figure 1. Main dialog

  • Press enter or return, or click the OK button. A second dialog box should open up warning you about potential download speed issues.
  • Again, press enter or return, or click the OK button.

The user can tab through the options to change which button enter/return activates like decent software tends to do.

Warning dialog

Figure 2. Download status info

  • Wait until the dialog box in Figure 1 goes away and you are done!

If something goes wrong, an error message will open in a modal dialog box & you will know.

Options

In the previous section about the ~ three-click install, none of the options were discussed. The defaults are a fairly safe way to test the script. The tool has three main sets of options.

Speaking of options, all the standard ways to run a ULP work; the RUN command, the menu, and the ULP button.

Configuration Level

Our tool gives three levels of configuration. One level only downloads the files you desire. One actually configures EAGLE to have the same look, keyboard shortcuts, etc. as we use here at SparkFun. The final and default option does all of the things.

Figure 3. Configuration level section of tool

Part of the configuration process sets up EAGLE to only use our libraries. With the exception of the user-submitted library, we have tested and actively use the parts in these libraries. This configuration with a limited number of libraries makes EAGLE run faster when searching through parts.

Only SparkFun Libraries

Figure 4. Default SparkFun libraries

The majority of the configuration comes from our eagle.scr. It's this script that sets up the keyboard shortcuts, adjusts layer colors, sets the default grid spacing, etc. Our ULP offers the 'Download only' option for those of you who have personal customizations that you don't want messed with, but want an easy way to get our libraries. This tool is aimed more at the beginner, and the settings should be great for them.

Permanence | Caching

The second major option is the write mode. By default, the files that the ULP downloads will disappear when EAGLE is closed. If the checkbox in the following image is selected, then the files that the tool downloads and creates will remain on your drive. This option is more of a personal preference, and was designed to try to provide flexibility for more advanced users.

Figure 5. Permanence section of tool

Note: This tool will prompt the user before overwriting any files. The names should be unique, but overwrite existing files with caution! As of this writing there is a bug EAGLE that will cause this script to determine that a file already exists even though it doesn't. This false positive is safe and will prompt you, but their engineers are working on fixing it and the bug will eventually go away.

Download Options

By default, our configuration tool will download all of the standard EAGLE files; libraries, design rules, user language programs, scripts, and CAM jobs. It will download these files to their default locations. If the user doesn't want to download our CAM jobs, they can simply uncheck the checkbox in the section they don't want downloaded.

Note: For a complete configuration the user must download at least the libraries. They cannot be set as the default libraries if they don't exist. If you choose a custom download path, you must set this path for the configuration to find and use these libraries each time the script is run.

Figure 6. Download options section of tool

The user is free to change the path where the various file types are downloaded. We have provided the change button as a way to allow the user to configure the directory used. Testing indicated that EAGLE will not allow a script to create new directories without user interaction. The directory selection dialog box is able to create new directories. The button to create a new directory ('New Folder') is located in the lower left corner in the following image.

Directory selection dialog box

Figure 7. Directory selection dialog box

Pressing this button will open yet another modal dialog box as pictured in the next image. It's personal preference, but we don't find it a terrible idea to create a new directory in the default location to contain all of the new files. This may be useful in the future if you plan on removing files added by this script. Apologies for not making this the default due to the way EAGLE handles new directory creation. New directories created by the EAGLE GUI are permanent even if you have that option unchecked. We decided against having the script 'manually' delete them for lower risk of deleting something important.

New directory dialog box

Figure 8. New directory dialog box

The following section of a screenshot shows an example of a custom install path for our EAGLE libraries. The downside to custom install paths is that the script doesn't currently store that information. The user will have to reconfigure the paths each time you run the script. The script uses the currently set paths, so even if the user is only doing the configuration, at least the library and script paths need to match the location where the files live.

Figure 9. Example of edited install path

This ULP can take a long time to run depending on your network connection and other variables. Please check the status in the location shown in figure 10. If there is an error, an error dialog will popup. If the tool windows disappears, it means the tool has finished.

ULP status

Figure 10. ULP status

Other Info

Auto Update

A second exception to the nonpermanent mode is the script itself. When it runs, the first thing it does is check for an update on GitHub. If an update is found, it will be downloaded and run instead of the version that the user ran.

Going further

That quick introduction to the tool should cover most of the information one needs to get up and running. This ULP is an alternative to the Using the SparkFun Libraries, and Configuring the UI sections of the How to Install and Setup EAGLE tutorial on our site.

As always, our code is open source. We encourage you to take it and play with it. There is a fair amount of error checking, but we know that it's incomplete. We accept pull requests on improvements.

The code between the header and the first function definition is where we've hard coded all of the files this script uses. If you want to repurpose this script, I'd start there. Happy hacking!