On This Page (10)
- 1. Gerber RS-274X / X2
- X2 Attributes & File Polarity
- PROFILE (.GM1) Convention & Extension Collisions
- 2. Excellon NC Drill
- 3. IPC-2581 Rev B (.cvg)
- 4. Micro-STEP (ISO 10303-21 AP242 / AP214)
- 5. Enriched PCB & Schematic SVG Formats
- Enriched PCB SVG (pcb_svg_enrichment_a0.schema.json)
- Enriched Schematic SVG (schematic_svg_enrichment_a0.schema.json)
- Related
Fabrication & Enriched SVG Wire Formats
Beyond JSON wire contracts, kicad-monkey emits industry-standard manufacturing packages (Gerber RS-274X/X2, Excellon NC Drill, IPC-2581 Rev B, ISO 10303-21 Micro-STEP) and enriched review SVGs designed for interactive web viewers and automated design-review pipelines.
Every fabrication output is lowered from a single normalized whole-nanometre (+Y up) board view (KiCadFabView in Python, FabViewData in Rust), preventing geometric drift between copper Gerbers, drill files, IPC-2581 stackups, and alignment STEP solids.
1. Gerber RS-274X / X2
Both Python (fab.to_gerbers(...)) and Rust (KiCadFab::to_gerbers(...)) emit Ucamco Gerber Layer Format Specification 2026.05 files on an exact 1 nm metric grid (%FSLAX46Y46*%, %MOMM*%).
X2 Attributes & File Polarity
When Gerber X2 is enabled (the default; pass x2=False or --x1 for strict RS-274X), every file carries standard attribute headers:
%TF.*(File attributes):%TF.FileFunction(copper index & side, solder mask, paste, legend/silkscreen, profile, orOther,<virtual_key>),%TF.FilePolarity(PositiveorNegative),%TF.SameCoordinates,%TF.GenerationSoftware, and%TF.CreationDate(pinned when deterministic timestamps are requested).%TA.*/%TD(Aperture & object attributes): pad/via function attributes (%TA.AperFunction,...*%) cleared cleanly with%TD*%when switching aperture roles so CAM tools can distinguish SMD pads, via pads, conductor traces, and fiducials.- Apertures & macros: circles (
%ADD..C), rectangles (%ADD..R), obrounds (%ADD..O), and custom aperture macros (%AM...*%) for rotated/chamfered/rounded-rectangle/trapezoid pads so flashed pads stay exact flashes rather than polygon approximations whenever the Gerber spec allows. Filled zones, custom pad polygons, and knockout regions emit closed positive/negativeG36*/G37*contours.
PROFILE (.GM1) Convention & Extension Collisions
- Board outlines (
Edge.Cuts) emit as strokedPROFILEgeometry on<stem>.GM1by default (%TF.FileFunction,Profile,NP*%). - Watch for mechanical-layer collisions: if a board also exports a user/mechanical layer mapped to
.GM1, or if you override extensions viaGerberOptionsdual-key extension maps, reserve.GM1exclusively forPROFILE(or mapPROFILEto.GKO) so two layers never collide on the same filename. - Optional interior board cutouts (
CUTOUTSvirtual layer orprofile_cutouts) keep exterior profile contours distinct from cutout annotations.
2. Excellon NC Drill
fab.to_nc_drill(...) / KiCadFab::to_nc_drill(...) emits unambiguous, explicit-decimal Excellon files that avoid leading/trailing zero ambiguity across CAM viewers:
- Headers & coordinate precision:
M48,FMAT,2, metric (METRIC, 4-decimalX{mm:.4f}Y{mm:.4f}) or imperial (INCH) format headers, tool table (T1C...), and explicit origin shift when auxiliary-axis origin (use_aux_origin) is enabled. - Routed oval slots (
G85): oblong/slot pad drills emit as two-pointG85linear rout commands (X<x1>Y<y1>G85X<x2>Y<y2>) rather than overlapping round hits. - Plated vs. NPTH & drill-pair splitting:
- Plated through-holes (
PTH) and non-plated through-holes (NPTH) always split into separate files (-PTH.drl/-NPTH.drl). - Blind, buried, and microvia holes split by physical copper layer span
(start_layer, end_layer)so each laser/controlled-depth drill pass receives its own cleanly scoped file.
- Plated through-holes (
3. IPC-2581 Rev B (.cvg)
fab.to_ipc2581(...) / KiCadFab::to_ipc2581() emits a single self-contained, schema-valid IPC-2581 Rev B .cvg XML file:
- Physical
<StackupGroup>discipline:<StackupGroup>contains only physical board layers (copper, dielectric, solder mask, paste, silkscreen, and drill spans). Virtual layers (CUTOUTS,PIN1_*,ASSEMBLY_*, etc.) are emitted as standalone<Layer>+<LayerFeature>records withDOCUMENT/ASSEMBLYroles so CAM stackup importers never mistake documentation overlays for physical copper or dielectric thickness. - Components & negative standoff handling:
<Component>placements carry exact XY coordinates, side, rotation, package reference, height, and standoff. When a footprint's 3D model or mechanical datum sits below the board seating plane (negative standoff, such as a through-board recessed connector or board-edge LED), standoff values are normalized cleanly instead of emitting invalid negative heights that fail strict IPC-2581B XSD checks.
4. Micro-STEP (ISO 10303-21 AP242 / AP214)
fab.to_micro_step(...), KiCadFab::to_micro_step(), and kcr pcb-layer-step / k3 pcb-layer-step emit valid ISO 10303-21 STEP AP242 / AP214 3D CAD files with zero OpenCASCADE (OCCT) or Geometer runtime dependency:
- Analytic 2.5D extruded solids: board outlines, interior cutouts, drilled holes, and per-layer copper/mask/paste/silkscreen alignment geometry are extruded directly from whole-nanometre 2D contours into exact B-Rep
ADVANCED_BREP_SHAPE_REPRESENTATIONsolids. - Assembly instancing (
NEXT_ASSEMBLY_USAGE_OCCURRENCE+ITEM_DEFINED_TRANSFORMATION): repeated identical pad and via geometries share one canonical B-Rep prototype placed viaNEXT_ASSEMBLY_USAGE_OCCURRENCEandITEM_DEFINED_TRANSFORMATION, keeping file sizes compact and load times fast in SolidWorks, Fusion, FreeCAD, and Onshape.
5. Enriched PCB & Schematic SVG Formats
KiCad Monkey supports two distinct SVG profiles:
profile="oracle": metadata-free geometry shaped strictly for pixel/vector parity comparison againstkicad-cli.profile="enriched": source-aware SVGs carrying structureddata-*attributes on every primitive group and an embedded JSON<metadata>block validated againstpcb_svg_enrichment_a0.schema.jsonorschematic_svg_enrichment_a0.schema.json.
Enriched PCB SVG (pcb_svg_enrichment_a0.schema.json)
Document-level JSON metadata lives inside:
<metadata id="pcb-enrichment-a0" data-schema="kicad_monkey.pcb.svg.enrichment.a0">
{ ... }
</metadata>Root SVG discovery attributes include data-stage, data-group-mode, data-enrichment-schema, data-view-kind, data-profile, data-source, and data-included-layers. Element-level <g> wrappers carry:
| Attribute Group | Key Attributes | Notes |
|---|---|---|
| Primitive & source kind | data-primitive (track, arc, via, via-hole, zone, footprint, pad, pad-hole, graphic, text, dimension, footprint-graphic), data-ref (property, fp_text, fp_text_box, fp_line, fp_arc, fp_circle, fp_rect, fp_poly), data-kind, data-geometry-source | Identifies both the normalized review primitive and its originating KiCad source item or derived geometry source (e.g., STEP HLR vs. native F.Fab vs. pad envelope). |
| Layers | data-layer-name, data-layer-names, data-layer-role, data-layer-roles | Uses canonical KiCad layer names (F.Cu, In1.Cu, F.SilkS); UI display aliases live in layers.layer_name_to_display_name. |
| Electrical & components | data-net, data-net-id, data-net-index, data-net-class, data-net-classes, data-component, data-component-uid, data-component-uuid, data-footprint, data-pad-number, data-pad-designator, data-pad-type, data-pad-shape | Enables instant net highlighting and component cross-probing without reparsing .kicad_pcb. |
| Drills & vias | data-hole-owner, data-hole-kind (round/slot), data-hole-plating (plated/non_plated/unknown), data-hole-diameter-mm, data-hole-width-mm, data-hole-height-mm, data-via-type, data-via-drill-mm, data-via-size-mm, data-ipc4761-* | Copper-flash scope (via_aperture / pad flash) and physical drill scope (via_drill / pad-hole) are kept strictly separate so removed internal annuli never hide through-board drills. |
Enriched Schematic SVG (schematic_svg_enrichment_a0.schema.json)
Document-level JSON metadata lives inside:
<metadata id="schematic-enrichment-a0" data-schema="kicad_monkey.schematic.svg.enrichment.a0">
{ ... }
</metadata>Element-level <g> wrappers carry data-ref (source KiCad record kind such as symbol_pin, sheet_pin) and data-primitive (symbol, power-symbol, sheet-symbol, port, sheet-entry, pin).
For interactive single-page highlighting, consumers should read view_indexes (svg_to_net, svg_to_nets, net_to_svg, net_uid_to_svg) first rather than walking the full embedded design payload or guessing connectivity from DOM nesting.
Compiled-Graph Selector Linkage
When rendered alongside a CompiledSchematicGraph, the enrichment payload additively includes compiled_schematic_graph_view (kicad_monkey.schematic.svg.compiled_graph_view.a0) with linkage contract kicad_monkey.schematic.svg.compiled_graph_linkage.a0:
- Root SVG discovery attributes expose the graph schema,
page_occurrence_ref,artifact_key("sch.dwg_scene"), and linkage contract. - The authoritative join key between a DOM element and the compiled electrical graph is always
(page_occurrence_ref, artifact_key, element_id). - Displayed designators, net labels, text strings, and DOM order are never authoritative join keys — especially when a reused hierarchical
.kicad_schappears on multiple pages with identical source UUIDs.
Related
- Complete Contract & Schema Catalog —
kicad_monkey.fab_view.a0,CompiledSchematicGraph.json, and enrichment schemas. - Fab &
KiCadFabView— Python fabrication API and option reference. - Virtual Fab Layers (17 Layers) — virtual layer geometry across Gerber, IPC-2581B, SVG, and
vdoc. - Fabrication & Virtual Layers in Rust — native Rust
kicad-monkey-fabwriters and parity notes.