Shared interface design

PCB Interfaces

Dataclasses used by PCB SVG, assembly projection, and layer STEP workflows.

PcbSvgCanvasConfig

Rationale

PCB SVGs need a compact visual canvas while preserving Altium coordinate metadata.

Purpose

Defines the A0 SVG viewBox bounds mode and margin for rendered layer outputs and composed views.

Test Requirements

Tests must verify default board-outline bounds, config validation, and real SVG output metadata.

Working Definition

Working when board views open tightly around the board profile and metadata records the canvas transform.

PcbSvgAssemblyConfig

Rationale

Assembly SVG virtual layers need component-level projection policy without forcing all components through HLR.

Purpose

Stores default and DNP projection modes plus normal and DNP designator colors.

Test Requirements

Config tests must validate projection-mode aliases and optional root serialization.

Working Definition

Working when configs can select detail, simple, bounding_box, or none before rendering consumes those options.

PcbSvgDnpConfig

Rationale

DNP components need explicit visual policy that does not depend on STEP HLR.

Purpose

Stores DNP color and hatch styling for future pad-bounding-box projection output.

Test Requirements

Config tests must verify DNP hatching fields parse and serialize.

Working Definition

Working when DNP visual defaults are available to renderer code and remain absent from default JSON when unused.

PcbSvgDiodeConfig

Rationale

Two-pin diode marking needs a shared detection and cathode convention.

Purpose

Stores diode detection prefixes, text terms, cathode pad names, numeric cathode fallback, marker color, and line-art default.

Test Requirements

Config and inventory tests must exercise diode detection and cathode mapping fields.

Working Definition

Working when generated config comments identify diode candidates and users can override cathode behavior.

PcbSvgPin1Config

Rationale

Pin-1 overlays need global defaults so passive families can stay quiet while explicit component overrides remain possible.

Purpose

Stores designator prefixes excluded from automatic pin-1 marking in PCB SVG virtual views.

Test Requirements

Config tests must verify default and configured prefix lists parse and serialize with the PCB SVG config root.

Working Definition

Working when pin-1 views can suppress default passive markers and component overrides can re-enable specific parts.

PcbSvgComponentOverride

Rationale

Users need per-designator control over projection, pin, cathode, diode, and designator behavior.

Purpose

Represents one optional component override keyed by designator in pcb.svg.config.

Test Requirements

Config tests must validate side and projection parsing plus optional-field serialization.

Working Definition

Working when hand-edited component overrides round-trip without adding no-op defaults.

PcbSvgGlobalConfig

Rationale

PCB SVG defaults need a shared A0 root.

Purpose

Stores global PCB SVG options and style defaults inherited by layer outputs and composed views.

Test Requirements

PCB SVG tests must preserve default style inheritance and CLI output selection behavior.

Working Definition

Working when global options merge predictably with per-view style overrides.

PcbSvgViewConfig

Rationale

Each PCB SVG view needs an explicit draw stack and durable update boundary.

Purpose

Defines one configured PCB SVG view, including output pattern, group id, layer tokens, mirror policy, HLR mode, and style overrides.

Test Requirements

View-selection and config tests must exercise explicit view names and layer-output filters.

Working Definition

Working when selected views render the configured layer token stack and can be updated by durable group id.

PcbSvgConfig

Rationale

PCB SVG command config needs a versionable root object.

Purpose

Aggregates the pcb.svg.config user config, A0 schema, global options, layer-output policy, and composed view list.

Test Requirements

Tests must cover created defaults, schema rejection, CLI overrides, JSONC input, and style merging.

Working Definition

Working when command config loads and selects the intended layer outputs and composed views.

CruncherPcbRenderInput

Rationale

PCB commands need one resolved board input shape.

Purpose

Carries resolved PcbDoc, board key, path, and project parameters.

Test Requirements

L3 PCB SVG tests must load public PcbDoc inputs without private context.

Working Definition

Working when all PCB render commands receive consistent resolved input metadata.

PcbSvgComponentInventoryEntry

