altium-toolkit 1.0.8 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/README.md +18 -6
  2. package/docs/api.md +78 -16
  3. package/docs/model-format.md +229 -8
  4. package/docs/schemas/altium_toolkit/ci_artifact_bundle_a1.schema.json +76 -0
  5. package/docs/schemas/altium_toolkit/draftsman_digest_a1.schema.json +35 -0
  6. package/docs/schemas/altium_toolkit/netlist_a1.schema.json +53 -0
  7. package/docs/schemas/altium_toolkit/normalized_model_a1.schema.json +1826 -110
  8. package/docs/schemas/altium_toolkit/parser_compatibility_fuzz_a1.schema.json +25 -0
  9. package/docs/schemas/altium_toolkit/pcb_svg_semantics_a1.schema.json +86 -0
  10. package/docs/schemas/altium_toolkit/project_bundle_a1.schema.json +63 -0
  11. package/docs/schemas/altium_toolkit/project_document_graph_a1.schema.json +33 -0
  12. package/docs/schemas/altium_toolkit/schematic_svg_semantics_a1.schema.json +50 -0
  13. package/docs/schemas/altium_toolkit/svg_model_cross_link_a1.schema.json +39 -0
  14. package/docs/testing.md +9 -3
  15. package/package.json +1 -1
  16. package/spec/library-scope.md +7 -1
  17. package/src/core/altium/AltiumLayoutParser.mjs +104 -8
  18. package/src/core/altium/AltiumParser.mjs +196 -45
  19. package/src/core/altium/CiArtifactBundleBuilder.mjs +202 -0
  20. package/src/core/altium/DraftsmanDigestParser.mjs +689 -0
  21. package/src/core/altium/EmbeddedFileInventoryBuilder.mjs +255 -0
  22. package/src/core/altium/IntLibModelParser.mjs +240 -0
  23. package/src/core/altium/IntLibStreamExtractor.mjs +366 -0
  24. package/src/core/altium/LibraryRenderManifestBuilder.mjs +417 -0
  25. package/src/core/altium/LibrarySearchIndex.mjs +215 -0
  26. package/src/core/altium/NormalizedModelSchema.mjs +36 -0
  27. package/src/core/altium/ParserCompatibilityFuzzer.mjs +192 -0
  28. package/src/core/altium/PcbCustomPadShapeParser.mjs +244 -0
  29. package/src/core/altium/PcbDefaultsParser.mjs +171 -0
  30. package/src/core/altium/PcbDimensionParser.mjs +229 -0
  31. package/src/core/altium/PcbEmbeddedModelExtractor.mjs +232 -6
  32. package/src/core/altium/PcbExtendedPrimitiveInformationParser.mjs +256 -0
  33. package/src/core/altium/PcbLibModelParser.mjs +235 -14
  34. package/src/core/altium/PcbLibStreamExtractor.mjs +62 -4
  35. package/src/core/altium/PcbMaskPasteResolver.mjs +354 -0
  36. package/src/core/altium/PcbMechanicalLayerPairParser.mjs +204 -0
  37. package/src/core/altium/PcbModelParser.mjs +495 -32
  38. package/src/core/altium/PcbOwnershipGraphBuilder.mjs +245 -0
  39. package/src/core/altium/PcbPadPrimitiveParser.mjs +78 -65
  40. package/src/core/altium/PcbPadStackParser.mjs +229 -2
  41. package/src/core/altium/PcbPickPlacePositionResolver.mjs +224 -0
  42. package/src/core/altium/PcbPrimitiveParameterParser.mjs +3 -2
  43. package/src/core/altium/PcbRawRecordRegistry.mjs +121 -130
  44. package/src/core/altium/PcbRegionPrimitiveParser.mjs +76 -3
  45. package/src/core/altium/PcbRouteAnalysisBuilder.mjs +730 -0
  46. package/src/core/altium/PcbRuleParser.mjs +354 -33
  47. package/src/core/altium/PcbSidecarRecordParser.mjs +177 -0
  48. package/src/core/altium/PcbSpecialStringResolver.mjs +220 -0
  49. package/src/core/altium/PcbStatisticsBuilder.mjs +541 -0
  50. package/src/core/altium/PcbStreamExtractor.mjs +111 -4
  51. package/src/core/altium/PcbTextPrimitiveParser.mjs +60 -0
  52. package/src/core/altium/PcbUnionParser.mjs +307 -0
  53. package/src/core/altium/PcbViaStackParser.mjs +98 -10
  54. package/src/core/altium/PcbViaStructureParser.mjs +335 -0
  55. package/src/core/altium/PrintableTextDecoder.mjs +53 -3
  56. package/src/core/altium/PrjPcbModelParser.mjs +281 -7
  57. package/src/core/altium/ProjectAnnotationParser.mjs +205 -0
  58. package/src/core/altium/ProjectDesignBundleBuilder.mjs +492 -0
  59. package/src/core/altium/ProjectDocumentGraphBuilder.mjs +280 -0
  60. package/src/core/altium/ProjectNetlistExporter.mjs +503 -0
  61. package/src/core/altium/ProjectOutJobDigestBuilder.mjs +109 -0
  62. package/src/core/altium/ProjectVariantViewBuilder.mjs +334 -0
  63. package/src/core/altium/SchematicBindingProvenanceParser.mjs +223 -0
  64. package/src/core/altium/SchematicComponentOwnerTextResolver.mjs +312 -0
  65. package/src/core/altium/SchematicComponentTextResolver.mjs +72 -19
  66. package/src/core/altium/SchematicConnectivityQaBuilder.mjs +271 -0
  67. package/src/core/altium/SchematicCrossSheetConnectorParser.mjs +140 -0
  68. package/src/core/altium/SchematicDirectiveParser.mjs +312 -0
  69. package/src/core/altium/SchematicDisplayModeCatalogParser.mjs +231 -0
  70. package/src/core/altium/SchematicHarnessParser.mjs +302 -0
  71. package/src/core/altium/SchematicImageParser.mjs +474 -3
  72. package/src/core/altium/SchematicImplementationParser.mjs +518 -0
  73. package/src/core/altium/SchematicNetlistBuilder.mjs +15 -2
  74. package/src/core/altium/SchematicOwnershipGraphParser.mjs +195 -0
  75. package/src/core/altium/SchematicPinParser.mjs +84 -1
  76. package/src/core/altium/SchematicPrimitiveParser.mjs +301 -0
  77. package/src/core/altium/SchematicProjectParameterResolver.mjs +361 -0
  78. package/src/core/altium/SchematicQaReportBuilder.mjs +284 -0
  79. package/src/core/altium/SchematicRecordTypeRegistry.mjs +137 -0
  80. package/src/core/altium/SchematicRepeatedChannelParser.mjs +229 -0
  81. package/src/core/altium/SchematicStreamExtractor.mjs +10 -1
  82. package/src/core/altium/SchematicTemplateParser.mjs +256 -0
  83. package/src/core/altium/SchematicTextParser.mjs +123 -0
  84. package/src/core/altium/SvgModelCrossLinkValidator.mjs +402 -0
  85. package/src/core/circuit-json/CircuitJsonModelAdapter.mjs +136 -96
  86. package/src/core/circuit-json/CircuitJsonModelAdapterPcbElements.mjs +244 -0
  87. package/src/core/circuit-json/CircuitJsonModelSchema.mjs +1 -1
  88. package/src/core/ole/OleCompoundDocument.mjs +20 -0
  89. package/src/parser.mjs +35 -0
  90. package/src/styles/altium-renderers.css +19 -0
  91. package/src/ui/PcbBarcodeTextRenderer.mjs +436 -0
  92. package/src/ui/PcbInteractionIndex.mjs +9 -4
  93. package/src/ui/PcbScene3dBuilder.mjs +137 -3
  94. package/src/ui/PcbScene3dModelRegistry.mjs +74 -0
  95. package/src/ui/PcbSvgRenderer.mjs +1252 -34
  96. package/src/ui/PcbTextPrimitiveRenderer.mjs +193 -7
  97. package/src/ui/SchematicNoteRenderer.mjs +9 -2
  98. package/src/ui/SchematicOwnerPinLabelLayout.mjs +206 -0
  99. package/src/ui/SchematicShapeRenderer.mjs +362 -0
  100. package/src/ui/SchematicSvgRenderer.mjs +1442 -92
  101. package/src/ui/SchematicTypography.mjs +48 -5
  102. package/src/ui/TextGeometrySidecarBuilder.mjs +147 -0
