Public command
pcb-layer-step
Generate a compact colored STEP model for fixture-alignment checks on one KiCad PCB layer.
Usage
kicad-cruncher pcb-layer-step board.kicad_pcb
kicad-cruncher pcb-layer-step project.kicad_pro --doc board.kicad_pcb --layer bottom
kicad-cruncher pcb-layer-step board.kicad_pcb --config pcb-layer-step.json -o output/pcb-layer-step
kicad-cruncher pcb-layer-step --init-config --config pcb-layer-step.jsonPurpose
pcb-layer-step is a fixture-alignment exporter, not a full PCB fabrication STEP exporter. The generated JSONC config is intentionally comment-heavy and defaults to a small bottom-side fixture view: TP* component pads as a red test_points body, drill reference overlays, and separate board outline/cutout bodies. Tracks, arcs, poured copper zones, vias, and generic copper regions can be enabled through the same v2 fixture-alignment config shape.
Arguments
file accepts .kicad_pcb or .kicad_pro. When omitted, the command auto-detects exactly one KiCad project or PCB in the current directory. --doc selects the PCB file for project inputs. --config selects a JSON/JSONC pcb-layer-step.json; when omitted, the command looks next to each input and creates the template if missing. -o selects the output directory directly.
Config
The config contract is wn.kicad_cruncher.pcb_layer_step.config.v2. The root defaults object is copied into each entry of outputs, and each output accepts the same fields as defaults. features.component_pads may be false, true, {"mode":"all"}, or {"mode":"matching_designators","include_designators":["TP*"]}. colors.pad_rules split matched pads into named Geometer bodies. features.tracks can be a boolean or {"enabled":true,"color":"#B87333","body":"tracks"}; arcs follow the same trace body/color when a trace style is configured. drills.mode supports auto, cut, overlay, and none.
fuse_copper requests Geometer fuse_regions for copper bodies. When a trace-only body is split out and fusion is enabled, KiCad Cruncher also sends component pad and via copper regions as cutouts for that trace body so fused traces clip cleanly at pads and vias in review outputs.
Geometry
The exporter uses KiCad Monkey parsed PCB geometry in millimeters. Footprint pad regions are transformed from footprint-local coordinates to board coordinates. Oval pad and oval drill slot orientation is preserved through the footprint transform. Tracks and arcs use KiCad Monkey polygon conversion. Filled copper zone polygons become poured-polygon regions; KiCad placement-rule and keepout zones are skipped so step/repeat placement areas do not render as copper. Vias are emitted as copper disks on layers they span. Board outline and cutouts are derived from the same generalized Edge.Cuts classifier used by pcb-svg, so closed line/arc loops, rectangles, circles, curves, and polygons are classified consistently across SVG and STEP outputs.
Coordinates
Geometer receives geometry.planar_step.request.a0 bodies in millimeters. Geometry is translated relative to KiCad setup/aux_axis_origin; boards without an aux axis origin use absolute KiCad board coordinates. The manifest records coordinate_origin.mode="kicad_aux_axis_origin", the origin in millimeters, the selected layer, effective drill-hole mode, feature counts, and emitted file size.
Output
When -o is omitted, artifacts are written under ./output/pcb-layer-step/. Each configured output writes a STEP file and a sibling JSON manifest. output_step supports brace tokens such as {board}, {layer}, and {output}; the generated template defaults to {board}__fixture_alignment.step.
Tests
L0 verifies command registration and help. L3 runs the command against copied yoshi mainboard and taillight KiCad corpus boards using the default fixture-alignment config shape, with Geometer mocked at the request boundary so tests can inspect body IDs, colors, drill overlay counts, board outline bodies, and manifest fields without requiring STEP kernel output. Additional L3 coverage verifies taillight placement-rule zones are omitted from copper, Yoshi USB oval slots preserve orientation, and all-copper review configs request fused trace bodies with pad/via clipping cutouts.