kicad monkey v2026.11.30
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.

CommandAliasesCategoryRuntimeConfigGuide
kcr jlc—Fabrication & Manufacturing OutputsPython kcr + Native Rust k3Optional ./bom.config in the current working directory (kicad_cruncher.bom.config.a0, never auto-created)Fabrication & Outputs

Usage

sh
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).

sh
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

ArgumentDescription
fileKiCad .kicad_pro or .kicad_pcb file (optional if one .kicad_pro in CWD)

Options

FlagDescription
-o, --output OUTPUTOutput root directory (default: ./output)
--config CONFIGBOM/PnP JSON/JSONC config (default: ./bom.config if present)
--write-config PATHWrite a documented JSONC BOM/PnP config template
--variant VARIANTFilter by specific variant name
--all-variantsGenerate outputs for all variants plus base
--units UNITSCoordinate units (JLC CPL requires mm). Choices: mm, mils.
--position-mode POSITION_MODEPlacement position mode (default: config value or component-center). Choices: component-center.
--exclude-no-bomExclude placement-eligible parts that are not BOM-eligible from CPL generation
--no-colorDisable 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

  1. Input validation (no standalone schematics):
    • Accepts .kicad_pro or .kicad_pcb. Passing a .kicad_sch is rejected with exit code 1 because CPL placement coordinates require a PCB.
    • If omitted, auto-detects a single *.kicad_pro in CWD, falling back to a single *.kicad_pcb.
  2. Optional ./bom.config in CWD (never auto-created):
    • Shares the exact kicad_cruncher.bom.config.a0 schema with kcr bom and kcr pnp.
    • Explicit --config <path> loads that file; otherwise kcr jlc looks for ./bom.config in the current working directory (not beside the board).
    • Unlike kcr bom, kcr jlc never auto-creates ./bom.config. Without a config file, built-in defaults apply (output.dir_template: "{Command}", writing into ./output/jlc/ when -o is omitted, plus bom.config.used.json).
  3. --write-config [PATH] dual behavior:
    • With no input file (kcr jlc --write-config), writes the commented bom.config template and exits 0 immediately.
    • With an input file (kcr jlc project.kicad_pro --write-config bom.config), writes the template and continues generating the JLC bundle.

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:

See kcr bom Configuration for the full annotated JSONC reference.

Precedence & Conflict Rules

  1. Hard error when effective units are not mm:
    • JLCPCB CPL strictly requires millimeters. If --units mils is passed — or pnp.units: "mils" is set in ./bom.config without overriding --units mm on the CLI — kcr jlc aborts immediately with exit code 1.
  2. DNP parts are ALWAYS excluded from CPL:
    • Even when bom.include_dnp: true retains DNP items in the BOM review output, DNP components are always omitted from jlc-cpl-xlsx and from the missing-JLCPCB-Part-# audit.
  3. --exclude-no-bom is OR-only:
    • Effective exclude_no_bom = cli.--exclude-no-bom OR config.pnp.exclude_no_bom. Passing the flag can enable it over false, but you cannot turn off pnp.exclude_no_bom: true from the CLI.
  4. Variant selection & missing-LCSC exit status:
    • Variant precedence is --all-variants > --variant <NAME> > variants.* in bom.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 0 once the workbooks are written.
  5. Python kcr jlc vs native Rust k3 jlc:
    • Python kcr jlc writes formatted .xlsx workbooks (jlc-xlsx + jlc-cpl-xlsx) under ./output/jlc (via ./output + {Command}).
    • Native Rust k3 jlc writes CSV files (jlc-csv + jlc-cpl) under ./output/jlc and adds an optional --gerbers flag to bundle Gerber X2 + Excellon NC Drill in the same run.

Quick Examples

sh
# Export JLCPCB-formatted BOM and CPL workbooks (units must be mm)
kcr jlc project.kicad_pro -o output
sh
# Export JLCPCB workbooks for every assembly variant
kcr jlc project.kicad_pro --all-variants -o output
kicad-monkey v2026.11.30·Docs updated 2026.12.01 15:43 UTC (fd9b75b)