package/README.md CHANGED
@@ -18,20 +18,30 @@ browser or Node-based tools.
18
18
 
19
19
  ## Features
20
20
 
21
- - Parse standalone native `.SchDoc`, `.PcbDoc`, `.PcbLib`, and `.PrjPcb` files from
22
- `ArrayBuffer`
21
+ - Parse standalone native `.SchDoc`, `.PcbDoc`, `.PcbLib`, `.PrjPcb`, and
22
+ `.IntLib` files from `ArrayBuffer`
23
23
  - Recover schematic records, PCB outlines, placements, PCB library footprints,
24
24
  project document references, variants, parameters, primitives, embedded
25
25
  schematic images, component annotations from PrimitiveParameters/Text streams,
26
- embedded PCB STEP payload metadata, and embedded PCB/PcbLib font payloads with
27
- basic text metrics
26
+ PCB pad/via stack and hole-tolerance detail, via-protection sidecars, custom
27
+ pad shape links, extended mask/paste sidecars, PCB union metadata, embedded
28
+ PCB 3D payload metadata, PCB component provenance, differential-pair class
29
+ joins, schematic directive semantics, barcode PCB text metadata, mechanical
30
+ layer pairs, pick-and-place coordinate modes, PCB dimensions, project
31
+ class-generation policy, project-level design bundles, annotation mappings,
32
+ effective variant views, schematic/PCB ownership sidecars, deterministic
33
+ wirelist/netlist exports, library render manifests, library lookup indexes,
34
+ schematic project-parameter text resolution, PCB QA statistics, structured
35
+ diagnostics, and embedded PCB/PcbLib font payloads with basic text metrics
28
36
  - Preserve raw PCB primitive records through a read-only record registry so
29
37
  unsupported or partially decoded stream data remains inspectable
30
38
  - Emit Circuit JSON arrays from parser roots, with non-serialized
31
39
  renderer-compatibility fields for existing consumers
32
- - Render schematic SVG, PCB SVG, and grouped BOM HTML
40
+ - Render semantically annotated schematic SVG, semantically annotated PCB SVG,
41
+ deterministic per-layer PCB SVG exports, and grouped BOM HTML
33
42
  - Build non-interactive PCB 3D scene-description data for host applications,
34
- including refined board outlines and silkscreen drill cutouts
43
+ including refined board outlines, silkscreen drill cutouts, and external
44
+ model projection diagnostics
35
45
  - Render a static 3D board summary
36
46
  - Run entirely with local input data; no network calls are made by the parser
37
47
 
@@ -78,6 +88,8 @@ import 'altium-toolkit/styles/altium-renderers.css'
78
88
  - [API](docs/api.md)
79
89
  - [Model Format](docs/model-format.md)
80
90
  - [Normalized Model Schema](docs/schemas/altium_toolkit/normalized_model_a1.schema.json)
