Where is stored the list of libraries and the path

Hi,

I am trying to do parser of the schematic file and I miss the list of the libraries used in the project plus the path. I see that this information is present when you generate the netlist file, but this requires a manual extra step.

Does anybody how to access to the list and paths of the libraries present in a specific project?

Thanks!

There are some files for this.
fp-lib-table (for footprint libraries) and sym-lib-table (for schematic symbol libraries).

Both files exist in the global configuration (for global libraries) and as project specific version (in the project directory).

Read " How to setup a project with local libs" in Library management in KiCad version 5.

Each project can have its own fp-lib-table and sym-lib-table. Each user has the global tables in their configuration. The path variables which can be used in the library tables are defined in the user configuration.

So, if you have an external script you have to read some files, i.e. you need the extra steps anyways.

Thanks for the link and the info.

My idea is to create a new library (my library) with copies of the components that I first select in the official kicad library and other github libraries. Instead of adding the components manually to my new library this could be done with the scrip that analyses the components in my schematic and appends new components found to the new library (and change them in the schematic). The idea of the new library is to add more attribute to the components (like the JBLPCB code), small modifications or relate the footprint with the 3d model. The script could generate the BOM easily too.

Does it make sense?

In order for your scripts to be able to extract data from KiCad’s libraries, you first need all schematic symbols to have valid footprints assigned.

Currently about 75% of schematic symbols have pre-assigned footprints:

If you have assigned the footprints, it’s pretty easy to get those footprints into a separate library. First put them on the PCB with: Eeschema / Tools / Update PCB from Schematic [F8], and then: Pcbnew / File / Archive Footrpints / …

This does put the footprints into (new or existing) library, but does not update the links to point to that library.

You may also want to have a look at:

There are (links to) some 60+ KiCad related projects and scripts.

A more generic search: https://html.duckduckgo.com/html?q=kicad+project+archive

also finds: https://github.com/MitjaNemec/Kicad_action_plugins and one of them is the “archive project” plugin which also handles with footprint information.

I’ve got a bit of a mushy mind with lots of holes. Can’t remember who forked which project from where. GIT is a bit chaotic in that aspect, but maybe one (or some) of these projects are useful for studying or modifying into your own scripts.

Do you want something like https://gitlab.com/kicad/code/kicad/-/issues/4131 and the related feature wishes?

When you decide what to do, remember also that the schematic file format will be completely different in the upcoming v6 (hopefully early next year, 2021). Eeschema will also have a python API then. If you now write it for v5 file format you will have to rewrite it later, especially if you then want to use python and the API then instead of reading and parsing the files.

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