Electronic – EAGLE share package variants between different libraries

eaglelibrary

Is it possible to share package variants between different libraries because
I'm not a huge fan of copying the same package variant over and over again.

Example:

ref_packages.lbr
    defines SOT23 package
texas_instruments.lbr - needs ref_packages.lbr to work!
    uses the package defined in ref_packages.lbr

When the SOT23 package in ref_packages.lbr is changed, it is also "changed" in texas_instruments.lbr.

Best Answer

As far as I'm aware there is no way of doing this. In the Library Editor, when you are connecting up devices, it is only possible to select ones from within the current library. As such the 'Copy To Library' function was added to make moving parts and packages between libraries relatively easy.


That said, if you are using Eagle V6 or later, they moved over to an XML format for the libraries and PCB designs. What this means is that if you build a package using the library editor, it is then possible to open the library file with a text editor and then copy the package over to your other library manually.

You just have to look for the <packages> tag in the library file and within that tag there are multiple <package name="something">...</package> sections which are the data for your footprint. If you copy the contents of the tag you are interested in to the other library files and save then the package will be updated in those libraries.

As this is an XML operation essentially, then it should be possible to do this with some form of script which will could be written to search through all libraries and update any packages with ones from your reference library - I've actually have good results in the past using the XML features of Processing 2+ to parse the eagle files (I made one processing application which could move the contents of a .brd file around by parsing all of the x= and y= tags).


Another option to look into would be to see if it is possible to replace packages in a library using ULP scripts. As far as I am aware pretty much everything you can do in Eagle can also be done in ULP - so it may well be possible to use a ULP script to work through libraries updating the packages.


Granted these aren't really what you would want ideally - I agree that it should be possible to have a library of standard packages, it would make life far easier to keep track of everything.

However there are some downsides to this, which is that if you make a change to a 'standard' footprint, you would then have to go back through every design you've made with that library and update it to make sure it still passes any DRC checks. In light of that, what I started doing is essentially to make a library specifically for each board, copying the contents of other libraries into the board specific one as I go. That way there is no worry of DRC issues if you revisit a design down the line.