Rationale

Generated PCB SVG configs need concise component facts without running rendering or HLR.

Purpose

Stores one component's side, footprint, pads, rotation, diode detection, and cathode candidate.

Test Requirements

Inventory tests must cover side extraction, pad names, diode detection, and cathode mapping.

Working Definition

Working when config templates can list useful per-component hints from PcbDoc data alone.

PcbSvgComponentInventory

Rationale

PCB SVG config generation needs a board-level component inventory that remains independent from SVG rendering.

Purpose

Groups component inventory entries for one board and exposes diode candidates for template comments.

Test Requirements

Fixture-backed tests must verify cricket-node component and diode comments are emitted from inventory data.

Working Definition

Working when config generation can annotate all discovered designators without invoking Geometer.

AssemblyProjectionOptions

Rationale

Assembly HLR projection needs explicit side and curve policy.

Purpose

Configures projected side and curve conversion behavior.

Test Requirements

Projection cache tests must exercise geometer HLR requests.

Working Definition

Working when projection options produce stable cached projected geometry.

AssemblyProjectedArc

Rationale

Projected assembly geometry may contain arcs that need structured metadata.

Purpose

Represents one projected arc segment.

Test Requirements

Projection tests must preserve projected curve handling.

Working Definition

Working when arcs survive HLR projection with usable coordinates.

AssemblyProjectedGeometry

Rationale

Assembly SVG rendering needs a stable projected geometry bundle.

Purpose

Stores projected lines, arcs, and bounds.

Test Requirements

Projection tests must verify cached geometer-backed geometry.

Working Definition

Working when assembly rendering can consume projected data without re-running HLR.

CruncherPcbAssemblySvgRenderOptions

Rationale

Assembly SVG rendering extends normal PCB SVG options.

Purpose

Controls assembly SVG render behavior.

Test Requirements

PCB SVG workflow tests must keep render options compatible with public fixtures.

Working Definition

Working when assembly and layer renders share compatible option handling.

CruncherPcbCutoutStyle

Rationale

Standalone cutout artifacts and composed board views need one resolved cutout styling contract.

Purpose

Stores resolved board-cutout overlay, hatching, label, dashed-outline, and stroke-width settings for the cutout-aware PCB SVG renderer.

Test Requirements

Unit tests must verify the style drives hash spacing, hash direction, stroke width, dashed outlines, and composed-view overlay output.

Working Definition

Working when top and bottom SVG views inherit global cutout style settings and standalone cutout layers can share the same style values.

CruncherPcbCutoutLayerRenderer

Rationale

Board-profile cutouts need an independently toggleable SVG layer artifact.

Purpose

Renders pcbdoc.board.outline.cutouts as a synthetic BOARD_CUTOUTS layer with optional hatching, configurable stroke widths, dashed outlines, and labels.

Test Requirements

Unit tests must exercise cutout paths, metadata, hatching spacing, angle, and line width, dashed outline options, outline line width, labels, and empty-board behavior. L3 must exercise a real fixture with arc and line cutouts.

Working Definition

Working when cutout-enabled layer views can emit a red cutout-only SVG without changing normal PCB layer rendering.

PcbLayerStepOptions

Rationale

Layer STEP generation needs immutable effective options.

Purpose

Represents resolved layer, color, thickness, outline, cutout, drill, plating, filter, and fusion options.

Test Requirements

Unit tests must cover config and CLI override merging.

Working Definition

Working when generated STEP requests match resolved options.

PcbLayerStepResult

Rationale

STEP export callers need generated file and count metadata.

Purpose

Reports output path, manifest path, layer, and geometry counts.

Test Requirements

STEP export tests must verify manifest and result fields.

Working Definition

Working when callers can inspect outputs without reparsing the STEP file.

PcbLayerStepConfig

Rationale

The command needs a JSON root config for repeatable layer exports.

Purpose

Stores persisted layer STEP options.

Test Requirements

Config tests must verify template creation and schema.

Working Definition

Working when config templates load into valid effective options.