On This Page (10)
kcr jlc
Generate a JLCPCB BOM XLSX and CPL XLSX from one KiCad .kicad_pro or .kicad_pcb file. The command reuses the BOM/PnP config for aliases, sorting, variants, BOM group_fields, PnP output_fields, and output naming.
| Command | Aliases | Category | Runtime | Config | Guide |
|---|---|---|---|---|---|
kcr jlc | — | 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 jlc [-h] [-o OUTPUT] [--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 JLCPCB BOM CSV, CPL CSV, and optional Gerbers + NC Drill; Python kcr jlc writes .xlsx workbooks (jlc-xlsx + jlc-cpl-xlsx).
k3 jlc [-o OUTPUT] [--units {mm}] [--position-mode {component-center}] [--exclude-no-bom] [--gerbers] [--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 root directory (default: ./output) |
--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 outputs for all variants plus base |
--units UNITS | Coordinate units (JLC CPL requires 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 from CPL generation |
--no-color | Disable ANSI colors and animated spinners |
How It Works
kcr jlc generates a ready-to-upload JLCPCB assembly pair — JLCPCB BOM (jlc-xlsx with Comment, Designator, Footprint, JLCPCB Part #) and JLCPCB CPL (jlc-cpl-xlsx with Designator, Layer, Mid X, Mid Y, Rotation) — from one KiCad project (.kicad_pro) or board (.kicad_pcb).
After writing the workbooks, kcr jlc audits every fitted grouped BOM line for a populated jlcpcb_part_number (matching aliases such as JLCPCB Part #, JLC Part #, LCSC Part #, and LCSC). Any fitted lines lacking an LCSC/JLCPCB part number are printed in a colorized terminal table (QTY, DESIGNATORS, VALUE, FOOTPRINT, MPN, MFG) alongside a warning banner so missing order codes are caught before upload.
Input & Config Discovery
- Input validation (no standalone schematics):
- Accepts
.kicad_proor.kicad_pcb. Passing a.kicad_schis rejected with exit code1because CPL placement coordinates require a 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):- Shares the exact
kicad_cruncher.bom.config.a0schema withkcr bomandkcr pnp. - Explicit
--config <path>loads that file; otherwisekcr jlclooks for./bom.configin the current working directory (not beside the board). - Unlike
kcr bom,kcr jlcnever auto-creates./bom.config. Without a config file, built-in defaults apply (output.dir_template: "{Command}", writing into./output/jlc/when-ois omitted, plusbom.config.used.json).
- Shares the exact
--write-config [PATH]dual behavior:- With no input file (
kcr jlc --write-config), writes the commentedbom.configtemplate and exits0immediately. - With an input file (
kcr jlc project.kicad_pro --write-config bom.config), writes the template and continues generating the JLC bundle.
- With no input file (
Configuration (bom.config Fields Used by kcr jlc)
kcr jlc always forces the output kinds to jlc-xlsx and jlc-cpl-xlsx (ignoring bom.outputs and pnp.outputs), while honoring:
field_aliases— especiallyjlcpcb_part_number(JLCPCB Part #,LCSC Part #,LCSC, etc.) for BOM export and missing-LCSC auditing.variants— variant selection when--variant/--all-variantsare omitted.bom.source_mode,bom.group_fields,bom.include_dnp,bom.split_dnp,bom.dnp_placement,bom.pcb_line_item,bom.prefix_order.pnp.units,pnp.position_mode,pnp.exclude_no_bom,pnp.layer_order,pnp.prefix_order.output.dir_templateandoutput.name_template(with{Command}set tojlc), plus thebom.config.used.jsonprovenance snapshot written alongside the output workbooks.
See kcr bom Configuration for the full annotated JSONC reference.
Precedence & Conflict Rules
- Hard error when effective units are not
mm:- JLCPCB CPL strictly requires millimeters. If
--units milsis passed — orpnp.units: "mils"is set in./bom.configwithout overriding--units mmon the CLI —kcr jlcaborts immediately with exit code1.
- JLCPCB CPL strictly requires millimeters. If
- DNP parts are ALWAYS excluded from CPL:
- Even when
bom.include_dnp: trueretains DNP items in the BOM review output, DNP components are always omitted fromjlc-cpl-xlsxand from the missing-JLCPCB-Part-# audit.
- Even when
--exclude-no-bomis OR-only:- Effective
exclude_no_bom = cli.--exclude-no-bom OR config.pnp.exclude_no_bom. Passing the flag can enable it overfalse, but you cannot turn offpnp.exclude_no_bom: truefrom the CLI.
- Effective
- Variant selection & missing-LCSC exit status:
- Variant precedence is
--all-variants>--variant <NAME>>variants.*inbom.config(unknown variant names log a warning rather than failing). - Missing JLCPCB/LCSC part numbers display a warning banner and summary table, while still returning exit code
0once the workbooks are written.
- Variant precedence is
- Python
kcr jlcvs native Rustk3 jlc:- Python
kcr jlcwrites formatted.xlsxworkbooks (jlc-xlsx+jlc-cpl-xlsx) under./output/jlc(via./output+{Command}). - Native Rust
k3 jlcwrites CSV files (jlc-csv+jlc-cpl) under./output/jlcand adds an optional--gerbersflag to bundle Gerber X2 + Excellon NC Drill in the same run.
- Python
Quick Examples
# Export JLCPCB-formatted BOM and CPL workbooks (units must be mm)
kcr jlc project.kicad_pro -o output# Export JLCPCB workbooks for every assembly variant
kcr jlc project.kicad_pro --all-variants -o output