circuit-json-to-gltf 0.0.58 → 0.0.59
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 +9 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15064,12 +15064,14 @@ var import_booleans2 = __toESM(require_booleans(), 1);
|
|
|
15064
15064
|
var geom32 = __toESM(require_geom3(), 1);
|
|
15065
15065
|
var import_measureBoundingBox2 = __toESM(require_measureBoundingBox2(), 1);
|
|
15066
15066
|
var createPanelMesh = (panel, options) => {
|
|
15067
|
-
const { thickness, holes = [], platedHoles = [] } = options;
|
|
15067
|
+
const { thickness, holes = [], platedHoles = [], cutouts = [] } = options;
|
|
15068
15068
|
const center = panel.center ?? { x: 0, y: 0 };
|
|
15069
15069
|
let panelGeom = createBoardOutlineGeom(panel, center, thickness);
|
|
15070
15070
|
const holeGeoms = createHoleGeoms(center, thickness, holes, platedHoles);
|
|
15071
|
-
|
|
15072
|
-
|
|
15071
|
+
const cutoutGeoms = createCutoutGeoms(center, thickness, cutouts);
|
|
15072
|
+
const subtractGeoms = [...holeGeoms, ...cutoutGeoms];
|
|
15073
|
+
if (subtractGeoms.length > 0) {
|
|
15074
|
+
panelGeom = (0, import_booleans2.subtract)(panelGeom, ...subtractGeoms);
|
|
15073
15075
|
}
|
|
15074
15076
|
panelGeom = (0, import_transforms3.rotateX)(-Math.PI / 2, panelGeom);
|
|
15075
15077
|
const polygons = geom32.toPolygons(panelGeom);
|
|
@@ -15117,10 +15119,13 @@ async function convertCircuitJsonTo3D(circuitJson, options = {}) {
|
|
|
15117
15119
|
if (pcbPanel) {
|
|
15118
15120
|
const pcbHoles = db.pcb_hole?.list?.() ?? [];
|
|
15119
15121
|
const pcbPlatedHoles = db.pcb_plated_hole?.list?.() ?? [];
|
|
15122
|
+
const pcbCutouts = db.pcb_cutout?.list?.() ?? [];
|
|
15123
|
+
const panelCutouts = pcbCutouts.filter((cutout) => !cutout.pcb_board_id);
|
|
15120
15124
|
const panelMesh = createPanelMesh(pcbPanel, {
|
|
15121
15125
|
thickness: effectiveBoardThickness,
|
|
15122
15126
|
holes: pcbHoles,
|
|
15123
|
-
platedHoles: pcbPlatedHoles
|
|
15127
|
+
platedHoles: pcbPlatedHoles,
|
|
15128
|
+
cutouts: panelCutouts
|
|
15124
15129
|
});
|
|
15125
15130
|
const meshWidth = panelMesh.boundingBox.max.x - panelMesh.boundingBox.min.x;
|
|
15126
15131
|
const meshHeight = panelMesh.boundingBox.max.z - panelMesh.boundingBox.min.z;
|