@tscircuit/3d-viewer 0.0.360 → 0.0.362

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 +26 -10
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -25583,7 +25583,7 @@ import * as THREE10 from "three";
25583
25583
  // package.json
25584
25584
  var package_default = {
25585
25585
  name: "@tscircuit/3d-viewer",
25586
- version: "0.0.359",
25586
+ version: "0.0.361",
25587
25587
  main: "./dist/index.js",
25588
25588
  module: "./dist/index.js",
25589
25589
  type: "module",
@@ -25630,7 +25630,7 @@ var package_default = {
25630
25630
  "@storybook/blocks": "9.0.0-alpha.17",
25631
25631
  "@storybook/react-vite": "^9.1.2",
25632
25632
  "@tscircuit/circuit-json-util": "^0.0.67",
25633
- "@tscircuit/core": "^0.0.678",
25633
+ "@tscircuit/core": "^0.0.681",
25634
25634
  "@tscircuit/props": "^0.0.292",
25635
25635
  "@types/jsdom": "^21.1.7",
25636
25636
  "@types/react": "19",
@@ -26973,10 +26973,10 @@ function createSilkscreenPathGeom(sp, ctx) {
26973
26973
  // src/BoardGeomBuilder.ts
26974
26974
  var buildStateOrder = [
26975
26975
  "initializing",
26976
+ "processing_pads",
26976
26977
  "processing_plated_holes",
26977
26978
  "processing_holes",
26978
26979
  "processing_cutouts",
26979
- "processing_pads",
26980
26980
  "processing_traces",
26981
26981
  "processing_vias",
26982
26982
  "processing_silkscreen_text",
@@ -27054,7 +27054,7 @@ var BoardGeomBuilder = class {
27054
27054
  center: [this.board.center.x, this.board.center.y, 0]
27055
27055
  });
27056
27056
  }
27057
- this.state = "processing_plated_holes";
27057
+ this.state = "processing_pads";
27058
27058
  this.currentIndex = 0;
27059
27059
  }
27060
27060
  goToNextState() {
@@ -27196,6 +27196,9 @@ var BoardGeomBuilder = class {
27196
27196
  if (!opts.dontCutBoard) {
27197
27197
  this.boardGeom = (0, import_booleans2.subtract)(this.boardGeom, cyGeom);
27198
27198
  }
27199
+ this.padGeoms = this.padGeoms.map(
27200
+ (pg) => (0, import_colors4.colorize)(colors.copper, (0, import_booleans2.subtract)(pg, cyGeom))
27201
+ );
27199
27202
  const platedHoleGeom = platedHole(ph, this.ctx);
27200
27203
  this.platedHoleGeoms.push(platedHoleGeom);
27201
27204
  } else if (ph.shape === "pill" || ph.shape === "pill_hole_with_rect_pad") {
@@ -27223,6 +27226,9 @@ var BoardGeomBuilder = class {
27223
27226
  if (!opts.dontCutBoard) {
27224
27227
  this.boardGeom = (0, import_booleans2.subtract)(this.boardGeom, pillHole);
27225
27228
  }
27229
+ this.padGeoms = this.padGeoms.map(
27230
+ (pg) => (0, import_colors4.colorize)(colors.copper, (0, import_booleans2.subtract)(pg, pillHole))
27231
+ );
27226
27232
  const platedHoleGeom = platedHole(ph, this.ctx);
27227
27233
  this.platedHoleGeoms.push(platedHoleGeom);
27228
27234
  }
@@ -27238,6 +27244,9 @@ var BoardGeomBuilder = class {
27238
27244
  // Ensure it cuts through
27239
27245
  });
27240
27246
  this.boardGeom = (0, import_booleans2.subtract)(this.boardGeom, cyGeom);
27247
+ this.padGeoms = this.padGeoms.map(
27248
+ (pg) => (0, import_colors4.colorize)(colors.copper, (0, import_booleans2.subtract)(pg, cyGeom))
27249
+ );
27241
27250
  }
27242
27251
  }
