ULP: layers2images and cfgfuncs.inc

After an EAGLE crash-course for a board design we wanted (we were going to outsource but that fell through), I wrote a few ULPs to help with the design process. Most of them aren’t really third party ready (too many assumptions which if not satisfied will cause horrible crashes), but these two have been cleared after making them a bit more friendly… you might find them useful as a user or ULP author respectively:

layers2images

Exports layers to bitmap images. This is essentially a batch automation of going to File > Export in EAGLE itself.

The layers to be exported are selected by toggling whether you want only Visible layers and only Used layers to be exported. Usually the combination of the two is what you’d want, but if you’ve got a nice layer display set up but still want all used layers exported, you’d simply disable the Visible option.

Supported output formats are PNG, BMP and TIF. Supported DPI is any via the command line, but within the Graphical User Interface it’s limited to 150, 300, 600 and 1200.

The exported images’ colors can be either taken from the layers’ original colors, be exported as monochrome, or only have layers which are gray (be that white or black or anything in between) exported as monochrome.

Once run, just adjust the settings to your liking, click OK, choose the output folder, and off it goes.

Hit the Help button for full documentation.

The settings you selected are stored and restored automatically with a little help from…

cfgfuncs.inc

Is an include file with a set of functions to help authors with storing/restoring ULP settings. EAGLE 5.10 added two commands that allow you to do this; cfgget and cfgset.

However, the original functions are limited to String data types which means data conversions galore in your code and not being able to use Constants as default values. cfgfuncs adds support for chars, ints and reals.

In addition, CadSoft recommends that you use an appropriate namespace for your ULP for each parameter, such as “ULP:trackWidthsToLayers.tolerance”, “ULP:trackWidthsToLayers.minWidth”, “ULP:trackWidthsToLayers.maxWidth”, and so on. cfgfuncs.inc does away with that tede. If the ULP is saved as “trackWidthsToLayers.ulp”, it automatically assumes you’ll want a namespace beginning with “ULP:trackWidthsToLayers.”, thus allowing you to only bother with the actual parameter names: “tolerance”, “minWidth”, “maxWidth”.

( The namespace can still be manually set if your ULP has more than one parameterset. )

Open the cfgfuncs.inc file for full documentation of the functions.

These files have also been uploaded to the CadSoft ULP download section, so they might appear there sometime next week.