# Merge Altium Schematic Libraries (and PCB libraries)

I want to combine two Altium schematic libraries into one, eliminating any duplicates as defined by the symbol reference.

There is a command to remove duplicates in a library as so:

Unfortunately, if I copy/paste the contents of one library into another in the SCH Library dialog, duplicates are re-named with a trailing '_1' etc. so they are no longer duplicates.

There is a library splitter command, and a remove duplicates command so I assume there's some way to put back what can be split asunder but I have not been able to find it so far. Any suggestions would be appreciated.

• Can't you filter the list for the names ending with _1 and just delete all of them? (just a guess, I don't have altium here..) – Eugene Sh. Nov 10 '16 at 18:57
• @EugeneSh. That's my backup plan- I can filter the source libraries first in case there are some already there, but I was hoping for a more elegant solution. – Spehro Pefhany Nov 10 '16 at 19:14
• Altium, elegant? – The Photon Nov 10 '16 at 19:19
• @ThePhoton It's relative I guess. ;-) There's usually more than one way of doing things, seldom all that intuitive. – Spehro Pefhany Nov 10 '16 at 19:23
• I think there isn't a elegant way to do this. The only way I can think of is filtering the _1 components. – Jesus Castane Nov 11 '16 at 10:13

I'd recommend using Altium's excellent scripting capabilities, there are plenty of examples here (and other places), including one for 'Delete Selected Library Items'. I would take one of these scripts and modify it for your purposes.

Or write your own script to de-duplicate the libraries in-place without copying (I know I've written one of these myself in years past, but I've no idea where it is right now - I'll see if I can find it)

The basic script is simple (pseudo code):

Open lib
Loop through components in lib
If it's name ends in '_1' and various fields are the same then
delete it
end if
end loop
close lib