jscad-electronics 0.0.108 → 0.0.109

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.d.ts CHANGED
@@ -216,12 +216,13 @@ declare const SOD123: ({ fullWidth, fullLength }: {
216
216
  fullLength?: number | undefined;
217
217
  }) => react_jsx_runtime.JSX.Element;
218
218
 
219
- declare const PinRow: ({ numberOfPins, pitch, longSidePinLength, invert, faceup, }: {
219
+ declare const PinRow: ({ numberOfPins, pitch, longSidePinLength, invert, faceup, rows, }: {
220
220
  numberOfPins: number;
221
221
  pitch?: number;
222
222
  longSidePinLength?: number;
223
223
  invert?: boolean;
224
224
  faceup?: boolean;
225
+ rows?: number;
225
226
  }) => react_jsx_runtime.JSX.Element;
226
227
 
227
228
  declare const SOD523: () => react_jsx_runtime.JSX.Element;
package/dist/index.js CHANGED
@@ -1017,81 +1017,84 @@ var PinRow = ({
1017
1017
  pitch = 2.54,
1018
1018
  longSidePinLength = 6,
1019
1019
  invert,
1020
- faceup
1020
+ faceup,
1021
+ rows = 1
1021
1022
  }) => {
1022
1023
  const pinThickness = 0.63;
1023
1024
  const bodyHeight = 2;
1024
- const bodyWidth = numberOfPins * pitch;
1025
+ const pinsPerRow = Math.ceil(numberOfPins / rows);
1026
+ const rowSpacing = 2.54;
1027
+ const bodyWidth = pinsPerRow * pitch;
1028
+ const bodyDepth = rows > 1 ? (rows - 1) * rowSpacing + pinThickness * 3 : pinThickness * 3;
1025
1029
  const shortSidePinLength = 3;
1026
- const xoff = -((numberOfPins - 1) / 2) * pitch;
1030
+ const xoff = -((pinsPerRow - 1) / 2) * pitch;
1031
+ const bodyCenterY = rows > 1 ? -((rows - 1) * rowSpacing) / 2 : 0;
1027
1032
  const flipZ = (z) => invert || faceup ? -z + bodyHeight : z;
1028
1033
  return /* @__PURE__ */ jsxs18(Fragment16, { children: [
1029
1034
  /* @__PURE__ */ jsx20(
1030
1035
  Cuboid14,
1031
1036
  {
1032
1037
  color: "#222",
1033
- size: [bodyWidth, pinThickness * 3, bodyHeight],
1034
- center: [0, 0, flipZ(bodyHeight / 2)]
1038
+ size: [bodyWidth, bodyDepth, bodyHeight],
1039
+ center: [0, bodyCenterY, flipZ(bodyHeight / 2)]
1035
1040
  }
1036
1041
  ),
1037
- Array.from({ length: numberOfPins }, (_, i) => /* @__PURE__ */ jsxs18(Fragment16, { children: [
1038
- !faceup && /* @__PURE__ */ jsx20(Colorize6, { color: "gold", children: /* @__PURE__ */ jsxs18(Hull2, { children: [
1039
- /* @__PURE__ */ jsx20(
1040
- Cuboid14,
1041
- {
1042
- color: "gold",
1043
- size: [pinThickness, pinThickness, shortSidePinLength * 0.9],
1044
- center: [
1045
- xoff + i * pitch,
1046
- 0,
1047
- flipZ(bodyHeight * 0.9 + bodyHeight / 2)
1048
- ]
1049
- }
1050
- ),
1051
- /* @__PURE__ */ jsx20(
1052
- Cuboid14,
1053
- {
1054
- color: "gold",
1055
- size: [
1056
- pinThickness / 1.8,
1057
- pinThickness / 1.8,
1058
- shortSidePinLength
1059
- ],
1060
- center: [
1061
- xoff + i * pitch,
1062
- 0,
1063
- flipZ(bodyHeight + bodyHeight / 2)
1064
- ]
1065
- }
1066
- )
1067
- ] }) }),
1068
- /* @__PURE__ */ jsx20(Colorize6, { color: "gold", children: /* @__PURE__ */ jsxs18(Hull2, { children: [
1069
- /* @__PURE__ */ jsx20(
1070
- Cuboid14,
1071
- {
1072
- color: "gold",
1073
- size: [pinThickness, pinThickness, longSidePinLength * 0.9],
1074
- center: [
1075
- xoff + i * pitch,
1076
- 0,
1077
- flipZ(-longSidePinLength / 2 * 0.9)
1078
- ]
1079
- }
1080
- ),
1081
- /* @__PURE__ */ jsx20(
1082
- Cuboid14,
1083
- {
1084
- color: "gold",
1085
- size: [
1086
- pinThickness / 1.8,
1087
- pinThickness / 1.8,
1088
- longSidePinLength
1089
- ],
1090
- center: [xoff + i * pitch, 0, flipZ(-longSidePinLength / 2)]
1091
- }
1092
- )
1093
- ] }) })
1094
- ] }))
1042
+ Array.from({ length: numberOfPins }, (_, i) => {
1043
+ const row = Math.floor(i / pinsPerRow);
1044
+ const col = i % pinsPerRow;
1045
+ const x = xoff + col * pitch;
1046
+ const y = -row * rowSpacing;
1047
+ return /* @__PURE__ */ jsxs18(Fragment16, { children: [
1048
+ !faceup && /* @__PURE__ */ jsx20(Colorize6, { color: "gold", children: /* @__PURE__ */ jsxs18(Hull2, { children: [
1049
+ /* @__PURE__ */ jsx20(
1050
+ Cuboid14,
1051
+ {
1052
+ color: "gold",
1053
+ size: [
1054
+ pinThickness,
1055
+ pinThickness,
1056
+ shortSidePinLength * 0.9
1057
+ ],
1058
+ center: [x, y, flipZ(bodyHeight * 0.9 + bodyHeight / 2)]
1059
+ }
1060
+ ),
1061
+ /* @__PURE__ */ jsx20(
1062
+ Cuboid14,
1063
+ {
1064
+ color: "gold",
1065
+ size: [
1066
+ pinThickness / 1.8,
1067
+ pinThickness / 1.8,
1068
+ shortSidePinLength
1069
+ ],
1070
+ center: [x, y, flipZ(bodyHeight + bodyHeight / 2)]
1071
+ }
1072
+ )
1073
+ ] }) }, `short-${i}`),
1074
+ /* @__PURE__ */ jsx20(Colorize6, { color: "gold", children: /* @__PURE__ */ jsxs18(Hull2, { children: [
1075
+ /* @__PURE__ */ jsx20(
1076
+ Cuboid14,
1077
+ {
1078
+ color: "gold",
1079
+ size: [pinThickness, pinThickness, longSidePinLength * 0.9],
1080
+ center: [x, y, flipZ(-longSidePinLength / 2 * 0.9)]
1081
+ }
1082
+ ),
1083
+ /* @__PURE__ */ jsx20(
1084
+ Cuboid14,
1085
+ {
1086
+ color: "gold",
1087
+ size: [
1088
+ pinThickness / 1.8,
1089
+ pinThickness / 1.8,
1090
+ longSidePinLength
1091
+ ],
1092
+ center: [x, y, flipZ(-longSidePinLength / 2)]
1093
+ }
1094
+ )
1095
+ ] }) }, `long-${i}`)
1096
+ ] });
1097
+ })
1095
1098
  ] });
1096
1099
  };
1097
1100
 
@@ -1452,31 +1455,39 @@ var FemaleHeader = ({
1452
1455
  pitch = 2.54,
1453
1456
  legsLength = 3,
1454
1457
  outerDiameter = 0.945,
1455
- innerDiameter = 0.945
1458
+ innerDiameter = 0.945,
1459
+ rows = 1
1456
1460
  }) => {
1457
1461
  const pinThickness = innerDiameter / 1.5;
1458
1462
  const bodyDepth = pinThickness * 2 + outerDiameter;
1459
1463
  const bodyHeight = 5;
1460
- const bodyWidth = (numberOfPins - 1) * pitch + outerDiameter + pitch / 2;
1464
+ const pinsPerRow = Math.ceil(numberOfPins / rows);
1465
+ const rowSpacing = 2.54;
1466
+ const bodyWidth = (pinsPerRow - 1) * pitch + outerDiameter + pitch / 2;
1467
+ const bodyDepthTotal = rows > 1 ? (rows - 1) * rowSpacing + bodyDepth : bodyDepth;
1461
1468
  const gapWidth = pinThickness * 1.6;
1462
- const xoff = -((numberOfPins - 1) / 2) * pitch;
1469
+ const xoff = -((pinsPerRow - 1) / 2) * pitch;
1470
+ const bodyCenterY = rows > 1 ? -((rows - 1) * rowSpacing) / 2 : 0;
1463
1471
  const Body = /* @__PURE__ */ jsx24(Colorize8, { color: "#1a1a1a", children: /* @__PURE__ */ jsxs22(Subtract3, { children: [
1464
1472
  /* @__PURE__ */ jsx24(
1465
1473
  Cuboid16,
1466
1474
  {
1467
1475
  color: "#000",
1468
- size: [bodyWidth, bodyDepth, bodyHeight],
1469
- center: [0, 0, bodyHeight / 2]
1476
+ size: [bodyWidth, bodyDepthTotal, bodyHeight],
1477
+ center: [0, bodyCenterY, bodyHeight / 2]
1470
1478
  }
1471
1479
  ),
1472
- Array.from(
1473
- { length: numberOfPins },
1474
- (_, i) => innerDiameter ? /* @__PURE__ */ jsx24(
1480
+ Array.from({ length: numberOfPins }, (_, i) => {
1481
+ const row = Math.floor(i / pinsPerRow);
1482
+ const col = i % pinsPerRow;
1483
+ const x = xoff + col * pitch;
1484
+ const y = -row * rowSpacing;
1485
+ return innerDiameter ? /* @__PURE__ */ jsx24(
1475
1486
  Cylinder3,
1476
1487
  {
1477
1488
  height: bodyHeight + 0.1,
1478
1489
  radius: innerDiameter / 2,
1479
- center: [xoff + i * pitch, 0, bodyHeight / 2],
1490
+ center: [x, y, bodyHeight / 2],
1480
1491
  color: "#222"
1481
1492
  },
1482
1493
  i
@@ -1484,42 +1495,48 @@ var FemaleHeader = ({
1484
1495
  Cuboid16,
1485
1496
  {
1486
1497
  size: [gapWidth, gapWidth, bodyHeight],
1487
- center: [xoff + i * pitch, 0, bodyHeight / 2]
1498
+ center: [x, y, bodyHeight / 2]
1488
1499
  },
1489
1500
  i
1490
- )
1491
- )
1501
+ );
1502
+ })
1492
1503
  ] }) });
1493
1504
  return /* @__PURE__ */ jsxs22(Fragment20, { children: [
1494
1505
  Body,
1495
- Array.from({ length: numberOfPins }, (_, i) => /* @__PURE__ */ jsxs22(Colorize8, { color: "silver", children: [
1496
- /* @__PURE__ */ jsxs22(Hull3, { children: [
1497
- /* @__PURE__ */ jsx24(
1498
- Cuboid16,
1499
- {
1500
- color: "silver",
1501
- size: [pinThickness, pinThickness, legsLength * 0.9],
1502
- center: [xoff + i * pitch, 0, -legsLength / 2 * 0.9]
1503
- }
1504
- ),
1506
+ Array.from({ length: numberOfPins }, (_, i) => {
1507
+ const row = Math.floor(i / pinsPerRow);
1508
+ const col = i % pinsPerRow;
1509
+ const x = xoff + col * pitch;
1510
+ const y = -row * rowSpacing;
1511
+ return /* @__PURE__ */ jsxs22(Colorize8, { color: "silver", children: [
1512
+ /* @__PURE__ */ jsxs22(Hull3, { children: [
1513
+ /* @__PURE__ */ jsx24(
1514
+ Cuboid16,
1515
+ {
1516
+ color: "silver",
1517
+ size: [pinThickness, pinThickness, legsLength * 0.9],
1518
+ center: [x, y, -legsLength / 2 * 0.9]
1519
+ }
1520
+ ),
1521
+ /* @__PURE__ */ jsx24(
1522
+ Cuboid16,
1523
+ {
1524
+ color: "silver",
1525
+ size: [pinThickness / 1.8, pinThickness / 1.8, legsLength],
1526
+ center: [x, y, -legsLength / 2]
1527
+ }
1528
+ )
1529
+ ] }),
1505
1530
  /* @__PURE__ */ jsx24(
1506
1531
  Cuboid16,
1507
1532
  {
1508
1533
  color: "silver",
1509
- size: [pinThickness / 1.8, pinThickness / 1.8, legsLength],
1510
- center: [xoff + i * pitch, 0, -legsLength / 2]
1534
+ size: [gapWidth, gapWidth, gapWidth * 0.5],
1535
+ center: [x, y, gapWidth / 2 * 0.5]
1511
1536
  }
1512
1537
  )
1513
- ] }),
1514
- /* @__PURE__ */ jsx24(
1515
- Cuboid16,
1516
- {
1517
- color: "silver",
1518
- size: [gapWidth, gapWidth, gapWidth * 0.5],
1519
- center: [xoff + i * pitch, 0, gapWidth / 2 * 0.5]
1520
- }
1521
- )
1522
- ] }, i))
1538
+ ] }, i);
1539
+ })
1523
1540
  ] });
1524
1541
  };
1525
1542
 
@@ -4205,7 +4222,9 @@ var Footprinter3d = ({ footprint }) => {
4205
4222
  }
4206
4223
  );
4207
4224
  }
4208
- case "pinrow":
4225
+ case "pinrow": {
4226
+ const rowsMatch = footprint.match(/_rows(\d+)/);
4227
+ const rows = rowsMatch && rowsMatch[1] ? parseInt(rowsMatch[1], 10) : 1;
4209
4228
  if (fpJson.male)
4210
4229
  return /* @__PURE__ */ jsx60(
4211
4230
  PinRow,
@@ -4213,11 +4232,20 @@ var Footprinter3d = ({ footprint }) => {
4213
4232
  numberOfPins: fpJson.num_pins,
4214
4233
  pitch: fpJson.p,
4215
4234
  invert: fpJson.invert,
4216
- faceup: fpJson.faceup
4235
+ faceup: fpJson.faceup,
4236
+ rows
4217
4237
  }
4218
4238
  );
4219
4239
  if (fpJson.female)
4220
- return /* @__PURE__ */ jsx60(FemaleHeader, { numberOfPins: fpJson.num_pins, pitch: fpJson.p });
4240
+ return /* @__PURE__ */ jsx60(
4241
+ FemaleHeader,
4242
+ {
4243
+ numberOfPins: fpJson.num_pins,
4244
+ pitch: fpJson.p,
4245
+ rows
4246
+ }
4247
+ );
4248
+ }
4221
4249
  case "cap": {
4222
4250
  switch (fpJson.imperial) {
4223
4251
  case "0402":