altium-to-circuit-json 0.0.41 → 0.0.43
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/dist/index.js +19 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -729,7 +729,8 @@ function getDimensionText(record, measuredDistanceMils) {
|
|
|
729
729
|
amount /= 1e3;
|
|
730
730
|
unitLabel = "in";
|
|
731
731
|
}
|
|
732
|
-
|
|
732
|
+
const suffix = record.suffix?.trim() ? record.suffix : ` ${unitLabel}`;
|
|
733
|
+
return `${record.prefix ?? ""}${amount.toFixed(precision)}${suffix}`;
|
|
733
734
|
}
|
|
734
735
|
function mapMechanicalLayer(layer) {
|
|
735
736
|
return normalizeLayer2(layer).includes("BOTTOM") ? "bottom" : "top";
|
|
@@ -849,12 +850,7 @@ function createBoard(document) {
|
|
|
849
850
|
const bounds = getAltiumBounds2(altiumOutline) ?? getFallbackPcbBounds(document.records);
|
|
850
851
|
const width = Math.max(milsToMillimeters2(bounds.maxX - bounds.minX), 0.1);
|
|
851
852
|
const height = Math.max(milsToMillimeters2(bounds.maxY - bounds.minY), 0.1);
|
|
852
|
-
const numLayers = document
|
|
853
|
-
getPcbLayerStack(document.board).entries.filter(
|
|
854
|
-
(entry) => Boolean(mapAltiumCopperLayer(entry.name ?? entry.layerId))
|
|
855
|
-
).length,
|
|
856
|
-
2
|
|
857
|
-
) : 2;
|
|
853
|
+
const numLayers = getBoardLayerCount(document);
|
|
858
854
|
return {
|
|
859
855
|
type: "pcb_board",
|
|
860
856
|
pcb_board_id: BOARD_ID,
|
|
@@ -870,6 +866,22 @@ function createBoard(document) {
|
|
|
870
866
|
material: "fr4"
|
|
871
867
|
};
|
|
872
868
|
}
|
|
869
|
+
function getBoardLayerCount(document) {
|
|
870
|
+
if (!document.board) return 2;
|
|
871
|
+
const entries = getPcbLayerStack(document.board).entries;
|
|
872
|
+
const modernCopperLayerCount = entries.filter(
|
|
873
|
+
(entry) => entry.source === "v8" && entry.copperThickness !== void 0
|
|
874
|
+
).length;
|
|
875
|
+
if (modernCopperLayerCount > 0) {
|
|
876
|
+
return Math.max(modernCopperLayerCount, 2);
|
|
877
|
+
}
|
|
878
|
+
return Math.max(
|
|
879
|
+
entries.filter(
|
|
880
|
+
(entry) => Boolean(mapAltiumCopperLayer(entry.name ?? entry.layerId))
|
|
881
|
+
).length,
|
|
882
|
+
2
|
|
883
|
+
);
|
|
884
|
+
}
|
|
873
885
|
function getFallbackPcbBounds(records) {
|
|
874
886
|
const points = [];
|
|
875
887
|
for (const record of records) {
|