@tscircuit/copper-pour-solver 0.0.11 → 0.0.12
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
CHANGED
|
@@ -127,15 +127,6 @@ var processObstaclesForPour = (pads, pourConnectivityKey, margins, boardOutline)
|
|
|
127
127
|
const isHoleOrCutout = pad.connectivityKey.startsWith("hole:") || pad.connectivityKey.startsWith("cutout:");
|
|
128
128
|
if (isCircularPad(pad)) {
|
|
129
129
|
const margin = isHoleOrCutout ? cutoutMargin ?? 0 : padMargin;
|
|
130
|
-
if (isHoleOrCutout) {
|
|
131
|
-
console.log(
|
|
132
|
-
`Applying cutout margin to circular pad/hole/cutout: ${pad.padId}, margin: ${margin}`
|
|
133
|
-
);
|
|
134
|
-
} else {
|
|
135
|
-
console.log(
|
|
136
|
-
`Applying pad margin to circular pad: ${pad.padId}, margin: ${margin}`
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
130
|
const circle = new Flatten3.Circle(
|
|
140
131
|
new Flatten3.Point(pad.x, pad.y),
|
|
141
132
|
pad.radius + margin
|
|
@@ -145,15 +136,6 @@ var processObstaclesForPour = (pads, pourConnectivityKey, margins, boardOutline)
|
|
|
145
136
|
}
|
|
146
137
|
if (isRectPad(pad)) {
|
|
147
138
|
const margin = isHoleOrCutout ? cutoutMargin ?? 0 : padMargin;
|
|
148
|
-
if (isHoleOrCutout) {
|
|
149
|
-
console.log(
|
|
150
|
-
`Applying cutout margin to rect pad/cutout: ${pad.padId}, margin: ${margin}`
|
|
151
|
-
);
|
|
152
|
-
} else {
|
|
153
|
-
console.log(
|
|
154
|
-
`Applying pad margin to rect pad: ${pad.padId}, margin: ${margin}`
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
139
|
const { bounds } = pad;
|
|
158
140
|
const b = new Flatten3.Box(
|
|
159
141
|
bounds.minX - margin,
|
|
@@ -166,18 +148,10 @@ var processObstaclesForPour = (pads, pourConnectivityKey, margins, boardOutline)
|
|
|
166
148
|
}
|
|
167
149
|
if (isPolygonPad(pad)) {
|
|
168
150
|
const margin = isHoleOrCutout ? cutoutMargin ?? 0 : 0;
|
|
169
|
-
if (isHoleOrCutout) {
|
|
170
|
-
console.log(
|
|
171
|
-
`Applying cutout margin to polygon cutout: ${pad.padId}, margin: ${margin}`
|
|
172
|
-
);
|
|
173
|
-
}
|
|
174
151
|
const seen = /* @__PURE__ */ new Set();
|
|
175
152
|
const uniquePoints = pad.points.filter((p) => {
|
|
176
153
|
const key = `${p.x},${p.y}`;
|
|
177
154
|
if (seen.has(key)) {
|
|
178
|
-
console.log(
|
|
179
|
-
`Duplicate point detected and removed for ${pad.padId}: (${p.x}, ${p.y})`
|
|
180
|
-
);
|
|
181
155
|
return false;
|
|
182
156
|
}
|
|
183
157
|
seen.add(key);
|
|
@@ -490,9 +464,6 @@ var convertCircuitJsonToInputProblem = (circuitJson, options) => {
|
|
|
490
464
|
});
|
|
491
465
|
} else if (elm.type === "pcb_cutout") {
|
|
492
466
|
const cutout = elm;
|
|
493
|
-
console.log(
|
|
494
|
-
`Processing cutout: ${cutout.pcb_cutout_id} (shape: ${cutout.shape})`
|
|
495
|
-
);
|
|
496
467
|
if (cutout.shape === "rect") {
|
|
497
468
|
pads.push({
|
|
498
469
|
shape: "rect",
|
|
@@ -519,9 +490,6 @@ var convertCircuitJsonToInputProblem = (circuitJson, options) => {
|
|
|
519
490
|
radius: cutout.radius
|
|
520
491
|
});
|
|
521
492
|
} else if (cutout.shape === "polygon") {
|
|
522
|
-
console.log(
|
|
523
|
-
`Polygon cutout points for ${cutout.pcb_cutout_id}: ${JSON.stringify(cutout.points)}`
|
|
524
|
-
);
|
|
525
493
|
pads.push({
|
|
526
494
|
shape: "polygon",
|
|
527
495
|
padId: cutout.pcb_cutout_id,
|
|
@@ -184,9 +184,6 @@ export const convertCircuitJsonToInputProblem = (
|
|
|
184
184
|
} as InputCircularPad)
|
|
185
185
|
} else if (elm.type === "pcb_cutout") {
|
|
186
186
|
const cutout = elm as any
|
|
187
|
-
console.log(
|
|
188
|
-
`Processing cutout: ${cutout.pcb_cutout_id} (shape: ${cutout.shape})`,
|
|
189
|
-
)
|
|
190
187
|
if (cutout.shape === "rect") {
|
|
191
188
|
pads.push({
|
|
192
189
|
shape: "rect",
|
|
@@ -211,9 +208,6 @@ export const convertCircuitJsonToInputProblem = (
|
|
|
211
208
|
radius: cutout.radius,
|
|
212
209
|
} as InputCircularPad)
|
|
213
210
|
} else if (cutout.shape === "polygon") {
|
|
214
|
-
console.log(
|
|
215
|
-
`Polygon cutout points for ${cutout.pcb_cutout_id}: ${JSON.stringify(cutout.points)}`,
|
|
216
|
-
)
|
|
217
211
|
pads.push({
|
|
218
212
|
shape: "polygon",
|
|
219
213
|
padId: cutout.pcb_cutout_id,
|
|
@@ -130,15 +130,6 @@ export const processObstaclesForPour = (
|
|
|
130
130
|
|
|
131
131
|
if (isCircularPad(pad)) {
|
|
132
132
|
const margin = isHoleOrCutout ? (cutoutMargin ?? 0) : padMargin
|
|
133
|
-
if (isHoleOrCutout) {
|
|
134
|
-
console.log(
|
|
135
|
-
`Applying cutout margin to circular pad/hole/cutout: ${pad.padId}, margin: ${margin}`,
|
|
136
|
-
)
|
|
137
|
-
} else {
|
|
138
|
-
console.log(
|
|
139
|
-
`Applying pad margin to circular pad: ${pad.padId}, margin: ${margin}`,
|
|
140
|
-
)
|
|
141
|
-
}
|
|
142
133
|
const circle = new Flatten.Circle(
|
|
143
134
|
new Flatten.Point(pad.x, pad.y),
|
|
144
135
|
pad.radius + margin,
|
|
@@ -149,15 +140,6 @@ export const processObstaclesForPour = (
|
|
|
149
140
|
|
|
150
141
|
if (isRectPad(pad)) {
|
|
151
142
|
const margin = isHoleOrCutout ? (cutoutMargin ?? 0) : padMargin
|
|
152
|
-
if (isHoleOrCutout) {
|
|
153
|
-
console.log(
|
|
154
|
-
`Applying cutout margin to rect pad/cutout: ${pad.padId}, margin: ${margin}`,
|
|
155
|
-
)
|
|
156
|
-
} else {
|
|
157
|
-
console.log(
|
|
158
|
-
`Applying pad margin to rect pad: ${pad.padId}, margin: ${margin}`,
|
|
159
|
-
)
|
|
160
|
-
}
|
|
161
143
|
const { bounds } = pad
|
|
162
144
|
const b = new Flatten.Box(
|
|
163
145
|
bounds.minX - margin,
|
|
@@ -171,19 +153,11 @@ export const processObstaclesForPour = (
|
|
|
171
153
|
|
|
172
154
|
if (isPolygonPad(pad)) {
|
|
173
155
|
const margin = isHoleOrCutout ? (cutoutMargin ?? 0) : 0
|
|
174
|
-
if (isHoleOrCutout) {
|
|
175
|
-
console.log(
|
|
176
|
-
`Applying cutout margin to polygon cutout: ${pad.padId}, margin: ${margin}`,
|
|
177
|
-
)
|
|
178
|
-
}
|
|
179
156
|
|
|
180
157
|
const seen = new Set<string>()
|
|
181
158
|
const uniquePoints = pad.points.filter((p) => {
|
|
182
159
|
const key = `${p.x},${p.y}`
|
|
183
160
|
if (seen.has(key)) {
|
|
184
|
-
console.log(
|
|
185
|
-
`Duplicate point detected and removed for ${pad.padId}: (${p.x}, ${p.y})`,
|
|
186
|
-
)
|
|
187
161
|
return false
|
|
188
162
|
}
|
|
189
163
|
seen.add(key)
|