91
+ - [Project Bundle Schema](docs/schemas/altium_toolkit/project_bundle_a1.schema.json)
92
+ - [Netlist Schema](docs/schemas/altium_toolkit/netlist_a1.schema.json)
81
93
  - [Testing](docs/testing.md)
82
94
  - [Scope](spec/library-scope.md)
83
95
 
package/docs/api.md CHANGED
@@ -28,18 +28,22 @@ import { AltiumParser } from 'altium-toolkit/parser'
28
28
  const circuitJson = AltiumParser.parseArrayBuffer(fileName, arrayBuffer)
29
29
  ```
30
30
 
31
- `fileName` is used to infer schematic, PCB document, PCB footprint-library, or
32
- PCB project parsing from the extension. The parser accepts native `.SchDoc`,
33
- `.PcbDoc`, `.PcbLib`, and `.PrjPcb` bytes as an `ArrayBuffer` and returns a
34
- Circuit JSON element array. The returned array carries non-serialized
35
- renderer-compatibility fields such as `kind`, `fileType`, `schematic`, `pcb`,
36
- `pcbLibrary`, `project`, `summary`, `diagnostics`, and `bom` so existing
37
- renderers can consume parser output directly during the migration.
31
+ `fileName` is used to infer schematic, PCB document, PCB footprint-library, PCB
32
+ project, or integrated-library parsing from the extension. The parser accepts
33
+ native `.SchDoc`, `.PcbDoc`, `.PcbLib`, `.PrjPcb`, and `.IntLib` bytes as an
34
+ `ArrayBuffer` and returns a Circuit JSON element array. The returned array
35
+ carries non-serialized renderer-compatibility fields such as `kind`, `fileType`,
36
+ `schematic`, `pcb`, `pcbLibrary`, `project`, `integratedLibrary`, `summary`,
37
+ `diagnostics`, and `bom` so existing renderers can consume parser output
38
+ directly during the migration.
38
39
 
39
40
  PCB parsing reads the main primitive streams together with sidecar streams such
40
- as `PrimitiveParameters/Data` and `WideStrings6/Data`. Component parameters are
41
- joined by native primitive unique id, and modern `Texts6` designator records may
42
- resolve their display string through the wide-string table before the
41
+ as `PrimitiveParameters/Data`, `WideStrings6/Data`,
42
+ `ExtendedPrimitiveInformation/Data`, `CustomShapes/Data`, `UnionNames/Data`,
43
+ and `SmartUnions/Data`. Component parameters are joined by native primitive
44
+ unique id, modern `Texts6` designator records may resolve their display string
45
+ through the wide-string table, custom pad geometry is linked to anchor pads, and
46
+ smart-union memberships are attached to referenced primitives before the
43
47
  normalized component list and BOM are built.
44
48
 
45
49
  ```js
@@ -56,19 +60,52 @@ an integration still needs the legacy renderer model object. The
56
60
  `toRendererModel()`, and `isCircuitJson()` for explicit conversions.
57
61
 
58
62
  Specialized parser helpers are exported for lower-level integrations, including
59
- `PcbBoardRegionSemanticsParser`, `PcbComponentPrimitiveIndexer`,
60
- `PcbEmbeddedFontExtractor`, `PcbFontMetricsParser`, `PcbPadStackParser`,
61
- `PcbViaStackParser`, `PcbRuleParser`, and `PcbRawRecordRegistry`.
63
+ `IntLibStreamExtractor`, `PcbBoardRegionSemanticsParser`,
64
+ `PcbComponentPrimitiveIndexer`, `PcbCustomPadShapeParser`,
65
+ `PcbDimensionParser`, `PcbEmbeddedFontExtractor`,
66
+ `PcbExtendedPrimitiveInformationParser`, `PcbFontMetricsParser`,
67
+ `LibraryRenderManifestBuilder`, `LibrarySearchIndex`,
68
+ `PcbOwnershipGraphBuilder`, `PcbPadStackParser`,
69
+ `PcbPickPlacePositionResolver`,
70
+ `ProjectAnnotationParser`, `ProjectDesignBundleBuilder`,
71
+ `ProjectNetlistExporter`, `ProjectVariantViewBuilder`,
72
+ `PcbMechanicalLayerPairParser`, `PcbSpecialStringResolver`, `PcbUnionParser`,
73
+ `PcbViaStackParser`, `PcbRuleParser`, `PcbRawRecordRegistry`,
74
+ `PcbStatisticsBuilder`, `SchematicOwnershipGraphParser`, and
75
+ `SchematicProjectParameterResolver`.
62
76
  `PcbBoardRegionSemanticsParser` exposes the substack and bending-line
63
77
  normalization used by `.PcbDoc` models. `PcbComponentPrimitiveIndexer` exposes
64
78
  the native component-index grouping used to populate
65
79
  `pcb.componentPrimitives` and `pcb.componentPrimitiveGroups`. The pad, via, and
66
80
  rule helpers expose the same mask/cache, stack, and typed-constraint
67
- normalization used by `.PcbDoc` parsing. The font helpers expose the same
81
+ normalization used by `.PcbDoc` parsing. `PcbDimensionParser` exposes the
82
+ parser-only Dimensions6 normalization used by `.PcbDoc` parsing.
83
+ `SchematicOwnershipGraphParser` and `PcbOwnershipGraphBuilder` expose the
84
+ read-only ownership sidecars that parser roots attach under
85
+ `schematic.ownership` and `pcb.ownership`.
86
+ `PcbPickPlacePositionResolver` exposes the component-origin and pad-anchor
87
+ coordinate modes used by the normalized `pnp` model.
88
+ `ProjectDesignBundleBuilder` composes separately parsed project, schematic, and
89
+ PCB models into a project-level JSON bundle, and
90
+ `ProjectVariantViewBuilder` applies DNP, alternate fitted rows, parameter
91
+ overrides, and annotation designator mappings to bundle BOM, PnP, component,
92
+ and net views. `ProjectAnnotationParser` parses read-only annotation mapping
93
+ files, and `ProjectNetlistExporter` emits deterministic wirelist and richer
94
+ JSON netlist contracts from normalized bundles. The JSON contract includes
95
+ schematic source sheets, graphical elements, aliases, terminal endpoints,
96
+ hierarchy paths, and PCB net-table provenance when present.
97
+ `PcbMechanicalLayerPairParser`
98
+ exposes the mechanical-layer flip map used by `.PcbDoc` parsing. The font
99
+ helpers expose the same
68
100
  embedded font payload and metric shape that `.PcbDoc` and `.PcbLib` parsing adds
