jscad-electronics 0.0.107 → 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
@@ -669,10 +669,12 @@ var DipPinLeg = ({ x, y, z }) => {
669
669
  var Dip = ({
670
670
  numPins = 8,
671
671
  pitch = 2.54,
672
- bodyWidth = 6.4
672
+ bodyWidth = 6.4,
673
+ rowSpacing
673
674
  }) => {
674
675
  const numPinsOnEachSide = Math.floor(numPins / 2);
675
- const crossBodyPinWidth = bodyWidth + 1;
676
+ const pinRowSpacing = rowSpacing ?? (bodyWidth >= 7 ? bodyWidth : bodyWidth + 1.22);
677
+ const chipBodyWidth = bodyWidth >= 7 ? pinRowSpacing - 1.22 : bodyWidth;
676
678
  return /* @__PURE__ */ jsxs14(Fragment12, { children: [
677
679
  range(numPins).map((i) => {
678
680
  const yRow = i % numPinsOnEachSide;
@@ -680,7 +682,7 @@ var Dip = ({
680
682
  return /* @__PURE__ */ jsx15(
681
683
  DipPinLeg,
682
684
  {
683
- x: xRow * crossBodyPinWidth / 2,
685
+ x: xRow * pinRowSpacing / 2,
684
686
  y: yRow * pitch - (numPinsOnEachSide - 1) / 2 * pitch,
685
687
  z: DIP_PIN_HEIGHT / 2 + heightAboveSurface
686
688
  },
@@ -690,7 +692,7 @@ var Dip = ({
690
692
  /* @__PURE__ */ jsx15(
691
693
  ChipBody,
692
694
  {
693
- width: bodyWidth,
695
+ width: chipBodyWidth,
694
696
  length: numPinsOnEachSide * pitch + 0.5,
695
697
  height: DIP_PIN_HEIGHT - heightAboveSurface,
696
698
  heightAboveSurface,
@@ -1015,81 +1017,84 @@ var PinRow = ({
1015
1017
  pitch = 2.54,
1016
1018
  longSidePinLength = 6,
1017
1019
  invert,
1018
- faceup
1020
+ faceup,
1021
+ rows = 1
1019
1022
  }) => {
1020
1023
  const pinThickness = 0.63;
1021
1024
  const bodyHeight = 2;
1022
- 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;
1023
1029
  const shortSidePinLength = 3;
1024
- const xoff = -((numberOfPins - 1) / 2) * pitch;
1030
+ const xoff = -((pinsPerRow - 1) / 2) * pitch;
1031
+ const bodyCenterY = rows > 1 ? -((rows - 1) * rowSpacing) / 2 : 0;
1025
1032
  const flipZ = (z) => invert || faceup ? -z + bodyHeight : z;
1026
1033
  return /* @__PURE__ */ jsxs18(Fragment16, { children: [
1027
1034
  /* @__PURE__ */ jsx20(
1028
1035
  Cuboid14,
1029
1036
  {
1030
1037
  color: "#222",
1031
- size: [bodyWidth, pinThickness * 3, bodyHeight],
1032
- center: [0, 0, flipZ(bodyHeight / 2)]
1038
+ size: [bodyWidth, bodyDepth, bodyHeight],
1039
+ center: [0, bodyCenterY, flipZ(bodyHeight / 2)]
1033
1040
  }
1034
1041
  ),
1035
- Array.from({ length: numberOfPins }, (_, i) => /* @__PURE__ */ jsxs18(Fragment16, { children: [
1036
- !faceup && /* @__PURE__ */ jsx20(Colorize6, { color: "gold", children: /* @__PURE__ */ jsxs18(Hull2, { children: [
1037
- /* @__PURE__ */ jsx20(
1038
- Cuboid14,
1039
- {
1040
- color: "gold",
1041
- size: [pinThickness, pinThickness, shortSidePinLength * 0.9],
1042
- center: [
1043
- xoff + i * pitch,
1044
- 0,
1045
- flipZ(bodyHeight * 0.9 + bodyHeight / 2)
1046
- ]
1047
- }
1048
- ),
1049
- /* @__PURE__ */ jsx20(
1050
- Cuboid14,
1051
- {
1052
- color: "gold",
1053
- size: [
1054
- pinThickness / 1.8,
1055
- pinThickness / 1.8,
1056
- shortSidePinLength
1057
- ],
1058
- center: [
1059
- xoff + i * pitch,
1060
- 0,
1061
- flipZ(bodyHeight + bodyHeight / 2)
1062
- ]
1063
- }
1064
- )
1065
- ] }) }),
1066
- /* @__PURE__ */ jsx20(Colorize6, { color: "gold", children: /* @__PURE__ */ jsxs18(Hull2, { children: [
1067
- /* @__PURE__ */ jsx20(
1068
- Cuboid14,
1069
- {
1070
- color: "gold",
1071
- size: [pinThickness, pinThickness, longSidePinLength * 0.9],
1072
- center: [
1073
- xoff + i * pitch,
1074
- 0,
1075
- flipZ(-longSidePinLength / 2 * 0.9)
1076
- ]
1077
- }
1078
- ),
1079
- /* @__PURE__ */ jsx20(
1080
- Cuboid14,
1081
- {
1082
- color: "gold",
1083
- size: [
1084
- pinThickness / 1.8,
1085
- pinThickness / 1.8,
1086
- longSidePinLength
1087
- ],
1088
- center: [xoff + i * pitch, 0, flipZ(-longSidePinLength / 2)]
1089
- }
1090
- )
1091
- ] }) })
1092
- ] }))
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
+ })
1093
1098
  ] });
1094
1099
  };
1095
1100
 
@@ -1450,31 +1455,39 @@ var FemaleHeader = ({
1450
1455
  pitch = 2.54,
1451
1456
  legsLength = 3,
1452
1457
  outerDiameter = 0.945,
1453
- innerDiameter = 0.945
1458
+ innerDiameter = 0.945,
1459
+ rows = 1
1454
1460
  }) => {
1455
1461
  const pinThickness = innerDiameter / 1.5;
1456
1462
  const bodyDepth = pinThickness * 2 + outerDiameter;
1457
1463
  const bodyHeight = 5;
1458
- 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;
1459
1468
  const gapWidth = pinThickness * 1.6;
1460
- const xoff = -((numberOfPins - 1) / 2) * pitch;
1469
+ const xoff = -((pinsPerRow - 1) / 2) * pitch;
1470
+ const bodyCenterY = rows > 1 ? -((rows - 1) * rowSpacing) / 2 : 0;
1461
1471
  const Body = /* @__PURE__ */ jsx24(Colorize8, { color: "#1a1a1a", children: /* @__PURE__ */ jsxs22(Subtract3, { children: [
1462
1472
  /* @__PURE__ */ jsx24(
1463
1473
  Cuboid16,
1464
1474
  {
1465
1475
  color: "#000",
1466
- size: [bodyWidth, bodyDepth, bodyHeight],
1467
- center: [0, 0, bodyHeight / 2]
1476
+ size: [bodyWidth, bodyDepthTotal, bodyHeight],
1477
+ center: [0, bodyCenterY, bodyHeight / 2]
1468
1478
  }
1469
1479
  ),
1470
- Array.from(
1471
- { length: numberOfPins },
1472
- (_, 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(
1473
1486
  Cylinder3,
1474
1487
  {
1475
1488
  height: bodyHeight + 0.1,
1476
1489
  radius: innerDiameter / 2,
1477
- center: [xoff + i * pitch, 0, bodyHeight / 2],
1490
+ center: [x, y, bodyHeight / 2],
1478
1491
  color: "#222"
1479
1492
  },
1480
1493
  i
@@ -1482,42 +1495,48 @@ var FemaleHeader = ({
1482
1495
  Cuboid16,
1483
1496
  {
1484
1497
  size: [gapWidth, gapWidth, bodyHeight],
1485
- center: [xoff + i * pitch, 0, bodyHeight / 2]
1498
+ center: [x, y, bodyHeight / 2]
1486
1499
  },
1487
1500
  i
1488
- )
1489
- )
1501
+ );
1502
+ })
1490
1503
  ] }) });
1491
1504
  return /* @__PURE__ */ jsxs22(Fragment20, { children: [
1492
1505
  Body,
1493
- Array.from({ length: numberOfPins }, (_, i) => /* @__PURE__ */ jsxs22(Colorize8, { color: "silver", children: [
1494
- /* @__PURE__ */ jsxs22(Hull3, { children: [
1495
- /* @__PURE__ */ jsx24(
1496
- Cuboid16,
1497
- {
1498
- color: "silver",
1499
- size: [pinThickness, pinThickness, legsLength * 0.9],
1500
- center: [xoff + i * pitch, 0, -legsLength / 2 * 0.9]
1501
- }
1502
- ),
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
+ ] }),
1503
1530
  /* @__PURE__ */ jsx24(
1504
1531
  Cuboid16,
1505
1532
  {
1506
1533
  color: "silver",
1507
- size: [pinThickness / 1.8, pinThickness / 1.8, legsLength],
1508
- center: [xoff + i * pitch, 0, -legsLength / 2]
1534
+ size: [gapWidth, gapWidth, gapWidth * 0.5],
1535
+ center: [x, y, gapWidth / 2 * 0.5]
1509
1536
  }
1510
1537
  )
1511
- ] }),
1512
- /* @__PURE__ */ jsx24(
1513
- Cuboid16,
1514
- {
1515
- color: "silver",
1516
- size: [gapWidth, gapWidth, gapWidth * 0.5],
1517
- center: [xoff + i * pitch, 0, gapWidth / 2 * 0.5]
1518
- }
1519
- )
1520
- ] }, i))
1538
+ ] }, i);
1539
+ })
1521
1540
  ] });
1522
1541
  };
1523
1542
 
@@ -4203,7 +4222,9 @@ var Footprinter3d = ({ footprint }) => {
4203
4222
  }
4204
4223
  );
4205
4224
  }
4206
- case "pinrow":
4225
+ case "pinrow": {
4226
+ const rowsMatch = footprint.match(/_rows(\d+)/);
4227
+ const rows = rowsMatch && rowsMatch[1] ? parseInt(rowsMatch[1], 10) : 1;
4207
4228
  if (fpJson.male)
4208
4229
  return /* @__PURE__ */ jsx60(
4209
4230
  PinRow,
@@ -4211,11 +4232,20 @@ var Footprinter3d = ({ footprint }) => {
4211
4232
  numberOfPins: fpJson.num_pins,
4212
4233
  pitch: fpJson.p,
4213
4234
  invert: fpJson.invert,
4214
- faceup: fpJson.faceup
4235
+ faceup: fpJson.faceup,
4236
+ rows
4215
4237
  }
4216
4238
  );
4217
4239
  if (fpJson.female)
4218
- 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
+ }
4219
4249
  case "cap": {
4220
4250
  switch (fpJson.imperial) {
4221
4251
  case "0402":