@tscircuit/3d-viewer 0.0.216 → 0.0.217

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 +39 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -16982,7 +16982,7 @@ import { Canvas, useFrame as useFrame2 } from "@react-three/fiber";
16982
16982
  // package.json
16983
16983
  var package_default = {
16984
16984
  name: "@tscircuit/3d-viewer",
16985
- version: "0.0.215",
16985
+ version: "0.0.216",
16986
16986
  main: "./dist/index.js",
16987
16987
  module: "./dist/index.js",
16988
16988
  type: "module",
@@ -17846,6 +17846,21 @@ var BoardGeomBuilder = class {
17846
17846
  ctx;
17847
17847
  onCompleteCallback;
17848
17848
  finalGeoms = [];
17849
+ getHoleToCut(x, y) {
17850
+ const epsilon = M / 10;
17851
+ for (const via of this.pcb_vias) {
17852
+ if (Math.abs(via.x - x) < epsilon && Math.abs(via.y - y) < epsilon && via.hole_diameter) {
17853
+ return { diameter: via.hole_diameter };
17854
+ }
17855
+ }
17856
+ for (const ph of this.plated_holes) {
17857
+ if (ph.shape !== "circle") continue;
17858
+ if (Math.abs(ph.x - x) < epsilon && Math.abs(ph.y - y) < epsilon && ph.hole_diameter) {
17859
+ return { diameter: ph.hole_diameter };
17860
+ }
17861
+ }
17862
+ return null;
17863
+ }
17849
17864
  constructor(circuitJson, onComplete) {
17850
17865
  this.circuitJson = circuitJson;
17851
17866
  this.onCompleteCallback = onComplete;
@@ -18045,6 +18060,29 @@ var BoardGeomBuilder = class {
18045
18060
  [0, 0, zPos],
18046
18061
  (0, import_extrusions2.extrudeLinear)({ height: M }, expandedPath)
18047
18062
  );
18063
+ const startPointCoords = currentSegmentPoints[0];
18064
+ const endPointCoords = currentSegmentPoints[currentSegmentPoints.length - 1];
18065
+ const startHole = this.getHoleToCut(
18066
+ startPointCoords[0],
18067
+ startPointCoords[1]
18068
+ );
18069
+ if (startHole) {
18070
+ const cuttingCylinder = (0, import_primitives4.cylinder)({
18071
+ center: [startPointCoords[0], startPointCoords[1], zPos + M / 2],
18072
+ radius: startHole.diameter / 2 + M,
18073
+ height: M
18074
+ });
18075
+ traceGeom = (0, import_booleans2.subtract)(traceGeom, cuttingCylinder);
18076
+ }
18077
+ const endHole = this.getHoleToCut(endPointCoords[0], endPointCoords[1]);
18078
+ if (endHole) {
18079
+ const cuttingCylinder = (0, import_primitives4.cylinder)({
18080
+ center: [endPointCoords[0], endPointCoords[1], zPos + M / 2],
18081
+ radius: endHole.diameter / 2 + M,
18082
+ height: M
18083
+ });
18084
+ traceGeom = (0, import_booleans2.subtract)(traceGeom, cuttingCylinder);
18085
+ }
18048
18086
  const tracesMaterialColor = tracesMaterialColors[this.board.material] ?? colors.fr4GreenSolderWithMask;
18049
18087
  traceGeom = (0, import_colors3.colorize)(tracesMaterialColor, traceGeom);
18050
18088
  this.traceGeoms.push(traceGeom);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/3d-viewer",
3
- "version": "0.0.216",
3
+ "version": "0.0.217",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "type": "module",