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.
Files changed (2) hide show
  1. package/dist/index.js +9 -4
  2. 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
- if (holeGeoms.length > 0) {
15072
- panelGeom = (0, import_booleans2.subtract)(panelGeom, ...holeGeoms);
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;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "circuit-json-to-gltf",
3
3
  "main": "dist/index.js",
4
4
  "type": "module",
5
- "version": "0.0.58",
5
+ "version": "0.0.59",
6
6
  "scripts": {
7
7
  "test": "bun test tests/",
8
8
  "format": "biome format --write .",