@tscircuit/3d-viewer 0.0.445 → 0.0.446
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 +135 -30
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -27101,38 +27101,65 @@ var LQFP = ({
|
|
|
27101
27101
|
)
|
|
27102
27102
|
] });
|
|
27103
27103
|
};
|
|
27104
|
-
var getCcwSot723Coords2 = (pn) => {
|
|
27105
|
-
if (pn === 1) {
|
|
27106
|
-
return { x: 0, y: 0 };
|
|
27107
|
-
} else if (pn === 2) {
|
|
27108
|
-
return { x: 1, y: -0.4 };
|
|
27109
|
-
} else {
|
|
27110
|
-
return { x: 1, y: 0.4 };
|
|
27111
|
-
}
|
|
27112
|
-
};
|
|
27113
27104
|
var SOT723 = () => {
|
|
27114
|
-
const bodyWidth = 0.
|
|
27105
|
+
const bodyWidth = 0.85;
|
|
27115
27106
|
const bodyLength10 = 1.2;
|
|
27116
|
-
const bodyHeight = 0.
|
|
27117
|
-
const
|
|
27118
|
-
const
|
|
27119
|
-
const
|
|
27120
|
-
const
|
|
27107
|
+
const bodyHeight = 0.38;
|
|
27108
|
+
const straightHeight = bodyHeight * 0.55;
|
|
27109
|
+
const taperOffset = 0.1;
|
|
27110
|
+
const padLength = 0.3;
|
|
27111
|
+
const padThickness = 0.1;
|
|
27112
|
+
const leftPadWidth = 0.2;
|
|
27113
|
+
const rightPadWidth = 0.25;
|
|
27114
|
+
const rightPadCenterX = 0.55;
|
|
27115
|
+
const rightPadCenterY = 0;
|
|
27116
|
+
const leftTopPadCenterX = -0.55;
|
|
27117
|
+
const leftTopPadCenterY = 0.4;
|
|
27118
|
+
const leftBottomPadCenterX = -0.55;
|
|
27119
|
+
const leftBottomPadCenterY = -0.4;
|
|
27121
27120
|
return /* @__PURE__ */ jsxs(Fragment22, { children: [
|
|
27122
|
-
/* @__PURE__ */ jsx5(
|
|
27123
|
-
|
|
27124
|
-
const { x, y } = getCcwSot723Coords2(pn);
|
|
27125
|
-
return /* @__PURE__ */ jsx5(Translate, { center: [x, y, 0.05], children: /* @__PURE__ */ jsx5(
|
|
27121
|
+
/* @__PURE__ */ jsx5(Colorize, { color: "#222", children: /* @__PURE__ */ jsxs(Union, { children: [
|
|
27122
|
+
/* @__PURE__ */ jsx5(
|
|
27126
27123
|
Cuboid,
|
|
27127
27124
|
{
|
|
27128
|
-
size: [
|
|
27129
|
-
|
|
27130
|
-
pn === 1 ? centerLeadWidth : leadWidth,
|
|
27131
|
-
leadHeight
|
|
27132
|
-
]
|
|
27125
|
+
size: [bodyWidth, bodyLength10, straightHeight],
|
|
27126
|
+
center: [0, 0, straightHeight / 2]
|
|
27133
27127
|
}
|
|
27134
|
-
)
|
|
27135
|
-
|
|
27128
|
+
),
|
|
27129
|
+
/* @__PURE__ */ jsxs(Hull, { children: [
|
|
27130
|
+
/* @__PURE__ */ jsx5(Translate, { z: straightHeight, children: /* @__PURE__ */ jsx5(Cuboid, { size: [bodyWidth, bodyLength10, 0.01] }) }),
|
|
27131
|
+
/* @__PURE__ */ jsx5(Translate, { z: bodyHeight, children: /* @__PURE__ */ jsx5(
|
|
27132
|
+
Cuboid,
|
|
27133
|
+
{
|
|
27134
|
+
size: [bodyWidth - taperOffset, bodyLength10 - taperOffset, 0.01]
|
|
27135
|
+
}
|
|
27136
|
+
) })
|
|
27137
|
+
] })
|
|
27138
|
+
] }) }),
|
|
27139
|
+
/* @__PURE__ */ jsx5(
|
|
27140
|
+
Cuboid,
|
|
27141
|
+
{
|
|
27142
|
+
color: "#ccc",
|
|
27143
|
+
size: [padLength, rightPadWidth, padThickness],
|
|
27144
|
+
center: [rightPadCenterX, rightPadCenterY, padThickness / 2]
|
|
27145
|
+
}
|
|
27146
|
+
),
|
|
27147
|
+
/* @__PURE__ */ jsx5(
|
|
27148
|
+
Cuboid,
|
|
27149
|
+
{
|
|
27150
|
+
color: "#ccc",
|
|
27151
|
+
size: [padLength, leftPadWidth, padThickness],
|
|
27152
|
+
center: [leftTopPadCenterX, leftTopPadCenterY, padThickness / 2]
|
|
27153
|
+
}
|
|
27154
|
+
),
|
|
27155
|
+
/* @__PURE__ */ jsx5(
|
|
27156
|
+
Cuboid,
|
|
27157
|
+
{
|
|
27158
|
+
color: "#ccc",
|
|
27159
|
+
size: [padLength, leftPadWidth, padThickness],
|
|
27160
|
+
center: [leftBottomPadCenterX, leftBottomPadCenterY, padThickness / 2]
|
|
27161
|
+
}
|
|
27162
|
+
)
|
|
27136
27163
|
] });
|
|
27137
27164
|
};
|
|
27138
27165
|
var DFN = ({
|
|
@@ -27470,6 +27497,79 @@ var MS012 = ({
|
|
|
27470
27497
|
)
|
|
27471
27498
|
] });
|
|
27472
27499
|
};
|
|
27500
|
+
var TO220 = () => {
|
|
27501
|
+
const fullLength10 = 20;
|
|
27502
|
+
const bodyLength10 = 9.9;
|
|
27503
|
+
const bodyHeight = 4.5;
|
|
27504
|
+
const zOffset = 1;
|
|
27505
|
+
const padWidth = 9.9;
|
|
27506
|
+
const padLength = 6.5;
|
|
27507
|
+
const padThickness = 1.3;
|
|
27508
|
+
const padHoleDiameter = 3;
|
|
27509
|
+
const prongWidth = 0.81;
|
|
27510
|
+
const prongLength = 16;
|
|
27511
|
+
const prongHeight = 0.5;
|
|
27512
|
+
const prongPitch = 2.7;
|
|
27513
|
+
const bodyWidth = padWidth;
|
|
27514
|
+
const bodyFrontX = fullLength10 - bodyLength10 / 2;
|
|
27515
|
+
const bodyBackX = fullLength10 + bodyLength10 / 2;
|
|
27516
|
+
const prongCenterX = bodyFrontX - prongLength / 2;
|
|
27517
|
+
const padCenterX = bodyBackX + padLength / 2;
|
|
27518
|
+
return /* @__PURE__ */ jsx5(Translate, { center: [0, 0, zOffset], children: /* @__PURE__ */ jsxs(Fragment22, { children: [
|
|
27519
|
+
/* @__PURE__ */ jsxs(Rotate, { rotation: [0, 55, -55], children: [
|
|
27520
|
+
/* @__PURE__ */ jsxs(Subtract, { children: [
|
|
27521
|
+
/* @__PURE__ */ jsx5(
|
|
27522
|
+
Cuboid,
|
|
27523
|
+
{
|
|
27524
|
+
color: "#ccc",
|
|
27525
|
+
size: [padLength + 0.1, padWidth, padThickness],
|
|
27526
|
+
center: [padCenterX, 0, padThickness - 2]
|
|
27527
|
+
}
|
|
27528
|
+
),
|
|
27529
|
+
/* @__PURE__ */ jsx5(
|
|
27530
|
+
Cylinder,
|
|
27531
|
+
{
|
|
27532
|
+
color: "black",
|
|
27533
|
+
center: [padCenterX, 0, padThickness - 2],
|
|
27534
|
+
radius: padHoleDiameter / 2,
|
|
27535
|
+
height: padThickness * 1.2
|
|
27536
|
+
}
|
|
27537
|
+
)
|
|
27538
|
+
] }),
|
|
27539
|
+
/* @__PURE__ */ jsx5(Colorize, { color: "#222", children: /* @__PURE__ */ jsx5(
|
|
27540
|
+
ChipBody,
|
|
27541
|
+
{
|
|
27542
|
+
width: bodyWidth,
|
|
27543
|
+
length: bodyLength10,
|
|
27544
|
+
height: bodyHeight,
|
|
27545
|
+
center: { x: fullLength10, y: 0, z: -2.4 },
|
|
27546
|
+
includeNotch: false,
|
|
27547
|
+
straightHeightRatio: 0.3,
|
|
27548
|
+
taperRatio: 0.04,
|
|
27549
|
+
heightAboveSurface: 1
|
|
27550
|
+
}
|
|
27551
|
+
) })
|
|
27552
|
+
] }),
|
|
27553
|
+
/* @__PURE__ */ jsx5(Rotate, { rotation: [0, 55, 55], children: Array.from({ length: 3 }).map((_, i) => {
|
|
27554
|
+
const x = prongCenterX;
|
|
27555
|
+
const y = (i - 1) * prongPitch;
|
|
27556
|
+
const z135 = -prongHeight - 0.6;
|
|
27557
|
+
return /* @__PURE__ */ jsxs(Colorize, { color: "gold", children: [
|
|
27558
|
+
/* @__PURE__ */ jsxs(Hull, { children: [
|
|
27559
|
+
/* @__PURE__ */ jsx5(Translate, { center: [bodyFrontX - bodyHeight / 2 + 0.1, y, z135], children: /* @__PURE__ */ jsx5(Cuboid, { size: [bodyHeight, prongWidth + 1, prongHeight] }) }),
|
|
27560
|
+
/* @__PURE__ */ jsx5(
|
|
27561
|
+
Translate,
|
|
27562
|
+
{
|
|
27563
|
+
center: [bodyFrontX - bodyHeight / 2 - 1 + 0.1, y, z135],
|
|
27564
|
+
children: /* @__PURE__ */ jsx5(Cuboid, { size: [bodyHeight, prongWidth, prongHeight] })
|
|
27565
|
+
}
|
|
27566
|
+
)
|
|
27567
|
+
] }),
|
|
27568
|
+
/* @__PURE__ */ jsx5(Translate, { center: [x, y, z135], children: /* @__PURE__ */ jsx5(Cuboid, { size: [prongLength + 0.1, prongWidth, prongHeight] }) })
|
|
27569
|
+
] }, `prong-${i}`);
|
|
27570
|
+
}) })
|
|
27571
|
+
] }) });
|
|
27572
|
+
};
|
|
27473
27573
|
var Footprinter3d = ({ footprint }) => {
|
|
27474
27574
|
const fpJson = fp.string(footprint).json();
|
|
27475
27575
|
switch (fpJson.fn) {
|
|
@@ -27651,6 +27751,8 @@ var Footprinter3d = ({ footprint }) => {
|
|
|
27651
27751
|
);
|
|
27652
27752
|
case "sot723":
|
|
27653
27753
|
return /* @__PURE__ */ jsx5(SOT723, {});
|
|
27754
|
+
case "to220":
|
|
27755
|
+
return /* @__PURE__ */ jsx5(TO220, {});
|
|
27654
27756
|
}
|
|
27655
27757
|
const colorMatch = footprint.match(/_color\(([^)]+)\)/);
|
|
27656
27758
|
const color = colorMatch ? colorMatch[1] : void 0;
|
|
@@ -27714,7 +27816,7 @@ function renderNode(node, colorCtx, renderCtx) {
|
|
|
27714
27816
|
}
|
|
27715
27817
|
if (type === Translate) {
|
|
27716
27818
|
const off = toVec3(
|
|
27717
|
-
props?.offset ?? { x: props?.x, y: props?.y, z: props?.z }
|
|
27819
|
+
props?.offset ?? props?.center ?? { x: props?.x, y: props?.y, z: props?.z }
|
|
27718
27820
|
);
|
|
27719
27821
|
const geoms = (children ?? []).flatMap(
|
|
27720
27822
|
(c) => renderNode(c, colorCtx, renderCtx)
|
|
@@ -28324,7 +28426,7 @@ import * as THREE15 from "three";
|
|
|
28324
28426
|
// package.json
|
|
28325
28427
|
var package_default = {
|
|
28326
28428
|
name: "@tscircuit/3d-viewer",
|
|
28327
|
-
version: "0.0.
|
|
28429
|
+
version: "0.0.445",
|
|
28328
28430
|
main: "./dist/index.js",
|
|
28329
28431
|
module: "./dist/index.js",
|
|
28330
28432
|
type: "module",
|
|
@@ -28389,7 +28491,7 @@ var package_default = {
|
|
|
28389
28491
|
"circuit-json": "0.0.320",
|
|
28390
28492
|
"circuit-to-svg": "^0.0.179",
|
|
28391
28493
|
debug: "^4.4.0",
|
|
28392
|
-
"jscad-electronics": "^0.0.
|
|
28494
|
+
"jscad-electronics": "^0.0.91",
|
|
28393
28495
|
"jscad-planner": "^0.0.13",
|
|
28394
28496
|
jsdom: "^26.0.0",
|
|
28395
28497
|
"manifold-3d": "^3.2.1",
|
|
@@ -34140,8 +34242,11 @@ function createGeometryMeshes(geoms) {
|
|
|
34140
34242
|
new THREE27.MeshStandardMaterial({
|
|
34141
34243
|
color: comp.color,
|
|
34142
34244
|
side: THREE27.DoubleSide,
|
|
34143
|
-
flatShading: true
|
|
34245
|
+
flatShading: true,
|
|
34144
34246
|
// Consistent with board
|
|
34247
|
+
polygonOffset: true,
|
|
34248
|
+
polygonOffsetFactor: -1,
|
|
34249
|
+
polygonOffsetUnits: -1
|
|
34145
34250
|
})
|
|
34146
34251
|
);
|
|
34147
34252
|
mesh.name = comp.key;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/3d-viewer",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.446",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"circuit-json": "0.0.320",
|
|
66
66
|
"circuit-to-svg": "^0.0.179",
|
|
67
67
|
"debug": "^4.4.0",
|
|
68
|
-
"jscad-electronics": "^0.0.
|
|
68
|
+
"jscad-electronics": "^0.0.91",
|
|
69
69
|
"jscad-planner": "^0.0.13",
|
|
70
70
|
"jsdom": "^26.0.0",
|
|
71
71
|
"manifold-3d": "^3.2.1",
|