ppextract_sources - write a sources file for ppresolve_components from a schematic’s own embedded symbols
ppextract_sources
[-o FILE] [--symbol-dir DIR]
[--kicad-cli CMD] [--quiet]
SCHEMATIC
ppextract_sources {--help|--version}
ppextract_sources reads a KiCad schematic (a .kicad_sch file, with the sheets it includes) and writes two things: the symbols the schematic embeds (its own copy of every symbol it uses, exactly as its author drew it), one .kicad_sym file per library nickname, into a directory; and a sources file for ppresolve_components(1) with one entry per part, whose sym_path points at those files.
Those paths are absolute, the machine’s own. To share a sources file, replace them by paths with a KiCad variable, such as ${KICAD_SYM_DIR}/Device.kicad_sym, or by paths relative to a component library directory (see ppresolve_components(1))..PP It exists for the build-instructions route, where ppresolve_components(1) needs to be told which KiCad symbol each reference is. A design that predates a library rename keeps the old symbol name only in its own embedded symbols: KiCad 10’s installed Connector library no longer has Conn_01x03_Male, for instance, so pointing a sources entry at it ends in an error. The design’s own embedded symbol is the only one that exists, and reading it needs no library installed anywhere. Where both the schematic and an installed library (the directory named by $KICAD_SYM_DIR) have a symbol, the schematic’s own is used.
The pin_map is written empty. The build instructions give holes, not pins, so only you know which pin is which; see ppresolve_components(1). A part whose symbol is found neither in the schematic nor in an installed library is reported as a warning on standard error and is left out of the file, never given a path that cannot work.
-o FILE, --output FILE
The sources file to write (default: STEM-sources.json, in the current directory, STEM being the schematic’s name without its extension).
--symbol-dir DIR
The directory the embedded libraries are written to (default: STEM-symbols in the directory of the sources file, which is the current directory when -o is not given; before 0.72.59 it was always the current directory). The paths in the sources file are absolute.
--kicad-cli CMD
The kicad-cli command used to read the schematic’s netlist (default: $KICAD_CLI if set, else kicad-cli).
--quiet
Suppress the informational messages; warnings are still printed.
0 on success, also when some parts could not be given an entry (a warning is printed for each). 1 if the input is not a .kicad_sch file (a netlist carries no symbols) or does not exist, or kicad-cli cannot be run or cannot read the schematic; one message is printed, never a traceback.
Write the sources file and the embedded libraries for a design, then fill in the pin map and resolve its build instructions:
ppextract_sources
Camera-trap.kicad_sch
ppbuild_instructions Camera-trap.kicad_sch -o
instructions.txt
# edit Camera-trap-sources.json: add the pin_map entries
ppresolve_components instructions.txt --sources
Camera-trap-sources.json -o new.kicad_sch
ppresolve_components(1), ppbuild_instructions(1), ppkicad_layout(1), kicad-cli(1), ResearchJournal.org and SessionHandoff.org