calculate-packing 0.0.70 → 0.0.71
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 +32 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3202,9 +3202,37 @@ var getElementOutsideTree = (db, tree) => {
|
|
|
3202
3202
|
outside.push(ph);
|
|
3203
3203
|
}
|
|
3204
3204
|
}
|
|
3205
|
+
for (const hole of db.pcb_hole.list({})) {
|
|
3206
|
+
outside.push(hole);
|
|
3207
|
+
}
|
|
3205
3208
|
return outside;
|
|
3206
3209
|
};
|
|
3207
3210
|
|
|
3211
|
+
// lib/plumbing/getObstacleFromElement.ts
|
|
3212
|
+
var getObstacleFromElement = (element) => {
|
|
3213
|
+
if (element.type === "pcb_plated_hole" && element.shape === "circular_hole_with_rect_pad") {
|
|
3214
|
+
const { rect_pad_height, rect_pad_width, x, y } = element;
|
|
3215
|
+
return {
|
|
3216
|
+
obstacleId: element.pcb_plated_hole_id,
|
|
3217
|
+
absoluteCenter: { x, y },
|
|
3218
|
+
width: rect_pad_width,
|
|
3219
|
+
height: rect_pad_height
|
|
3220
|
+
};
|
|
3221
|
+
}
|
|
3222
|
+
if (element.type === "pcb_hole") {
|
|
3223
|
+
const { x, y, pcb_hole_id } = element;
|
|
3224
|
+
const width = "hole_diameter" in element ? element.hole_diameter : element.hole_width;
|
|
3225
|
+
const height = "hole_diameter" in element ? element.hole_diameter : element.hole_height;
|
|
3226
|
+
return {
|
|
3227
|
+
obstacleId: pcb_hole_id,
|
|
3228
|
+
absoluteCenter: { x, y },
|
|
3229
|
+
width,
|
|
3230
|
+
height
|
|
3231
|
+
};
|
|
3232
|
+
}
|
|
3233
|
+
return void 0;
|
|
3234
|
+
};
|
|
3235
|
+
|
|
3208
3236
|
// lib/plumbing/convertCircuitJsonToPackOutput.ts
|
|
3209
3237
|
var buildPackedComponent = (pcbComponents, componentId, db, getNetworkId, shouldAddInnerObstacles, sourcePortToPadIds = /* @__PURE__ */ new Map(), chipMarginsMap = {}, isStatic = false) => {
|
|
3210
3238
|
const padInfos = pcbComponents.flatMap((pc) => {
|
|
@@ -3297,7 +3325,7 @@ var convertCircuitJsonToPackOutput = (circuitJson, opts = {}) => {
|
|
|
3297
3325
|
const pcbBoard = circuitJson.find(
|
|
3298
3326
|
(item) => item.type === "pcb_board"
|
|
3299
3327
|
);
|
|
3300
|
-
if (pcbBoard
|
|
3328
|
+
if (pcbBoard?.outline) {
|
|
3301
3329
|
packOutput.boundaryOutline = pcbBoard.outline;
|
|
3302
3330
|
}
|
|
3303
3331
|
const getNetworkId = (pcbPortId) => {
|
|
@@ -3401,14 +3429,9 @@ var convertCircuitJsonToPackOutput = (circuitJson, opts = {}) => {
|
|
|
3401
3429
|
});
|
|
3402
3430
|
}
|
|
3403
3431
|
for (const element of elementsOutsideTree) {
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
packOutput.obstacles.push(
|
|
3407
|
-
obstacleId: element.pcb_plated_hole_id,
|
|
3408
|
-
absoluteCenter: { x, y },
|
|
3409
|
-
width: rect_pad_width,
|
|
3410
|
-
height: rect_pad_height
|
|
3411
|
-
});
|
|
3432
|
+
const obstacle = getObstacleFromElement(element);
|
|
3433
|
+
if (obstacle) {
|
|
3434
|
+
packOutput.obstacles.push(obstacle);
|
|
3412
3435
|
}
|
|
3413
3436
|
}
|
|
3414
3437
|
const weightedConnections = [];
|
package/package.json
CHANGED