69
101
  to normalized models. `PcbRawRecordRegistry` exposes immutable primitive stream
70
102
  descriptors and the raw-record preservation helpers used by the PcbDoc/PcbLib
71
103
  extractors.
104
+ `LibraryRenderManifestBuilder` and `LibrarySearchIndex` expose deterministic
105
+ SchLib/PcbLib render/export manifests plus exact, keyword, and fuzzy lookup
106
+ helpers. `PcbStatisticsBuilder` emits board QA summaries used by `.PcbDoc`
107
+ models. `SchematicProjectParameterResolver` resolves dot-prefixed and
108
+ equals-prefixed schematic special strings for parser and SVG integrations.
72
109
 
73
110
  ## Netlist Query
74
111
 
@@ -111,8 +148,13 @@ import {
111
148
  } from 'altium-toolkit/renderers'
112
149
  ```
113
150
 
114
- - `SchematicSvgRenderer.render(documentModel)` returns schematic SVG markup.
151
+ - `SchematicSvgRenderer.render(documentModel, options)` returns schematic SVG
152
+ markup. Pass `options.projectParameters` to resolve schematic special strings
153
+ in visible text and title-block fields during rendering.
115
154
  - `PcbSvgRenderer.render(documentModel)` returns PCB SVG markup.
155
+ - `PcbSvgRenderer.renderLayerSvgs(documentModel)` returns deterministic
156
+ per-layer PCB SVG entries with layer descriptors and layer-filtered SVG
157
+ markup.
116
158
  - `PcbSideResolvedRenderModel.resolve(documentModel, { side })` and
117
159
  `preparePcbSideResolvedRenderModel(documentModel, { side })` return a
118
160
  side-specific PCB render model for top-oriented renderers. Use
@@ -123,6 +165,23 @@ import {
123
165
  Renderer output is deterministic string markup. The library does not attach DOM
124
166
  events or mutate a host document.
125
167
 
168
+ Schematic SVG output includes stable semantic `data-*` attributes on recovered
169
+ wire, label, pin, and fallback component elements when source metadata is
170
+ available. The embedded `schematic-semantic-metadata` JSON sidecar uses schema
171
+ `altium-toolkit.schematic.svg.semantics.a1` and links element keys to nets,
172
+ components, and pins for downstream highlighting.
173
+
174
+ PCB SVG output includes stable semantic `data-*` attributes on recovered board,
175
+ copper, pad, via, component, and text elements. The embedded
176
+ `pcb-semantic-metadata` JSON sidecar uses schema
177
+ `altium-toolkit.pcb.svg.semantics.a1` and links SVG element keys to primitive
178
+ kind, layer, net/class, component, pad number, hole ownership, and board-outline
179
+ identity where that metadata is available. The same sidecar also records view
180
+ context, including board centroid, included layer ids, layer roles, cutouts, and
181
+ pad/via drill render state (`open`, `covered`, `filled`, or `capped`).
182
+ `PcbSvgRenderer.renderLayerSvgs()` uses the same semantic sidecar shape with
183
+ `view.kind: 'layer'` and a layer-specific `layerSet`.
184
+
126
185
  ## 3D Scene Data
127
186
 
128
187
  ```js