27243
27252
  processPad(pad2) {
@@ -28411,7 +28420,7 @@ function createPadManifoldOp({
28411
28420
 
28412
28421
  // src/utils/manifold/process-smt-pads.ts
28413
28422
  var COPPER_COLOR3 = new THREE18.Color(...colors.copper);
28414
- function processSmtPadsForManifold(Manifold, circuitJson, pcbThickness, manifoldInstancesForCleanup) {
28423
+ function processSmtPadsForManifold(Manifold, circuitJson, pcbThickness, manifoldInstancesForCleanup, holeUnion) {
28415
28424
  const smtPadGeoms = [];
28416
28425
  const smtPads = su10(circuitJson).pcb_smtpad.list();
28417
28426
  smtPads.forEach((pad2, index) => {
@@ -28426,7 +28435,12 @@ function processSmtPadsForManifold(Manifold, circuitJson, pcbThickness, manifold
28426
28435
  manifoldInstancesForCleanup.push(padManifoldOp);
28427
28436
  const translatedPad = padManifoldOp.translate([pad2.x, pad2.y, zPos]);
28428
28437
  manifoldInstancesForCleanup.push(translatedPad);
28429
- const threeGeom = manifoldMeshToThreeGeometry(translatedPad.getMesh());
28438
+ let finalPadOp = translatedPad;
28439
+ if (holeUnion) {
28440
+ finalPadOp = translatedPad.subtract(holeUnion);
28441
+ manifoldInstancesForCleanup.push(finalPadOp);
28442
+ }
28443
+ const threeGeom = manifoldMeshToThreeGeometry(finalPadOp.getMesh());
28430
28444
  smtPadGeoms.push({
28431
28445
  key: `pad-${pad2.pcb_smtpad_id || index}`,
28432
28446
  geometry: threeGeom,
@@ -28642,6 +28656,7 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson) => {
28642
28656
  manifoldInstancesForCleanup.current
28643
28657
  );
28644
28658
  const allBoardDrills = [];
28659
+ let holeUnion = null;
28645
28660
  const { nonPlatedHoleBoardDrills } = processNonPlatedHolesForManifold(
28646
28661
  Manifold,
28647
28662
  circuitJson,
@@ -28666,9 +28681,9 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson) => {
28666
28681
  allBoardDrills.push(...viaBoardDrills);
28667
28682
  currentGeoms.vias = viaCopperGeoms;
28668
28683
  if (allBoardDrills.length > 0) {
28669
- const unionedDrills = Manifold.union(allBoardDrills);
28670
- manifoldInstancesForCleanup.current.push(unionedDrills);
28671
- const nextBoardAfterDrills = currentBoardOp.subtract(unionedDrills);
28684
+ holeUnion = Manifold.union(allBoardDrills);
28685
+ manifoldInstancesForCleanup.current.push(holeUnion);
28686
+ const nextBoardAfterDrills = currentBoardOp.subtract(holeUnion);
28672
28687
  manifoldInstancesForCleanup.current.push(nextBoardAfterDrills);
28673
28688
  currentBoardOp = nextBoardAfterDrills;
28674
28689
  }
@@ -28704,7 +28719,8 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson) => {
28704
28719
  Manifold,
28705
28720
  circuitJson,
28706
28721
  currentPcbThickness,
28707
- manifoldInstancesForCleanup.current
28722
+ manifoldInstancesForCleanup.current,
28723
+ holeUnion
28708
28724
  );
28709
28725
  currentGeoms.smtPads = smtPadGeoms;
28710
28726
  setGeoms(currentGeoms);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/3d-viewer",
3
- "version": "0.0.360",
3
+ "version": "0.0.362",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "type": "module",
@@ -47,7 +47,7 @@
47
47
  "@storybook/blocks": "9.0.0-alpha.17",
48
48
  "@storybook/react-vite": "^9.1.2",
49
49
  "@tscircuit/circuit-json-util": "^0.0.67",
50
- "@tscircuit/core": "^0.0.678",
50
+ "@tscircuit/core": "^0.0.681",
51
51
  "@tscircuit/props": "^0.0.292",
52
52
  "@types/jsdom": "^21.1.7",
53
53
  "@types/react": "19",