altium-toolkit 1.0.9 → 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.
- package/docs/schemas/altium_toolkit/ci_artifact_bundle_a1.schema.json +76 -0
- package/docs/schemas/altium_toolkit/draftsman_digest_a1.schema.json +35 -0
- package/docs/schemas/altium_toolkit/netlist_a1.schema.json +6 -0
- package/docs/schemas/altium_toolkit/normalized_model_a1.schema.json +160 -1
- package/docs/schemas/altium_toolkit/parser_compatibility_fuzz_a1.schema.json +25 -0
- package/docs/schemas/altium_toolkit/pcb_svg_semantics_a1.schema.json +27 -0
- package/docs/schemas/altium_toolkit/project_bundle_a1.schema.json +6 -0
- package/docs/schemas/altium_toolkit/project_document_graph_a1.schema.json +33 -0
- package/docs/schemas/altium_toolkit/svg_model_cross_link_a1.schema.json +39 -0
- package/package.json +1 -1
- package/src/core/altium/AltiumParser.mjs +7 -2
- package/src/core/altium/CiArtifactBundleBuilder.mjs +202 -0
- package/src/core/altium/DraftsmanDigestParser.mjs +689 -0
- package/src/core/altium/ParserCompatibilityFuzzer.mjs +192 -0
- package/src/core/altium/PcbModelParser.mjs +29 -4
- package/src/core/altium/PcbPadStackParser.mjs +171 -2
- package/src/core/altium/PcbPickPlacePositionResolver.mjs +8 -1
- package/src/core/altium/PcbRegionPrimitiveParser.mjs +71 -2
- package/src/core/altium/PcbRouteAnalysisBuilder.mjs +730 -0
- package/src/core/altium/PcbStatisticsBuilder.mjs +9 -0
- package/src/core/altium/PrjPcbModelParser.mjs +24 -2
- package/src/core/altium/ProjectDesignBundleBuilder.mjs +15 -0
- package/src/core/altium/ProjectDocumentGraphBuilder.mjs +280 -0
- package/src/core/altium/ProjectNetlistExporter.mjs +5 -1
- package/src/core/altium/SvgModelCrossLinkValidator.mjs +402 -0
- package/src/core/circuit-json/CircuitJsonModelAdapter.mjs +136 -96
- package/src/core/circuit-json/CircuitJsonModelAdapterPcbElements.mjs +244 -0
- package/src/core/circuit-json/CircuitJsonModelSchema.mjs +1 -1
- package/src/parser.mjs +6 -0
- package/src/ui/PcbSvgRenderer.mjs +65 -0
|
@@ -829,6 +829,7 @@ export class PcbSvgRenderer {
|
|
|
829
829
|
return {
|
|
830
830
|
schema: PcbSvgRenderer.#SEMANTIC_SCHEMA,
|
|
831
831
|
view: PcbSvgRenderer.#buildViewMetadata(pcb, semanticContext),
|
|
832
|
+
lookups: PcbSvgRenderer.#buildSemanticLookups(pcb, semanticContext),
|
|
832
833
|
boardOutline: {
|
|
833
834
|
feature: 'board-outline',
|
|
834
835
|
elementKeys: ['pcb-board-outline', 'pcb-board-outline-stroke']
|
|
@@ -887,6 +888,70 @@ export class PcbSvgRenderer {
|
|
|
887
888
|
}
|
|
888
889
|
}
|
|
889
890
|
|
|
891
|
+
/**
|
|
892
|
+
* Builds stable lookup maps for semantic SVG consumers.
|
|
893
|
+
* @param {object} pcb Normalized PCB model.
|
|
894
|
+
* @param {object} semanticContext Semantic lookup context.
|
|
895
|
+
* @returns {object}
|
|
896
|
+
*/
|
|
897
|
+
static #buildSemanticLookups(pcb, semanticContext) {
|
|
898
|
+
const netsByIndex = {}
|
|
899
|
+
const netIndexByName = {}
|
|
900
|
+
const netClassesByName = {}
|
|
901
|
+
const componentsByIndex = {}
|
|
902
|
+
const componentIndexByDesignator = {}
|
|
903
|
+
const layersByKey = {}
|
|
904
|
+
const layerKeyByDisplayName = {}
|
|
905
|
+
|
|
906
|
+
for (const net of pcb?.nets || []) {
|
|
907
|
+
const netIndex = Number(net?.netIndex)
|
|
908
|
+
if (Number.isInteger(netIndex) && net?.name) {
|
|
909
|
+
netsByIndex[netIndex] = net.name
|
|
910
|
+
netIndexByName[net.name] = netIndex
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
for (const [
|
|
915
|
+
netName,
|
|
916
|
+
classNames
|
|
917
|
+
] of semanticContext.netClassNamesByNetName) {
|
|
918
|
+
netClassesByName[netName] = [...classNames].sort((left, right) =>
|
|
919
|
+
left.localeCompare(right, undefined, { numeric: true })
|
|
920
|
+
)
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
for (const [
|
|
924
|
+
componentIndex,
|
|
925
|
+
component
|
|
926
|
+
] of semanticContext.componentsByIndex) {
|
|
927
|
+
componentsByIndex[componentIndex] =
|
|
928
|
+
PcbSvgRenderer.#stripEmptySemanticObject({
|
|
929
|
+
designator: component.designator,
|
|
930
|
+
uniqueId: component.uniqueId,
|
|
931
|
+
pattern: component.pattern
|
|
932
|
+
})
|
|
933
|
+
if (component.designator) {
|
|
934
|
+
componentIndexByDesignator[component.designator] =
|
|
935
|
+
componentIndex
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
for (const layer of semanticContext.layerDescriptors) {
|
|
940
|
+
layersByKey[layer.layerKey] = layer
|
|
941
|
+
layerKeyByDisplayName[layer.displayName] = layer.layerKey
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
return {
|
|
945
|
+
netsByIndex,
|
|
946
|
+
netIndexByName,
|
|
947
|
+
netClassesByName,
|
|
948
|
+
componentsByIndex,
|
|
949
|
+
componentIndexByDesignator,
|
|
950
|
+
layersByKey,
|
|
951
|
+
layerKeyByDisplayName
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
|
|
890
955
|
/**
|
|
891
956
|
* Builds metadata for the rendered PCB view.
|
|
892
957
|
* @param {object} pcb Normalized PCB model.
|