@@ -138,7 +197,10 @@ import {
138
197
  placement, copper, silkscreen, and external-model scene-description data.
139
198
  It includes refined board-region outlines when a recovered outline is a
140
199
  rasterized stair-step fallback, and each silkscreen side exposes
141
- `drillCutouts` plus fill holes for drilled pads and vias.
200
+ `drillCutouts` plus fill holes for drilled pads and vias. External model
201
+ placements include `projection` diagnostics indicating whether bounds came
202
+ from authored overrides, resolved model bounds, nearby pad spans, procedural
203
+ component fallback, or only the model anchor.
142
204
  - `PcbScene3dModelRegistry` resolves embedded or session model candidates for
143
205
  component placements.
144
206
  - `PcbScene3dScenePreparator.prepare(documentModel, options)` prepares the same
@@ -35,10 +35,13 @@ the object form can call
35
35
 
36
36
  - `schema`: normalized model schema id, currently
37
37
  `urn:altium-toolkit:normalized-model:a1`
38
- - `kind`: `schematic`, `pcb`, `pcb-library`, or `project`
39
- - `fileType`: `SchDoc`, `PcbDoc`, `PcbLib`, or `PrjPcb`
38
+ - `kind`: `schematic`, `pcb`, `pcb-library`, `project`,
39
+ `integrated-library`, or `design-bundle`
40
+ - `fileType`: `SchDoc`, `PcbDoc`, `PcbLib`, `PrjPcb`, `IntLib`, or
41
+ `ProjectDesignBundle`
40
42
  - `fileName`: original file name passed to the parser
41
- - `diagnostics`: parser warnings and recovery notes
43
+ - `diagnostics`: parser warnings and recovery notes. Each diagnostic carries a
44
+ machine-readable `code` plus `severity` and `message`.
42
45
  - `bom`: grouped component metadata where available
43
46
 
44
47
  ## Schema Contracts
@@ -58,6 +61,61 @@ primitives, wires, labels, power ports, sheet symbols, images, net metadata, and
58
61
  component ownership hints. Coordinates remain in recovered document units until
59
62
  the SVG renderer maps them into SVG space.
60
63
 
64
+ `schematic.recordTypes` summarizes the native schematic `RECORD` ids seen in
65
+ the document. Each entry includes the numeric `recordType`, stable `name`,
66
+ semantic `family`, parser `supported` flag, and observed `count`. Bezier and
67
+ pie-chart primitives are exposed as first-class `schematic.beziers` and
68
+ `schematic.pies` arrays for deterministic SVG rendering. Rounded rectangles are
69
+ exposed through `schematic.roundedRectangles`, and IEEE drawing symbols are
70
+ exposed through `schematic.ieeeSymbols` with a stable `symbolName`. The registry
71
+ also names schematic families such as notes, compile masks, harness records,
72
+ blankets, and hyperlinks so consumers can inspect supported parser coverage
73
+ without stringly typed local maps.
74
+
75
+ Record-28 text frames are preserved both as drawable note text and as a
76
+ read-only `schematic.textFrames` contract with frame rectangle, alignment,
77
+ border width, fill/border state, font, margin, and render-order metadata.
78
+ Polyline records preserve authored endpoint marker kind and size on the first
79
+ and last rendered segment when present.
80
+
81
+ `schematic.directiveSemantics` exposes first-class schematic directives beside
82
+ their drawable geometry. It groups No ERC markers, parameter sets,
83
+ differential-pair directives, compile masks, and blankets. Parameter sets carry
84
+ owner-linked child parameter rows and a `parameterMap`, which lets consumers
85
+ distinguish hidden directive metadata from visible sheet text.
86
+
87
+ `schematic.ownership` is a read-only sidecar built from raw record
88
+ `OwnerIndex` and `IndexInSheet` values. It exposes stable record keys,
89
+ `childrenByParentKey`, `parentsByChildKey`, and `recordsByIndexInSheet` so
90
+ consumers can inspect component, sheet-symbol, and directive children without
91
+ reimplementing owner-index lookup rules.
92
+
93
+ Schematic project parameters and special strings can be resolved without
94
+ mutating source parser models through `SchematicProjectParameterResolver`.
95
+ The resolver supports dot-prefixed project parameters, equals-prefixed template
96
+ fields, and simple quoted-literal concatenation expressions. Schematic SVG
97
+ rendering accepts `projectParameters` and uses the resolver for visible sheet
98
+ text and title-block fields.
99
+
100
+ `schematic.renderDiagnostics` is an optional structured sidecar for rendering
101
+ fallback decisions. Font-family fallbacks are emitted with code
102
+ `schematic.font.family-fallback`, the raw source family, resolved deterministic
103
+ family, and matching top-level warning diagnostic.
104
+
105
+ The normalized schematic net model is single-sheet. `schematic.nets` is built
106
+ from the wires, labels, ports, pins, junctions, bus entries, and sheet entries
107
+ present in the parsed `.SchDoc`. Project-level hierarchy, repeated channels,
108
+ variants, and cross-sheet compilation metadata are preserved through the
109
+ `.PrjPcb` parser, but this schema does not currently emit a compiled
110
+ multi-sheet design netlist.
111
+
112
+ Embedded schematic images preserve the raw record geometry and expose
113
+ browser-facing payload metadata. When an embedded stream contains a native
114
+ PNG/JPEG/GIF/SVG/WebP payload alongside a preview, `mimeType` and `dataBase64`
115
+ refer to the native payload while `sourceMimeType` records the preview format.
116
+ Alpha-bearing 32-bit BMP previews are converted to PNG and marked with
117
+ `hasAlpha` so SVG renderers can display transparency deterministically.
118
+
61
119
  ## PCB Fields
62
120
 
63
121
  PCB documents include recovered `pcb` data with board outline geometry,
@@ -73,6 +131,19 @@ the registry id, source stream, primitive family/type, byte offsets, byte
73
131
  counts, parse status, encoding style, and a base64 payload for unsupported or
74
132
  partially decoded primitive stream data.
75
133
 
134
+ Barcode PCB text records preserve their barcode kind, render mode, authored
135
+ full size, margins, minimum bar width, show-text flag, and inverted state. SVG
136
+ rendering uses those fields to emit deterministic vector barcode groups with
137
+ semantic data attributes.
138
+
139
+ `pcb.mechanicalLayerPairs` lists paired mechanical layer ids and display names.
140
+ `pcb.layerFlipMetadata.mechanicalFlipMap` gives the bidirectional layer-id map
141
+ needed when bottom-side components or footprints are mirrored between paired
142
+ mechanical overlays.
143
+
144
+ PCB printable and sidecar property streams are decoded as UTF-8 first, with
145
+ Windows-1252 and GB18030 fallbacks for legacy text-backed properties.
146
+
76
147
  Component-owned PCB primitives are exposed directly from native Altium owner
77
148
  indexes. `pcb.componentPrimitives[componentIndex]` returns the grouped pads,
78
149
  tracks, arcs, fills, vias, regions, texts, and component bodies linked to that
@@ -80,6 +151,10 @@ component; missing sparse component indexes are represented as `null`. The
80
151
  compatibility list `pcb.componentPrimitiveGroups` carries the same group objects
81
152
  in placement order. Board-owned or net-owned primitives without a native
82
153
  `componentIndex` are intentionally left out of these component groups.
154
+ `pcb.ownership` is the broader primitive ownership sidecar. It groups public
155
+ primitive keys by component index, net index, and polygon index, while
156
+ `primitiveOwners` records the component/net/polygon owner for each decoded
157
+ primitive where that metadata exists.
83
158
 
84
159
  Component annotations may also include `uniqueId`, `parameters`, and
85
160
  `parameterSource` when the PCB contains `PrimitiveParameters/Data` entries keyed
@@ -92,6 +167,29 @@ Component-owned Texts6 comment/value records are marked with `role: 'comment'`
92
167
  and `isComment`; unresolved annotation slots are additionally marked with
93
168
  `isPlaceholder`.
94
169
 
170
+ Component rows may include schematic and library provenance in
171
+ `component.provenance`: channel offsets, source unique-id and hierarchy
172
+ segments, source library references, footprint descriptions, annotation
173
+ autoposition values, and pin/part swapping flags. This metadata is read-only
174
+ and is carried before any project-level schematic compilation is attempted.
175
+
176
+ Pick-and-place coordinates are exposed as `pnp` at the model root and mirrored
177
+ under `pcb.pickPlace`. The default `positionMode` is `altium-pick-place`, which
178
+ uses the center of component-owned pad anchors when available and falls back to
179
+ the component origin. `pnp.modes.componentOrigin.entries` exposes the same
180
+ components using authored component-origin coordinates. Entries preserve the
181
+ authored component rotation while using the normalized PCB coordinate frame.
182
+
183
+ `pcb.statistics` provides a deterministic board QA summary for regression
184
+ diffs and reports. It includes outline dimensions and centroid, drill and slot
185
+ counts, plated/non-plated hole counts, primitive-width histograms, and a
186
+ layer-stack summary with per-layer primitive counts. When stack metadata is
187
+ available, layer entries also carry material, copper thickness/weight,
188
+ dielectric thickness, dielectric constant, and dissipation factor, plus
189
+ aggregate material and role counts. The `planning` section summarizes keepout
190
+ regions, room-related rules and names, board-region flex/rigid counts, locked
191
+ 3D regions, bending-line counts, and board-region layer-stack usage.
192
+
95
193
  Decoded pad primitives preserve raw `padFlags` plus named tenting and testpoint
96
194
  flags. Pad shape codes are kept as raw `shapeTop` / `shapeMid` / `shapeBottom`
97
195
  values and mirrored through normalized `shape*Name` labels plus
@@ -102,14 +200,64 @@ pad-cache thermal-relief fields through `padCache`, corrected cache-validity
102
200
  fields for plane/thermal/power relief, raw paste/solder mask modes, effective
103
201
  mask expansions, and side-specific `hasTop*MaskOpening` /
104
202
  `hasBottom*MaskOpening` booleans for renderers that need layer-accurate paste
105
- and solder-mask decisions.
203
+ and solder-mask decisions. Pad and via drill tolerances use
204
+ `positiveTolerance`, `negativeTolerance`, and grouped `holeTolerance`; unset
205
+ native sentinel values are omitted instead of exposed as numeric mil values.
206
+
207
+ Decoded via primitives preserve stack mode, per-layer diameters, removed-pad
208
+ metadata, solder-mask-from-hole-edge flags, back solder-mask expansion,
209
+ `drillLayerPairType`, optional `propagationDelayPs`, and sidecar-linked
210
+ `viaProtection` metadata. `pcb.viaStructures` exposes the read-only sidecar
211
+ contract: `structures` describes IPC-4761-style protection definitions and
212
+ feature rows, `links` maps structure definitions to via primitive indexes, and
213
+ `byPrimitiveIndex` provides the same lookup in object form.
214
+ Linked via-protection records also add `drill` metadata to matching vias with
215
+ `holeKind`, `plating`, `renderState`, and `ipc4761Type`. Render states are
216
+ normalized as `open`, `covered`, `filled`, or `capped` for SVG and 3D
217
+ consumers.
218
+
219
+ PCB dimensions from `Dimensions6/Data` are exposed through `pcb.dimensions`.
220
+ Dimension entries preserve native kind codes and raw fields while adding a
221
+ normalized `kind` (`linear`, `angular`, `radial`, `datum`, `baseline`, or
222
+ `ordinate`), reference points, optional text location, prefix/suffix, precision,
223
+ measured value, angle value, and unit.
224
+
225
+ `pcb.extendedPrimitiveInformation` exposes
226
+ `ExtendedPrimitiveInformation/Data` entries keyed by primitive index and, when
227
+ available, primitive object id. Matching decoded primitives receive an
228
+ `extendedPrimitiveInformation` object with raw paste and solder mask-expansion
229
+ modes, source labels, and manual expansion values.
230
+
231
+ `pcb.customPadShapes` exposes `CustomShapes/Data` entries keyed by anchor pad
232
+ primitive index. Matching normalized pads receive a `customShape` object whose
233
+ layer entries reference the normalized region, shape-region, arc, track, and
234
+ fill geometry that forms the custom pad shape.
235
+
236
+ `pcb.unions` exposes `UnionNames/Data` and `SmartUnions/Data` metadata.
237
+ Smart-union type ids are normalized to stable labels such as `via-stitching`,
238
+ `via-shielding`, `drill-table`, `length-tuning`, and `layer-stack-table`.
239
+ Primitive records referenced by smart unions receive `unionMemberships`.
240
+
241
+ Differential-pair records are exposed through `pcb.differentialPairs`.
242
+ `Classes6/Data` entries whose kind identifies differential-pair classes are
243
+ joined into `pcb.differentialPairClasses`; each pair lists `classNames`, and
244
+ each class lists resolved `pairNames` plus `unresolvedMembers` for members that
245
+ were present in the class table but absent from `DifferentialPairs6/Data`.
246
+
247
+ PCB text primitives preserve authored special-string expressions in `text`.
248
+ When parser callers supply project parameters through extraction context,
249
+ matched text records also expose `rawText`, `resolvedText`, and
250
+ `specialString` metadata. The resolver supports dot-prefixed project parameter
251
+ references and simple quoted-literal concatenation expressions.
106
252
 
107
253
  PCB design rules preserve native rule-specific `constraints` as strings and add
108
254
  typed views for common consumers. `ruleType` exposes a normalized rule kind and
109
255
  category, `constraintValues` parses common numeric units such as mil, mm, inch,
110
- degrees, percentages, and booleans, and `typedConstraints` maps common Width and
111
- Clearance rule fields to semantic names such as `minWidth`,
112
- `preferredWidth`, `maxWidth`, `minClearance`, and `genericClearance`.
256
+ degrees, percentages, and booleans, and `typedConstraints` maps common rule
257
+ fields to semantic names. Covered families include width, clearance, routing
258
+ topology/corners/priority, fanout, length, matched length, solder-mask sliver,
259
+ silkscreen clearances, component clearance, annular ring, vias-under-SMD,
260
+ testpoint style, and testpoint usage rules.
113
261
 
114
262
  Board-planning regions are decoded separately from copper regions through
115
263
  `pcb.boardRegions`. These entries retain their contour geometry and now add
@@ -131,7 +279,23 @@ parameters, component metadata, primitive order, unknown record markers, and
131
279
  decoded pads, tracks, arcs, vias, fills, texts, and regions. Each footprint also
132
280
  preserves raw mixed-format primitive records with the same registry metadata
133
281
  shape used by PcbDoc raw records. Library-level `embeddedFonts` uses the same
134
- payload and metric shape as PCB documents.
282
+ payload and metric shape as PCB documents. Library-level `embeddedModels` and
283
+ `componentBodies` preserve embedded 3D payloads and body references when
284
+ present.
285
+ `pcbLibrary.indexes.footprintsByName` provides read-only footprint lookup and
286
+ search metadata, including source storage, primitive counts, pad/text counts,
287
+ and keyword tokens from footprint and component parameters. Footprint entries
288
+ may also preserve implementation rows, component-model rows, and pin display
289
+ mode metadata when those records are available from extraction.
290
+ Footprints carry the same advanced field shapes as PCB documents when available:
291
+ extended mask/paste sidecars attached to primitives, custom pad shape geometry,
292
+ barcode text metadata, embedded model references, and projection diagnostics for
293
+ component bodies. `pcbLibrary.renderManifest` exposes stable footprint SVG keys,
294
+ per-layer SVG keys, layer descriptors, and embedded asset descriptors. Asset
295
+ descriptors may include native format, wrapper type, byte size, checksum, and
296
+ structured diagnostics when extraction supplied that metadata.
297
+ `LibrarySearchIndex` provides exact, keyword, and fuzzy symbol/footprint lookup
298
+ helpers over parsed library read models.
135
299
 
136
300
  ## Project Fields
137
301
 
@@ -142,9 +306,66 @@ output groups. Reachable schematic documents follow the durable project
142
306
  metadata convention used by Altium: schematic stubs with only `DocumentPath` and
143
307
  `DocumentUniqueId` remain listed, but richer schematic document entries are
144
308
  preferred in `project.documentGroups.reachableSchematics`.
309
+ `project.classGeneration` preserves `[PrjClassGen]` policies and any
310
+ per-document class-generation options, including differential-pair class and
311
+ room-transfer policy flags when present.
312
+
313
+ Project parsing is metadata-only. It does not load referenced schematics or
314
+ emit a compiled multi-sheet netlist; consumers that need a design-wide netlist
315
+ should combine project metadata with separately parsed schematic documents.
316
+
317
+ `ProjectAnnotationParser` parses read-only annotation mapping files into
318
+ `annotations.mappings`, `bySourceDesignator`, and `byCompiledDesignator`.
319
+ `ProjectDesignBundleBuilder.build({ projectModel, documentModels,
320
+ annotationModels })` composes already parsed project, schematic, PCB, and
321
+ annotation models into a `design-bundle` payload. The bundle exposes `project`,
322
+ `variants`, `sheets`, `components`, `schematic_hierarchy`, `pnp`, `nets`,
323
+ `annotations`, and `indexes` so multi-document consumers can use one normalized
324
+ JSON object above single-document parser output. Passing `variantName` adds
325
+ `effectiveVariant`, which applies DNP rows, alternate fitted rows, parameter
326
+ overrides, and annotation designator mappings to BOM, PnP, component, and net
327
+ views without mutating the source parser models. `ProjectNetlistExporter` emits
328
+ deterministic wirelist and JSON netlist contracts from the normalized bundle or
329
+ effective variant view. The wirelist remains a compact line-oriented
330
+ `component.pin` view. The JSON netlist also carries aliases, auto-named flags,
331
+ schematic source sheets, graphical source elements, terminal endpoints,
332
+ hierarchy paths, and PCB net-table provenance when the bundle includes those
333
+ details.
334
+
335
+ ## SVG And 3D Contracts
336
+
337
+ `PcbSvgRenderer.renderLayerSvgs(documentModel)` returns one layer descriptor and
338
+ SVG string per recovered display layer. Layer SVGs use the same PCB semantic
339
+ metadata sidecar as the composite SVG, with `view.kind` set to `layer`, a
340
+ single included layer id, and `layerSet.layerView` describing the exported
341
+ layer.
342
+
343
+ External model placements in the 3D scene description include a `projection`
344
+ diagnostic object. The `source` explains whether bounds came from an authored
345
+ projection override, resolved model bounds, nearby pad-span fallback,
346
+ procedural component fallback, or model-anchor fallback. The diagnostic does
347
+ not alter placement coordinates.
348
+
349
+ ## Integrated Library Fields
350
+
351
+ Integrated libraries include recovered `integratedLibrary` data from `.IntLib`
352
+ compound documents. The parser preserves `Version.Txt`, cross-reference rows
353
+ from `LibCrossRef.Txt`, parameter records from `Parameters .bin`, and bundled
354
+ source entries from schematic-symbol, PCB-footprint, and PCB-3D library
355
+ folders. Source entries expose their stream path, file name, file type, library
356
+ kind, compression wrapper, byte count, base64 payload, and printable payload
357
+ text when the recovered bytes are text-like. Child source payloads are
358
+ read-only; callers can parse extracted `.SchLib`, `.PcbLib`, or 3D library
359
+ payloads with separate workflows where applicable.
360
+ `integratedLibrary.indexes` adds source lookups by file name and source kind,
361
+ plus cross-reference indexes that group schematic symbol and PCB footprint
362
+ models by component.
145
363
 
146
364
  ## Compatibility Rule
147
365
 
148
366
  Consumers should treat unknown fields as additive within the same schema id.
149
367
  Parser fixes may add detail, but existing field names and shapes should stay
150
368
  compatible unless a new schema id explicitly documents a model migration.
369
+ Focused machine-readable schemas are available under
370
+ `docs/schemas/altium_toolkit/` for the normalized root, project bundle, netlist
371
+ JSON, schematic SVG semantic metadata, and PCB SVG semantic metadata contracts.
@@ -0,0 +1,76 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "altium-toolkit.ci.artifact-bundle.a1",
4
+ "title": "Altium Toolkit CI Artifact Bundle A1",
5
+ "type": "object",
6
+ "additionalProperties": true,
7
+ "required": [
8
+ "schema",
9
+ "summary",
10
+ "designBundle",
11
+ "documentGraph",
12
+ "normalizedModels",
13
+ "netlist",
14
+ "bom",
15
+ "pnp",
16
+ "schematicSvgs",
17
+ "pcbLayerSvgs",
18
+ "statistics",
19
+ "diagnostics"
20
+ ],
21
+ "properties": {
22
+ "schema": {
23
+ "const": "altium-toolkit.ci.artifact-bundle.a1"
24
+ },
25
+ "summary": {
26
+ "type": "object",
27
+ "additionalProperties": true
28
+ },
29
+ "units": {
30
+ "type": "object",
31
+ "additionalProperties": {
32
+ "type": "string"
33
+ }
34
+ },
35
+ "designBundle": {
36
+ "type": "object"
37
+ },
38
+ "documentGraph": {
39
+ "type": "object"
40
+ },
41
+ "normalizedModels": {
42
+ "type": "array"
43
+ },
44
+ "netlist": {
45
+ "type": "object",
46
+ "required": ["json", "wirelist"],
47
+ "properties": {
48
+ "json": {
49
+ "type": "object"
50
+ },
51
+ "wirelist": {
52
+ "type": "string"
53
+ }
54
+ },
55
+ "additionalProperties": true
56
+ },
57
+ "bom": {
58
+ "type": "object"
59
+ },
60
+ "pnp": {
61
+ "type": "object"
62
+ },
63
+ "schematicSvgs": {
64
+ "type": "array"
65
+ },
66
+ "pcbLayerSvgs": {
67
+ "type": "array"
68
+ },
69
+ "statistics": {
70
+ "type": "object"
71
+ },
72
+ "diagnostics": {
73
+ "type": "array"
74
+ }
75
+ }
76
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "altium-toolkit.draftsman.digest.a1",
4
+ "title": "Altium Toolkit Draftsman Digest A1",
5
+ "type": "object",
6
+ "additionalProperties": true,
7
+ "required": ["schema", "pages"],
8
+ "properties": {
9
+ "schema": {
10
+ "const": "altium-toolkit.draftsman.digest.a1"
11
+ },
12
+ "sourceDocumentName": {
13
+ "type": "string"
14
+ },
15
+ "pages": {
16
+ "type": "array",
17
+ "items": {
18
+ "type": "object",
19
+ "additionalProperties": true,
20
+ "required": [
21
+ "index",
22
+ "title",
23
+ "titleBlocks",
24
+ "notes",
25
+ "images",
26
+ "unsupportedRawItems"
27
+ ]
28
+ }
29
+ },
30
+ "indexes": {
31
+ "type": "object",
32
+ "additionalProperties": true
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,53 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "altium-toolkit.netlist.a1",
4
+ "title": "Altium Toolkit Netlist A1",
5
+ "type": "object",
6
+ "additionalProperties": true,
7
+ "required": ["schema", "project", "nets"],
8
+ "properties": {
9
+ "schema": {
10
+ "const": "altium-toolkit.netlist.a1"
11
+ },
12
+ "project": {
13
+ "type": "string"
14
+ },
15
+ "units": {
16
+ "type": "object",
17
+ "additionalProperties": {
18
+ "type": "string"
19
+ }
20
+ },
21
+ "nets": {
22
+ "type": "array",
23
+ "items": {
24
+ "type": "object",
25
+ "additionalProperties": true,
26
+ "required": ["name", "pins"],
27
+ "properties": {
28
+ "name": {
29
+ "type": "string"
30
+ },
31
+ "aliases": {
32
+ "type": "array",
33
+ "items": {
34
+ "type": "string"
35
+ }
36
+ },
37
+ "autoNamed": {
38
+ "type": "boolean"
39
+ },
40
+ "pins": {
41
+ "type": "array"
42
+ },
43
+ "sources": {
44
+ "type": "array"
45
+ },
46
+ "pcb": {
47
+ "type": "array"
48
+ }
49
+ }
50
+ }
51
+ }
52
+ }
53
+ }