jscad-electronics 0.0.187 → 0.0.189

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/vanilla.js CHANGED
@@ -22,6 +22,18 @@ function h(type, props, ...restChildren) {
22
22
  import { mp } from "@tscircuit/modelprinter";
23
23
  import { fp } from "@tscircuit/footprinter";
24
24
 
25
+ // lib/materials.ts
26
+ var componentMaterials = {
27
+ moldedPlastic: { metalness: 0, roughness: 0.7 },
28
+ rubber: { metalness: 0, roughness: 0.9 },
29
+ sleeve: { metalness: 0, roughness: 0.45 },
30
+ tinnedLead: { metalness: 0.8, roughness: 0.55 },
31
+ goldContact: { metalness: 1, roughness: 0.25 },
32
+ copper: { metalness: 1, roughness: 0.35 },
33
+ brushedMetal: { metalness: 1, roughness: 0.4 },
34
+ steel: { metalness: 1, roughness: 0.25 }
35
+ };
36
+
25
37
  // lib/vanilla/primitives.ts
26
38
  var Cuboid = /* @__PURE__ */ Symbol("Cuboid");
27
39
  var Cube = /* @__PURE__ */ Symbol("Cube");
@@ -52,7 +64,7 @@ var FootprintPad = ({
52
64
  }) => {
53
65
  const color = isPin1 ? [0, 255, 0] : [255, 0, 0];
54
66
  if (pad.shape === "rect" || pad.shape === "rotated_rect") {
55
- return /* @__PURE__ */ jsx(Colorize, { color, children: /* @__PURE__ */ jsx(Translate, { offset: [pad.x, pad.y, -5e-3], children: /* @__PURE__ */ jsx(
67
+ return /* @__PURE__ */ jsx(Colorize, { color, material: componentMaterials.copper, children: /* @__PURE__ */ jsx(Translate, { offset: [pad.x, pad.y, -5e-3], children: /* @__PURE__ */ jsx(
56
68
  Rotate,
57
69
  {
58
70
  angles: [
@@ -66,14 +78,14 @@ var FootprintPad = ({
66
78
  }
67
79
  if (pad.shape === "circle") {
68
80
  const radius = pad.radius ?? pad.r ?? 0.25;
69
- return /* @__PURE__ */ jsx(Colorize, { color, children: /* @__PURE__ */ jsx(Translate, { offset: [pad.x, pad.y, -5e-3], children: /* @__PURE__ */ jsx(Cylinder, { radius, height: PAD_THICKNESS }) }) });
81
+ return /* @__PURE__ */ jsx(Colorize, { color, material: componentMaterials.copper, children: /* @__PURE__ */ jsx(Translate, { offset: [pad.x, pad.y, -5e-3], children: /* @__PURE__ */ jsx(Cylinder, { radius, height: PAD_THICKNESS }) }) });
70
82
  }
71
83
  if (pad.shape === "polygon") {
72
84
  const points = (pad.points ?? []).map(
73
85
  ({ x, y }) => [x, y]
74
86
  );
75
87
  if (points.length < 3) return null;
76
- return /* @__PURE__ */ jsx(Colorize, { color, children: /* @__PURE__ */ jsx(Translate, { offset: [0, 0, -5e-3], children: /* @__PURE__ */ jsx(ExtrudeLinear, { height: PAD_THICKNESS, children: /* @__PURE__ */ jsx(Polygon, { points }) }) }) });
88
+ return /* @__PURE__ */ jsx(Colorize, { color, material: componentMaterials.copper, children: /* @__PURE__ */ jsx(Translate, { offset: [0, 0, -5e-3], children: /* @__PURE__ */ jsx(ExtrudeLinear, { height: PAD_THICKNESS, children: /* @__PURE__ */ jsx(Polygon, { points }) }) }) });
77
89
  }
78
90
  throw new Error("Shape not supported: " + pad.shape);
79
91
  };
@@ -85,13 +97,13 @@ var FootprintPlatedHole = ({
85
97
  }) => {
86
98
  const color = isPin1 ? "#00ff00" : "#b87333";
87
99
  if (hole.shape === "circle") {
88
- return /* @__PURE__ */ jsx(Colorize, { color, children: /* @__PURE__ */ jsx(Translate, { offset: [hole.x, hole.y, -5e-3], children: /* @__PURE__ */ jsxs(Subtract, { children: [
100
+ return /* @__PURE__ */ jsx(Colorize, { color, material: componentMaterials.copper, children: /* @__PURE__ */ jsx(Translate, { offset: [hole.x, hole.y, -5e-3], children: /* @__PURE__ */ jsxs(Subtract, { children: [
89
101
  /* @__PURE__ */ jsx(Cylinder, { radius: hole.outer_diameter / 2, height: 0.01 }),
90
102
  /* @__PURE__ */ jsx(Cylinder, { radius: hole.hole_diameter / 2, height: 0.01 })
91
103
  ] }) }) });
92
104
  }
93
105
  if (hole.shape === "circular_hole_with_rect_pad") {
94
- return /* @__PURE__ */ jsx(Colorize, { color, children: /* @__PURE__ */ jsx(Translate, { offset: [hole.x, hole.y, 0], children: /* @__PURE__ */ jsxs(Subtract, { children: [
106
+ return /* @__PURE__ */ jsx(Colorize, { color, material: componentMaterials.copper, children: /* @__PURE__ */ jsx(Translate, { offset: [hole.x, hole.y, 0], children: /* @__PURE__ */ jsxs(Subtract, { children: [
95
107
  /* @__PURE__ */ jsx(
96
108
  Cuboid,
97
109
  {
@@ -109,7 +121,7 @@ var FootprintPlatedHole = ({
109
121
  const isHorizontal = width10 > height10;
110
122
  const holeWidth = hole.hole_width ?? 0.8;
111
123
  const holeHeight = hole.hole_height ?? 0.8;
112
- return /* @__PURE__ */ jsx(Colorize, { color, children: /* @__PURE__ */ jsx(Translate, { offset: [hole.x, hole.y, 0], children: /* @__PURE__ */ jsxs(Subtract, { children: [
124
+ return /* @__PURE__ */ jsx(Colorize, { color, material: componentMaterials.copper, children: /* @__PURE__ */ jsx(Translate, { offset: [hole.x, hole.y, 0], children: /* @__PURE__ */ jsxs(Subtract, { children: [
113
125
  /* @__PURE__ */ jsxs(Hull, { children: [
114
126
  /* @__PURE__ */ jsx(
115
127
  Cylinder,
@@ -175,6 +187,7 @@ var ExtrudedPads = ({
175
187
  if (!circuitJson && footprint && [
176
188
  "nema",
177
189
  "hexsocketbolt",
190
+ "hexbolt",
178
191
  "sheetmetal",
179
192
  "spurgear",
180
193
  "wormgear",
@@ -206,6 +219,132 @@ var ExtrudedPads = ({
206
219
  ] });
207
220
  };
208
221
 
222
+ // lib/models/hexbolt/mesh.ts
223
+ import {
224
+ hexBoltModelPropsSchema
225
+ } from "@tscircuit/modelprinter";
226
+ function createHexBoltMesh(input, options = {}) {
227
+ const p = hexBoltModelPropsSchema.parse(input);
228
+ const segments = options.radialSegments ?? 96;
229
+ const axial = options.threadStepsPerTurn ?? 24;
230
+ if (!Number.isInteger(segments) || segments < 24 || segments > 192 || segments % 24 !== 0 || !Number.isInteger(axial) || axial < 24 || axial > 96)
231
+ throw new Error(
232
+ "Screw mesh resolution requires 24..192 radial segments divisible by 24 and 24..96 thread steps"
233
+ );
234
+ const positions = [], indices = [];
235
+ const welded = /* @__PURE__ */ new Map();
236
+ const vertex = (x, y, z) => {
237
+ const key = [x, y, z].map((v) => Math.round(v * 1e10)).join(":");
238
+ const existing = welded.get(key);
239
+ if (existing !== void 0) return existing;
240
+ const index = positions.length / 3;
241
+ positions.push(x, y, z);
242
+ welded.set(key, index);
243
+ return index;
244
+ };
245
+ const triangle = (a, b, c) => {
246
+ if (a === b || b === c || c === a) return;
247
+ const point = (i) => positions.slice(3 * i, 3 * i + 3);
248
+ const A = point(a), B = point(b), C = point(c);
249
+ const u = B.map((v2, i) => v2 - A[i]), v = C.map((w, i) => w - A[i]);
250
+ const area = Math.hypot(
251
+ u[1] * v[2] - u[2] * v[1],
252
+ u[2] * v[0] - u[0] * v[2],
253
+ u[0] * v[1] - u[1] * v[0]
254
+ );
255
+ if (area > 1e-12) indices.push(a, b, c);
256
+ };
257
+ const ring = (radiusAt, zAt) => Array.from({ length: segments }, (_, i) => {
258
+ const theta = i * 2 * Math.PI / segments, r = radiusAt(theta);
259
+ return vertex(
260
+ r * Math.cos(theta),
261
+ r * Math.sin(theta),
262
+ typeof zAt === "number" ? zAt : zAt(theta)
263
+ );
264
+ });
265
+ const connect = (a, b) => {
266
+ for (let i = 0; i < segments; i++) {
267
+ const n = (i + 1) % segments;
268
+ triangle(a[i], a[n], b[n]);
269
+ triangle(a[i], b[n], b[i]);
270
+ }
271
+ };
272
+ const cap = (a, z, up) => {
273
+ const c = vertex(0, 0, z);
274
+ for (let i = 0; i < segments; i++) {
275
+ const n = (i + 1) % segments;
276
+ up ? triangle(c, a[i], a[n]) : triangle(c, a[n], a[i]);
277
+ }
278
+ };
279
+ let previous = [];
280
+ const add = (radiusAt, zAt) => {
281
+ const r = ring(radiusAt, zAt);
282
+ if (previous.length) connect(previous, r);
283
+ previous = r;
284
+ return r;
285
+ };
286
+ const major = p.diameter / 2, minor = p.threadRootDiameter / 2, pitch = p.threadPitch;
287
+ const shaftEnd = -p.underHeadRadius;
288
+ const steps = p.showThreads ? Math.ceil((shaftEnd + p.length) / pitch * axial) : 1;
289
+ if ((steps + 100) * segments > 4e5)
290
+ throw new Error("Screw exceeds mesh resolution limit");
291
+ const levels = /* @__PURE__ */ new Set([
292
+ -p.length,
293
+ -p.length + p.tipChamfer,
294
+ shaftEnd
295
+ ]);
296
+ if (p.showThreads)
297
+ for (let i = 0; i <= steps; i++)
298
+ levels.add(-p.length + (shaftEnd + p.length) * i / steps);
299
+ for (const z of [...levels].sort((a, b) => a - b)) {
300
+ const r = add((theta) => {
301
+ const phase = (((z + p.length) / pitch - (p.threadHand === "right" ? 1 : -1) * theta / (2 * Math.PI)) % 1 + 1) % 1;
302
+ const d = Math.min(phase, 1 - phase);
303
+ const groove = Math.min(
304
+ major - minor,
305
+ Math.max(0, (d - 1 / 16) * pitch * Math.sqrt(3))
306
+ );
307
+ const thread = p.showThreads ? major - groove : major;
308
+ return Math.min(
309
+ thread,
310
+ major - Math.max(0, p.tipChamfer - (z + p.length))
311
+ );
312
+ }, z);
313
+ if (z === -p.length) cap(r, z, false);
314
+ }
315
+ add(() => major, shaftEnd);
316
+ const filletCenterR = major + p.underHeadRadius;
317
+ const filletCenterZ = shaftEnd;
318
+ for (let i = 1; i <= 16; i++) {
319
+ const angle = Math.PI - (Math.PI - Math.PI / 2) * i / 16;
320
+ add(
321
+ () => filletCenterR + p.underHeadRadius * Math.cos(angle),
322
+ filletCenterZ + p.underHeadRadius * Math.sin(angle)
323
+ );
324
+ }
325
+ const hexRadius = (theta) => p.headAcrossFlats / 2 / Math.max(
326
+ Math.abs(Math.sin(theta)),
327
+ Math.abs(Math.sin(theta + 2 * Math.PI / 3)),
328
+ Math.abs(Math.sin(theta + 4 * Math.PI / 3))
329
+ );
330
+ add(hexRadius, 0);
331
+ const slope = Math.tan(p.headChamferAngle * Math.PI / 180);
332
+ const start = p.headHeight - (p.headCornerDiameter - p.headChamferDiameter) / 2 * slope;
333
+ add(hexRadius, start);
334
+ for (let i = 1; i <= 12; i++) {
335
+ const z = start + (p.headHeight - start) * i / 12;
336
+ add(
337
+ (theta) => Math.min(
338
+ hexRadius(theta),
339
+ p.headChamferDiameter / 2 + (p.headHeight - z) / slope
340
+ ),
341
+ z
342
+ );
343
+ }
344
+ cap(previous, p.headHeight, true);
345
+ return { positions, indices };
346
+ }
347
+
209
348
  // lib/mechanical/indexedMeshToGeom3.ts
210
349
  import jscad from "@jscad/modeling";
211
350
  function indexedMeshToGeom3(mesh) {
@@ -221,6 +360,14 @@ function indexedMeshToGeom3(mesh) {
221
360
  return jscad.geometries.geom3.fromPoints(polygons);
222
361
  }
223
362
 
363
+ // lib/models/hexbolt/HexBolt.tsx
364
+ function createHexBoltGeom(input, options) {
365
+ return indexedMeshToGeom3(createHexBoltMesh(input, options));
366
+ }
367
+ function HexBolt({ color = "#737e8f", ...props }) {
368
+ return /* @__PURE__ */ jsx(Colorize, { color, children: /* @__PURE__ */ jsx(Custom, { geometry: createHexBoltGeom(props) }) });
369
+ }
370
+
224
371
  // lib/mechanical/helical-gear-mesh.ts
225
372
  import {
226
373
  getHelicalGearDimensions,
@@ -522,7 +669,7 @@ function HexSocketBolt({
522
669
  color = "#737e8f",
523
670
  ...props
524
671
  }) {
525
- return /* @__PURE__ */ jsx(Colorize, { color, children: /* @__PURE__ */ jsx(Custom, { geometry: createHexSocketBoltGeom(props) }) });
672
+ return /* @__PURE__ */ jsx(Colorize, { color, material: componentMaterials.steel, children: /* @__PURE__ */ jsx(Custom, { geometry: createHexSocketBoltGeom(props) }) });
526
673
  }
527
674
 
528
675
  // lib/mechanical/sheet-metal-mesh.ts
@@ -675,7 +822,7 @@ function createSheetMetalGeom(input) {
675
822
  return indexedMeshToGeom3(createSheetMetalMesh(input));
676
823
  }
677
824
  function SheetMetal({ color = "#737e8f", ...props }) {
678
- return /* @__PURE__ */ jsx(Colorize, { color, children: /* @__PURE__ */ jsx(Custom, { geometry: createSheetMetalGeom(props) }) });
825
+ return /* @__PURE__ */ jsx(Colorize, { color, material: componentMaterials.brushedMetal, children: /* @__PURE__ */ jsx(Custom, { geometry: createSheetMetalGeom(props) }) });
679
826
  }
680
827
 
681
828
  // lib/SpurGear.tsx
@@ -1078,23 +1225,40 @@ function NemaMotor({
1078
1225
  return /* @__PURE__ */ jsx(
1079
1226
  Colorize,
1080
1227
  {
1228
+ material: section.name === "body" ? componentMaterials.moldedPlastic : section.name === "shaft" ? componentMaterials.steel : componentMaterials.brushedMetal,
1081
1229
  color: section.name === "body" ? bodyColor : section.name === "shaft" ? shaftColor : capColor,
1082
1230
  children: /* @__PURE__ */ jsx(Custom, { geometry: generalize({ simplify: true }, geometry) })
1083
1231
  },
1084
1232
  `${section.name}-${index}`
1085
1233
  );
1086
1234
  }),
1087
- createNemaMotorWireGeometry(p).map(({ geometry, color }, index) => /* @__PURE__ */ jsx(Colorize, { color, children: /* @__PURE__ */ jsx(Custom, { geometry: generalize({ simplify: true }, geometry) }) }, `wire-${index}`)),
1235
+ createNemaMotorWireGeometry(p).map(({ geometry, color }, index) => /* @__PURE__ */ jsx(
1236
+ Colorize,
1237
+ {
1238
+ material: componentMaterials.rubber,
1239
+ color,
1240
+ children: /* @__PURE__ */ jsx(Custom, { geometry: generalize({ simplify: true }, geometry) })
1241
+ },
1242
+ `wire-${index}`
1243
+ )),
1088
1244
  screw && [-halfPitch, halfPitch].flatMap(
1089
- (x) => [-halfPitch, halfPitch].map((y) => /* @__PURE__ */ jsx(Colorize, { color: screwColor, children: /* @__PURE__ */ jsx(
1090
- Custom,
1245
+ (x) => [-halfPitch, halfPitch].map((y) => /* @__PURE__ */ jsx(
1246
+ Colorize,
1091
1247
  {
1092
- geometry: jscad3.transforms.translate(
1093
- [x, y, -p.bodyLength],
1094
- generalize({ simplify: true }, screw)
1248
+ material: componentMaterials.steel,
1249
+ color: screwColor,
1250
+ children: /* @__PURE__ */ jsx(
1251
+ Custom,
1252
+ {
1253
+ geometry: jscad3.transforms.translate(
1254
+ [x, y, -p.bodyLength],
1255
+ generalize({ simplify: true }, screw)
1256
+ )
1257
+ }
1095
1258
  )
1096
- }
1097
- ) }, `rear-screw-${x}-${y}`))
1259
+ },
1260
+ `rear-screw-${x}-${y}`
1261
+ ))
1098
1262
  )
1099
1263
  ] });
1100
1264
  }
@@ -1464,7 +1628,7 @@ var ChipBody = ({
1464
1628
  chamferCutout(-xOffset, -yOffset)
1465
1629
  ] });
1466
1630
  }
1467
- return /* @__PURE__ */ jsx(Colorize, { color, children: /* @__PURE__ */ jsx(Translate, { offset: center, children: /* @__PURE__ */ jsx(Translate, { offset: { x: 0, y: 0, z: heightAboveSurface2 }, children: includeNotch ? /* @__PURE__ */ jsxs(Subtract, { children: [
1631
+ return /* @__PURE__ */ jsx(Colorize, { color, material: componentMaterials.moldedPlastic, children: /* @__PURE__ */ jsx(Translate, { offset: center, children: /* @__PURE__ */ jsx(Translate, { offset: { x: 0, y: 0, z: heightAboveSurface2 }, children: includeNotch ? /* @__PURE__ */ jsxs(Subtract, { children: [
1468
1632
  finalBody,
1469
1633
  /* @__PURE__ */ jsx(Translate, { offset: actualNotchPosition, children: /* @__PURE__ */ jsx(Rotate, { rotation: notchRotation, children: /* @__PURE__ */ jsx(Cylinder, { radius: actualNotchRadius, height: notchWidth }) }) })
1470
1634
  ] }) : finalBody }) }) });
@@ -1562,12 +1726,19 @@ var heightAboveSurface = 0.5;
1562
1726
  var DipPinLeg = ({ x, y, z }) => {
1563
1727
  const isRotated = x > 0;
1564
1728
  return /* @__PURE__ */ jsxs(Fragment2, { children: [
1565
- /* @__PURE__ */ jsx(Translate, { offset: { x: x + 0.25 / 2, y, z }, children: /* @__PURE__ */ jsx(Rotate, { rotation: ["-90deg", 0, "90deg"], children: /* @__PURE__ */ jsx(ExtrudeLinear, { height: 0.25, children: /* @__PURE__ */ jsx(
1566
- Polygon,
1729
+ /* @__PURE__ */ jsx(
1730
+ Translate,
1567
1731
  {
1568
- points: svgPathPoints.slice().reverse().map((p) => [p.x, p.y])
1732
+ material: componentMaterials.tinnedLead,
1733
+ offset: { x: x + 0.25 / 2, y, z },
1734
+ children: /* @__PURE__ */ jsx(Rotate, { rotation: ["-90deg", 0, "90deg"], children: /* @__PURE__ */ jsx(ExtrudeLinear, { height: 0.25, children: /* @__PURE__ */ jsx(
1735
+ Polygon,
1736
+ {
1737
+ points: svgPathPoints.slice().reverse().map((p) => [p.x, p.y])
1738
+ }
1739
+ ) }) })
1569
1740
  }
1570
- ) }) }) }),
1741
+ ),
1571
1742
  /* @__PURE__ */ jsx(
1572
1743
  Translate,
1573
1744
  {
@@ -1655,7 +1826,7 @@ var SmdChipLead = (props) => {
1655
1826
  const N = 15;
1656
1827
  const points = Array.from({ length: N }).map((_, i) => i / (N - 1) * bodyDistance).map((x) => [x, calculateSCurve(x, props)]);
1657
1828
  const polygon = getExpandedStroke(points, thickness);
1658
- return /* @__PURE__ */ jsx(Colorize, { color: "#fff", children: /* @__PURE__ */ jsx(Translate, { offset: { z: 0, y: 0, x: 0, ...props.position }, children: /* @__PURE__ */ jsx(Rotate, { rotation: ["90deg", 0, rotation ?? 0], children: /* @__PURE__ */ jsx(Translate, { offset: { x: 0, y: 0, z: -width10 / 2 }, children: /* @__PURE__ */ jsx(ExtrudeLinear, { height: width10, children: /* @__PURE__ */ jsx(Polygon, { points: polygon.map((p) => [p.x, p.y]) }) }) }) }) }) });
1829
+ return /* @__PURE__ */ jsx(Colorize, { color: "#c4c7ca", material: componentMaterials.tinnedLead, children: /* @__PURE__ */ jsx(Translate, { offset: { z: 0, y: 0, x: 0, ...props.position }, children: /* @__PURE__ */ jsx(Rotate, { rotation: ["90deg", 0, rotation ?? 0], children: /* @__PURE__ */ jsx(Translate, { offset: { x: 0, y: 0, z: -width10 / 2 }, children: /* @__PURE__ */ jsx(ExtrudeLinear, { height: width10, children: /* @__PURE__ */ jsx(Polygon, { points: polygon.map((p) => [p.x, p.y]) }) }) }) }) }) });
1659
1830
  };
1660
1831
 
1661
1832
  // lib/Tssop.tsx
@@ -1813,6 +1984,7 @@ var A0402 = ({ color = "#333" }) => {
1813
1984
  {
1814
1985
  size: [bodyLength, width, height],
1815
1986
  offset: [0, 0, height / 2],
1987
+ material: componentMaterials.moldedPlastic,
1816
1988
  color
1817
1989
  }
1818
1990
  ),
@@ -1821,6 +1993,7 @@ var A0402 = ({ color = "#333" }) => {
1821
1993
  {
1822
1994
  size: [terminatorWidth, height, width],
1823
1995
  offset: [fullLength / 2 - terminatorWidth / 2, 0, height / 2],
1996
+ material: componentMaterials.tinnedLead,
1824
1997
  color: "#ccc"
1825
1998
  }
1826
1999
  ),
@@ -1829,6 +2002,7 @@ var A0402 = ({ color = "#333" }) => {
1829
2002
  {
1830
2003
  size: [terminatorWidth, height, width],
1831
2004
  offset: [-fullLength / 2 + terminatorWidth / 2, 0, height / 2],
2005
+ material: componentMaterials.tinnedLead,
1832
2006
  color: "#ccc"
1833
2007
  }
1834
2008
  )
@@ -1848,6 +2022,7 @@ var A0603 = ({ color = "#333" }) => {
1848
2022
  {
1849
2023
  size: [bodyLength2, width2, height2],
1850
2024
  offset: [0, 0, height2 / 2],
2025
+ material: componentMaterials.moldedPlastic,
1851
2026
  color
1852
2027
  }
1853
2028
  ),
@@ -1856,6 +2031,7 @@ var A0603 = ({ color = "#333" }) => {
1856
2031
  {
1857
2032
  size: [terminatorLength, width2, height2],
1858
2033
  offset: [fullLength2 / 2 - terminatorLength / 2, 0, height2 / 2],
2034
+ material: componentMaterials.tinnedLead,
1859
2035
  color: "#ccc"
1860
2036
  }
1861
2037
  ),
@@ -1864,6 +2040,7 @@ var A0603 = ({ color = "#333" }) => {
1864
2040
  {
1865
2041
  size: [terminatorLength, width2, height2],
1866
2042
  offset: [-fullLength2 / 2 + terminatorLength / 2, 0, height2 / 2],
2043
+ material: componentMaterials.tinnedLead,
1867
2044
  color: "#ccc"
1868
2045
  }
1869
2046
  )
@@ -1943,6 +2120,7 @@ var A0805 = ({ color = "#333" }) => {
1943
2120
  {
1944
2121
  size: [bodyLength3, width3, height3],
1945
2122
  offset: [0, 0, height3 / 2],
2123
+ material: componentMaterials.moldedPlastic,
1946
2124
  color
1947
2125
  }
1948
2126
  ),
@@ -1951,6 +2129,7 @@ var A0805 = ({ color = "#333" }) => {
1951
2129
  {
1952
2130
  size: [terminatorWidth2, width3, height3],
1953
2131
  offset: [fullLength3 / 2 - terminatorWidth2 / 2, 0, height3 / 2],
2132
+ material: componentMaterials.tinnedLead,
1954
2133
  color: "#ccc"
1955
2134
  }
1956
2135
  ),
@@ -1959,6 +2138,7 @@ var A0805 = ({ color = "#333" }) => {
1959
2138
  {
1960
2139
  size: [terminatorWidth2, width3, height3],
1961
2140
  offset: [-fullLength3 / 2 + terminatorWidth2 / 2, 0, height3 / 2],
2141
+ material: componentMaterials.tinnedLead,
1962
2142
  color: "#ccc"
1963
2143
  }
1964
2144
  )
@@ -2142,69 +2322,84 @@ var PinHeader = ({
2142
2322
  Cuboid,
2143
2323
  {
2144
2324
  color: "#222",
2325
+ material: componentMaterials.moldedPlastic,
2145
2326
  size: [bodyLength10, bodyWidth, bodyHeight],
2146
2327
  center: [x, y, flipZ(bodyHeight / 2)]
2147
2328
  }
2148
2329
  ) }),
2149
- /* @__PURE__ */ jsx(Colorize, { color: PIN_METAL_COLOR, children: smd ? /* @__PURE__ */ jsx(
2150
- SmdChipLead,
2330
+ /* @__PURE__ */ jsx(
2331
+ Colorize,
2151
2332
  {
2152
- rotation: -Math.PI / 2,
2153
- position: {
2154
- x,
2155
- y: y + 1,
2156
- z: pinThickness / 2
2157
- },
2158
- thickness: pinThickness,
2159
- width: pinThickness,
2160
- height: pinThickness,
2161
- padContactLength: 2,
2162
- bodyDistance: 3
2333
+ color: PIN_METAL_COLOR,
2334
+ material: componentMaterials.goldContact,
2335
+ children: smd ? /* @__PURE__ */ jsx(
2336
+ SmdChipLead,
2337
+ {
2338
+ rotation: -Math.PI / 2,
2339
+ position: {
2340
+ x,
2341
+ y: y + 1,
2342
+ z: pinThickness / 2
2343
+ },
2344
+ thickness: pinThickness,
2345
+ width: pinThickness,
2346
+ height: pinThickness,
2347
+ padContactLength: 2,
2348
+ bodyDistance: 3
2349
+ }
2350
+ ) : /* @__PURE__ */ jsxs(Hull, { children: [
2351
+ /* @__PURE__ */ jsx(
2352
+ Cuboid,
2353
+ {
2354
+ color: PIN_METAL_COLOR,
2355
+ size: [pinThickness, pinThickness, shortSidePinLength * 0.9],
2356
+ center: [x, y, flipZ(bodyHeight * 0.9 + bodyHeight / 2)]
2357
+ }
2358
+ ),
2359
+ /* @__PURE__ */ jsx(
2360
+ Cuboid,
2361
+ {
2362
+ color: PIN_METAL_COLOR,
2363
+ size: [
2364
+ pinThickness / 1.8,
2365
+ pinThickness / 1.8,
2366
+ shortSidePinLength
2367
+ ],
2368
+ center: [x, y, flipZ(bodyHeight + bodyHeight / 2)]
2369
+ }
2370
+ )
2371
+ ] })
2163
2372
  }
2164
- ) : /* @__PURE__ */ jsxs(Hull, { children: [
2165
- /* @__PURE__ */ jsx(
2166
- Cuboid,
2167
- {
2168
- color: PIN_METAL_COLOR,
2169
- size: [pinThickness, pinThickness, shortSidePinLength * 0.9],
2170
- center: [x, y, flipZ(bodyHeight * 0.9 + bodyHeight / 2)]
2171
- }
2172
- ),
2173
- /* @__PURE__ */ jsx(
2174
- Cuboid,
2175
- {
2176
- color: PIN_METAL_COLOR,
2177
- size: [
2178
- pinThickness / 1.8,
2179
- pinThickness / 1.8,
2180
- shortSidePinLength
2181
- ],
2182
- center: [x, y, flipZ(bodyHeight + bodyHeight / 2)]
2183
- }
2184
- )
2185
- ] }) }),
2186
- /* @__PURE__ */ jsx(Colorize, { color: PIN_METAL_COLOR, children: /* @__PURE__ */ jsx(Translate, { y: rightangle ? -3.9 : 0, z: rightangle ? 1 : 0, children: /* @__PURE__ */ jsx(Rotate, { rotation: rightangle ? [-Math.PI / 2, 0, 0] : [0, 0, 0], children: /* @__PURE__ */ jsxs(Hull, { children: [
2187
- /* @__PURE__ */ jsx(
2188
- Cuboid,
2189
- {
2190
- color: PIN_METAL_COLOR,
2191
- size: [pinThickness, pinThickness, longSidePinLength * 0.9],
2192
- center: [x, y, flipZ(-longSidePinLength / 2 * 0.9)]
2193
- }
2194
- ),
2195
- /* @__PURE__ */ jsx(
2196
- Cuboid,
2197
- {
2198
- color: PIN_METAL_COLOR,
2199
- size: [
2200
- pinThickness / 1.8,
2201
- pinThickness / 1.8,
2202
- longSidePinLength
2203
- ],
2204
- center: [x, y, flipZ(-longSidePinLength / 2)]
2205
- }
2206
- )
2207
- ] }) }) }) })
2373
+ ),
2374
+ /* @__PURE__ */ jsx(
2375
+ Colorize,
2376
+ {
2377
+ color: PIN_METAL_COLOR,
2378
+ material: componentMaterials.goldContact,
2379
+ children: /* @__PURE__ */ jsx(Translate, { y: rightangle ? -3.9 : 0, z: rightangle ? 1 : 0, children: /* @__PURE__ */ jsx(Rotate, { rotation: rightangle ? [-Math.PI / 2, 0, 0] : [0, 0, 0], children: /* @__PURE__ */ jsxs(Hull, { children: [
2380
+ /* @__PURE__ */ jsx(
2381
+ Cuboid,
2382
+ {
2383
+ color: PIN_METAL_COLOR,
2384
+ size: [pinThickness, pinThickness, longSidePinLength * 0.9],
2385
+ center: [x, y, flipZ(-longSidePinLength / 2 * 0.9)]
2386
+ }
2387
+ ),
2388
+ /* @__PURE__ */ jsx(
2389
+ Cuboid,
2390
+ {
2391
+ color: PIN_METAL_COLOR,
2392
+ size: [
2393
+ pinThickness / 1.8,
2394
+ pinThickness / 1.8,
2395
+ longSidePinLength
2396
+ ],
2397
+ center: [x, y, flipZ(-longSidePinLength / 2)]
2398
+ }
2399
+ )
2400
+ ] }) }) })
2401
+ }
2402
+ )
2208
2403
  ] });
2209
2404
  };
2210
2405
 
@@ -2479,7 +2674,7 @@ var LegacyQFN = ({
2479
2674
  pinPositions.push({ pn, x, y, pw, pl });
2480
2675
  }
2481
2676
  return /* @__PURE__ */ jsxs(Fragment2, { children: [
2482
- /* @__PURE__ */ jsx(Colorize, { color: "grey", children: /* @__PURE__ */ jsx(
2677
+ /* @__PURE__ */ jsx(Colorize, { material: componentMaterials.tinnedLead, color: "grey", children: /* @__PURE__ */ jsx(
2483
2678
  Cuboid,
2484
2679
  {
2485
2680
  center: [0, 0, bodyThickness / 2],
@@ -2784,6 +2979,7 @@ var A0201 = ({ color = "#333" }) => {
2784
2979
  {
2785
2980
  size: [bodyLength4, width4, height4],
2786
2981
  offset: [0, 0, height4 / 2],
2982
+ material: componentMaterials.moldedPlastic,
2787
2983
  color
2788
2984
  }
2789
2985
  ),
@@ -2792,6 +2988,7 @@ var A0201 = ({ color = "#333" }) => {
2792
2988
  {
2793
2989
  size: [terminatorWidth3, width4, height4],
2794
2990
  offset: [fullLength4 / 2 - terminatorWidth3 / 2, 0, height4 / 2],
2991
+ material: componentMaterials.tinnedLead,
2795
2992
  color: "#ccc"
2796
2993
  }
2797
2994
  ),
@@ -2800,6 +2997,7 @@ var A0201 = ({ color = "#333" }) => {
2800
2997
  {
2801
2998
  size: [terminatorWidth3, width4, height4],
2802
2999
  offset: [-fullLength4 / 2 + terminatorWidth3 / 2, 0, height4 / 2],
3000
+ material: componentMaterials.tinnedLead,
2803
3001
  color: "#ccc"
2804
3002
  }
2805
3003
  )
@@ -2819,6 +3017,7 @@ var A01005 = ({ color = "#333" }) => {
2819
3017
  {
2820
3018
  size: [bodyLength5, width5, height5],
2821
3019
  offset: [0, 0, height5 / 2],
3020
+ material: componentMaterials.moldedPlastic,
2822
3021
  color
2823
3022
  }
2824
3023
  ),
@@ -2827,6 +3026,7 @@ var A01005 = ({ color = "#333" }) => {
2827
3026
  {
2828
3027
  size: [terminatorWidth4, width5, height5],
2829
3028
  offset: [fullLength5 / 2 - terminatorWidth4 / 2, 0, height5 / 2],
3029
+ material: componentMaterials.tinnedLead,
2830
3030
  color: "#ccc"
2831
3031
  }
2832
3032
  ),
@@ -2835,6 +3035,7 @@ var A01005 = ({ color = "#333" }) => {
2835
3035
  {
2836
3036
  size: [terminatorWidth4, width5, height5],
2837
3037
  offset: [-fullLength5 / 2 + terminatorWidth4 / 2, 0, height5 / 2],
3038
+ material: componentMaterials.tinnedLead,
2838
3039
  color: "#ccc"
2839
3040
  }
2840
3041
  )
@@ -2854,6 +3055,7 @@ var A1206 = ({ color = "#333" }) => {
2854
3055
  {
2855
3056
  size: [bodyLength6, width6, height6],
2856
3057
  offset: [0, 0, height6 / 2],
3058
+ material: componentMaterials.moldedPlastic,
2857
3059
  color
2858
3060
  }
2859
3061
  ),
@@ -2862,6 +3064,7 @@ var A1206 = ({ color = "#333" }) => {
2862
3064
  {
2863
3065
  size: [terminatorWidth5, width6, height6],
2864
3066
  offset: [fullLength6 / 2 - terminatorWidth5 / 2, 0, height6 / 2],
3067
+ material: componentMaterials.tinnedLead,
2865
3068
  color: "#ccc"
2866
3069
  }
2867
3070
  ),
@@ -2870,6 +3073,7 @@ var A1206 = ({ color = "#333" }) => {
2870
3073
  {
2871
3074
  size: [terminatorWidth5, width6, height6],
2872
3075
  offset: [-fullLength6 / 2 + terminatorWidth5 / 2, 0, height6 / 2],
3076
+ material: componentMaterials.tinnedLead,
2873
3077
  color: "#ccc"
2874
3078
  }
2875
3079
  )
@@ -2889,6 +3093,7 @@ var A1210 = ({ color = "#333" }) => {
2889
3093
  {
2890
3094
  size: [bodyLength7, width7, height7],
2891
3095
  offset: [0, 0, height7 / 2],
3096
+ material: componentMaterials.moldedPlastic,
2892
3097
  color
2893
3098
  }
2894
3099
  ),
@@ -2897,6 +3102,7 @@ var A1210 = ({ color = "#333" }) => {
2897
3102
  {
2898
3103
  size: [terminatorWidth6, width7, height7],
2899
3104
  offset: [fullLength7 / 2 - terminatorWidth6 / 2, 0, height7 / 2],
3105
+ material: componentMaterials.tinnedLead,
2900
3106
  color: "#ccc"
2901
3107
  }
2902
3108
  ),
@@ -2905,6 +3111,7 @@ var A1210 = ({ color = "#333" }) => {
2905
3111
  {
2906
3112
  size: [terminatorWidth6, width7, height7],
2907
3113
  offset: [-fullLength7 / 2 + terminatorWidth6 / 2, 0, height7 / 2],
3114
+ material: componentMaterials.tinnedLead,
2908
3115
  color: "#ccc"
2909
3116
  }
2910
3117
  )
@@ -2924,6 +3131,7 @@ var A2010 = ({ color = "#333" }) => {
2924
3131
  {
2925
3132
  size: [bodyLength8, width8, height8],
2926
3133
  offset: [0, 0, height8 / 2],
3134
+ material: componentMaterials.moldedPlastic,
2927
3135
  color
2928
3136
  }
2929
3137
  ),
@@ -2932,6 +3140,7 @@ var A2010 = ({ color = "#333" }) => {
2932
3140
  {
2933
3141
  size: [terminatorWidth7, width8, height8],
2934
3142
  offset: [fullLength8 / 2 - terminatorWidth7 / 2, 0, height8 / 2],
3143
+ material: componentMaterials.tinnedLead,
2935
3144
  color: "#ccc"
2936
3145
  }
2937
3146
  ),
@@ -2940,6 +3149,7 @@ var A2010 = ({ color = "#333" }) => {
2940
3149
  {
2941
3150
  size: [terminatorWidth7, width8, height8],
2942
3151
  offset: [-fullLength8 / 2 + terminatorWidth7 / 2, 0, height8 / 2],
3152
+ material: componentMaterials.tinnedLead,
2943
3153
  color: "#ccc"
2944
3154
  }
2945
3155
  )
@@ -2959,6 +3169,7 @@ var A2512 = ({ color = "#333" }) => {
2959
3169
  {
2960
3170
  size: [bodyLength9, width9, height9],
2961
3171
  offset: [0, 0, height9 / 2],
3172
+ material: componentMaterials.moldedPlastic,
2962
3173
  color
2963
3174
  }
2964
3175
  ),
@@ -2967,6 +3178,7 @@ var A2512 = ({ color = "#333" }) => {
2967
3178
  {
2968
3179
  size: [terminatorWidth8, width9, height9],
2969
3180
  offset: [fullLength9 / 2 - terminatorWidth8 / 2, 0, height9 / 2],
3181
+ material: componentMaterials.tinnedLead,
2970
3182
  color: "#ccc"
2971
3183
  }
2972
3184
  ),
@@ -2975,6 +3187,7 @@ var A2512 = ({ color = "#333" }) => {
2975
3187
  {
2976
3188
  size: [terminatorWidth8, width9, height9],
2977
3189
  offset: [-fullLength9 / 2 + terminatorWidth8 / 2, 0, height9 / 2],
3190
+ material: componentMaterials.tinnedLead,
2978
3191
  color: "#ccc"
2979
3192
  }
2980
3193
  )
@@ -4813,11 +5026,11 @@ var DFN = ({
4813
5026
  }
4814
5027
  );
4815
5028
  return /* @__PURE__ */ jsxs(Fragment2, { children: [
4816
- /* @__PURE__ */ jsx(Colorize, { color: "#25272a", children: pin1MarkWidth > 0 ? /* @__PURE__ */ jsxs(Subtract, { children: [
5029
+ /* @__PURE__ */ jsx(Colorize, { material: componentMaterials.moldedPlastic, color: "#25272a", children: pin1MarkWidth > 0 ? /* @__PURE__ */ jsxs(Subtract, { children: [
4817
5030
  body,
4818
5031
  stripe
4819
5032
  ] }) : body }),
4820
- /* @__PURE__ */ jsx(Colorize, { color: "#c7c9cd", children: pinPositions.map(
5033
+ /* @__PURE__ */ jsx(Colorize, { material: componentMaterials.tinnedLead, color: "#c7c9cd", children: pinPositions.map(
4821
5034
  (p) => p.pinNumber === 1 && pin1TerminalChamfer > 0 ? /* @__PURE__ */ jsxs(Hull, { children: [
4822
5035
  /* @__PURE__ */ jsx(
4823
5036
  Cuboid,
@@ -4857,6 +5070,7 @@ var DFN = ({
4857
5070
  thermalPadSize && /* @__PURE__ */ jsx(
4858
5071
  Cuboid,
4859
5072
  {
5073
+ material: componentMaterials.tinnedLead,
4860
5074
  color: "#c7c9cd",
4861
5075
  size: [
4862
5076
  thermalPadSize.width,
@@ -6494,99 +6708,114 @@ var JSTZH1_5mm = ({
6494
6708
  const bodyWidth = (numPins - 1) * pitch + 4;
6495
6709
  const startX = -((numPins - 1) * pitch) / 2;
6496
6710
  return /* @__PURE__ */ jsxs(Fragment2, { children: [
6497
- /* @__PURE__ */ jsx(Translate, { offset: [0, 0, bodyHeight], children: /* @__PURE__ */ jsx(Rotate, { angles: [Math.PI, 0, 0], children: /* @__PURE__ */ jsx(Colorize, { color: bodyColor, children: /* @__PURE__ */ jsxs(Subtract, { children: [
6498
- /* @__PURE__ */ jsx(
6499
- Cuboid,
6500
- {
6501
- size: [bodyWidth, bodyDepth, bodyHeight],
6502
- center: [0, 0, bodyHeight / 2]
6503
- }
6504
- ),
6505
- /* @__PURE__ */ jsx(
6506
- Cuboid,
6507
- {
6508
- size: [
6509
- bodyWidth - wallThickness * 2,
6510
- bodyDepth - wallThickness * 2,
6511
- hollowHeight
6512
- ],
6513
- center: [0, 0, hollowHeight / 2]
6514
- }
6515
- ),
6516
- /* @__PURE__ */ jsx(
6517
- Cuboid,
6518
- {
6519
- size: [bodyWidth, bodyDepth / 3, hollowHeight],
6520
- center: [0, 0, hollowHeight / 6]
6521
- }
6522
- ),
6523
- /* @__PURE__ */ jsx(
6524
- Cuboid,
6525
- {
6526
- size: [
6527
- bodyWidth - wallThickness * 2,
6528
- wallThickness / 2,
6529
- hollowHeight
6530
- ],
6531
- center: [
6532
- 0,
6533
- bodyDepth / 2 - wallThickness / 4,
6534
- hollowHeight / 2
6535
- ]
6536
- }
6537
- ),
6538
- /* @__PURE__ */ jsx(
6539
- Cuboid,
6540
- {
6541
- size: [
6542
- bodyWidth - wallThickness * 2,
6543
- wallThickness / 2,
6544
- hollowHeight
6545
- ],
6546
- center: [
6547
- 0,
6548
- -bodyDepth / 2 + wallThickness / 4,
6549
- hollowHeight / 2
6550
- ]
6551
- }
6552
- ),
6553
- /* @__PURE__ */ jsx(
6554
- Cuboid,
6555
- {
6556
- size: [1, wallThickness + 2, 1],
6557
- center: [-bodyWidth / 4, bodyDepth / 2, bodyHeight / 2]
6558
- }
6559
- ),
6560
- /* @__PURE__ */ jsx(
6561
- Cuboid,
6562
- {
6563
- size: [1, wallThickness + 3, 1],
6564
- center: [bodyWidth / 4, bodyDepth / 2, bodyHeight / 2]
6565
- }
6566
- ),
6567
- /* @__PURE__ */ jsx(
6568
- Cuboid,
6569
- {
6570
- size: [1, wallThickness + 2, 1],
6571
- center: [-bodyWidth / 4, -bodyDepth / 2, bodyHeight / 2]
6572
- }
6573
- ),
6574
- /* @__PURE__ */ jsx(
6575
- Cuboid,
6576
- {
6577
- size: [1, wallThickness + 3, 1],
6578
- center: [bodyWidth / 4, -bodyDepth / 2, bodyHeight / 2]
6579
- }
6580
- )
6581
- ] }) }) }) }),
6582
- showPins && Array.from({ length: numPins }).map((_, i) => /* @__PURE__ */ jsx(Colorize, { color: pinColor, children: /* @__PURE__ */ jsx(
6583
- Cylinder,
6711
+ /* @__PURE__ */ jsx(Translate, { offset: [0, 0, bodyHeight], children: /* @__PURE__ */ jsx(Rotate, { angles: [Math.PI, 0, 0], children: /* @__PURE__ */ jsx(
6712
+ Colorize,
6584
6713
  {
6585
- height: pinLength,
6586
- radius: 0.35,
6587
- center: [startX + i * pitch, 0, 2.5]
6714
+ material: componentMaterials.moldedPlastic,
6715
+ color: bodyColor,
6716
+ children: /* @__PURE__ */ jsxs(Subtract, { children: [
6717
+ /* @__PURE__ */ jsx(
6718
+ Cuboid,
6719
+ {
6720
+ size: [bodyWidth, bodyDepth, bodyHeight],
6721
+ center: [0, 0, bodyHeight / 2]
6722
+ }
6723
+ ),
6724
+ /* @__PURE__ */ jsx(
6725
+ Cuboid,
6726
+ {
6727
+ size: [
6728
+ bodyWidth - wallThickness * 2,
6729
+ bodyDepth - wallThickness * 2,
6730
+ hollowHeight
6731
+ ],
6732
+ center: [0, 0, hollowHeight / 2]
6733
+ }
6734
+ ),
6735
+ /* @__PURE__ */ jsx(
6736
+ Cuboid,
6737
+ {
6738
+ size: [bodyWidth, bodyDepth / 3, hollowHeight],
6739
+ center: [0, 0, hollowHeight / 6]
6740
+ }
6741
+ ),
6742
+ /* @__PURE__ */ jsx(
6743
+ Cuboid,
6744
+ {
6745
+ size: [
6746
+ bodyWidth - wallThickness * 2,
6747
+ wallThickness / 2,
6748
+ hollowHeight
6749
+ ],
6750
+ center: [
6751
+ 0,
6752
+ bodyDepth / 2 - wallThickness / 4,
6753
+ hollowHeight / 2
6754
+ ]
6755
+ }
6756
+ ),
6757
+ /* @__PURE__ */ jsx(
6758
+ Cuboid,
6759
+ {
6760
+ size: [
6761
+ bodyWidth - wallThickness * 2,
6762
+ wallThickness / 2,
6763
+ hollowHeight
6764
+ ],
6765
+ center: [
6766
+ 0,
6767
+ -bodyDepth / 2 + wallThickness / 4,
6768
+ hollowHeight / 2
6769
+ ]
6770
+ }
6771
+ ),
6772
+ /* @__PURE__ */ jsx(
6773
+ Cuboid,
6774
+ {
6775
+ size: [1, wallThickness + 2, 1],
6776
+ center: [-bodyWidth / 4, bodyDepth / 2, bodyHeight / 2]
6777
+ }
6778
+ ),
6779
+ /* @__PURE__ */ jsx(
6780
+ Cuboid,
6781
+ {
6782
+ size: [1, wallThickness + 3, 1],
6783
+ center: [bodyWidth / 4, bodyDepth / 2, bodyHeight / 2]
6784
+ }
6785
+ ),
6786
+ /* @__PURE__ */ jsx(
6787
+ Cuboid,
6788
+ {
6789
+ size: [1, wallThickness + 2, 1],
6790
+ center: [-bodyWidth / 4, -bodyDepth / 2, bodyHeight / 2]
6791
+ }
6792
+ ),
6793
+ /* @__PURE__ */ jsx(
6794
+ Cuboid,
6795
+ {
6796
+ size: [1, wallThickness + 3, 1],
6797
+ center: [bodyWidth / 4, -bodyDepth / 2, bodyHeight / 2]
6798
+ }
6799
+ )
6800
+ ] })
6588
6801
  }
6589
- ) }, i)),
6802
+ ) }) }),
6803
+ showPins && Array.from({ length: numPins }).map((_, i) => /* @__PURE__ */ jsx(
6804
+ Colorize,
6805
+ {
6806
+ material: componentMaterials.tinnedLead,
6807
+ color: pinColor,
6808
+ children: /* @__PURE__ */ jsx(
6809
+ Cylinder,
6810
+ {
6811
+ height: pinLength,
6812
+ radius: 0.35,
6813
+ center: [startX + i * pitch, 0, 2.5]
6814
+ }
6815
+ )
6816
+ },
6817
+ i
6818
+ )),
6590
6819
  showFootprint && Array.from({ length: numPins }).map((_, i) => {
6591
6820
  const isPin1 = i === 0;
6592
6821
  const hole = isPin1 ? {
@@ -6652,120 +6881,135 @@ var JSTPH2_0mm = ({
6652
6881
  const topReliefWidth = 0.8;
6653
6882
  const topReliefDepth = 0.65;
6654
6883
  return /* @__PURE__ */ jsxs(Fragment2, { children: [
6655
- /* @__PURE__ */ jsx(Translate, { offset: [0, 0, bodyHeight], children: /* @__PURE__ */ jsx(Rotate, { angles: [Math.PI, 0, 0], children: /* @__PURE__ */ jsx(Colorize, { color: bodyColor, children: /* @__PURE__ */ jsxs(Subtract, { children: [
6656
- /* @__PURE__ */ jsx(
6657
- Cuboid,
6658
- {
6659
- size: [bodyWidth, bodyDepth, bodyHeight],
6660
- center: [0, 0, bodyHeight / 2]
6661
- }
6662
- ),
6663
- /* @__PURE__ */ jsx(
6664
- Cuboid,
6665
- {
6666
- size: [
6667
- bodyWidth - wallThickness * 2,
6668
- bodyDepth - wallThickness * 2,
6669
- hollowHeight
6670
- ],
6671
- center: [0, 0, hollowHeight / 2]
6672
- }
6673
- ),
6674
- /* @__PURE__ */ jsx(
6675
- Cuboid,
6676
- {
6677
- size: [bodyWidth, bodyDepth / 3, hollowHeight],
6678
- center: [0, 0, hollowHeight / 6]
6679
- }
6680
- ),
6681
- /* @__PURE__ */ jsx(
6682
- Cuboid,
6683
- {
6684
- size: [
6685
- bodyWidth - wallThickness * 2,
6686
- wallThickness / 2,
6687
- hollowHeight
6688
- ],
6689
- center: [
6690
- 0,
6691
- bodyDepth / 2 - wallThickness / 4,
6692
- hollowHeight / 2
6693
- ]
6694
- }
6695
- ),
6696
- /* @__PURE__ */ jsx(
6697
- Cuboid,
6698
- {
6699
- size: [
6700
- bodyWidth - wallThickness * 2,
6701
- wallThickness / 2,
6702
- hollowHeight
6703
- ],
6704
- center: [
6705
- 0,
6706
- -bodyDepth / 2 + wallThickness / 4,
6707
- hollowHeight / 2
6708
- ]
6709
- }
6710
- ),
6711
- /* @__PURE__ */ jsx(
6712
- Cuboid,
6713
- {
6714
- size: [
6715
- latchWindowWidth,
6716
- bodyDepth + wallThickness,
6717
- latchWindowHeight
6718
- ],
6719
- center: [-bodyWidth / 2 + latchWindowInset, 0, bodyHeight / 2]
6720
- }
6721
- ),
6722
- /* @__PURE__ */ jsx(
6723
- Cuboid,
6724
- {
6725
- size: [
6726
- latchWindowWidth,
6727
- bodyDepth + wallThickness,
6728
- latchWindowHeight
6729
- ],
6730
- center: [bodyWidth / 2 - latchWindowInset, 0, bodyHeight / 2]
6731
- }
6732
- ),
6733
- /* @__PURE__ */ jsx(
6734
- Cuboid,
6735
- {
6736
- size: [wallThickness * 3, topReliefWidth, topReliefDepth],
6737
- center: [-bodyWidth / 2, 0, topReliefDepth / 2]
6738
- }
6739
- ),
6740
- /* @__PURE__ */ jsx(Translate, { offset: [-bodyWidth / 2, 0, topReliefDepth], children: /* @__PURE__ */ jsx(Rotate, { angles: [0, Math.PI / 2, 0], children: /* @__PURE__ */ jsx(
6741
- Cylinder,
6742
- {
6743
- height: wallThickness * 3,
6744
- radius: topReliefWidth / 2
6745
- }
6746
- ) }) }),
6747
- /* @__PURE__ */ jsx(
6748
- Cuboid,
6749
- {
6750
- size: [wallThickness * 3, topReliefWidth, topReliefDepth],
6751
- center: [bodyWidth / 2, 0, topReliefDepth / 2]
6752
- }
6753
- ),
6754
- /* @__PURE__ */ jsx(Translate, { offset: [bodyWidth / 2, 0, topReliefDepth], children: /* @__PURE__ */ jsx(Rotate, { angles: [0, Math.PI / 2, 0], children: /* @__PURE__ */ jsx(
6755
- Cylinder,
6756
- {
6757
- height: wallThickness * 3,
6758
- radius: topReliefWidth / 2
6759
- }
6760
- ) }) })
6761
- ] }) }) }) }),
6762
- showPins && Array.from({ length: numPins }).map((_, i) => /* @__PURE__ */ jsx(Colorize, { color: pinColor, children: /* @__PURE__ */ jsx(
6763
- Cuboid,
6884
+ /* @__PURE__ */ jsx(Translate, { offset: [0, 0, bodyHeight], children: /* @__PURE__ */ jsx(Rotate, { angles: [Math.PI, 0, 0], children: /* @__PURE__ */ jsx(
6885
+ Colorize,
6764
6886
  {
6765
- size: [pinThickness, pinThickness, pinLength],
6766
- center: [startX + i * pitch, 0, (pinTop - pinTailLength) / 2]
6887
+ color: bodyColor,
6888
+ material: componentMaterials.moldedPlastic,
6889
+ children: /* @__PURE__ */ jsxs(Subtract, { children: [
6890
+ /* @__PURE__ */ jsx(
6891
+ Cuboid,
6892
+ {
6893
+ size: [bodyWidth, bodyDepth, bodyHeight],
6894
+ center: [0, 0, bodyHeight / 2]
6895
+ }
6896
+ ),
6897
+ /* @__PURE__ */ jsx(
6898
+ Cuboid,
6899
+ {
6900
+ size: [
6901
+ bodyWidth - wallThickness * 2,
6902
+ bodyDepth - wallThickness * 2,
6903
+ hollowHeight
6904
+ ],
6905
+ center: [0, 0, hollowHeight / 2]
6906
+ }
6907
+ ),
6908
+ /* @__PURE__ */ jsx(
6909
+ Cuboid,
6910
+ {
6911
+ size: [bodyWidth, bodyDepth / 3, hollowHeight],
6912
+ center: [0, 0, hollowHeight / 6]
6913
+ }
6914
+ ),
6915
+ /* @__PURE__ */ jsx(
6916
+ Cuboid,
6917
+ {
6918
+ size: [
6919
+ bodyWidth - wallThickness * 2,
6920
+ wallThickness / 2,
6921
+ hollowHeight
6922
+ ],
6923
+ center: [
6924
+ 0,
6925
+ bodyDepth / 2 - wallThickness / 4,
6926
+ hollowHeight / 2
6927
+ ]
6928
+ }
6929
+ ),
6930
+ /* @__PURE__ */ jsx(
6931
+ Cuboid,
6932
+ {
6933
+ size: [
6934
+ bodyWidth - wallThickness * 2,
6935
+ wallThickness / 2,
6936
+ hollowHeight
6937
+ ],
6938
+ center: [
6939
+ 0,
6940
+ -bodyDepth / 2 + wallThickness / 4,
6941
+ hollowHeight / 2
6942
+ ]
6943
+ }
6944
+ ),
6945
+ /* @__PURE__ */ jsx(
6946
+ Cuboid,
6947
+ {
6948
+ size: [
6949
+ latchWindowWidth,
6950
+ bodyDepth + wallThickness,
6951
+ latchWindowHeight
6952
+ ],
6953
+ center: [-bodyWidth / 2 + latchWindowInset, 0, bodyHeight / 2]
6954
+ }
6955
+ ),
6956
+ /* @__PURE__ */ jsx(
6957
+ Cuboid,
6958
+ {
6959
+ size: [
6960
+ latchWindowWidth,
6961
+ bodyDepth + wallThickness,
6962
+ latchWindowHeight
6963
+ ],
6964
+ center: [bodyWidth / 2 - latchWindowInset, 0, bodyHeight / 2]
6965
+ }
6966
+ ),
6967
+ /* @__PURE__ */ jsx(
6968
+ Cuboid,
6969
+ {
6970
+ size: [wallThickness * 3, topReliefWidth, topReliefDepth],
6971
+ center: [-bodyWidth / 2, 0, topReliefDepth / 2]
6972
+ }
6973
+ ),
6974
+ /* @__PURE__ */ jsx(Translate, { offset: [-bodyWidth / 2, 0, topReliefDepth], children: /* @__PURE__ */ jsx(Rotate, { angles: [0, Math.PI / 2, 0], children: /* @__PURE__ */ jsx(
6975
+ Cylinder,
6976
+ {
6977
+ height: wallThickness * 3,
6978
+ radius: topReliefWidth / 2
6979
+ }
6980
+ ) }) }),
6981
+ /* @__PURE__ */ jsx(
6982
+ Cuboid,
6983
+ {
6984
+ size: [wallThickness * 3, topReliefWidth, topReliefDepth],
6985
+ center: [bodyWidth / 2, 0, topReliefDepth / 2]
6986
+ }
6987
+ ),
6988
+ /* @__PURE__ */ jsx(Translate, { offset: [bodyWidth / 2, 0, topReliefDepth], children: /* @__PURE__ */ jsx(Rotate, { angles: [0, Math.PI / 2, 0], children: /* @__PURE__ */ jsx(
6989
+ Cylinder,
6990
+ {
6991
+ height: wallThickness * 3,
6992
+ radius: topReliefWidth / 2
6993
+ }
6994
+ ) }) })
6995
+ ] })
6767
6996
  }
6768
- ) }, i)),
6997
+ ) }) }),
6998
+ showPins && Array.from({ length: numPins }).map((_, i) => /* @__PURE__ */ jsx(
6999
+ Colorize,
7000
+ {
7001
+ color: pinColor,
7002
+ material: componentMaterials.tinnedLead,
7003
+ children: /* @__PURE__ */ jsx(
7004
+ Cuboid,
7005
+ {
7006
+ size: [pinThickness, pinThickness, pinLength],
7007
+ center: [startX + i * pitch, 0, (pinTop - pinTailLength) / 2]
7008
+ }
7009
+ )
7010
+ },
7011
+ i
7012
+ )),
6769
7013
  showFootprint && Array.from({ length: numPins }).map((_, i) => {
6770
7014
  const isPin1 = i === 0;
6771
7015
  const hole = isPin1 ? {
@@ -6836,7 +7080,7 @@ var JSTXH2_5mm = ({
6836
7080
  );
6837
7081
  const lockNotchHeight = 2.4;
6838
7082
  return /* @__PURE__ */ jsxs(Fragment2, { children: [
6839
- /* @__PURE__ */ jsx(Translate, { offset: [0, 0, bodyHeight / 2], children: /* @__PURE__ */ jsx(Colorize, { color: bodyColor, children: /* @__PURE__ */ jsxs(Subtract, { children: [
7083
+ /* @__PURE__ */ jsx(Translate, { offset: [0, 0, bodyHeight / 2], children: /* @__PURE__ */ jsx(Colorize, { material: componentMaterials.moldedPlastic, color: bodyColor, children: /* @__PURE__ */ jsxs(Subtract, { children: [
6840
7084
  /* @__PURE__ */ jsx(Cuboid, { size: [bodyWidth, bodyDepth, bodyHeight] }),
6841
7085
  /* @__PURE__ */ jsx(Translate, { offset: [0, 0, (bodyHeight - hollowHeight) / 2 + 0.1], children: /* @__PURE__ */ jsx(
6842
7086
  Cuboid,
@@ -6913,7 +7157,15 @@ var JSTXH2_5mm = ({
6913
7157
  `vent_${i}`
6914
7158
  ))
6915
7159
  ] }) }) }),
6916
- showPins && Array.from({ length: numPins }).map((_, i) => /* @__PURE__ */ jsx(Colorize, { color: pinColor, children: /* @__PURE__ */ jsx(Translate, { offset: [startX + i * pitch, 0, pinLength / 2 - 3.4], children: /* @__PURE__ */ jsx(Cuboid, { size: [0.64, 0.64, pinLength] }) }) }, i)),
7160
+ showPins && Array.from({ length: numPins }).map((_, i) => /* @__PURE__ */ jsx(
7161
+ Colorize,
7162
+ {
7163
+ material: componentMaterials.tinnedLead,
7164
+ color: pinColor,
7165
+ children: /* @__PURE__ */ jsx(Translate, { offset: [startX + i * pitch, 0, pinLength / 2 - 3.4], children: /* @__PURE__ */ jsx(Cuboid, { size: [0.64, 0.64, pinLength] }) })
7166
+ },
7167
+ i
7168
+ )),
6917
7169
  showFootprint && (() => {
6918
7170
  try {
6919
7171
  const circuitJson = fp2.string(`jst${numPins}_xh`).circuitJson();
@@ -6966,7 +7218,7 @@ var JstSh = ({ footprint = "jst6_sh" }) => {
6966
7218
  const y = rowY + direction * 1.8, width10 = n + 2, depth = 2.9, height10 = 4.2;
6967
7219
  const pinY = y - direction * 0.25;
6968
7220
  return /* @__PURE__ */ jsxs(Rotate, { rotation: [0, 0, angle], children: [
6969
- /* @__PURE__ */ jsx(Colorize, { color: "#e4e1d6", children: /* @__PURE__ */ jsxs(Subtract, { children: [
7221
+ /* @__PURE__ */ jsx(Colorize, { material: componentMaterials.moldedPlastic, color: "#e4e1d6", children: /* @__PURE__ */ jsxs(Subtract, { children: [
6970
7222
  /* @__PURE__ */ jsx(
6971
7223
  Cuboid,
6972
7224
  {
@@ -7002,7 +7254,7 @@ var JstSh = ({ footprint = "jst6_sh" }) => {
7002
7254
  side
7003
7255
  ))
7004
7256
  ] }) }),
7005
- /* @__PURE__ */ jsxs(Colorize, { color: "#c6c7c9", children: [
7257
+ /* @__PURE__ */ jsxs(Colorize, { material: componentMaterials.tinnedLead, color: "#c6c7c9", children: [
7006
7258
  signals.map((pad, i) => {
7007
7259
  const tailY = pad.y - direction * pad.height * 0.4;
7008
7260
  return /* @__PURE__ */ jsxs(Union, { children: [
@@ -7140,18 +7392,26 @@ var Crystal = ({
7140
7392
  })
7141
7393
  ];
7142
7394
  return /* @__PURE__ */ jsxs(Fragment2, { children: [
7143
- terminalPositions.map((center, index) => /* @__PURE__ */ jsx(Colorize, { color: "#d6a258", children: /* @__PURE__ */ jsx(ExtrudeLinear, { height: terminalThickness, children: /* @__PURE__ */ jsx(
7144
- Polygon,
7395
+ terminalPositions.map((center, index) => /* @__PURE__ */ jsx(
7396
+ Colorize,
7145
7397
  {
7146
- points: getTerminalPoints(
7147
- center,
7148
- terminalWidth,
7149
- terminalLength,
7150
- bodyChamfer,
7151
- index === 0
7152
- )
7153
- }
7154
- ) }) }, index)),
7398
+ color: "#d6a258",
7399
+ material: componentMaterials.goldContact,
7400
+ children: /* @__PURE__ */ jsx(ExtrudeLinear, { height: terminalThickness, children: /* @__PURE__ */ jsx(
7401
+ Polygon,
7402
+ {
7403
+ points: getTerminalPoints(
7404
+ center,
7405
+ terminalWidth,
7406
+ terminalLength,
7407
+ bodyChamfer,
7408
+ index === 0
7409
+ )
7410
+ }
7411
+ ) })
7412
+ },
7413
+ index
7414
+ )),
7155
7415
  /* @__PURE__ */ jsx(
7156
7416
  ChipBody,
7157
7417
  {
@@ -7167,8 +7427,8 @@ var Crystal = ({
7167
7427
  chamferSize: bodyChamfer
7168
7428
  }
7169
7429
  ),
7170
- /* @__PURE__ */ jsx(Colorize, { color: "#d2a057", children: /* @__PURE__ */ jsx(Hull, { children: sealProfile }) }),
7171
- /* @__PURE__ */ jsx(Colorize, { color: "#b9bec2", children: /* @__PURE__ */ jsx(Hull, { children: lidProfiles }) })
7430
+ /* @__PURE__ */ jsx(Colorize, { color: "#d2a057", material: componentMaterials.goldContact, children: /* @__PURE__ */ jsx(Hull, { children: sealProfile }) }),
7431
+ /* @__PURE__ */ jsx(Colorize, { color: "#b9bec2", material: componentMaterials.brushedMetal, children: /* @__PURE__ */ jsx(Hull, { children: lidProfiles }) })
7172
7432
  ] });
7173
7433
  };
7174
7434
 
@@ -7607,6 +7867,7 @@ var ParametricChip = ({
7607
7867
  {
7608
7868
  size: [bodyLength10, width10, height10],
7609
7869
  offset: [0, 0, height10 / 2],
7870
+ material: componentMaterials.moldedPlastic,
7610
7871
  color
7611
7872
  }
7612
7873
  ),
@@ -7615,6 +7876,7 @@ var ParametricChip = ({
7615
7876
  {
7616
7877
  size: [terminatorWidth9, height10, width10],
7617
7878
  offset: [fullLength10 / 2 - terminatorWidth9 / 2, 0, height10 / 2],
7879
+ material: componentMaterials.tinnedLead,
7618
7880
  color: "#ccc"
7619
7881
  }
7620
7882
  ),
@@ -7623,6 +7885,7 @@ var ParametricChip = ({
7623
7885
  {
7624
7886
  size: [terminatorWidth9, height10, width10],
7625
7887
  offset: [-fullLength10 / 2 + terminatorWidth9 / 2, 0, height10 / 2],
7888
+ material: componentMaterials.tinnedLead,
7626
7889
  color: "#ccc"
7627
7890
  }
7628
7891
  )
@@ -8019,14 +8282,14 @@ var DPAK = ({
8019
8282
  const leadZ = tabThickness / 2;
8020
8283
  const leadThickness = 0.4;
8021
8284
  return /* @__PURE__ */ jsxs(Fragment2, { children: [
8022
- /* @__PURE__ */ jsx(Colorize, { color: tabColor, children: /* @__PURE__ */ jsx(
8285
+ /* @__PURE__ */ jsx(Colorize, { material: componentMaterials.tinnedLead, color: tabColor, children: /* @__PURE__ */ jsx(
8023
8286
  Cuboid,
8024
8287
  {
8025
8288
  size: [tabWidth, tabLength, tabThickness],
8026
8289
  center: [tabCenterX, 0, tabThickness / 2]
8027
8290
  }
8028
8291
  ) }),
8029
- /* @__PURE__ */ jsx(Colorize, { color, children: /* @__PURE__ */ jsx(
8292
+ /* @__PURE__ */ jsx(Colorize, { material: componentMaterials.moldedPlastic, color, children: /* @__PURE__ */ jsx(
8030
8293
  Cuboid,
8031
8294
  {
8032
8295
  size: [bodyWidth, bodyLength10, bodyHeight],
@@ -8034,39 +8297,47 @@ var DPAK = ({
8034
8297
  }
8035
8298
  ) }),
8036
8299
  [-1, 1].map((side) => {
8037
- return /* @__PURE__ */ jsxs(Colorize, { color: leadColor, children: [
8038
- /* @__PURE__ */ jsx(
8039
- Cuboid,
8040
- {
8041
- size: [leadContactLength, leadWidth, leadThickness],
8042
- center: [
8043
- leadPadX + leadContactLength / 2,
8044
- side * pitch,
8045
- leadThickness / 2
8046
- ]
8047
- }
8048
- ),
8049
- /* @__PURE__ */ jsxs(Hull, { children: [
8050
- /* @__PURE__ */ jsx(
8051
- Cuboid,
8052
- {
8053
- size: [0.1, leadWidth, leadThickness],
8054
- center: [
8055
- leadPadX + leadContactLength,
8056
- side * pitch,
8057
- leadThickness / 2
8058
- ]
8059
- }
8060
- ),
8061
- /* @__PURE__ */ jsx(
8062
- Cuboid,
8063
- {
8064
- size: [0.1, leadWidth, leadThickness],
8065
- center: [bodyFrontX, side * pitch, leadZ + tabThickness / 2]
8066
- }
8067
- )
8068
- ] })
8069
- ] }, `lead-${side}`);
8300
+ return /* @__PURE__ */ jsxs(
8301
+ Colorize,
8302
+ {
8303
+ material: componentMaterials.tinnedLead,
8304
+ color: leadColor,
8305
+ children: [
8306
+ /* @__PURE__ */ jsx(
8307
+ Cuboid,
8308
+ {
8309
+ size: [leadContactLength, leadWidth, leadThickness],
8310
+ center: [
8311
+ leadPadX + leadContactLength / 2,
8312
+ side * pitch,
8313
+ leadThickness / 2
8314
+ ]
8315
+ }
8316
+ ),
8317
+ /* @__PURE__ */ jsxs(Hull, { children: [
8318
+ /* @__PURE__ */ jsx(
8319
+ Cuboid,
8320
+ {
8321
+ size: [0.1, leadWidth, leadThickness],
8322
+ center: [
8323
+ leadPadX + leadContactLength,
8324
+ side * pitch,
8325
+ leadThickness / 2
8326
+ ]
8327
+ }
8328
+ ),
8329
+ /* @__PURE__ */ jsx(
8330
+ Cuboid,
8331
+ {
8332
+ size: [0.1, leadWidth, leadThickness],
8333
+ center: [bodyFrontX, side * pitch, leadZ + tabThickness / 2]
8334
+ }
8335
+ )
8336
+ ] })
8337
+ ]
8338
+ },
8339
+ `lead-${side}`
8340
+ );
8070
8341
  })
8071
8342
  ] });
8072
8343
  };
@@ -8090,7 +8361,7 @@ var ElectrolyticCapacitor = ({
8090
8361
  const grooveWidth = Math.max(diameter * 0.06, 0.2);
8091
8362
  const grooveDepth = 0.3;
8092
8363
  return /* @__PURE__ */ jsxs(Fragment2, { children: [
8093
- /* @__PURE__ */ jsx(Colorize, { color: baseColor, children: /* @__PURE__ */ jsx(
8364
+ /* @__PURE__ */ jsx(Colorize, { color: baseColor, material: componentMaterials.rubber, children: /* @__PURE__ */ jsx(
8094
8365
  Cylinder,
8095
8366
  {
8096
8367
  radius: radius - 0.05,
@@ -8098,7 +8369,7 @@ var ElectrolyticCapacitor = ({
8098
8369
  center: [0, 0, baseHeight / 2]
8099
8370
  }
8100
8371
  ) }),
8101
- /* @__PURE__ */ jsx(Colorize, { color: sleeveColor, children: /* @__PURE__ */ jsxs(Subtract, { children: [
8372
+ /* @__PURE__ */ jsx(Colorize, { color: sleeveColor, material: componentMaterials.sleeve, children: /* @__PURE__ */ jsxs(Subtract, { children: [
8102
8373
  /* @__PURE__ */ jsx(
8103
8374
  RoundedCylinder,
8104
8375
  {
@@ -8123,14 +8394,22 @@ var ElectrolyticCapacitor = ({
8123
8394
  }
8124
8395
  )
8125
8396
  ] }) }),
8126
- [-1, 1].map((side) => /* @__PURE__ */ jsx(Colorize, { color: "#c0c0c0", children: /* @__PURE__ */ jsx(
8127
- Cylinder,
8397
+ [-1, 1].map((side) => /* @__PURE__ */ jsx(
8398
+ Colorize,
8128
8399
  {
8129
- radius: leadDiameter / 2,
8130
- height: leadLength + baseHeight,
8131
- center: [side * leadPitch / 2, 0, (baseHeight - leadLength) / 2]
8132
- }
8133
- ) }, `lead-${side}`))
8400
+ material: componentMaterials.tinnedLead,
8401
+ color: "#c0c0c0",
8402
+ children: /* @__PURE__ */ jsx(
8403
+ Cylinder,
8404
+ {
8405
+ radius: leadDiameter / 2,
8406
+ height: leadLength + baseHeight,
8407
+ center: [side * leadPitch / 2, 0, (baseHeight - leadLength) / 2]
8408
+ }
8409
+ )
8410
+ },
8411
+ `lead-${side}`
8412
+ ))
8134
8413
  ] });
8135
8414
  };
8136
8415
 
@@ -8437,7 +8716,7 @@ var UsbCMidmount = ({
8437
8716
  );
8438
8717
  const tabBottom = -0.9, tabTop = centerZ + 0.1;
8439
8718
  return /* @__PURE__ */ jsxs(Rotate, { rotation: [0, 0, angle], children: [
8440
- /* @__PURE__ */ jsx(Colorize, { color: "#b8bdc4", children: /* @__PURE__ */ jsx(Translate, { offset: [0, centerY, centerZ], children: /* @__PURE__ */ jsxs(Subtract, { children: [
8719
+ /* @__PURE__ */ jsx(Colorize, { color: "#b8bdc4", material: componentMaterials.brushedMetal, children: /* @__PURE__ */ jsx(Translate, { offset: [0, centerY, centerZ], children: /* @__PURE__ */ jsxs(Subtract, { children: [
8441
8720
  /* @__PURE__ */ jsx(Capsule, { width: width10, height: height10, depth }),
8442
8721
  /* @__PURE__ */ jsx(
8443
8722
  Capsule,
@@ -8448,7 +8727,7 @@ var UsbCMidmount = ({
8448
8727
  }
8449
8728
  )
8450
8729
  ] }) }) }),
8451
- /* @__PURE__ */ jsxs(Colorize, { color: "#242529", children: [
8730
+ /* @__PURE__ */ jsxs(Colorize, { color: "#242529", material: componentMaterials.moldedPlastic, children: [
8452
8731
  /* @__PURE__ */ jsx(
8453
8732
  Cuboid,
8454
8733
  {
@@ -8469,7 +8748,7 @@ var UsbCMidmount = ({
8469
8748
  ) : null
8470
8749
  )
8471
8750
  ] }),
8472
- /* @__PURE__ */ jsxs(Colorize, { color: "#d3ad57", children: [
8751
+ /* @__PURE__ */ jsxs(Colorize, { color: "#d3ad57", material: componentMaterials.goldContact, children: [
8473
8752
  [-1, 1].flatMap(
8474
8753
  (side) => [-2.75, -2.25, -1.25, -0.25, 0.25, 1.25, 2.25, 2.75].map((x) => /* @__PURE__ */ jsx(
8475
8754
  Cuboid,
@@ -8493,7 +8772,7 @@ var UsbCMidmount = ({
8493
8772
  i
8494
8773
  ))
8495
8774
  ] }),
8496
- /* @__PURE__ */ jsx(Colorize, { color: "#b8bdc4", children: slots.map((slot, i) => /* @__PURE__ */ jsx(
8775
+ /* @__PURE__ */ jsx(Colorize, { color: "#b8bdc4", material: componentMaterials.brushedMetal, children: slots.map((slot, i) => /* @__PURE__ */ jsx(
8497
8776
  Cuboid,
8498
8777
  {
8499
8778
  size: [
@@ -8790,34 +9069,56 @@ var CableStrip = ({
8790
9069
  color,
8791
9070
  acrossOffset = 0,
8792
9071
  normalOffset = 0,
8793
- overlap = 0.03
8794
- }) => /* @__PURE__ */ jsx(Colorize, { color, children: points.slice(1).map((point, index) => {
8795
- const previous = points[index];
8796
- const dx = point[0] - previous[0];
8797
- const dy = point[1] - previous[1];
8798
- const dz = point[2] - previous[2];
8799
- const segmentLength = Math.hypot(dx, dy, dz);
8800
- if (segmentLength < EPSILON) return null;
8801
- const pitch = Math.asin(dz / segmentLength);
8802
- const yaw = Math.atan2(-dx, dy);
8803
- const midpoint = [
8804
- (previous[0] + point[0]) / 2,
8805
- (previous[1] + point[1]) / 2,
8806
- (previous[2] + point[2]) / 2
8807
- ];
8808
- const roundRadius = Math.max(
8809
- 1e-3,
8810
- Math.min(width10, thickness, segmentLength) / 2 - 1e-3
8811
- );
8812
- return /* @__PURE__ */ jsx(Translate, { offset: midpoint, children: /* @__PURE__ */ jsx(Rotate, { rotation: [pitch, 0, yaw], children: /* @__PURE__ */ jsx(
8813
- RoundedCuboid,
8814
- {
8815
- size: [width10, segmentLength + overlap, thickness],
8816
- center: [acrossOffset, 0, normalOffset],
8817
- roundRadius
8818
- }
8819
- ) }) }, `${index}:${midpoint.join(":")}`);
8820
- }) });
9072
+ overlap = 0.03,
9073
+ widthAtDistance,
9074
+ startDistance = 0
9075
+ }) => {
9076
+ const distances = getPathDistances(points);
9077
+ return /* @__PURE__ */ jsx(Colorize, { color, children: points.slice(1).map((point, index) => {
9078
+ const previous = points[index];
9079
+ const dx = point[0] - previous[0];
9080
+ const dy = point[1] - previous[1];
9081
+ const dz = point[2] - previous[2];
9082
+ const segmentLength = Math.hypot(dx, dy, dz);
9083
+ if (segmentLength < EPSILON) return null;
9084
+ const pitch = Math.asin(dz / segmentLength);
9085
+ const yaw = Math.atan2(-dx, dy);
9086
+ const midpoint = [
9087
+ (previous[0] + point[0]) / 2,
9088
+ (previous[1] + point[1]) / 2,
9089
+ (previous[2] + point[2]) / 2
9090
+ ];
9091
+ const roundRadius = Math.max(
9092
+ 1e-3,
9093
+ Math.min(width10, thickness, segmentLength) / 2 - 1e-3
9094
+ );
9095
+ const startWidth = widthAtDistance?.(startDistance + distances[index]) ?? width10;
9096
+ const endWidth = widthAtDistance?.(startDistance + distances[index + 1]) ?? width10;
9097
+ return /* @__PURE__ */ jsx(Translate, { offset: midpoint, children: /* @__PURE__ */ jsx(Rotate, { rotation: [pitch, 0, yaw], children: widthAtDistance ? /* @__PURE__ */ jsxs(Hull, { children: [
9098
+ /* @__PURE__ */ jsx(
9099
+ Cuboid,
9100
+ {
9101
+ size: [startWidth, overlap, thickness],
9102
+ center: [acrossOffset, -segmentLength / 2, normalOffset]
9103
+ }
9104
+ ),
9105
+ /* @__PURE__ */ jsx(
9106
+ Cuboid,
9107
+ {
9108
+ size: [endWidth, overlap, thickness],
9109
+ center: [acrossOffset, segmentLength / 2, normalOffset]
9110
+ }
9111
+ )
9112
+ ] }) : /* @__PURE__ */ jsx(
9113
+ RoundedCuboid,
9114
+ {
9115
+ size: [width10, segmentLength + overlap, thickness],
9116
+ center: [acrossOffset, 0, normalOffset],
9117
+ roundRadius
9118
+ }
9119
+ ) }) }, `${index}:${midpoint.join(":")}`);
9120
+ }) });
9121
+ };
8821
9122
  var FlexScreen = (props) => {
8822
9123
  const {
8823
9124
  width: width10,
@@ -8837,13 +9138,15 @@ var FlexScreen = (props) => {
8837
9138
  flexCableLength = 28,
8838
9139
  flexCableThickness = 0.18,
8839
9140
  flexCableColor = "#d79528",
8840
- conductorCount = 8,
8841
- conductorPitch,
8842
- conductorWidth,
9141
+ pinCount: conductorCount = props.conductorCount ?? 8,
9142
+ pitch: conductorPitch = props.conductorPitch,
9143
+ padWidth: conductorWidth = props.conductorWidth,
8843
9144
  conductorThickness = 0.035,
8844
9145
  conductorColor = "#8c4a18",
8845
9146
  cableEdgeMargin = 0.6,
8846
- exposedContactLength = 2.4,
9147
+ padLength: exposedContactLength = props.exposedContactLength ?? 2.4,
9148
+ tailLength,
9149
+ taperLength,
8847
9150
  showConductors = true,
8848
9151
  showFlexCable = true,
8849
9152
  showStiffeners = true,
@@ -8891,8 +9194,11 @@ var FlexScreen = (props) => {
8891
9194
  assertPositive("foldOutset", foldOutset);
8892
9195
  assertPositive("boardThickness", boardThickness);
8893
9196
  if (showStiffeners) assertPositive("stiffenerThickness", stiffenerThickness);
9197
+ if (!Number.isFinite(exposedContactLength) || exposedContactLength < 0) {
9198
+ throw new Error("padLength must be a finite nonnegative length");
9199
+ }
8894
9200
  if (!Number.isInteger(conductorCount) || conductorCount < 1) {
8895
- throw new Error("conductorCount must be a positive integer");
9201
+ throw new Error("pinCount must be a positive integer");
8896
9202
  }
8897
9203
  if (!Number.isInteger(bendSegments) || bendSegments < 2) {
8898
9204
  throw new Error("bendSegments must be an integer of at least 2");
@@ -8912,17 +9218,22 @@ var FlexScreen = (props) => {
8912
9218
  throw new Error("cableEdgeMargin leaves no usable flex cable width");
8913
9219
  }
8914
9220
  const resolvedConductorPitch = conductorPitch ?? (conductorCount === 1 ? 0 : usableCableWidth / conductorCount);
8915
- if (conductorCount > 1 && (!Number.isFinite(resolvedConductorPitch) || resolvedConductorPitch <= 0)) {
8916
- throw new Error("conductorPitch must be greater than zero");
9221
+ if ((conductorPitch !== void 0 || conductorCount > 1) && (!Number.isFinite(resolvedConductorPitch) || resolvedConductorPitch <= 0)) {
9222
+ throw new Error("pitch must be greater than zero");
8917
9223
  }
8918
9224
  const resolvedConductorWidth = conductorWidth ?? (conductorCount === 1 ? Math.min(usableCableWidth, resolvedCableWidth * 0.45) : resolvedConductorPitch * 0.48);
8919
- assertPositive("conductorWidth", resolvedConductorWidth);
9225
+ assertPositive("padWidth", resolvedConductorWidth);
8920
9226
  const conductorSpan = (conductorCount - 1) * resolvedConductorPitch + resolvedConductorWidth;
8921
- if (conductorSpan > usableCableWidth + EPSILON) {
8922
- throw new Error(
8923
- "conductorPitch and conductorWidth do not fit inside the flex cable margins"
8924
- );
8925
- }
9227
+ const connectorWidth = Math.max(
9228
+ resolvedCableWidth,
9229
+ conductorSpan + cableEdgeMargin * 2
9230
+ );
9231
+ const widensAtConnector = connectorWidth > resolvedCableWidth + EPSILON;
9232
+ const screenConductorPitch = widensAtConnector ? conductorCount === 1 ? 0 : usableCableWidth / conductorCount : resolvedConductorPitch;
9233
+ const screenConductorWidth = widensAtConnector ? Math.min(
9234
+ resolvedConductorWidth,
9235
+ conductorCount === 1 ? usableCableWidth : screenConductorPitch * 0.48
9236
+ ) : resolvedConductorWidth;
8926
9237
  const cableStartsBelowBoard = belowBoard && !foldedFace;
8927
9238
  const defaultCableZ = cableStartsBelowBoard ? boardTopZ - boardThickness - boardClearance - flexCableThickness / 2 : boardTopZ + boardClearance + flexCableThickness / 2;
8928
9239
  const start = [
@@ -8949,23 +9260,56 @@ var FlexScreen = (props) => {
8949
9260
  direction
8950
9261
  }) : createFlatPath(start, flexCableLength);
8951
9262
  const totalCableLength = getPathDistances(path).at(-1);
9263
+ if (tailLength !== void 0) {
9264
+ assertPositive("tailLength", tailLength);
9265
+ if (tailLength >= totalCableLength) {
9266
+ throw new Error("tailLength must be shorter than flexCableLength");
9267
+ }
9268
+ }
9269
+ if (taperLength !== void 0) assertPositive("taperLength", taperLength);
8952
9270
  const contactLength = Math.min(
8953
9271
  Math.max(0, exposedContactLength),
8954
- totalCableLength / 2
9272
+ totalCableLength / 2,
9273
+ tailLength ?? Infinity
8955
9274
  );
8956
9275
  const resolvedStiffenerLength = Math.min(
8957
9276
  Math.max(0, stiffenerLength),
8958
- totalCableLength / 2
9277
+ totalCableLength / 2,
9278
+ tailLength ?? Infinity
9279
+ );
9280
+ const connectorLeadLength = tailLength ?? Math.max(contactLength, resolvedStiffenerLength);
9281
+ if (taperLength !== void 0 && connectorLeadLength + taperLength > totalCableLength + EPSILON) {
9282
+ throw new Error(
9283
+ "tailLength and taperLength must fit within flexCableLength"
9284
+ );
9285
+ }
9286
+ const taperEndDistance = Math.min(
9287
+ totalCableLength,
9288
+ connectorLeadLength + (taperLength ?? Math.max(3, (connectorWidth - resolvedCableWidth) / 2))
8959
9289
  );
9290
+ const cableWidthAtDistance = (distance2) => {
9291
+ if (distance2 <= connectorLeadLength) return connectorWidth;
9292
+ const progress = Math.min(
9293
+ 1,
9294
+ (distance2 - connectorLeadLength) / (taperEndDistance - connectorLeadLength)
9295
+ );
9296
+ return connectorWidth + (resolvedCableWidth - connectorWidth) * progress;
9297
+ };
9298
+ const cablePath = widensAtConnector ? [
9299
+ ...slicePath(path, 0, connectorLeadLength),
9300
+ ...slicePath(path, connectorLeadLength, taperEndDistance).slice(1),
9301
+ ...slicePath(path, taperEndDistance, totalCableLength).slice(1)
9302
+ ] : path;
9303
+ const widthProfile = widensAtConnector ? cableWidthAtDistance : void 0;
8960
9304
  const startContacts = slicePath(path, 0, contactLength);
8961
9305
  const endContacts = slicePath(
8962
9306
  path,
8963
9307
  totalCableLength - contactLength,
8964
9308
  totalCableLength
8965
9309
  );
8966
- const startStiffener = slicePath(path, 0, resolvedStiffenerLength);
9310
+ const startStiffener = slicePath(cablePath, 0, resolvedStiffenerLength);
8967
9311
  const endStiffener = slicePath(
8968
- path,
9312
+ cablePath,
8969
9313
  totalCableLength - resolvedStiffenerLength,
8970
9314
  totalCableLength
8971
9315
  );
@@ -9014,7 +9358,7 @@ var FlexScreen = (props) => {
9014
9358
  ];
9015
9359
  const conductorOffsets = Array.from(
9016
9360
  { length: conductorCount },
9017
- (_, index) => conductorCount === 1 ? 0 : (index - (conductorCount - 1) / 2) * resolvedConductorPitch
9361
+ (_, index) => (index - (conductorCount - 1) / 2) * resolvedConductorPitch
9018
9362
  );
9019
9363
  const conductorNormalOffset = (flexCableThickness + conductorThickness) / 2;
9020
9364
  const stiffenerNormalOffset = -(flexCableThickness + stiffenerThickness) / 2;
@@ -9022,8 +9366,9 @@ var FlexScreen = (props) => {
9022
9366
  showFlexCable && /* @__PURE__ */ jsx(
9023
9367
  CableStrip,
9024
9368
  {
9025
- points: path,
9369
+ points: cablePath,
9026
9370
  width: resolvedCableWidth,
9371
+ widthAtDistance: widthProfile,
9027
9372
  thickness: flexCableThickness,
9028
9373
  color: flexCableColor
9029
9374
  }
@@ -9033,7 +9378,7 @@ var FlexScreen = (props) => {
9033
9378
  CableStrip,
9034
9379
  {
9035
9380
  points: startStiffener,
9036
- width: resolvedCableWidth,
9381
+ width: connectorWidth,
9037
9382
  thickness: stiffenerThickness,
9038
9383
  color: stiffenerColor,
9039
9384
  normalOffset: stiffenerNormalOffset
@@ -9044,6 +9389,8 @@ var FlexScreen = (props) => {
9044
9389
  {
9045
9390
  points: endStiffener,
9046
9391
  width: resolvedCableWidth,
9392
+ widthAtDistance: widthProfile,
9393
+ startDistance: totalCableLength - resolvedStiffenerLength,
9047
9394
  thickness: stiffenerThickness,
9048
9395
  color: stiffenerColor,
9049
9396
  normalOffset: stiffenerNormalOffset
@@ -9066,10 +9413,10 @@ var FlexScreen = (props) => {
9066
9413
  CableStrip,
9067
9414
  {
9068
9415
  points: endContacts,
9069
- width: resolvedConductorWidth,
9416
+ width: screenConductorWidth,
9070
9417
  thickness: conductorThickness,
9071
9418
  color: conductorColor,
9072
- acrossOffset,
9419
+ acrossOffset: (index - (conductorCount - 1) / 2) * screenConductorPitch,
9073
9420
  normalOffset: conductorNormalOffset
9074
9421
  }
9075
9422
  )
@@ -9108,6 +9455,10 @@ var Footprinter3d = ({ footprint }) => {
9108
9455
  if (mp3.getModelNames().includes(modelFn)) {
9109
9456
  const model = mp3.string(footprint).json();
9110
9457
  switch (model.fn) {
9458
+ case "hexbolt": {
9459
+ const { fn, ...props } = model;
9460
+ return /* @__PURE__ */ jsx(HexBolt, { ...props });
9461
+ }
9111
9462
  case "nema": {
9112
9463
  const { fn, ...props } = model;
9113
9464
  return /* @__PURE__ */ jsx(NemaMotor, { ...props });
@@ -9826,6 +10177,16 @@ function renderNode(node, colorCtx, renderCtx) {
9826
10177
  return node.flatMap((n) => renderNode(n, colorCtx, renderCtx));
9827
10178
  if (!isVNode(node)) return [];
9828
10179
  const { type, props, children } = node;
10180
+ if (props?.material) {
10181
+ const { material, ...rest } = props;
10182
+ return renderNode({ ...node, props: rest }, colorCtx, renderCtx).map(
10183
+ (entry) => ({
10184
+ ...entry,
10185
+ material: { ...material },
10186
+ geom: { ...entry.geom, material: { ...material } }
10187
+ })
10188
+ );
10189
+ }
9829
10190
  if (type === Fragment) {
9830
10191
  return (children ?? []).flatMap((c) => renderNode(c, colorCtx, renderCtx));
9831
10192
  }
@@ -9842,7 +10203,8 @@ function renderNode(node, colorCtx, renderCtx) {
9842
10203
  const geoms = (children ?? []).flatMap(
9843
10204
  (c) => renderNode(c, colorCtx, renderCtx)
9844
10205
  );
9845
- return geoms.map(({ geom, color }) => ({
10206
+ return geoms.map(({ geom, color, material }) => ({
10207
+ material,
9846
10208
  geom: transforms.translate(off, geom),
9847
10209
  color: color ?? colorCtx
9848
10210
  }));
@@ -9857,7 +10219,8 @@ function renderNode(node, colorCtx, renderCtx) {
9857
10219
  const geoms = (children ?? []).flatMap(
9858
10220
  (c) => renderNode(c, colorCtx, renderCtx)
9859
10221
  );
9860
- return geoms.map(({ geom, color }) => ({
10222
+ return geoms.map(({ geom, color, material }) => ({
10223
+ material,
9861
10224
  geom: transforms.rotateZ(
9862
10225
  rot[2],
9863
10226
  transforms.rotateY(rot[1], transforms.rotateX(rot[0], geom))
@@ -9866,14 +10229,23 @@ function renderNode(node, colorCtx, renderCtx) {
9866
10229
  }));
9867
10230
  }
9868
10231
  if (type === Union || type === Subtract || type === Hull) {
9869
- const geoms = (children ?? []).flatMap((c) => renderNode(c, colorCtx, renderCtx)).map((g) => g.geom);
10232
+ const entries = (children ?? []).flatMap(
10233
+ (c) => renderNode(c, colorCtx, renderCtx)
10234
+ );
10235
+ const geoms = entries.map((g) => g.geom);
9870
10236
  if (geoms.length === 0) return [];
9871
10237
  let geom;
9872
10238
  if (type === Union) geom = booleans.union(geoms);
9873
10239
  else if (type === Subtract)
9874
10240
  geom = booleans.subtract(geoms[0], geoms.slice(1));
9875
10241
  else geom = hulls.hull(geoms);
9876
- return [{ geom, color: colorCtx }];
10242
+ return [
10243
+ {
10244
+ geom,
10245
+ color: colorCtx,
10246
+ material: type === Subtract ? entries[0]?.material : void 0
10247
+ }
10248
+ ];
9877
10249
  }
9878
10250
  if (type === Custom) {
9879
10251
  return [{ geom: props.geometry, color: colorCtx }];
@@ -9884,7 +10256,10 @@ function renderNode(node, colorCtx, renderCtx) {
9884
10256
  return [{ geom: g2, color: colorCtx ?? props?.color }];
9885
10257
  }
9886
10258
  if (type === ExtrudeLinear) {
9887
- const geoms2 = (children ?? []).flatMap((c) => renderNode(c, colorCtx, renderCtx)).map((g) => g.geom);
10259
+ const entries = (children ?? []).flatMap(
10260
+ (c) => renderNode(c, colorCtx, renderCtx)
10261
+ );
10262
+ const geoms2 = entries.map((g) => g.geom);
9888
10263
  if (geoms2.length === 0) return [];
9889
10264
  const base2 = geoms2.length > 1 ? booleans.union(geoms2) : geoms2[0];
9890
10265
  const height10 = props?.height ?? props?.h ?? 1;
@@ -9895,7 +10270,13 @@ function renderNode(node, colorCtx, renderCtx) {
9895
10270
  poly.vertices.reverse();
9896
10271
  }
9897
10272
  }
9898
- return [{ geom: g3, color: colorCtx ?? props?.color }];
10273
+ return [
10274
+ {
10275
+ geom: g3,
10276
+ color: colorCtx ?? props?.color,
10277
+ material: entries.length === 1 ? entries[0]?.material : void 0
10278
+ }
10279
+ ];
9899
10280
  }
9900
10281
  if (type === Cuboid || type === Cube || type === Cylinder || type === Sphere || type === RoundedCuboid || type === RoundedCylinder) {
9901
10282
  let g;
@@ -9940,7 +10321,11 @@ function renderNode(node, colorCtx, renderCtx) {
9940
10321
  }
9941
10322
  function render(root, jscad4) {
9942
10323
  const geometries = renderNode(root, void 0, { jscad: jscad4 });
9943
- return { geometries };
10324
+ return {
10325
+ geometries: geometries.map(
10326
+ (entry) => entry.material ? { ...entry, geom: { ...entry.geom, material: entry.material } } : entry
10327
+ )
10328
+ };
9944
10329
  }
9945
10330
 
9946
10331
  // lib/vanilla/convertCSGToThreeGeom.ts
@@ -10054,6 +10439,7 @@ function createJSCADRenderer(jscad4) {
10054
10439
  export {
10055
10440
  Fragment,
10056
10441
  HelicalGear,
10442
+ HexBolt,
10057
10443
  HexSocketBolt,
10058
10444
  NEMA17,
10059
10445
  NEMA23,
@@ -10065,6 +10451,8 @@ export {
10065
10451
  convertCSGToThreeGeom,
10066
10452
  createHelicalGearGeom,
10067
10453
  createHelicalGearMesh,
10454
+ createHexBoltGeom,
10455
+ createHexBoltMesh,
10068
10456
  createHexSocketBoltGeom,
10069
10457
  createHexSocketBoltMesh,
10070
10458
  createJSCADRenderer,