On This Page (8)
kcr lib-extract
Extract cleaned symbols, footprints, metadata, and embedded STEP models from a KiCad project into a non-destructive lib_cruncher ingestion bundle.
| Command | Aliases | Category | Runtime | Config | Guide |
|---|---|---|---|---|---|
kcr lib-extract | kcr library-extract | Projects, Libraries & Assets | Python kcr | None (CLI flags only) | — |
Usage
kcr lib-extract [-h] [-o OUTPUT]
[--dedupe {name,fingerprint}]
[--no-embed-models]
[--no-embed-external-models]
[--all-embedded-models]
[--include-asset-scan]
[--validate-kicad-cli]
[--kicad-cli KICAD_CLI]
[file]Positional Arguments
| Argument | Description |
|---|---|
file | KiCad .kicad_pro project; optional when one .kicad_pro is in CWD |
Options
| Flag | Description |
|---|---|
-o, --output OUTPUT | Output directory (default: ./output/lib-extract) |
--dedupe DEDUPE | Dedupe policy for internal extraction. Choices: name, fingerprint. |
--no-embed-models | Do not copy board-level embedded model payloads into extracted footprints |
--no-embed-external-models | Do not embed resolvable external STEP/STP model references into extracted footprints |
--all-embedded-models | Scan the full project and write every embedded STEP/STP payload to models/ |
--include-asset-scan | Include full project asset/model scan in library_extraction.json |
--validate-kicad-cli | Validate generated libraries with kicad-cli; project-lib apply mode also runs a before/after schematic ERC library-hygiene gate |
--kicad-cli KICAD_CLI | Explicit kicad-cli executable for --validate-kicad-cli |
How It Works
kcr lib-extract (alias kcr library-extract) produces a lean, non-destructive library-ingestion bundle under -o <dir> (default ./output/lib-extract) tailored for downstream library catalog tools such as lib_cruncher.
It shares the exact extraction engine and model/validation flags with kcr megamaid, with three intentional differences:
- Skips power symbols (
GND,+3V3,VCC, etc.) so catalog ingestion only receives real component symbols. - Omits
embedded_assets/anddesign_review/to keep output trees compact and fast. - Writes
lib_extract_manifest.json(kicad_cruncher.lib_extract_manifest.a0),library_extraction.json,symbols/,footprints.pretty/,models/, andREADME.md.
When to Pick lib-extract vs megamaid vs project-lib
- Use
kcr lib-extractwhen feeding cleaned symbols, footprints, and embedded STEP models into a shared library catalog (lib_cruncher). - Use
kcr megamaidwhen you also wantembedded_assets/and a fulldesign_review/bundle alongside the libraries. - Use
kcr project-libwhen you want to keep libraries inside the project (./local-library), updatesym-lib-table/fp-lib-table, and optionally relink schematic/PCB references.
Flag Semantics & Validation
--dedupe {name,fingerprint}: choose name-based (default) or structural fingerprint deduplication for internal extraction.- Embedded 3D model controls:
--no-embed-modelsskips copying board-level embedded STEP payloads into extracted.kicad_modfiles;--no-embed-external-modelsskips resolving/embedding external STEP/STP files;--all-embedded-modelswrites every embedded STEP/STP payload found in the project intomodels/. --include-asset-scan: appends the full project asset/model scan intolibrary_extraction.json.--validate-kicad-cli&--kicad-cli <PATH>: validates generated libraries viakicad-cli; returns exit code1on validation failure while keeping written files on disk.
Quick Examples
# Extract embedded symbols/footprints from a project into local libraries
kcr lib-extract project.kicad_pro -o output/libs