Migrate libraries and combine libraries with python

I am developing a simple set of scripts to clean up and combine libraries, either when downloaded from services like Ultralibrarian or snap EDA, or just if libraries have gotten messy over time.

These libraries have the following annoying features:

  • Each part has it’s own library, instead of fitting in a project specific library.
  • they are in the legacy .lib format

I have made a very simple script to merge two libraries (https://github.com/dbriscoe511/Kicad-lib-condenser), but I would like to be able to input a legacy library, and have the script convert it to a .kicad_sym library and merge it if desired. I cant find a script that does this.

Digging though some of the kicad source code I found the PANEL_SYM_LIB_TABLE::convertLibrary function, but it depends on a ton of stuff in the kicad code, and doesn’t have a python binding available. Is there a good way to convert libraries without using this function, or just compile this function on it’s own to use in the combiner script?

Is there a way to combine libraries quickly other than a script? I have been importing the downloaded library, migrating it, opening the symbols I want, saving them into the new folder, and removing the downloaded library.

In the symbol editor you can migrate a legacy library in one go instead of symbol by symbol. It’s under Manage Symbol Libraries. Add the legacy library then click on Migrate.

Note that you can continue to use legacy libraries read-only. So a lazy way might be to convert only those symbols you need to a new library as and when needed. Not so neat of course.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.