CLI command design

pnp

Exports pick-and-place placement data from KiCad project or PCB inputs using the shared BOM/PnP normalization layer for canonical parameter fields, stable sorting, JSON, CSV, XLSX, and JLC CPL output.

Usage

kicad-cruncher pnp project.kicad_pro --format json -o output/pnp
kicad-cruncher pnp project.kicad_pro --format csv
kicad-cruncher pnp project.kicad_pro --format xlsx
kicad-cruncher pnp project.kicad_pro --format jlc-cpl
kicad-cruncher pnp project.kicad_pro --format jlc-cpl-xlsx
kicad-cruncher pnp project.kicad_pro --position-mode component-center
kicad-cruncher pnp --write-config bom.config
kicad-cruncher pnp project.kicad_pro --config bom.config

Arguments

file is a .kicad_pro or .kicad_pcb. --format selects one legacy output format and overrides multi-output config mode. --config loads the shared BOM/PnP JSON or JSONC config; if omitted, bom.config in the working directory is used when present. --write-config writes the documented default JSONC config. --units selects mm or mils; JLC CPL output requires mm. --position-mode defaults to component-center, the only KiCad mode currently documented and accepted. It resolves to KiCad's footprint placement point, not a separate geometric centroid, exported relative to KiCad's aux axis origin, also called the drill/place file origin, with the same coordinate convention used by appz bom_cruncher. --variant, --all-variants, and --exclude-no-bom control variant and component inclusion.

Config

The generated bom.config is shared with the BOM and JLC commands and starts with one block-comment documentation header. pnp.outputs can emit json, csv, xlsx, jlc-cpl, and jlc-cpl-xlsx. pnp.output_fields controls generic table columns. Supported generated fields are designator, comment, layer, footprint, center_x, center_y, rotation, units, and description. Configured table columns can also include canonical fields such as manufacturer, manufacturer_part_number, jlcpcb_part_number, and value; aliases such as mfg, mpn, part_number, and pn; or exact raw KiCad parameter names. JLC CPL ignores pnp.output_fields and always emits Designator, Layer, Mid X, Mid Y, and Rotation. layer_order and prefix_order control stable placement sorting.

Output

Legacy output is written under the selected output directory. Config output uses shared output path templates and can emit json, csv, xlsx, jlc-cpl, and jlc-cpl-xlsx in one run. JSON includes normalized placement records with canonical fields, units, selected position mode, and aux-axis/drill-place-origin-relative coordinates. JLC CPL outputs emit Designator, Layer, Mid X, Mid Y, and Rotation. Configured outputs write bom.config.used.json beside generated artifacts.

Tests

L0 verifies command registration and help. L3 workflow coverage exercises Yoshi PnP variants, top-before-bottom sorting, natural designator sorting, JSON payload shape, table rows, XLSX generation, and JLC CPL rows.