@tscircuit/copper-pour-solver 0.0.22 → 0.0.24
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 +29 -10
- package/lib/circuit-json/convert-circuit-json-to-input-problem.ts +29 -10
- package/package.json +1 -1
- package/tests/assets/tsci_AnasSarkiz.STM32F746G-DISCO.circuit.json +67472 -0
- package/tests/repro02-pinrow4-copper-pour/__snapshots__/repro02-pinrow4-copper-pour.snap.svg +1 -0
- package/tests/repro02-pinrow4-copper-pour/repro02-pinrow4-copper-pour.json +2344 -0
- package/tests/repro02-pinrow4-copper-pour/repro02-pinrow4-copper-pour.test.ts +18 -0
- package/tests/stm32f746g-disco.test.ts +26 -0
package/dist/index.js
CHANGED
|
@@ -385,7 +385,6 @@ var convertCircuitJsonToInputProblem = (circuitJson, options) => {
|
|
|
385
385
|
}
|
|
386
386
|
} else if (elm.type === "pcb_plated_hole") {
|
|
387
387
|
const platedHole = elm;
|
|
388
|
-
if (platedHole.shape !== "circle") continue;
|
|
389
388
|
if (!platedHole.layers.includes(options.layer)) continue;
|
|
390
389
|
let connectivityKey = connectivityMap.getNetConnectedToId(
|
|
391
390
|
platedHole.pcb_plated_hole_id
|
|
@@ -393,15 +392,35 @@ var convertCircuitJsonToInputProblem = (circuitJson, options) => {
|
|
|
393
392
|
if (!connectivityKey) {
|
|
394
393
|
connectivityKey = `unconnected-plated-hole:${platedHole.pcb_plated_hole_id}`;
|
|
395
394
|
}
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
395
|
+
if (platedHole.shape === "circle") {
|
|
396
|
+
pads.push({
|
|
397
|
+
shape: "circle",
|
|
398
|
+
padId: platedHole.pcb_plated_hole_id,
|
|
399
|
+
layer: options.layer,
|
|
400
|
+
connectivityKey,
|
|
401
|
+
x: platedHole.x,
|
|
402
|
+
y: platedHole.y,
|
|
403
|
+
radius: platedHole.outer_diameter / 2
|
|
404
|
+
});
|
|
405
|
+
} else if (platedHole.shape === "circular_hole_with_rect_pad") {
|
|
406
|
+
const rectWidth = platedHole.rect_pad_width;
|
|
407
|
+
const rectHeight = platedHole.rect_pad_height;
|
|
408
|
+
if (typeof rectWidth !== "number" || typeof rectHeight !== "number") {
|
|
409
|
+
continue;
|
|
410
|
+
}
|
|
411
|
+
pads.push({
|
|
412
|
+
shape: "rect",
|
|
413
|
+
padId: platedHole.pcb_plated_hole_id,
|
|
414
|
+
layer: options.layer,
|
|
415
|
+
connectivityKey,
|
|
416
|
+
bounds: {
|
|
417
|
+
minX: platedHole.x - rectWidth / 2,
|
|
418
|
+
minY: platedHole.y - rectHeight / 2,
|
|
419
|
+
maxX: platedHole.x + rectWidth / 2,
|
|
420
|
+
maxY: platedHole.y + rectHeight / 2
|
|
421
|
+
}
|
|
422
|
+
});
|
|
423
|
+
}
|
|
405
424
|
} else if (elm.type === "pcb_hole") {
|
|
406
425
|
const hole = elm;
|
|
407
426
|
if (hole.hole_shape !== "circle") continue;
|
|
@@ -84,7 +84,6 @@ export const convertCircuitJsonToInputProblem = (
|
|
|
84
84
|
}
|
|
85
85
|
} else if (elm.type === "pcb_plated_hole") {
|
|
86
86
|
const platedHole = elm as PcbPlatedHole
|
|
87
|
-
if (platedHole.shape !== "circle") continue
|
|
88
87
|
if (!platedHole.layers.includes(options.layer)) continue
|
|
89
88
|
|
|
90
89
|
let connectivityKey = connectivityMap.getNetConnectedToId(
|
|
@@ -94,15 +93,35 @@ export const convertCircuitJsonToInputProblem = (
|
|
|
94
93
|
connectivityKey = `unconnected-plated-hole:${platedHole.pcb_plated_hole_id}`
|
|
95
94
|
}
|
|
96
95
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
96
|
+
if (platedHole.shape === "circle") {
|
|
97
|
+
pads.push({
|
|
98
|
+
shape: "circle",
|
|
99
|
+
padId: platedHole.pcb_plated_hole_id,
|
|
100
|
+
layer: options.layer,
|
|
101
|
+
connectivityKey,
|
|
102
|
+
x: platedHole.x,
|
|
103
|
+
y: platedHole.y,
|
|
104
|
+
radius: platedHole.outer_diameter / 2,
|
|
105
|
+
} as InputCircularPad)
|
|
106
|
+
} else if (platedHole.shape === "circular_hole_with_rect_pad") {
|
|
107
|
+
const rectWidth = platedHole.rect_pad_width
|
|
108
|
+
const rectHeight = platedHole.rect_pad_height
|
|
109
|
+
if (typeof rectWidth !== "number" || typeof rectHeight !== "number") {
|
|
110
|
+
continue
|
|
111
|
+
}
|
|
112
|
+
pads.push({
|
|
113
|
+
shape: "rect",
|
|
114
|
+
padId: platedHole.pcb_plated_hole_id,
|
|
115
|
+
layer: options.layer,
|
|
116
|
+
connectivityKey,
|
|
117
|
+
bounds: {
|
|
118
|
+
minX: platedHole.x - rectWidth / 2,
|
|
119
|
+
minY: platedHole.y - rectHeight / 2,
|
|
120
|
+
maxX: platedHole.x + rectWidth / 2,
|
|
121
|
+
maxY: platedHole.y + rectHeight / 2,
|
|
122
|
+
},
|
|
123
|
+
} as InputRectPad)
|
|
124
|
+
}
|
|
106
125
|
} else if (elm.type === "pcb_hole") {
|
|
107
126
|
const hole = elm as PcbHole
|
|
108
127
|
if (hole.hole_shape !== "circle") continue
|