@tscircuit/3d-viewer 0.0.493 → 0.0.495
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 +43 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -30825,7 +30825,7 @@ import * as THREE16 from "three";
|
|
|
30825
30825
|
// package.json
|
|
30826
30826
|
var package_default = {
|
|
30827
30827
|
name: "@tscircuit/3d-viewer",
|
|
30828
|
-
version: "0.0.
|
|
30828
|
+
version: "0.0.494",
|
|
30829
30829
|
main: "./dist/index.js",
|
|
30830
30830
|
module: "./dist/index.js",
|
|
30831
30831
|
type: "module",
|
|
@@ -32504,6 +32504,11 @@ var platedHole = (plated_hole, ctx, options = {}) => {
|
|
|
32504
32504
|
return (0, import_colors2.colorize)(colors.copper, (0, import_booleans2.subtract)(copperSolid, drill));
|
|
32505
32505
|
}
|
|
32506
32506
|
if (plated_hole.shape === "pill_hole_with_rect_pad") {
|
|
32507
|
+
if (plated_hole.hole_shape && plated_hole.hole_shape !== "pill" || plated_hole.pad_shape && plated_hole.pad_shape !== "rect") {
|
|
32508
|
+
throw new Error(
|
|
32509
|
+
`Invalid hole_shape or pad_shape for pill_hole_with_rect_pad`
|
|
32510
|
+
);
|
|
32511
|
+
}
|
|
32507
32512
|
const holeOffsetX = plated_hole.hole_offset_x || 0;
|
|
32508
32513
|
const holeOffsetY = plated_hole.hole_offset_y || 0;
|
|
32509
32514
|
const shouldRotate = plated_hole.hole_height > plated_hole.hole_width;
|
|
@@ -33179,6 +33184,9 @@ var BoardGeomBuilder = class {
|
|
|
33179
33184
|
if (ph.shape === "circle" || ph.shape === "circular_hole_with_rect_pad") {
|
|
33180
33185
|
let cyGeom = null;
|
|
33181
33186
|
if (ph.shape === "circular_hole_with_rect_pad") {
|
|
33187
|
+
if (ph.hole_shape && ph.hole_shape !== "circle" || ph.pad_shape && ph.pad_shape !== "rect") {
|
|
33188
|
+
return;
|
|
33189
|
+
}
|
|
33182
33190
|
cyGeom = (0, import_primitives7.cylinder)({
|
|
33183
33191
|
center: [
|
|
33184
33192
|
ph.x + (ph.hole_offset_x || 0),
|
|
@@ -33250,6 +33258,9 @@ var BoardGeomBuilder = class {
|
|
|
33250
33258
|
});
|
|
33251
33259
|
this.platedHoleGeoms.push(platedHoleGeom);
|
|
33252
33260
|
} else if (ph.shape === "pill_hole_with_rect_pad") {
|
|
33261
|
+
if (ph.hole_shape && ph.hole_shape !== "pill" || ph.pad_shape && ph.pad_shape !== "rect") {
|
|
33262
|
+
return;
|
|
33263
|
+
}
|
|
33253
33264
|
const shouldRotate = ph.hole_height > ph.hole_width;
|
|
33254
33265
|
const holeWidth = shouldRotate ? ph.hole_height : ph.hole_width;
|
|
33255
33266
|
const holeHeight = shouldRotate ? ph.hole_width : ph.hole_height;
|
|
@@ -33858,8 +33869,8 @@ import * as THREE24 from "three";
|
|
|
33858
33869
|
import { su as su9 } from "@tscircuit/circuit-json-util";
|
|
33859
33870
|
|
|
33860
33871
|
// src/utils/soldermask-texture.ts
|
|
33861
|
-
import * as THREE19 from "three";
|
|
33862
33872
|
import { su as su5 } from "@tscircuit/circuit-json-util";
|
|
33873
|
+
import * as THREE19 from "three";
|
|
33863
33874
|
|
|
33864
33875
|
// node_modules/@tscircuit/math-utils/dist/chunk-5N7UJNVK.js
|
|
33865
33876
|
var getBoundsFromPoints = (points) => {
|
|
@@ -34180,6 +34191,22 @@ function createSoldermaskTextureForLayer({
|
|
|
34180
34191
|
ctx.arc(adjustedCanvasX, adjustedCanvasY, canvasRadius, 0, 2 * Math.PI);
|
|
34181
34192
|
ctx.fill();
|
|
34182
34193
|
}
|
|
34194
|
+
if (hole.pad_outline && hole.pad_outline.length >= 3) {
|
|
34195
|
+
ctx.beginPath();
|
|
34196
|
+
hole.pad_outline.forEach(
|
|
34197
|
+
(point2, index2) => {
|
|
34198
|
+
const px = canvasXFromPcb(hole.x + point2.x);
|
|
34199
|
+
const py = canvasYFromPcb(hole.y + point2.y);
|
|
34200
|
+
if (index2 === 0) {
|
|
34201
|
+
ctx.moveTo(px, py);
|
|
34202
|
+
} else {
|
|
34203
|
+
ctx.lineTo(px, py);
|
|
34204
|
+
}
|
|
34205
|
+
}
|
|
34206
|
+
);
|
|
34207
|
+
ctx.closePath();
|
|
34208
|
+
ctx.fill();
|
|
34209
|
+
}
|
|
34183
34210
|
} else if (hole.shape === "circular_hole_with_rect_pad") {
|
|
34184
34211
|
const padWidth = (hole.rect_pad_width ?? hole.hole_diameter ?? 0) * traceTextureResolution;
|
|
34185
34212
|
const padHeight = (hole.rect_pad_height ?? hole.hole_diameter ?? 0) * traceTextureResolution;
|
|
@@ -36657,6 +36684,9 @@ function processPlatedHolesForManifold(Manifold, CrossSection, circuitJson, pcbT
|
|
|
36657
36684
|
color: COPPER_COLOR
|
|
36658
36685
|
});
|
|
36659
36686
|
} else if (ph.shape === "pill_hole_with_rect_pad") {
|
|
36687
|
+
if (ph.hole_shape && ph.hole_shape !== "pill" || ph.pad_shape && ph.pad_shape !== "rect") {
|
|
36688
|
+
return;
|
|
36689
|
+
}
|
|
36660
36690
|
const holeW = ph.hole_width;
|
|
36661
36691
|
const holeH = ph.hole_height;
|
|
36662
36692
|
const holeOffsetX = ph.hole_offset_x || 0;
|
|
@@ -36668,9 +36698,11 @@ function processPlatedHolesForManifold(Manifold, CrossSection, circuitJson, pcbT
|
|
|
36668
36698
|
const drillW = holeW + 2 * MANIFOLD_Z_OFFSET;
|
|
36669
36699
|
const drillH = holeH + 2 * MANIFOLD_Z_OFFSET;
|
|
36670
36700
|
const drillDepth = pcbThickness * 1.2;
|
|
36671
|
-
|
|
36672
|
-
|
|
36673
|
-
|
|
36701
|
+
const boardPillDrillOp = createPillOp(
|
|
36702
|
+
drillW,
|
|
36703
|
+
drillH,
|
|
36704
|
+
drillDepth
|
|
36705
|
+
).translate([holeOffsetX, holeOffsetY, 0]);
|
|
36674
36706
|
const translatedBoardPillDrill = boardPillDrillOp.translate([
|
|
36675
36707
|
ph.x,
|
|
36676
36708
|
ph.y,
|
|
@@ -36866,7 +36898,7 @@ function processPlatedHolesForManifold(Manifold, CrossSection, circuitJson, pcbT
|
|
|
36866
36898
|
}
|
|
36867
36899
|
const outerCrossSection = CrossSection.ofPolygons([outerPoints]);
|
|
36868
36900
|
manifoldInstancesForCleanup.push(outerCrossSection);
|
|
36869
|
-
|
|
36901
|
+
const outerCopperOp = Manifold.extrude(
|
|
36870
36902
|
outerCrossSection,
|
|
36871
36903
|
copperPartThickness,
|
|
36872
36904
|
0,
|
|
@@ -36885,7 +36917,7 @@ function processPlatedHolesForManifold(Manifold, CrossSection, circuitJson, pcbT
|
|
|
36885
36917
|
}
|
|
36886
36918
|
const innerCrossSection = CrossSection.ofPolygons([innerPoints]);
|
|
36887
36919
|
manifoldInstancesForCleanup.push(innerCrossSection);
|
|
36888
|
-
|
|
36920
|
+
const innerDrillOp = Manifold.extrude(
|
|
36889
36921
|
innerCrossSection,
|
|
36890
36922
|
copperPartThickness * 1.05,
|
|
36891
36923
|
0,
|
|
@@ -36920,6 +36952,9 @@ function processPlatedHolesForManifold(Manifold, CrossSection, circuitJson, pcbT
|
|
|
36920
36952
|
color: COPPER_COLOR
|
|
36921
36953
|
});
|
|
36922
36954
|
} else if (ph.shape === "circular_hole_with_rect_pad") {
|
|
36955
|
+
if (ph.hole_shape && ph.hole_shape !== "circle" || ph.pad_shape && ph.pad_shape !== "rect") {
|
|
36956
|
+
return;
|
|
36957
|
+
}
|
|
36923
36958
|
const holeOffsetX = ph.hole_offset_x || 0;
|
|
36924
36959
|
const holeOffsetY = ph.hole_offset_y || 0;
|
|
36925
36960
|
const translatedDrill = createCircleHoleDrill({
|
|
@@ -37010,7 +37045,7 @@ function processPlatedHolesForManifold(Manifold, CrossSection, circuitJson, pcbT
|
|
|
37010
37045
|
});
|
|
37011
37046
|
}
|
|
37012
37047
|
});
|
|
37013
|
-
let platedHoleSubtractOp
|
|
37048
|
+
let platedHoleSubtractOp;
|
|
37014
37049
|
if (platedHoleCopperOpsForSubtract.length > 0) {
|
|
37015
37050
|
platedHoleSubtractOp = Manifold.union(platedHoleCopperOpsForSubtract);
|
|
37016
37051
|
manifoldInstancesForCleanup.push(platedHoleSubtractOp);
|