@tscircuit/3d-viewer 0.0.280 → 0.0.282
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 +97 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -17282,7 +17282,7 @@ import {
|
|
|
17282
17282
|
// package.json
|
|
17283
17283
|
var package_default = {
|
|
17284
17284
|
name: "@tscircuit/3d-viewer",
|
|
17285
|
-
version: "0.0.
|
|
17285
|
+
version: "0.0.281",
|
|
17286
17286
|
main: "./dist/index.js",
|
|
17287
17287
|
module: "./dist/index.js",
|
|
17288
17288
|
type: "module",
|
|
@@ -17314,7 +17314,7 @@ var package_default = {
|
|
|
17314
17314
|
"@react-three/drei": "^9.121.4",
|
|
17315
17315
|
"@react-three/fiber": "^8.17.14",
|
|
17316
17316
|
"@tscircuit/core": "^0.0.454",
|
|
17317
|
-
"@tscircuit/props": "^0.0.
|
|
17317
|
+
"@tscircuit/props": "^0.0.240",
|
|
17318
17318
|
"@tscircuit/soup-util": "^0.0.41",
|
|
17319
17319
|
"jscad-electronics": "^0.0.29",
|
|
17320
17320
|
"jscad-fiber": "^0.0.79",
|
|
@@ -19410,7 +19410,7 @@ function processPlatedHolesForManifold(Manifold, circuitJson, pcbThickness, mani
|
|
|
19410
19410
|
let platedPart = Manifold.cylinder(
|
|
19411
19411
|
copperPartThickness,
|
|
19412
19412
|
ph.outer_diameter / 2,
|
|
19413
|
-
|
|
19413
|
+
ph.outer_diameter / 2,
|
|
19414
19414
|
SMOOTH_CIRCLE_SEGMENTS,
|
|
19415
19415
|
true
|
|
19416
19416
|
);
|
|
@@ -19419,7 +19419,7 @@ function processPlatedHolesForManifold(Manifold, circuitJson, pcbThickness, mani
|
|
|
19419
19419
|
copperPartThickness * 1.05,
|
|
19420
19420
|
// ensure it cuts through
|
|
19421
19421
|
ph.hole_diameter / 2,
|
|
19422
|
-
|
|
19422
|
+
ph.hole_diameter / 2,
|
|
19423
19423
|
SMOOTH_CIRCLE_SEGMENTS,
|
|
19424
19424
|
true
|
|
19425
19425
|
);
|
|
@@ -19436,6 +19436,99 @@ function processPlatedHolesForManifold(Manifold, circuitJson, pcbThickness, mani
|
|
|
19436
19436
|
geometry: threeGeom,
|
|
19437
19437
|
color: COPPER_COLOR
|
|
19438
19438
|
});
|
|
19439
|
+
} else if (ph.shape === "pill") {
|
|
19440
|
+
const holeWidthRaw = ph.hole_width;
|
|
19441
|
+
const holeHeightRaw = ph.hole_height;
|
|
19442
|
+
const shouldRotate = holeHeightRaw > holeWidthRaw;
|
|
19443
|
+
const holeW = shouldRotate ? holeHeightRaw : holeWidthRaw;
|
|
19444
|
+
const holeH = shouldRotate ? holeWidthRaw : holeHeightRaw;
|
|
19445
|
+
const defaultPadExtension = 0.4;
|
|
19446
|
+
const outerW = shouldRotate ? ph.outer_height ?? holeH + defaultPadExtension / 2 : ph.outer_width ?? holeW + defaultPadExtension / 2;
|
|
19447
|
+
const outerH = shouldRotate ? ph.outer_width ?? holeW + defaultPadExtension / 2 : ph.outer_height ?? holeH + defaultPadExtension / 2;
|
|
19448
|
+
const createPill = (width, height, depth) => {
|
|
19449
|
+
const radius = height / 2;
|
|
19450
|
+
const rectLength = width - height;
|
|
19451
|
+
let pillOp;
|
|
19452
|
+
if (rectLength < 1e-9) {
|
|
19453
|
+
pillOp = Manifold.cylinder(
|
|
19454
|
+
depth,
|
|
19455
|
+
radius,
|
|
19456
|
+
radius,
|
|
19457
|
+
SMOOTH_CIRCLE_SEGMENTS,
|
|
19458
|
+
true
|
|
19459
|
+
);
|
|
19460
|
+
} else {
|
|
19461
|
+
const rect = Manifold.cube(
|
|
19462
|
+
[Math.max(0, rectLength), height, depth],
|
|
19463
|
+
true
|
|
19464
|
+
);
|
|
19465
|
+
const cap1 = Manifold.cylinder(
|
|
19466
|
+
depth,
|
|
19467
|
+
radius,
|
|
19468
|
+
radius,
|
|
19469
|
+
SMOOTH_CIRCLE_SEGMENTS,
|
|
19470
|
+
true
|
|
19471
|
+
).translate([-rectLength / 2, 0, 0]);
|
|
19472
|
+
const cap2 = Manifold.cylinder(
|
|
19473
|
+
depth,
|
|
19474
|
+
radius,
|
|
19475
|
+
radius,
|
|
19476
|
+
SMOOTH_CIRCLE_SEGMENTS,
|
|
19477
|
+
true
|
|
19478
|
+
).translate([rectLength / 2, 0, 0]);
|
|
19479
|
+
pillOp = Manifold.union([rect, cap1, cap2]);
|
|
19480
|
+
manifoldInstancesForCleanup.push(rect, cap1, cap2);
|
|
19481
|
+
}
|
|
19482
|
+
manifoldInstancesForCleanup.push(pillOp);
|
|
19483
|
+
return pillOp;
|
|
19484
|
+
};
|
|
19485
|
+
const drillW = holeW + 2 * MANIFOLD_Z_OFFSET;
|
|
19486
|
+
const drillH = holeH + 2 * MANIFOLD_Z_OFFSET;
|
|
19487
|
+
const drillDepth = pcbThickness * 1.2;
|
|
19488
|
+
let boardPillDrillOp = createPill(drillW, drillH, drillDepth);
|
|
19489
|
+
if (shouldRotate) {
|
|
19490
|
+
const rotatedOp = boardPillDrillOp.rotate([0, 0, 90]);
|
|
19491
|
+
manifoldInstancesForCleanup.push(rotatedOp);
|
|
19492
|
+
boardPillDrillOp = rotatedOp;
|
|
19493
|
+
}
|
|
19494
|
+
const translatedBoardPillDrill = boardPillDrillOp.translate([
|
|
19495
|
+
ph.x,
|
|
19496
|
+
ph.y,
|
|
19497
|
+
0
|
|
19498
|
+
]);
|
|
19499
|
+
manifoldInstancesForCleanup.push(translatedBoardPillDrill);
|
|
19500
|
+
platedHoleBoardDrills.push(translatedBoardPillDrill);
|
|
19501
|
+
const copperPartThickness = pcbThickness + 2 * MANIFOLD_Z_OFFSET;
|
|
19502
|
+
const outerCopperOpUnrotated = createPill(
|
|
19503
|
+
outerW,
|
|
19504
|
+
outerH,
|
|
19505
|
+
copperPartThickness
|
|
19506
|
+
);
|
|
19507
|
+
const innerDrillOpUnrotated = createPill(
|
|
19508
|
+
holeW,
|
|
19509
|
+
holeH,
|
|
19510
|
+
copperPartThickness * 1.05
|
|
19511
|
+
// Make drill slightly thicker to ensure cut
|
|
19512
|
+
);
|
|
19513
|
+
let finalPlatedPartOp = outerCopperOpUnrotated.subtract(
|
|
19514
|
+
innerDrillOpUnrotated
|
|
19515
|
+
);
|
|
19516
|
+
manifoldInstancesForCleanup.push(finalPlatedPartOp);
|
|
19517
|
+
if (shouldRotate) {
|
|
19518
|
+
const rotatedOp = finalPlatedPartOp.rotate([0, 0, 90]);
|
|
19519
|
+
manifoldInstancesForCleanup.push(rotatedOp);
|
|
19520
|
+
finalPlatedPartOp = rotatedOp;
|
|
19521
|
+
}
|
|
19522
|
+
const translatedPlatedPart = finalPlatedPartOp.translate([ph.x, ph.y, 0]);
|
|
19523
|
+
manifoldInstancesForCleanup.push(translatedPlatedPart);
|
|
19524
|
+
const threeGeom = manifoldMeshToThreeGeometry(
|
|
19525
|
+
translatedPlatedPart.getMesh()
|
|
19526
|
+
);
|
|
19527
|
+
platedHoleCopperGeoms.push({
|
|
19528
|
+
key: `ph-${ph.pcb_plated_hole_id || index}`,
|
|
19529
|
+
geometry: threeGeom,
|
|
19530
|
+
color: COPPER_COLOR
|
|
19531
|
+
});
|
|
19439
19532
|
}
|
|
19440
19533
|
});
|
|
19441
19534
|
return { platedHoleBoardDrills, platedHoleCopperGeoms };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/3d-viewer",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.282",
|
|
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.454",
|
|
35
|
-
"@tscircuit/props": "^0.0.
|
|
35
|
+
"@tscircuit/props": "^0.0.240",
|
|
36
36
|
"@tscircuit/soup-util": "^0.0.41",
|
|
37
37
|
"jscad-electronics": "^0.0.29",
|
|
38
38
|
"jscad-fiber": "^0.0.79",
|