@tscircuit/3d-viewer 0.0.412 → 0.0.413
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 +354 -158
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -16636,8 +16636,8 @@ var pcb_fabrication_note_dimension = z93.object({
|
|
|
16636
16636
|
pcb_group_id: z93.string().optional(),
|
|
16637
16637
|
subcircuit_id: z93.string().optional(),
|
|
16638
16638
|
layer: visible_layer,
|
|
16639
|
-
from: point
|
|
16640
|
-
to: point
|
|
16639
|
+
from: point,
|
|
16640
|
+
to: point,
|
|
16641
16641
|
text: z93.string().optional(),
|
|
16642
16642
|
offset: length.optional(),
|
|
16643
16643
|
font: z93.literal("tscircuit2024").default("tscircuit2024"),
|
|
@@ -26576,7 +26576,7 @@ import * as THREE13 from "three";
|
|
|
26576
26576
|
// package.json
|
|
26577
26577
|
var package_default = {
|
|
26578
26578
|
name: "@tscircuit/3d-viewer",
|
|
26579
|
-
version: "0.0.
|
|
26579
|
+
version: "0.0.412",
|
|
26580
26580
|
main: "./dist/index.js",
|
|
26581
26581
|
module: "./dist/index.js",
|
|
26582
26582
|
type: "module",
|
|
@@ -26623,8 +26623,8 @@ var package_default = {
|
|
|
26623
26623
|
"@storybook/blocks": "9.0.0-alpha.17",
|
|
26624
26624
|
"@storybook/react-vite": "^9.1.5",
|
|
26625
26625
|
"@tscircuit/circuit-json-util": "^0.0.72",
|
|
26626
|
-
"@tscircuit/core": "^0.0.
|
|
26627
|
-
"@tscircuit/props": "^0.0.
|
|
26626
|
+
"@tscircuit/core": "^0.0.787",
|
|
26627
|
+
"@tscircuit/props": "^0.0.364",
|
|
26628
26628
|
"@tscircuit/checks": "^0.0.85",
|
|
26629
26629
|
"@tscircuit/math-utils": "^0.0.27",
|
|
26630
26630
|
"@tscircuit/capacity-autorouter": "^0.0.131",
|
|
@@ -26636,7 +26636,7 @@ var package_default = {
|
|
|
26636
26636
|
"@vitejs/plugin-react": "^4.3.4",
|
|
26637
26637
|
"bun-match-svg": "^0.0.9",
|
|
26638
26638
|
"bun-types": "1.2.1",
|
|
26639
|
-
"circuit-json": "0.0.
|
|
26639
|
+
"circuit-json": "0.0.279",
|
|
26640
26640
|
"circuit-to-svg": "^0.0.179",
|
|
26641
26641
|
debug: "^4.4.0",
|
|
26642
26642
|
"jscad-electronics": "^0.0.48",
|
|
@@ -27519,38 +27519,67 @@ var platedHole = (plated_hole, ctx, options = {}) => {
|
|
|
27519
27519
|
return (0, import_colors2.colorize)(colors.copper, (0, import_booleans.subtract)(copperSolid, drill));
|
|
27520
27520
|
}
|
|
27521
27521
|
if (plated_hole.shape === "circular_hole_with_rect_pad") {
|
|
27522
|
+
const holeOffsetX = plated_hole.hole_offset_x || 0;
|
|
27523
|
+
const holeOffsetY = plated_hole.hole_offset_y || 0;
|
|
27522
27524
|
const padWidth = plated_hole.rect_pad_width || plated_hole.hole_diameter;
|
|
27523
27525
|
const padHeight = plated_hole.rect_pad_height || plated_hole.hole_diameter;
|
|
27524
27526
|
const rectBorderRadius = extractRectBorderRadius(plated_hole);
|
|
27525
27527
|
const copperSolid = maybeClip(
|
|
27526
27528
|
(0, import_booleans.union)(
|
|
27527
|
-
// Top rectangular pad
|
|
27529
|
+
// Top rectangular pad (thicker to ensure connection)
|
|
27528
27530
|
createRectPadGeom({
|
|
27529
27531
|
width: padWidth,
|
|
27530
27532
|
height: padHeight,
|
|
27531
|
-
thickness: platedHoleLipHeight,
|
|
27533
|
+
thickness: platedHoleLipHeight + 0.1,
|
|
27534
|
+
// Slightly thicker to ensure connection
|
|
27532
27535
|
center: [
|
|
27533
27536
|
plated_hole.x,
|
|
27534
27537
|
plated_hole.y,
|
|
27535
|
-
ctx.pcbThickness / 2 + platedHoleLipHeight / 2 + M
|
|
27538
|
+
ctx.pcbThickness / 2 + platedHoleLipHeight / 2 + M - 0.05
|
|
27539
|
+
// Adjusted for thickness
|
|
27536
27540
|
],
|
|
27537
27541
|
borderRadius: rectBorderRadius
|
|
27538
27542
|
}),
|
|
27539
|
-
// Bottom rectangular pad
|
|
27543
|
+
// Bottom rectangular pad (thicker to ensure connection)
|
|
27540
27544
|
createRectPadGeom({
|
|
27541
27545
|
width: padWidth,
|
|
27542
27546
|
height: padHeight,
|
|
27543
|
-
thickness: platedHoleLipHeight,
|
|
27547
|
+
thickness: platedHoleLipHeight + 0.1,
|
|
27548
|
+
// Slightly thicker to ensure connection
|
|
27544
27549
|
center: [
|
|
27545
27550
|
plated_hole.x,
|
|
27546
27551
|
plated_hole.y,
|
|
27547
|
-
-ctx.pcbThickness / 2 - platedHoleLipHeight / 2 - M
|
|
27552
|
+
-ctx.pcbThickness / 2 - platedHoleLipHeight / 2 - M + 0.05
|
|
27553
|
+
// Adjusted for thickness
|
|
27548
27554
|
],
|
|
27549
27555
|
borderRadius: rectBorderRadius
|
|
27550
27556
|
}),
|
|
27551
|
-
//
|
|
27557
|
+
// Main copper fill between pads with rounded corners
|
|
27558
|
+
(() => {
|
|
27559
|
+
const height10 = ctx.pcbThickness - platedHoleLipHeight * 2 - M * 2 + 0.1;
|
|
27560
|
+
const rect2d = (0, import_primitives3.roundedRectangle)({
|
|
27561
|
+
size: [padWidth, padHeight],
|
|
27562
|
+
roundRadius: rectBorderRadius || 0,
|
|
27563
|
+
segments: RECT_PAD_SEGMENTS
|
|
27564
|
+
});
|
|
27565
|
+
const extruded = (0, import_extrusions2.extrudeLinear)({ height: height10 }, rect2d);
|
|
27566
|
+
return (0, import_transforms2.translate)(
|
|
27567
|
+
[
|
|
27568
|
+
plated_hole.x,
|
|
27569
|
+
plated_hole.y,
|
|
27570
|
+
-height10 / 2
|
|
27571
|
+
// Center vertically
|
|
27572
|
+
],
|
|
27573
|
+
extruded
|
|
27574
|
+
);
|
|
27575
|
+
})(),
|
|
27576
|
+
// Plated barrel around hole (ensured connection with pads)
|
|
27552
27577
|
(0, import_primitives3.cylinder)({
|
|
27553
|
-
center: [
|
|
27578
|
+
center: [
|
|
27579
|
+
plated_hole.x + (holeOffsetX || 0),
|
|
27580
|
+
plated_hole.y + (holeOffsetY || 0),
|
|
27581
|
+
0
|
|
27582
|
+
],
|
|
27554
27583
|
radius: plated_hole.hole_diameter / 2,
|
|
27555
27584
|
height: ctx.pcbThickness
|
|
27556
27585
|
})
|
|
@@ -27558,11 +27587,35 @@ var platedHole = (plated_hole, ctx, options = {}) => {
|
|
|
27558
27587
|
clipGeom
|
|
27559
27588
|
);
|
|
27560
27589
|
const drill = (0, import_primitives3.cylinder)({
|
|
27561
|
-
center: [
|
|
27590
|
+
center: [
|
|
27591
|
+
plated_hole.x + (holeOffsetX || 0),
|
|
27592
|
+
plated_hole.y + (holeOffsetY || 0),
|
|
27593
|
+
0
|
|
27594
|
+
],
|
|
27562
27595
|
radius: Math.max(plated_hole.hole_diameter / 2 - M, 0.01),
|
|
27563
27596
|
height: throughDrillHeight
|
|
27564
27597
|
});
|
|
27565
|
-
|
|
27598
|
+
const barrel = (0, import_primitives3.cylinder)({
|
|
27599
|
+
center: [
|
|
27600
|
+
plated_hole.x + (holeOffsetX || 0),
|
|
27601
|
+
plated_hole.y + (holeOffsetY || 0),
|
|
27602
|
+
0
|
|
27603
|
+
],
|
|
27604
|
+
radius: plated_hole.hole_diameter / 2,
|
|
27605
|
+
height: ctx.pcbThickness
|
|
27606
|
+
});
|
|
27607
|
+
let finalCopper = (0, import_booleans.union)(
|
|
27608
|
+
(0, import_booleans.subtract)(copperSolid, barrel),
|
|
27609
|
+
// Subtract the barrel from the main shape
|
|
27610
|
+
barrel
|
|
27611
|
+
// Add the barrel back to ensure proper connection
|
|
27612
|
+
);
|
|
27613
|
+
if (options.clipGeom) {
|
|
27614
|
+
finalCopper = (0, import_booleans.subtract)(finalCopper, drill);
|
|
27615
|
+
finalCopper = (0, import_booleans.intersect)(finalCopper, options.clipGeom);
|
|
27616
|
+
return (0, import_colors2.colorize)(colors.copper, finalCopper);
|
|
27617
|
+
}
|
|
27618
|
+
return (0, import_colors2.colorize)(colors.copper, (0, import_booleans.subtract)(finalCopper, drill));
|
|
27566
27619
|
}
|
|
27567
27620
|
if (plated_hole.shape === "pill") {
|
|
27568
27621
|
const shouldRotate = plated_hole.hole_height > plated_hole.hole_width;
|
|
@@ -27626,6 +27679,8 @@ var platedHole = (plated_hole, ctx, options = {}) => {
|
|
|
27626
27679
|
return (0, import_colors2.colorize)(colors.copper, (0, import_booleans.subtract)(copperSolid, drill));
|
|
27627
27680
|
}
|
|
27628
27681
|
if (plated_hole.shape === "pill_hole_with_rect_pad") {
|
|
27682
|
+
const holeOffsetX = plated_hole.hole_offset_x || 0;
|
|
27683
|
+
const holeOffsetY = plated_hole.hole_offset_y || 0;
|
|
27629
27684
|
const shouldRotate = plated_hole.hole_height > plated_hole.hole_width;
|
|
27630
27685
|
const holeWidth = shouldRotate ? plated_hole.hole_height : plated_hole.hole_width;
|
|
27631
27686
|
const holeHeight = shouldRotate ? plated_hole.hole_width : plated_hole.hole_height;
|
|
@@ -27634,64 +27689,140 @@ var platedHole = (plated_hole, ctx, options = {}) => {
|
|
|
27634
27689
|
const padWidth = plated_hole.rect_pad_width || holeWidth + 0.2;
|
|
27635
27690
|
const padHeight = plated_hole.rect_pad_height || holeHeight + 0.2;
|
|
27636
27691
|
const rectBorderRadius = extractRectBorderRadius(plated_hole);
|
|
27637
|
-
const
|
|
27638
|
-
|
|
27639
|
-
|
|
27640
|
-
|
|
27641
|
-
|
|
27642
|
-
|
|
27643
|
-
|
|
27644
|
-
|
|
27645
|
-
|
|
27646
|
-
|
|
27647
|
-
|
|
27648
|
-
|
|
27649
|
-
|
|
27650
|
-
|
|
27651
|
-
|
|
27652
|
-
|
|
27653
|
-
|
|
27654
|
-
|
|
27655
|
-
|
|
27656
|
-
|
|
27657
|
-
|
|
27658
|
-
|
|
27659
|
-
|
|
27660
|
-
|
|
27661
|
-
|
|
27662
|
-
|
|
27692
|
+
const barrelMargin = 0.03;
|
|
27693
|
+
const barrel = (0, import_booleans.union)(
|
|
27694
|
+
(0, import_primitives3.cuboid)({
|
|
27695
|
+
center: [plated_hole.x + holeOffsetX, plated_hole.y + holeOffsetY, 0],
|
|
27696
|
+
size: shouldRotate ? [
|
|
27697
|
+
holeHeight + 2 * barrelMargin,
|
|
27698
|
+
rectLength + 2 * barrelMargin,
|
|
27699
|
+
ctx.pcbThickness + 0.2
|
|
27700
|
+
] : [
|
|
27701
|
+
rectLength + 2 * barrelMargin,
|
|
27702
|
+
holeHeight + 2 * barrelMargin,
|
|
27703
|
+
ctx.pcbThickness + 0.2
|
|
27704
|
+
]
|
|
27705
|
+
}),
|
|
27706
|
+
(0, import_primitives3.cylinder)({
|
|
27707
|
+
center: shouldRotate ? [
|
|
27708
|
+
plated_hole.x + holeOffsetX,
|
|
27709
|
+
plated_hole.y + holeOffsetY - rectLength / 2,
|
|
27710
|
+
0
|
|
27711
|
+
] : [
|
|
27712
|
+
plated_hole.x + holeOffsetX - rectLength / 2,
|
|
27713
|
+
plated_hole.y + holeOffsetY,
|
|
27714
|
+
0
|
|
27715
|
+
],
|
|
27716
|
+
radius: holeRadius + barrelMargin,
|
|
27717
|
+
height: ctx.pcbThickness + 0.2
|
|
27718
|
+
// extend slightly above/below PCB
|
|
27719
|
+
}),
|
|
27720
|
+
(0, import_primitives3.cylinder)({
|
|
27721
|
+
center: shouldRotate ? [
|
|
27722
|
+
plated_hole.x + holeOffsetX,
|
|
27723
|
+
plated_hole.y + holeOffsetY + rectLength / 2,
|
|
27724
|
+
0
|
|
27725
|
+
] : [
|
|
27726
|
+
plated_hole.x + holeOffsetX + rectLength / 2,
|
|
27727
|
+
plated_hole.y + holeOffsetY,
|
|
27728
|
+
0
|
|
27729
|
+
],
|
|
27730
|
+
radius: holeRadius + barrelMargin,
|
|
27731
|
+
height: ctx.pcbThickness + 0.2
|
|
27732
|
+
})
|
|
27733
|
+
);
|
|
27734
|
+
const holeCut = (0, import_booleans.union)(
|
|
27735
|
+
(0, import_primitives3.cuboid)({
|
|
27736
|
+
center: [plated_hole.x + holeOffsetX, plated_hole.y + holeOffsetY, 0],
|
|
27737
|
+
size: shouldRotate ? [holeHeight, rectLength, throughDrillHeight * 1.1] : [rectLength, holeHeight, throughDrillHeight * 1.1]
|
|
27738
|
+
}),
|
|
27739
|
+
(0, import_primitives3.cylinder)({
|
|
27740
|
+
center: shouldRotate ? [
|
|
27741
|
+
plated_hole.x + holeOffsetX,
|
|
27742
|
+
plated_hole.y + holeOffsetY - rectLength / 2,
|
|
27743
|
+
0
|
|
27744
|
+
] : [
|
|
27745
|
+
plated_hole.x + holeOffsetX - rectLength / 2,
|
|
27746
|
+
plated_hole.y + holeOffsetY,
|
|
27747
|
+
0
|
|
27748
|
+
],
|
|
27749
|
+
radius: holeRadius,
|
|
27750
|
+
height: throughDrillHeight * 1.1
|
|
27751
|
+
}),
|
|
27752
|
+
(0, import_primitives3.cylinder)({
|
|
27753
|
+
center: shouldRotate ? [
|
|
27754
|
+
plated_hole.x + holeOffsetX,
|
|
27755
|
+
plated_hole.y + holeOffsetY + rectLength / 2,
|
|
27756
|
+
0
|
|
27757
|
+
] : [
|
|
27758
|
+
plated_hole.x + holeOffsetX + rectLength / 2,
|
|
27759
|
+
plated_hole.y + holeOffsetY,
|
|
27760
|
+
0
|
|
27761
|
+
],
|
|
27762
|
+
radius: holeRadius,
|
|
27763
|
+
height: throughDrillHeight * 1.1
|
|
27764
|
+
})
|
|
27765
|
+
);
|
|
27766
|
+
const mainFill = createRectPadGeom({
|
|
27663
27767
|
width: padWidth,
|
|
27664
27768
|
height: padHeight,
|
|
27665
|
-
thickness: platedHoleLipHeight,
|
|
27666
|
-
center: [
|
|
27667
|
-
plated_hole.x,
|
|
27668
|
-
plated_hole.y,
|
|
27669
|
-
-ctx.pcbThickness / 2 - platedHoleLipHeight / 2 - M
|
|
27670
|
-
],
|
|
27769
|
+
thickness: ctx.pcbThickness - 2 * platedHoleLipHeight - M * 2 + 0.1,
|
|
27770
|
+
center: [plated_hole.x, plated_hole.y, 0],
|
|
27671
27771
|
borderRadius: rectBorderRadius
|
|
27672
27772
|
});
|
|
27673
|
-
const
|
|
27773
|
+
const createPadWithHole = (zOffset) => {
|
|
27774
|
+
const pad2 = createRectPadGeom({
|
|
27775
|
+
width: padWidth,
|
|
27776
|
+
height: padHeight,
|
|
27777
|
+
thickness: platedHoleLipHeight + 0.1,
|
|
27778
|
+
center: [plated_hole.x, plated_hole.y, zOffset],
|
|
27779
|
+
borderRadius: rectBorderRadius
|
|
27780
|
+
});
|
|
27781
|
+
return (0, import_booleans.subtract)(pad2, holeCut);
|
|
27782
|
+
};
|
|
27783
|
+
const topPad = createPadWithHole(
|
|
27784
|
+
ctx.pcbThickness / 2 - platedHoleLipHeight / 2 + 0.05
|
|
27785
|
+
);
|
|
27786
|
+
const bottomPad = createPadWithHole(
|
|
27787
|
+
-ctx.pcbThickness / 2 + platedHoleLipHeight / 2 - 0.05
|
|
27788
|
+
);
|
|
27789
|
+
const filledArea = (0, import_booleans.subtract)(mainFill, holeCut);
|
|
27790
|
+
const barrelHoleCut = (0, import_booleans.union)(
|
|
27674
27791
|
(0, import_primitives3.cuboid)({
|
|
27675
|
-
center: [plated_hole.x, plated_hole.y, 0],
|
|
27676
|
-
size: shouldRotate ? [holeHeight -
|
|
27792
|
+
center: [plated_hole.x + holeOffsetX, plated_hole.y + holeOffsetY, 0],
|
|
27793
|
+
size: shouldRotate ? [holeHeight - 2 * M, rectLength - 2 * M, throughDrillHeight * 1.1] : [rectLength - 2 * M, holeHeight - 2 * M, throughDrillHeight * 1.1]
|
|
27677
27794
|
}),
|
|
27678
27795
|
(0, import_primitives3.cylinder)({
|
|
27679
|
-
center: shouldRotate ? [
|
|
27680
|
-
|
|
27681
|
-
|
|
27796
|
+
center: shouldRotate ? [
|
|
27797
|
+
plated_hole.x + holeOffsetX,
|
|
27798
|
+
plated_hole.y + holeOffsetY - rectLength / 2,
|
|
27799
|
+
0
|
|
27800
|
+
] : [
|
|
27801
|
+
plated_hole.x + holeOffsetX - rectLength / 2,
|
|
27802
|
+
plated_hole.y + holeOffsetY,
|
|
27803
|
+
0
|
|
27804
|
+
],
|
|
27805
|
+
radius: holeRadius - M,
|
|
27806
|
+
height: throughDrillHeight * 1.1
|
|
27682
27807
|
}),
|
|
27683
27808
|
(0, import_primitives3.cylinder)({
|
|
27684
|
-
center: shouldRotate ? [
|
|
27685
|
-
|
|
27686
|
-
|
|
27809
|
+
center: shouldRotate ? [
|
|
27810
|
+
plated_hole.x + holeOffsetX,
|
|
27811
|
+
plated_hole.y + holeOffsetY + rectLength / 2,
|
|
27812
|
+
0
|
|
27813
|
+
] : [
|
|
27814
|
+
plated_hole.x + holeOffsetX + rectLength / 2,
|
|
27815
|
+
plated_hole.y + holeOffsetY,
|
|
27816
|
+
0
|
|
27817
|
+
],
|
|
27818
|
+
radius: holeRadius - M,
|
|
27819
|
+
height: throughDrillHeight * 1.1
|
|
27687
27820
|
})
|
|
27688
27821
|
);
|
|
27689
|
-
const
|
|
27690
|
-
|
|
27691
|
-
|
|
27692
|
-
);
|
|
27693
|
-
const drill = holeCut;
|
|
27694
|
-
return (0, import_colors2.colorize)(colors.copper, (0, import_booleans.subtract)(copperSolid, drill));
|
|
27822
|
+
const barrelWithHole = (0, import_booleans.subtract)(barrel, barrelHoleCut);
|
|
27823
|
+
const finalCopper = (0, import_booleans.union)(filledArea, barrelWithHole, topPad, bottomPad);
|
|
27824
|
+
let result = maybeClip(finalCopper, clipGeom);
|
|
27825
|
+
return (0, import_colors2.colorize)(colors.copper, result);
|
|
27695
27826
|
} else {
|
|
27696
27827
|
throw new Error(`Unsupported plated hole shape: ${plated_hole.shape}`);
|
|
27697
27828
|
}
|
|
@@ -28421,13 +28552,24 @@ var BoardGeomBuilder = class {
|
|
|
28421
28552
|
processPlatedHole(ph, opts = {}) {
|
|
28422
28553
|
if (!this.boardGeom) return;
|
|
28423
28554
|
if (ph.shape === "circle" || ph.shape === "circular_hole_with_rect_pad") {
|
|
28424
|
-
|
|
28425
|
-
|
|
28426
|
-
|
|
28427
|
-
|
|
28428
|
-
|
|
28429
|
-
|
|
28430
|
-
|
|
28555
|
+
let cyGeom = null;
|
|
28556
|
+
if (ph.shape === "circular_hole_with_rect_pad") {
|
|
28557
|
+
cyGeom = (0, import_primitives6.cylinder)({
|
|
28558
|
+
center: [ph.x + ph.hole_offset_x, ph.y + ph.hole_offset_y, 0],
|
|
28559
|
+
radius: ph.hole_diameter / 2 + M,
|
|
28560
|
+
// Add margin for subtraction
|
|
28561
|
+
height: this.ctx.pcbThickness * 1.5
|
|
28562
|
+
// Ensure it cuts through
|
|
28563
|
+
});
|
|
28564
|
+
} else {
|
|
28565
|
+
cyGeom = (0, import_primitives6.cylinder)({
|
|
28566
|
+
center: [ph.x, ph.y, 0],
|
|
28567
|
+
radius: ph.hole_diameter / 2 + M,
|
|
28568
|
+
// Add margin for subtraction
|
|
28569
|
+
height: this.ctx.pcbThickness * 1.5
|
|
28570
|
+
// Ensure it cuts through
|
|
28571
|
+
});
|
|
28572
|
+
}
|
|
28431
28573
|
if (!opts.dontCutBoard) {
|
|
28432
28574
|
this.boardGeom = (0, import_booleans3.subtract)(this.boardGeom, cyGeom);
|
|
28433
28575
|
}
|
|
@@ -28444,22 +28586,58 @@ var BoardGeomBuilder = class {
|
|
|
28444
28586
|
const holeHeight = shouldRotate ? ph.hole_width : ph.hole_height;
|
|
28445
28587
|
const holeRadius = holeHeight / 2;
|
|
28446
28588
|
const rectLength = Math.abs(holeWidth - holeHeight);
|
|
28447
|
-
|
|
28448
|
-
|
|
28449
|
-
|
|
28450
|
-
|
|
28451
|
-
|
|
28452
|
-
|
|
28453
|
-
|
|
28454
|
-
|
|
28455
|
-
|
|
28456
|
-
|
|
28457
|
-
|
|
28458
|
-
|
|
28459
|
-
|
|
28460
|
-
|
|
28461
|
-
|
|
28462
|
-
|
|
28589
|
+
let pillHole;
|
|
28590
|
+
if (ph.shape === "pill_hole_with_rect_pad") {
|
|
28591
|
+
pillHole = (0, import_booleans3.union)(
|
|
28592
|
+
(0, import_primitives6.cuboid)({
|
|
28593
|
+
center: [ph.x + ph.hole_offset_x, ph.y + ph.hole_offset_y, 0],
|
|
28594
|
+
size: shouldRotate ? [holeHeight, rectLength, this.ctx.pcbThickness * 1.5] : [rectLength, holeHeight, this.ctx.pcbThickness * 1.5]
|
|
28595
|
+
}),
|
|
28596
|
+
(0, import_primitives6.cylinder)({
|
|
28597
|
+
center: shouldRotate ? [
|
|
28598
|
+
ph.x + ph.hole_offset_x,
|
|
28599
|
+
ph.y + ph.hole_offset_y - rectLength / 2,
|
|
28600
|
+
0
|
|
28601
|
+
] : [
|
|
28602
|
+
ph.x + ph.hole_offset_x - rectLength / 2,
|
|
28603
|
+
ph.y + ph.hole_offset_y,
|
|
28604
|
+
0
|
|
28605
|
+
],
|
|
28606
|
+
radius: holeRadius,
|
|
28607
|
+
height: this.ctx.pcbThickness * 1.5
|
|
28608
|
+
}),
|
|
28609
|
+
(0, import_primitives6.cylinder)({
|
|
28610
|
+
center: shouldRotate ? [
|
|
28611
|
+
ph.x + ph.hole_offset_x,
|
|
28612
|
+
ph.y + ph.hole_offset_y + rectLength / 2,
|
|
28613
|
+
0
|
|
28614
|
+
] : [
|
|
28615
|
+
ph.x + ph.hole_offset_x + rectLength / 2,
|
|
28616
|
+
ph.y + ph.hole_offset_y,
|
|
28617
|
+
0
|
|
28618
|
+
],
|
|
28619
|
+
radius: holeRadius,
|
|
28620
|
+
height: this.ctx.pcbThickness * 1.5
|
|
28621
|
+
})
|
|
28622
|
+
);
|
|
28623
|
+
} else {
|
|
28624
|
+
pillHole = (0, import_booleans3.union)(
|
|
28625
|
+
(0, import_primitives6.cuboid)({
|
|
28626
|
+
center: [ph.x, ph.y, 0],
|
|
28627
|
+
size: shouldRotate ? [holeHeight, rectLength, this.ctx.pcbThickness * 1.5] : [rectLength, holeHeight, this.ctx.pcbThickness * 1.5]
|
|
28628
|
+
}),
|
|
28629
|
+
(0, import_primitives6.cylinder)({
|
|
28630
|
+
center: shouldRotate ? [ph.x, ph.y - rectLength / 2, 0] : [ph.x - rectLength / 2, ph.y, 0],
|
|
28631
|
+
radius: holeRadius,
|
|
28632
|
+
height: this.ctx.pcbThickness * 1.5
|
|
28633
|
+
}),
|
|
28634
|
+
(0, import_primitives6.cylinder)({
|
|
28635
|
+
center: shouldRotate ? [ph.x, ph.y + rectLength / 2, 0] : [ph.x + rectLength / 2, ph.y, 0],
|
|
28636
|
+
radius: holeRadius,
|
|
28637
|
+
height: this.ctx.pcbThickness * 1.5
|
|
28638
|
+
})
|
|
28639
|
+
);
|
|
28640
|
+
}
|
|
28463
28641
|
if (!opts.dontCutBoard) {
|
|
28464
28642
|
this.boardGeom = (0, import_booleans3.subtract)(this.boardGeom, pillHole);
|
|
28465
28643
|
}
|
|
@@ -29703,6 +29881,8 @@ function processPlatedHolesForManifold(Manifold, circuitJson, pcbThickness, mani
|
|
|
29703
29881
|
} else if (ph.shape === "pill_hole_with_rect_pad") {
|
|
29704
29882
|
const holeW = ph.hole_width;
|
|
29705
29883
|
const holeH = ph.hole_height;
|
|
29884
|
+
const holeOffsetX = ph.hole_offset_x || 0;
|
|
29885
|
+
const holeOffsetY = ph.hole_offset_y || 0;
|
|
29706
29886
|
const padWidth = ph.rect_pad_width;
|
|
29707
29887
|
const padHeight = ph.rect_pad_height;
|
|
29708
29888
|
const rectBorderRadius = extractRectBorderRadius(ph);
|
|
@@ -29710,7 +29890,9 @@ function processPlatedHolesForManifold(Manifold, circuitJson, pcbThickness, mani
|
|
|
29710
29890
|
const drillW = holeW + 2 * MANIFOLD_Z_OFFSET;
|
|
29711
29891
|
const drillH = holeH + 2 * MANIFOLD_Z_OFFSET;
|
|
29712
29892
|
const drillDepth = pcbThickness * 1.2;
|
|
29713
|
-
let boardPillDrillOp = createPillOp(drillW, drillH, drillDepth)
|
|
29893
|
+
let boardPillDrillOp = createPillOp(drillW, drillH, drillDepth).translate(
|
|
29894
|
+
[holeOffsetX, holeOffsetY, 0]
|
|
29895
|
+
);
|
|
29714
29896
|
const translatedBoardPillDrill = boardPillDrillOp.translate([
|
|
29715
29897
|
ph.x,
|
|
29716
29898
|
ph.y,
|
|
@@ -29718,51 +29900,59 @@ function processPlatedHolesForManifold(Manifold, circuitJson, pcbThickness, mani
|
|
|
29718
29900
|
]);
|
|
29719
29901
|
manifoldInstancesForCleanup.push(translatedBoardPillDrill);
|
|
29720
29902
|
platedHoleBoardDrills.push(translatedBoardPillDrill);
|
|
29721
|
-
|
|
29722
|
-
holeW,
|
|
29723
|
-
holeH,
|
|
29724
|
-
pcbThickness + 2 * MANIFOLD_Z_OFFSET
|
|
29725
|
-
);
|
|
29726
|
-
let topPadOp = createRoundedRectPrism({
|
|
29903
|
+
const mainFill = createRoundedRectPrism({
|
|
29727
29904
|
Manifold,
|
|
29728
29905
|
width: padWidth,
|
|
29729
29906
|
height: padHeight,
|
|
29730
|
-
thickness: padThickness,
|
|
29907
|
+
thickness: pcbThickness - 2 * padThickness + 0.1,
|
|
29908
|
+
// Fill between pads
|
|
29731
29909
|
borderRadius: rectBorderRadius
|
|
29732
29910
|
});
|
|
29733
|
-
manifoldInstancesForCleanup.push(
|
|
29734
|
-
|
|
29911
|
+
manifoldInstancesForCleanup.push(mainFill);
|
|
29912
|
+
const topPad = createRoundedRectPrism({
|
|
29735
29913
|
Manifold,
|
|
29736
29914
|
width: padWidth,
|
|
29737
29915
|
height: padHeight,
|
|
29738
|
-
thickness: padThickness,
|
|
29916
|
+
thickness: padThickness + 0.1,
|
|
29739
29917
|
borderRadius: rectBorderRadius
|
|
29740
|
-
});
|
|
29741
|
-
|
|
29742
|
-
|
|
29743
|
-
|
|
29744
|
-
|
|
29745
|
-
|
|
29746
|
-
|
|
29747
|
-
|
|
29748
|
-
|
|
29749
|
-
|
|
29750
|
-
|
|
29751
|
-
|
|
29918
|
+
}).translate([0, 0, pcbThickness / 2 - padThickness / 2 + 0.05]);
|
|
29919
|
+
const bottomPad = createRoundedRectPrism({
|
|
29920
|
+
Manifold,
|
|
29921
|
+
width: padWidth,
|
|
29922
|
+
height: padHeight,
|
|
29923
|
+
thickness: padThickness + 0.1,
|
|
29924
|
+
borderRadius: rectBorderRadius
|
|
29925
|
+
}).translate([0, 0, -pcbThickness / 2 + padThickness / 2 - 0.05]);
|
|
29926
|
+
manifoldInstancesForCleanup.push(topPad, bottomPad);
|
|
29927
|
+
const barrelPill = createPillOp(
|
|
29928
|
+
holeW,
|
|
29929
|
+
holeH,
|
|
29930
|
+
pcbThickness * 1.02
|
|
29931
|
+
// Slightly taller than board
|
|
29932
|
+
).translate([holeOffsetX, holeOffsetY, 0]);
|
|
29933
|
+
manifoldInstancesForCleanup.push(barrelPill);
|
|
29934
|
+
const copperUnion = Manifold.union([
|
|
29935
|
+
mainFill,
|
|
29936
|
+
topPad,
|
|
29937
|
+
bottomPad,
|
|
29938
|
+
barrelPill
|
|
29752
29939
|
]);
|
|
29753
|
-
manifoldInstancesForCleanup.push(
|
|
29754
|
-
const
|
|
29755
|
-
|
|
29756
|
-
|
|
29757
|
-
|
|
29758
|
-
|
|
29759
|
-
|
|
29760
|
-
|
|
29761
|
-
|
|
29762
|
-
|
|
29940
|
+
manifoldInstancesForCleanup.push(copperUnion);
|
|
29941
|
+
const holeCutOp = createPillOp(
|
|
29942
|
+
Math.max(holeW - 2 * PLATED_HOLE_LIP_HEIGHT, 0.01),
|
|
29943
|
+
Math.max(holeH - 2 * PLATED_HOLE_LIP_HEIGHT, 0.01),
|
|
29944
|
+
pcbThickness * 1.2
|
|
29945
|
+
// Ensure it cuts through
|
|
29946
|
+
).translate([holeOffsetX, holeOffsetY, 0]);
|
|
29947
|
+
manifoldInstancesForCleanup.push(holeCutOp);
|
|
29948
|
+
const finalCopper = copperUnion.subtract(holeCutOp);
|
|
29949
|
+
manifoldInstancesForCleanup.push(finalCopper);
|
|
29950
|
+
const translatedCopper = finalCopper.translate([ph.x, ph.y, 0]);
|
|
29951
|
+
manifoldInstancesForCleanup.push(translatedCopper);
|
|
29952
|
+
let finalCopperOp = translatedCopper;
|
|
29763
29953
|
if (boardClipVolume) {
|
|
29764
29954
|
const clipped = Manifold.intersection([
|
|
29765
|
-
|
|
29955
|
+
translatedCopper,
|
|
29766
29956
|
boardClipVolume
|
|
29767
29957
|
]);
|
|
29768
29958
|
manifoldInstancesForCleanup.push(clipped);
|
|
@@ -29775,71 +29965,77 @@ function processPlatedHolesForManifold(Manifold, circuitJson, pcbThickness, mani
|
|
|
29775
29965
|
color: COPPER_COLOR
|
|
29776
29966
|
});
|
|
29777
29967
|
} else if (ph.shape === "circular_hole_with_rect_pad") {
|
|
29968
|
+
const holeOffsetX = ph.hole_offset_x || 0;
|
|
29969
|
+
const holeOffsetY = ph.hole_offset_y || 0;
|
|
29778
29970
|
const translatedDrill = createCircleHoleDrill({
|
|
29779
29971
|
Manifold,
|
|
29780
|
-
x: ph.x,
|
|
29781
|
-
|
|
29972
|
+
x: ph.x + holeOffsetX,
|
|
29973
|
+
// Apply hole offset
|
|
29974
|
+
y: ph.y + holeOffsetY,
|
|
29975
|
+
// Apply hole offset
|
|
29782
29976
|
diameter: ph.hole_diameter,
|
|
29783
29977
|
thickness: pcbThickness,
|
|
29784
29978
|
segments: SMOOTH_CIRCLE_SEGMENTS
|
|
29785
29979
|
});
|
|
29786
29980
|
manifoldInstancesForCleanup.push(translatedDrill);
|
|
29787
29981
|
platedHoleBoardDrills.push(translatedDrill);
|
|
29788
|
-
const copperPartThickness = pcbThickness + 2 * MANIFOLD_Z_OFFSET;
|
|
29789
|
-
const holeRadius = ph.hole_diameter / 2;
|
|
29790
|
-
const barrelCylinder = Manifold.cylinder(
|
|
29791
|
-
copperPartThickness,
|
|
29792
|
-
holeRadius,
|
|
29793
|
-
holeRadius,
|
|
29794
|
-
SMOOTH_CIRCLE_SEGMENTS,
|
|
29795
|
-
true
|
|
29796
|
-
);
|
|
29797
|
-
manifoldInstancesForCleanup.push(barrelCylinder);
|
|
29798
29982
|
const padWidth = ph.rect_pad_width ?? ph.hole_diameter;
|
|
29799
29983
|
const padHeight = ph.rect_pad_height ?? ph.hole_diameter;
|
|
29800
29984
|
const rectBorderRadius = extractRectBorderRadius(ph);
|
|
29801
29985
|
const padThickness = DEFAULT_SMT_PAD_THICKNESS;
|
|
29986
|
+
const holeRadius = ph.hole_diameter / 2;
|
|
29987
|
+
const mainFill = createRoundedRectPrism({
|
|
29988
|
+
Manifold,
|
|
29989
|
+
width: padWidth,
|
|
29990
|
+
height: padHeight,
|
|
29991
|
+
thickness: pcbThickness - 2 * padThickness + 0.1,
|
|
29992
|
+
// Fill between pads
|
|
29993
|
+
borderRadius: rectBorderRadius
|
|
29994
|
+
});
|
|
29995
|
+
manifoldInstancesForCleanup.push(mainFill);
|
|
29802
29996
|
const topPad = createRoundedRectPrism({
|
|
29803
29997
|
Manifold,
|
|
29804
29998
|
width: padWidth,
|
|
29805
29999
|
height: padHeight,
|
|
29806
|
-
thickness: padThickness,
|
|
30000
|
+
thickness: padThickness + 0.1,
|
|
29807
30001
|
borderRadius: rectBorderRadius
|
|
29808
|
-
}).translate([
|
|
29809
|
-
0,
|
|
29810
|
-
0,
|
|
29811
|
-
pcbThickness / 2 + padThickness / 2 + MANIFOLD_Z_OFFSET
|
|
29812
|
-
]);
|
|
30002
|
+
}).translate([0, 0, pcbThickness / 2 - padThickness / 2 + 0.05]);
|
|
29813
30003
|
const bottomPad = createRoundedRectPrism({
|
|
29814
30004
|
Manifold,
|
|
29815
30005
|
width: padWidth,
|
|
29816
30006
|
height: padHeight,
|
|
29817
|
-
thickness: padThickness,
|
|
30007
|
+
thickness: padThickness + 0.1,
|
|
29818
30008
|
borderRadius: rectBorderRadius
|
|
29819
|
-
}).translate([
|
|
29820
|
-
0,
|
|
29821
|
-
0,
|
|
29822
|
-
-pcbThickness / 2 - padThickness / 2 - MANIFOLD_Z_OFFSET
|
|
29823
|
-
]);
|
|
30009
|
+
}).translate([0, 0, -pcbThickness / 2 + padThickness / 2 - 0.05]);
|
|
29824
30010
|
manifoldInstancesForCleanup.push(topPad, bottomPad);
|
|
29825
|
-
const
|
|
29826
|
-
|
|
30011
|
+
const barrelCylinder = Manifold.cylinder(
|
|
30012
|
+
pcbThickness * 1.02,
|
|
30013
|
+
// Slightly taller than board
|
|
30014
|
+
holeRadius,
|
|
30015
|
+
holeRadius,
|
|
30016
|
+
SMOOTH_CIRCLE_SEGMENTS,
|
|
30017
|
+
true
|
|
30018
|
+
).translate([holeOffsetX, holeOffsetY, 0]);
|
|
30019
|
+
manifoldInstancesForCleanup.push(barrelCylinder);
|
|
30020
|
+
const copperUnion = Manifold.union([
|
|
30021
|
+
mainFill,
|
|
29827
30022
|
topPad,
|
|
29828
|
-
bottomPad
|
|
30023
|
+
bottomPad,
|
|
30024
|
+
barrelCylinder
|
|
29829
30025
|
]);
|
|
29830
|
-
manifoldInstancesForCleanup.push(
|
|
29831
|
-
const
|
|
29832
|
-
|
|
29833
|
-
|
|
29834
|
-
|
|
29835
|
-
|
|
30026
|
+
manifoldInstancesForCleanup.push(copperUnion);
|
|
30027
|
+
const holeDrill = Manifold.cylinder(
|
|
30028
|
+
pcbThickness * 1.2,
|
|
30029
|
+
// Ensure it cuts through
|
|
30030
|
+
Math.max(holeRadius - M, 0.01),
|
|
30031
|
+
Math.max(holeRadius - M, 0.01),
|
|
29836
30032
|
SMOOTH_CIRCLE_SEGMENTS,
|
|
29837
30033
|
true
|
|
29838
|
-
);
|
|
29839
|
-
manifoldInstancesForCleanup.push(
|
|
29840
|
-
const
|
|
29841
|
-
manifoldInstancesForCleanup.push(
|
|
29842
|
-
const translatedCopper =
|
|
30034
|
+
).translate([holeOffsetX, holeOffsetY, 0]);
|
|
30035
|
+
manifoldInstancesForCleanup.push(holeDrill);
|
|
30036
|
+
const finalCopper = copperUnion.subtract(holeDrill);
|
|
30037
|
+
manifoldInstancesForCleanup.push(finalCopper);
|
|
30038
|
+
const translatedCopper = finalCopper.translate([ph.x, ph.y, 0]);
|
|
29843
30039
|
manifoldInstancesForCleanup.push(translatedCopper);
|
|
29844
30040
|
let finalCopperOp = translatedCopper;
|
|
29845
30041
|
if (boardClipVolume) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/3d-viewer",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.413",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"@storybook/blocks": "9.0.0-alpha.17",
|
|
48
48
|
"@storybook/react-vite": "^9.1.5",
|
|
49
49
|
"@tscircuit/circuit-json-util": "^0.0.72",
|
|
50
|
-
"@tscircuit/core": "^0.0.
|
|
51
|
-
"@tscircuit/props": "^0.0.
|
|
50
|
+
"@tscircuit/core": "^0.0.787",
|
|
51
|
+
"@tscircuit/props": "^0.0.364",
|
|
52
52
|
"@tscircuit/checks": "^0.0.85",
|
|
53
53
|
"@tscircuit/math-utils": "^0.0.27",
|
|
54
54
|
"@tscircuit/capacity-autorouter": "^0.0.131",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@vitejs/plugin-react": "^4.3.4",
|
|
61
61
|
"bun-match-svg": "^0.0.9",
|
|
62
62
|
"bun-types": "1.2.1",
|
|
63
|
-
"circuit-json": "0.0.
|
|
63
|
+
"circuit-json": "0.0.279",
|
|
64
64
|
"circuit-to-svg": "^0.0.179",
|
|
65
65
|
"debug": "^4.4.0",
|
|
66
66
|
"jscad-electronics": "^0.0.48",
|