# How to copy attributes between package variants in eagle library editor

I have entered a set of attributes into a eagle library. However I started to enter the data after having drawn all package variantes. The package variants are only different pad layouts I use for ease of layout. The outcome was, the attributes showed up in only the technology/package combination I was editing then. Copying them to all technologies (with the differing attributes changed) was straightforward.

Now I want to do the same for all package variants. I found the ULP "copy-attribute-at-deviceset.ulp". But it does only partially, what I need. In fact it generates all attribs in all packages for all technologies. But it doesn't copy values reproducible. I managed to copy the values of one technology once, but it was copied to a different technology in all packages and opened the default technology "" which I did not intend to use.

Does so know a different script or some trick? Or do I have to resort to writing my own ULP?

Use the power of scripts and ULPs.

When I want all technologies and package combinations to have the same attribute, I use my ATTR_ALL ULP:

#usage "<b><h1>Apply attribute to all package/technology variants</h1></b>\n"
"<pre><b>attr_all</b> <i>name</i> '<i>value</i>'</pre>"
"<p>"
"Sets the indicated attribute for all package and technology combinations of "
"a device.&nbsp;  This ULP must be run in the device editor of a library."

string fnam;                           //script output file name
string cmd;                            //command to execute at end of ULP
string pack;                           //package variant name string
string techs[];                        //list of technologies
int ntechs;                            //number of technologies in list
int i;                                 //scratch integer and loop counter
//
//   Start of executable program.
//
fnam = argv[0];                        //init temp script name to full ULP pathname
fnam = filesetext (fnam, ".scr");      //make script file of same generic name
output (fnam, "wtD") {                 //open temporary script output file
deviceset (devset) {
devset.devices (dev) {

pack = dev.name;
if (pack == "''") pack = "";
printf ("package '%s';\n", pack);

ntechs = strsplit(techs, dev.technologies, ' ');
for (i = 0; i < ntechs; i++) {
printf ("technology %s;\n", techs[i]);
printf ("attribute %s '%s' constant;\n", argv[1], argv[2]);
}                              //back for next technology this device
}                                //back for next DEV in device set
}                                  //end of device set
}                                    //done with output file
cmd = "script " + fnam;
exit (cmd);                            //run the temporary script


For cases where different variants have slightly different attributes, I use a script to set the attributes the way I want them for one variant, then replicate and edit that chunk of script code for the other variants. That way you only spend time on those things that are different between the variants.

Having a script is also nice when you mess up. When you don't like the result, you can make small incremental changes to the script and re-run the whole thing.

I keep the last script around I used for this purpose as a reminder of the syntax. That makes doing something similar next time simpler. I also have a template script that contains everything for creating one variant of a device. I copy the template to a temporary script and edit as necessary. Most of the time you don't need the full arbitrary device creation, so just delete the parts you don't need. That's a lot easier than looking up the syntax details for commands that aren't there.

Here is my template script:

#   Templage script for creating a new device in a library.
#
edit 'xxx.dev';
description '--- description ---';
prefix 'ZZ';
value On;

#
add SYNAME 0 next (0 0);

package PKNAME 'variant';
technology '';

attr manuf 'Megacorp:ABC-123';
attr supplier 'Mouser:666-ABC-123';
# attr qty '1';
# attr bom 'no';
attr valstat 'val';
# attr subst 'no';
attr desc '-- BOM description --';
attr dval '-- BOM value --';

# conn <pin function name> <pad number>
#
#   Pad number must be upper case.
#
conn 'name1' '1';
conn 'name2' '2';


I was looking for the same type of functionality and found the e-attributverwaltung.ulp (alf@cadsoft.de) program. This seemed to handle all sorts of different Attribute functionality but the problem is it's in German, so I did my best and translated the Dialogs/Text using Google Translate.

• To use it save the AttributeManager.ulp to the [Eagle Install]/ulp directory.
• In a SCH, BRD or Library (Maybe others) click the "ULP" Icon in the Menu Bar
• The AttributeManager.ulp should now be listed, double click on the file and this will bring up the program.

There are ways to save default attributes (saved in a .lst file) and various other functions, a real time saver! Hope this helps.

• Cool, I never noticed this ULP. I'll try it next week. Thank you. – Ariser Jan 27 '18 at 17:31
• One thing to caution about, I use it to set default properties, I havn't tried out the rest of the features yet so not sure about bugs. – Andy Braham Jan 28 '18 at 6:52