@tscircuit/3d-viewer 0.0.227 → 0.0.229
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 +90 -6
- package/package.json +4 -4
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.
|
|
16985
|
+
version: "0.0.228",
|
|
16986
16986
|
main: "./dist/index.js",
|
|
16987
16987
|
module: "./dist/index.js",
|
|
16988
16988
|
type: "module",
|
|
@@ -17014,7 +17014,7 @@ var package_default = {
|
|
|
17014
17014
|
"@react-three/drei": "^9.121.4",
|
|
17015
17015
|
"@react-three/fiber": "^8.17.14",
|
|
17016
17016
|
"@tscircuit/core": "^0.0.416",
|
|
17017
|
-
"@tscircuit/props": "^0.0.
|
|
17017
|
+
"@tscircuit/props": "^0.0.186",
|
|
17018
17018
|
"@tscircuit/soup-util": "^0.0.41",
|
|
17019
17019
|
"jscad-electronics": "^0.0.27",
|
|
17020
17020
|
"jscad-fiber": "^0.0.79",
|
|
@@ -17046,8 +17046,8 @@ var package_default = {
|
|
|
17046
17046
|
"@vitejs/plugin-react": "^4.3.4",
|
|
17047
17047
|
"bun-match-svg": "^0.0.9",
|
|
17048
17048
|
"bun-types": "^1.2.1",
|
|
17049
|
-
"circuit-json": "^0.0.
|
|
17050
|
-
"circuit-to-svg": "^0.0.
|
|
17049
|
+
"circuit-json": "^0.0.185",
|
|
17050
|
+
"circuit-to-svg": "^0.0.130",
|
|
17051
17051
|
debug: "^4.4.0",
|
|
17052
17052
|
jsdom: "^26.0.0",
|
|
17053
17053
|
semver: "^7.7.0",
|
|
@@ -17420,6 +17420,39 @@ var platedHole = (plated_hole, ctx) => {
|
|
|
17420
17420
|
)
|
|
17421
17421
|
);
|
|
17422
17422
|
}
|
|
17423
|
+
if (plated_hole.shape === "circular_hole_with_rect_pad") {
|
|
17424
|
+
const padWidth = plated_hole.rect_pad_width || plated_hole.hole_diameter;
|
|
17425
|
+
const padHeight = plated_hole.rect_pad_height || plated_hole.hole_diameter;
|
|
17426
|
+
return (0, import_colors2.colorize)(
|
|
17427
|
+
colors.copper,
|
|
17428
|
+
(0, import_booleans.subtract)(
|
|
17429
|
+
(0, import_booleans.union)(
|
|
17430
|
+
// Top rectangular pad
|
|
17431
|
+
(0, import_primitives3.cuboid)({
|
|
17432
|
+
center: [plated_hole.x, plated_hole.y, 1.2 / 2],
|
|
17433
|
+
size: [padWidth, padHeight, platedHoleLipHeight]
|
|
17434
|
+
}),
|
|
17435
|
+
// Bottom rectangular pad
|
|
17436
|
+
(0, import_primitives3.cuboid)({
|
|
17437
|
+
center: [plated_hole.x, plated_hole.y, -1.2 / 2],
|
|
17438
|
+
size: [padWidth, padHeight, platedHoleLipHeight]
|
|
17439
|
+
}),
|
|
17440
|
+
// Plated barrel around hole
|
|
17441
|
+
(0, import_primitives3.cylinder)({
|
|
17442
|
+
center: [plated_hole.x, plated_hole.y, 0],
|
|
17443
|
+
radius: plated_hole.hole_diameter / 2,
|
|
17444
|
+
height: 1.2
|
|
17445
|
+
})
|
|
17446
|
+
),
|
|
17447
|
+
// Subtract actual hole through
|
|
17448
|
+
(0, import_primitives3.cylinder)({
|
|
17449
|
+
center: [plated_hole.x, plated_hole.y, 0],
|
|
17450
|
+
radius: Math.max(plated_hole.hole_diameter / 2 - M, 0.01),
|
|
17451
|
+
height: 1.5
|
|
17452
|
+
})
|
|
17453
|
+
)
|
|
17454
|
+
);
|
|
17455
|
+
}
|
|
17423
17456
|
if (plated_hole.shape === "pill") {
|
|
17424
17457
|
const shouldRotate = plated_hole.hole_height > plated_hole.hole_width;
|
|
17425
17458
|
const holeWidth = shouldRotate ? plated_hole.hole_height : plated_hole.hole_width;
|
|
@@ -17501,6 +17534,57 @@ var platedHole = (plated_hole, ctx) => {
|
|
|
17501
17534
|
)
|
|
17502
17535
|
)
|
|
17503
17536
|
);
|
|
17537
|
+
}
|
|
17538
|
+
if (plated_hole.shape === "pill_hole_with_rect_pad") {
|
|
17539
|
+
const shouldRotate = plated_hole.hole_height > plated_hole.hole_width;
|
|
17540
|
+
const holeWidth = shouldRotate ? plated_hole.hole_height : plated_hole.hole_width;
|
|
17541
|
+
const holeHeight = shouldRotate ? plated_hole.hole_width : plated_hole.hole_height;
|
|
17542
|
+
const holeRadius = holeHeight / 2;
|
|
17543
|
+
const rectLength = Math.abs(holeWidth - holeHeight);
|
|
17544
|
+
const padWidth = plated_hole.rect_pad_width || holeWidth + 0.2;
|
|
17545
|
+
const padHeight = plated_hole.rect_pad_height || holeHeight + 0.2;
|
|
17546
|
+
const mainRect = (0, import_primitives3.cuboid)({
|
|
17547
|
+
center: [plated_hole.x, plated_hole.y, 0],
|
|
17548
|
+
size: shouldRotate ? [holeHeight, rectLength, 1.2] : [rectLength, holeHeight, 1.2]
|
|
17549
|
+
});
|
|
17550
|
+
const leftCap = (0, import_primitives3.cylinder)({
|
|
17551
|
+
center: shouldRotate ? [plated_hole.x, plated_hole.y - rectLength / 2, 0] : [plated_hole.x - rectLength / 2, plated_hole.y, 0],
|
|
17552
|
+
radius: holeRadius,
|
|
17553
|
+
height: 1.2
|
|
17554
|
+
});
|
|
17555
|
+
const rightCap = (0, import_primitives3.cylinder)({
|
|
17556
|
+
center: shouldRotate ? [plated_hole.x, plated_hole.y + rectLength / 2, 0] : [plated_hole.x + rectLength / 2, plated_hole.y, 0],
|
|
17557
|
+
radius: holeRadius,
|
|
17558
|
+
height: 1.2
|
|
17559
|
+
});
|
|
17560
|
+
const topPad = (0, import_primitives3.cuboid)({
|
|
17561
|
+
center: [plated_hole.x, plated_hole.y, 1.2 / 2],
|
|
17562
|
+
size: [padWidth, padHeight, platedHoleLipHeight]
|
|
17563
|
+
});
|
|
17564
|
+
const bottomPad = (0, import_primitives3.cuboid)({
|
|
17565
|
+
center: [plated_hole.x, plated_hole.y, -1.2 / 2],
|
|
17566
|
+
size: [padWidth, padHeight, platedHoleLipHeight]
|
|
17567
|
+
});
|
|
17568
|
+
const holeCut = (0, import_booleans.union)(
|
|
17569
|
+
(0, import_primitives3.cuboid)({
|
|
17570
|
+
center: [plated_hole.x, plated_hole.y, 0],
|
|
17571
|
+
size: shouldRotate ? [holeHeight - platedHoleLipHeight, rectLength, 1.5] : [rectLength, holeHeight - platedHoleLipHeight, 1.5]
|
|
17572
|
+
}),
|
|
17573
|
+
(0, import_primitives3.cylinder)({
|
|
17574
|
+
center: shouldRotate ? [plated_hole.x, plated_hole.y - rectLength / 2, 0] : [plated_hole.x - rectLength / 2, plated_hole.y, 0],
|
|
17575
|
+
radius: holeRadius - platedHoleLipHeight,
|
|
17576
|
+
height: 1.5
|
|
17577
|
+
}),
|
|
17578
|
+
(0, import_primitives3.cylinder)({
|
|
17579
|
+
center: shouldRotate ? [plated_hole.x, plated_hole.y + rectLength / 2, 0] : [plated_hole.x + rectLength / 2, plated_hole.y, 0],
|
|
17580
|
+
radius: holeRadius - platedHoleLipHeight,
|
|
17581
|
+
height: 1.5
|
|
17582
|
+
})
|
|
17583
|
+
);
|
|
17584
|
+
return (0, import_colors2.colorize)(
|
|
17585
|
+
colors.copper,
|
|
17586
|
+
(0, import_booleans.subtract)((0, import_booleans.union)(mainRect, leftCap, rightCap, topPad, bottomPad), holeCut)
|
|
17587
|
+
);
|
|
17504
17588
|
} else {
|
|
17505
17589
|
throw new Error(`Unsupported plated hole shape: ${plated_hole.shape}`);
|
|
17506
17590
|
}
|
|
@@ -18053,7 +18137,7 @@ var BoardGeomBuilder = class {
|
|
|
18053
18137
|
}
|
|
18054
18138
|
processPlatedHole(ph, opts = {}) {
|
|
18055
18139
|
if (!this.boardGeom) return;
|
|
18056
|
-
if (ph.shape === "circle") {
|
|
18140
|
+
if (ph.shape === "circle" || ph.shape === "circular_hole_with_rect_pad") {
|
|
18057
18141
|
const cyGeom = (0, import_primitives5.cylinder)({
|
|
18058
18142
|
center: [ph.x, ph.y, 0],
|
|
18059
18143
|
radius: ph.hole_diameter / 2 + M,
|
|
@@ -18066,7 +18150,7 @@ var BoardGeomBuilder = class {
|
|
|
18066
18150
|
}
|
|
18067
18151
|
const platedHoleGeom = platedHole(ph, this.ctx);
|
|
18068
18152
|
this.platedHoleGeoms.push(platedHoleGeom);
|
|
18069
|
-
} else if (ph.shape === "pill") {
|
|
18153
|
+
} else if (ph.shape === "pill" || ph.shape === "pill_hole_with_rect_pad") {
|
|
18070
18154
|
const shouldRotate = ph.hole_height > ph.hole_width;
|
|
18071
18155
|
const holeWidth = shouldRotate ? ph.hole_height : ph.hole_width;
|
|
18072
18156
|
const holeHeight = shouldRotate ? ph.hole_width : ph.hole_height;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/3d-viewer",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.229",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@react-three/drei": "^9.121.4",
|
|
33
33
|
"@react-three/fiber": "^8.17.14",
|
|
34
34
|
"@tscircuit/core": "^0.0.416",
|
|
35
|
-
"@tscircuit/props": "^0.0.
|
|
35
|
+
"@tscircuit/props": "^0.0.186",
|
|
36
36
|
"@tscircuit/soup-util": "^0.0.41",
|
|
37
37
|
"jscad-electronics": "^0.0.27",
|
|
38
38
|
"jscad-fiber": "^0.0.79",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"@vitejs/plugin-react": "^4.3.4",
|
|
65
65
|
"bun-match-svg": "^0.0.9",
|
|
66
66
|
"bun-types": "^1.2.1",
|
|
67
|
-
"circuit-json": "^0.0.
|
|
68
|
-
"circuit-to-svg": "^0.0.
|
|
67
|
+
"circuit-json": "^0.0.185",
|
|
68
|
+
"circuit-to-svg": "^0.0.130",
|
|
69
69
|
"debug": "^4.4.0",
|
|
70
70
|
"jsdom": "^26.0.0",
|
|
71
71
|
"semver": "^7.7.0",
|