On This Page (10)
kcr pnp
Generate Pick-and-Place (PnP) from KiCad .kicad_pro or .kicad_pcb files. Includes all component parameters. Config-driven runs can emit JSON, CSV, XLSX, and JLCPCB CPL upload columns in one invocation. Config output_fields can include generated placement fields such as center_x, center_y, rotation, and units, canonical fields such as manufacturer or mpn, and exact raw KiCad parameter names.
| Command | Aliases | Category | Runtime | Config | Guide |
|---|---|---|---|---|---|
kcr pnp | — | Fabrication & Manufacturing Outputs | Python kcr + Native Rust k3 | Optional ./bom.config in the current working directory (kicad_cruncher.bom.config.a0, never auto-created) | Fabrication & Outputs |
Usage
kcr pnp [-h] [-o OUTPUT]
[--format {csv,json,xlsx,jlc-cpl,jlc-cpl-xlsx}]
[--config CONFIG] [--write-config [PATH]]
[--variant VARIANT] [--all-variants]
[--units {mm,mils}]
[--position-mode {component-center}]
[--exclude-no-bom] [--no-color]
[file]Native Rust CLI Equivalent (k3)
Implemented natively in k3 for CSV, JSON, and JLC CPL centroid exports (mm/mils and variants).
k3 pnp [-o OUTPUT] [--format {csv,json,jlc-cpl}] [--units {mm,mils}] [--position-mode {component-center}] [--exclude-no-bom] [--config PATH] [--write-config [PATH]] [--variant NAME | --all-variants] [file]Positional Arguments
| Argument | Description |
|---|---|
file | KiCad .kicad_pro or .kicad_pcb file (optional if one .kicad_pro in CWD) |
Options
| Flag | Description |
|---|---|
-o, --output OUTPUT | Output directory (default: ./output/pnp) |
--format FORMAT | Single output format; overrides multi-output config mode. Choices: csv, json, xlsx, jlc-cpl, jlc-cpl-xlsx. |
--config CONFIG | BOM/PnP JSON/JSONC config (default: ./bom.config if present) |
--write-config PATH | Write a documented JSONC BOM/PnP config template |
--variant VARIANT | Filter by specific variant name |
--all-variants | Generate PnP for all variants (plus base) |
--units UNITS | Coordinate units (default: config value or mm). Choices: mm, mils. |
--position-mode POSITION_MODE | Placement position mode (default: config value or component-center). Choices: component-center. |
--exclude-no-bom | Exclude placement-eligible parts that are not BOM-eligible |
--no-color | Disable ANSI colors and animated spinners |
How It Works
kcr pnp exports Pick-and-Place (centroid) placement tables from a KiCad project (.kicad_pro) or board (.kicad_pcb) relative to the board's aux axis / drill-place file origin, using the KiCad footprint placement point (component-center).
Like kcr bom, it supports both multi-artifact config mode and single-artifact legacy --format mode, sharing the exact same ./bom.config schema (kicad_cruncher.bom.config.a0).
Input & Config Discovery
- Input validation (no standalone schematics):
- Accepts
.kicad_proor.kicad_pcb. Passing a.kicad_schis rejected with exit code1because placement coordinates only exist on the PCB. - If omitted, auto-detects a single
*.kicad_proin CWD, falling back to a single*.kicad_pcb.
- Accepts
- Optional
./bom.configin CWD (never auto-created):- Explicit
--config <path>loads that config file. - Otherwise,
kcr pnpchecks./bom.configin the current working directory (not beside the board). - Unlike
kcr bom,kcr pnpnever auto-creates./bom.config. If no config file is found,kcr pnpruns in legacy single-format mode (default--format csv, writing under./output/pnp/). - When a config file is found and
--formatis omitted,kcr pnpruns in config mode: emitting every kind inpnp.outputs(default["json", "csv"]) under./output/{Command}/and writingbom.config.used.jsonbeside the outputs.
- Explicit
--write-config [PATH]:- With no input file, writes the shared commented
bom.configtemplate and exits0. With an input file, writes the template and proceeds with PnP export.
- With no input file, writes the shared commented
Configuration (pnp Section of bom.config)
See kcr bom Configuration for the full kicad_cruncher.bom.config.a0 schema (field_aliases, variants, output templates). The pnp section controls placement exports:
{
"schema": "kicad_cruncher.bom.config.a0",
"pnp": {
"outputs": ["json", "csv"], // "json" | "csv" | "xlsx" | "jlc-cpl" | "jlc-cpl-xlsx"
"output_fields": [
"designator", "comment", "layer", "footprint",
"center_x", "center_y", "rotation", "description"
],
"units": "mm", // "mm" | "mils" (JLC CPL strictly requires "mm")
"position_mode": "component-center",
"exclude_no_bom": false, // Omit parts marked exclude_from_bom
"layer_order": ["top", "bottom"],
"prefix_order": [] // Optional designator-prefix sort priority
}
}Precedence & Conflict Rules
- Hard error on JLC CPL with non-
mmunits:- If the effective units are not
"mm"(from--units milsorpnp.units: "mils") and any requested output isjlc-cplorjlc-cpl-xlsx(either via--formator viapnp.outputsin config mode),kcr pnpaborts immediately with exit code1because JLCPCB CPL strictly requires millimeters.
- If the effective units are not
- DNP parts are ALWAYS excluded:
- Any component marked DNP (from schematic DNP state, footprint
dnpattribute, or active variant override) is unconditionally omitted from PnP and CPL outputs, regardless ofbom.include_dnpor--exclude-no-bom.
- Any component marked DNP (from schematic DNP state, footprint
--exclude-no-bomis OR-only:- Effective
exclude_no_bom = cli.--exclude-no-bom OR config.pnp.exclude_no_bom. You can enable it on the CLI overfalseinbom.config, but you cannot disablepnp.exclude_no_bom: truevia a CLI flag.
- Effective
- Units & position mode precedence:
- CLI
--unitsoverridespnp.units(default"mm"). - CLI
--position-modeoverridespnp.position_mode(default"component-center").
- CLI
- Config mode vs
--formatmode:- Passing
--formatoverridespnp.outputs, writes one file to./output/pnp/<stem>[_<variant>]_pnp.<ext>, and skipsbom.config.used.json.
- Passing
- Variant selection:
- Follows the shared ladder:
--all-variants>--variant <NAME>>variants.*inbom.config. Unknown variant names warn rather than fail.
- Follows the shared ladder:
- Python
kcrvs native Rustk3:- Native Rust
k3 pnpemitscsv,json, andjlc-cpl; Pythonkcr pnpadditionally emits formatted.xlsxworkbooks (xlsx,jlc-cpl-xlsx).
- Native Rust
Quick Examples
# Export Pick-and-Place CSV from a board or project
kcr pnp board.kicad_pcb -o output/pnp# Export PnP in mils for a named variant, excluding No-BOM parts
kcr pnp project.kicad_pro --units mils --exclude-no-bom --variant Proto -o output/pnp