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.jsonc -o output/pcb-layer-step
kicad-cruncher pcb-layer-step --init-config --config pcb-layer-step.jsoncPurpose
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, M* pads for mounting-hole context, drill reference/cut policy, and yellow 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 config. When omitted, the command looks for pcb-layer-step.jsonc next to each input and creates that JSONC template if it does not exist. -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.defaults.color is the fallback copper color. Every feature entry may be a boolean or an object with enabled, color, step_body_name, and thickness_bias_mm. The step_body_name field replaces the old body term, and features.component_pads.highlight_rules replaces the old colors.pad_rules block. String and enum defaults are generated with comments that list valid options.
features.component_pads may be false, true, {"mode":"all"}, or {"mode":"matching_designators","include_designators":["TP*","M*"]}. drills.mode supports auto, cut, overlay, and none; scoped drill modes add inherit for selected components, other components, free pads, and vias. fuse_copper requests Geometer fuse_regions for copper bodies. Trace, arc, polygon, and region bodies are clipped against pad/via shapes so connecting copper does not fill pad holes or overlap highlighted pad bodies 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.