This document describes the implemented mate_config.a0 shape
and the portable design direction. The command contract is
mate.html, and the generated Altium MCO operation
contract is mco.html. Current implementation covers
config initialization, selector resolution, name-based library lookup,
mate component placement, PCB labels, board outline/cutout graphics and
regions, STEP artifact insertion, PCB designator arrangement, and
source-side validation. Some future projection actions remain draft.
The current command name is mate, but the domain model
is broader: create an output board that mates to an input board. The first
feature-complete use case is cricket-node mated to node-test-array derived
fixture parts. The config model should remain portable enough to map later
to KiCad and a generic pcb_cruncher workflow, while the
current MCO backend remains Altium-specific.
| Term | Meaning |
|---|---|
source, input, DUT |
The existing board being analyzed. For the first workflow this is cricket-node. |
destination, output, mate |
The generated board that physically mates to the source board. |
| human config | The human-authored or GUI-authored source of truth. It describes intent and should avoid derived facts. |
| resolved plan | The planner's internal view after reading source board facts: coordinates, nets, sides, source geometry, selected objects, and projection actions. |
| MCO | The derived, inspectable, Altium-specific operation script compiled from the human config and resolved plan. |
mate writes an editable mate.a0.jsonc when no config exists.plan resolves selectors against the source project, resolves symbol and footprint names from libraries.roots, validates source-side and geometry rules, and compiles MCO.mate with an existing config executes the generated MCO to create the output board and supporting artifacts.The cricket-node use case needs these source object classes to be explicit in the planner, even when the first config uses presets or designator patterns.
| Class | Resolved Facts | First Use |
|---|---|---|
| component | Designator, footprint, schematic linkage when available, side, center, pads, net names, pin/pad mapping. | TP-style test pads, M-style mounts, future J/connector/header mating. |
| free pad or drill | Location, size, hole size, plated state, layer/span, net name when resolvable. | Cricket-node 2 mm NPTH alignment pins and other free pads. |
| board outline | Closed outline geometry, origin relationship, arcs/lines when available. | Mechanical reference graphics or output outline setup. |
| internal cutout | Regions inside the outline, shape geometry, layer/object metadata. | Mechanical reference graphics and optional actual output cutouts. |
| Action | Meaning |
|---|---|
mate_component |
Place a different symbol/footprint that mates to the selected source object, such as a pogo pin for a source test pad. The public A0 form names symbol_name and footprint_name; the planner resolves concrete libraries from libraries.roots. |
copy_source_footprint |
Project the source footprint 1:1 into the output. This supports .100 inch headers, shield-style boards, and early workflows without a curated mate library. |
same_pad |
Project equivalent pads or drills without a full component abstraction. |
reference_graphics |
Add mechanical or silkscreen reference geometry, such as source-pad outlines, bounding boxes, or future pin-1 markers. The current implemented subset supports source_pad_outline from inspected source pad geometry, with one expanded outline by default and optional multiple outlines via outline_count or double_outline. The outline follows the effective source-layer pad body for circular, obround, rectangular/square, octagonal/chamfered, and rounded-rectangle pads. clearance_mils is the visible gap from the source pad edge to the inside edge of the outline stroke, so zero clearance makes the outline touch the pad edge. Filled source-pad graphics are a planned reference mode but are not part of this subset. |
label |
Add text labels near mate features or in arranged groups. Labels may be tied to source nets, source designators, or custom text. |
breakout |
Add additional connectors wired to selected source nets, such as future Saleae-style 2x4 headers with generated net labels and text labels. |
outline_or_cutout |
Project source board outline or internal cutouts as graphics, actual output cutouts, or both. |
alignment_artifact |
Produce generated helper outputs such as a bottom-layer STEP artifact from pcb-layer-step. |
source_mount_side; it is a resolved fact or optional validation expectation.validation.side_agnostic_kinds when they should not participate in signal-side inference.output.origin is preserve_source, the planner resolves source outline bounds and source board origin, then passes both to the generated output project skeleton rather than requiring the config to repeat derived coordinates.output.board_outline.mode may use source_bounds for the DUT bounds or source_bounds_with_margin for a larger rectangle. margin_mils may be one number or an object with left, bottom, right, and top. Exact match_shape output is deferred until the skeleton supports arbitrary outline geometry.The first complete workflow should support cricket-node without requiring users to type resolved coordinates or net names. The config should select source objects, and the planner should resolve the facts needed to compile MCO.
TP*.M5-M8 normalization to output M1-M4 where needed.mating_parts/.D by default, grouped by symbol type. Route each netted symbol with a wire that leaves the symbol in the resolved mate symbol signal pin orientation. The schematic net label is placed on that wire, rotated with the wire direction, and the wire is long enough to sit under the estimated full label text.board_right and board_left. Board-edge labels are loose text outside MATE_FEATURES so they can be manually moved after generation.pcb-layer-step artifact for visual/mechanical alignment and optionally insert the generated STEP into the output PcbDoc at a configurable Z height.MATE_FEATURES, excluding movable PCB net-label text.This is the implemented public A0 shape used by the Cricket Node example. Some optional sections and future projection actions may still evolve after review.
{
"schema": "wn.pcb_cruncher.mate_config.a0",
"source": {
"board": "path/to/cricket-node.PrjPcb",
"pcbdoc": null
},
"output": {
"backend": "altium",
"output_dir": "output/cricket-node-mate",
"project_name": "cricket_node_mate",
"schematic_sheet_style": "D",
"origin": "preserve_source",
"board_outline": {
"mode": "source_bounds_with_margin",
"margin_mils": {
"left": 500,
"bottom": 500,
"right": 3000,
"top": 500
}
}
},
"libraries": {
"roots": ["mating_parts"],
"recursive": true
},
"validation": {
"source_side": "infer_single_side",
"allow_side_agnostic_through_hole": true
},
"projections": [
{
"id": "test_points",
"source": {
"object": "component",
"designators": "TP*"
},
"actions": [
{
"kind": "mate_component",
"symbol_name": "YZ209315103P-01",
"footprint_name": "YZ209315103P-01",
"designator_prefix": "TP",
"signal_pad_designator": "1"
},
{
"kind": "reference_graphics",
"shape": "source_pad_outline",
"layer": "MECHANICAL_1",
"style": {
"mode": "outline",
"outline_count": 1,
"clearance_mils": 10,
"stroke_width_mils": 10
}
},
{
"kind": "label",
"text": "source_net",
"placement": {
"side": "board_right",
"offset_mils": [250, 250],
"box_size_mils": [450, 70],
"row_spacing_mils": 90,
"column_spacing_mils": 80,
"auto_width_padding_mils": 80
}
}
]
},
{
"id": "mounts",
"source": {
"object": "component",
"designators": "M1-4"
},
"actions": [
{
"kind": "mate_component",
"symbol_name": "9774080360R",
"footprint_name": "9774080360R-YIYUAN",
"designator_prefix": "M"
}
]
},
{
"id": "alignment_pins",
"source": {
"object": "free_pad",
"hole_size_mils": {"min": 75, "max": 85},
"plated": false
},
"actions": [
{
"kind": "mate_component",
"symbol_name": "H2184-05",
"footprint_name": "H2184-05",
"designator_prefix": "P",
"signal_pad_designator": "1"
},
{"kind": "label", "text": "source_net"}
]
}
],
"pcb_designators": {
"enabled": true,
"placement": "above_component",
"offset_mils": [0, 10],
"width_factor": 0.6,
"style": {
"height_mils": 40,
"layer": "TOP_OVERLAY",
"font_kind": "truetype",
"font_name": "Arial",
"bold": true,
"stroke_width_mils": 8
}
},
"board_projection": {
"outline": {
"graphics": {
"enabled": true,
"layer": "TOP_OVERLAY",
"stroke_width_mils": 8
}
},
"cutouts": {
"graphics": {
"enabled": true,
"layer": "MECHANICAL_1",
"stroke_width_mils": 8
},
"actual_cutouts": true
}
},
"artifacts": {
"pcb_layer_step": {
"enabled": true,
"source_layer": "bottom",
"thickness_mm": 0.035,
"z_mm": -0.0175,
"features": {
"tracks": {"enabled": false, "color": "#B87333"},
"polygons": {"enabled": false, "color": "#7A8F2A"},
"arcs": false,
"fills": false,
"regions": false,
"vias": false,
"component_pads": {
"mode": "matching_designators",
"include_designators": ["TP*"]
},
"free_pads": false
},
"drills": {
"mode": "overlay",
"minimum_diameter_mm": 0.85,
"shape": "ring",
"ring_width_mm": 0.12,
"plated_ring_shape": "pad"
},
"fuse_copper": false,
"insert_in_output": {
"enabled": true,
"z_mm": 8.5,
"layer": "MECHANICAL_13",
"side": "TOP"
},
"highlights": [
{"projection": "test_points", "color": "#FF0000"}
]
}
}
}
Before a GUI exists, bare mate produces a commented config
with useful selector presets and optional sections. Later, a GUI can render
the source board SVG, show grouped source objects such as test points,
debug pads, connectors, and mounts, and write the same config format after
user selection.
Source selectors are local to each projection group. Component designators
may be a wildcard, a compact range such as TP1-5, a
comma-separated expression such as TP1-5, U12, or an explicit
JSON array for machine-generated configs.
Projection actions own their output options. For example, two projection
groups may both use label actions but choose different
placement side, offsets, box sizes, and text style. Mate configs therefore
do not use the legacy global pcb_labels block as the primary
label contract. A label side of left or
right places the label relative to the projected target, while
board_left or board_right places labels in
vertical columns inside the output board outline. Board-edge labels are
grouped by projection id, falling back to source kind when no projection id
is present. Each board-edge column gets a silkscreen text header using that
group name. row_spacing_mils sets spacing within a column,
column_spacing_mils sets spacing between columns, and
auto_width_padding_mils is added to the longest rendered label
estimate so every board-edge label box uses the same width. Board-edge
labels and their headers are emitted after the generated feature union and
are therefore not part of MATE_FEATURES.
Generated schematic placement is intentionally simple but collision-aware:
mate symbols are placed on a coarse grid grouped by symbol type and sorted
in natural designator order within each group, the default sheet style is
D, schematic designators are centered just above their symbols,
wires extend away from each symbol in the selected signal pin orientation,
and schematic net labels sit along those wires with matching orientation.
Wire length is estimated from the label text so it remains visible beneath
the label, and the grid leaves room before the next symbol column. This
keeps the first generated schematic reviewable while leaving
connector-specific and breakout-specific schematic organization for later
slices.
pcb_designators is a post-placement PCB text normalization
block. The current implemented placement is above_component;
it updates the generated component-owned designator text instead of adding
duplicate loose text. The cricket-node default is Arial TrueType, 40 mil,
bold, on top overlay.
Artifact highlights reference projection ids instead of duplicating source
selectors. pcb-layer-step owns layer, local STEP Z, thickness,
feature visibility, and feature colors. Output-board insertion owns the
model-placement z_mm; for the Cricket Node example that value
is 8.5 mm while the exported STEP uses local
z_mm: -0.0175. Since z_mm is the bottom extrusion
plane and copper thickness is 0.035 mm, local Z=0
is the copper mid-plane. The first example renders selected TP pads red and
makes track and polygon visibility/color choices explicit.