jscad-electronics 0.0.108 → 0.0.110
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 +2 -1
- package/dist/index.js +128 -100
- package/dist/index.js.map +1 -1
- package/dist/vanilla.js +128 -100
- package/dist/vanilla.js.map +1 -1
- package/package.json +2 -2
package/dist/vanilla.js
CHANGED
|
@@ -678,81 +678,84 @@ var PinRow = ({
|
|
|
678
678
|
pitch = 2.54,
|
|
679
679
|
longSidePinLength = 6,
|
|
680
680
|
invert,
|
|
681
|
-
faceup
|
|
681
|
+
faceup,
|
|
682
|
+
rows = 1
|
|
682
683
|
}) => {
|
|
683
684
|
const pinThickness = 0.63;
|
|
684
685
|
const bodyHeight = 2;
|
|
685
|
-
const
|
|
686
|
+
const pinsPerRow = Math.ceil(numberOfPins / rows);
|
|
687
|
+
const rowSpacing = 2.54;
|
|
688
|
+
const bodyWidth = pinsPerRow * pitch;
|
|
689
|
+
const bodyDepth = rows > 1 ? (rows - 1) * rowSpacing + pinThickness * 3 : pinThickness * 3;
|
|
686
690
|
const shortSidePinLength = 3;
|
|
687
|
-
const xoff = -((
|
|
691
|
+
const xoff = -((pinsPerRow - 1) / 2) * pitch;
|
|
692
|
+
const bodyCenterY = rows > 1 ? -((rows - 1) * rowSpacing) / 2 : 0;
|
|
688
693
|
const flipZ = (z) => invert || faceup ? -z + bodyHeight : z;
|
|
689
694
|
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
690
695
|
/* @__PURE__ */ jsx(
|
|
691
696
|
Cuboid,
|
|
692
697
|
{
|
|
693
698
|
color: "#222",
|
|
694
|
-
size: [bodyWidth,
|
|
695
|
-
center: [0,
|
|
699
|
+
size: [bodyWidth, bodyDepth, bodyHeight],
|
|
700
|
+
center: [0, bodyCenterY, flipZ(bodyHeight / 2)]
|
|
696
701
|
}
|
|
697
702
|
),
|
|
698
|
-
Array.from({ length: numberOfPins }, (_, i) =>
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
/* @__PURE__ */ jsx(
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
] }) })
|
|
755
|
-
] }))
|
|
703
|
+
Array.from({ length: numberOfPins }, (_, i) => {
|
|
704
|
+
const row = Math.floor(i / pinsPerRow);
|
|
705
|
+
const col = i % pinsPerRow;
|
|
706
|
+
const x = xoff + col * pitch;
|
|
707
|
+
const y = -row * rowSpacing;
|
|
708
|
+
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
709
|
+
!faceup && /* @__PURE__ */ jsx(Colorize, { color: "gold", children: /* @__PURE__ */ jsxs(Hull, { children: [
|
|
710
|
+
/* @__PURE__ */ jsx(
|
|
711
|
+
Cuboid,
|
|
712
|
+
{
|
|
713
|
+
color: "gold",
|
|
714
|
+
size: [
|
|
715
|
+
pinThickness,
|
|
716
|
+
pinThickness,
|
|
717
|
+
shortSidePinLength * 0.9
|
|
718
|
+
],
|
|
719
|
+
center: [x, y, flipZ(bodyHeight * 0.9 + bodyHeight / 2)]
|
|
720
|
+
}
|
|
721
|
+
),
|
|
722
|
+
/* @__PURE__ */ jsx(
|
|
723
|
+
Cuboid,
|
|
724
|
+
{
|
|
725
|
+
color: "gold",
|
|
726
|
+
size: [
|
|
727
|
+
pinThickness / 1.8,
|
|
728
|
+
pinThickness / 1.8,
|
|
729
|
+
shortSidePinLength
|
|
730
|
+
],
|
|
731
|
+
center: [x, y, flipZ(bodyHeight + bodyHeight / 2)]
|
|
732
|
+
}
|
|
733
|
+
)
|
|
734
|
+
] }) }, `short-${i}`),
|
|
735
|
+
/* @__PURE__ */ jsx(Colorize, { color: "gold", children: /* @__PURE__ */ jsxs(Hull, { children: [
|
|
736
|
+
/* @__PURE__ */ jsx(
|
|
737
|
+
Cuboid,
|
|
738
|
+
{
|
|
739
|
+
color: "gold",
|
|
740
|
+
size: [pinThickness, pinThickness, longSidePinLength * 0.9],
|
|
741
|
+
center: [x, y, flipZ(-longSidePinLength / 2 * 0.9)]
|
|
742
|
+
}
|
|
743
|
+
),
|
|
744
|
+
/* @__PURE__ */ jsx(
|
|
745
|
+
Cuboid,
|
|
746
|
+
{
|
|
747
|
+
color: "gold",
|
|
748
|
+
size: [
|
|
749
|
+
pinThickness / 1.8,
|
|
750
|
+
pinThickness / 1.8,
|
|
751
|
+
longSidePinLength
|
|
752
|
+
],
|
|
753
|
+
center: [x, y, flipZ(-longSidePinLength / 2)]
|
|
754
|
+
}
|
|
755
|
+
)
|
|
756
|
+
] }) }, `long-${i}`)
|
|
757
|
+
] });
|
|
758
|
+
})
|
|
756
759
|
] });
|
|
757
760
|
};
|
|
758
761
|
|
|
@@ -1315,31 +1318,39 @@ var FemaleHeader = ({
|
|
|
1315
1318
|
pitch = 2.54,
|
|
1316
1319
|
legsLength = 3,
|
|
1317
1320
|
outerDiameter = 0.945,
|
|
1318
|
-
innerDiameter = 0.945
|
|
1321
|
+
innerDiameter = 0.945,
|
|
1322
|
+
rows = 1
|
|
1319
1323
|
}) => {
|
|
1320
1324
|
const pinThickness = innerDiameter / 1.5;
|
|
1321
1325
|
const bodyDepth = pinThickness * 2 + outerDiameter;
|
|
1322
1326
|
const bodyHeight = 5;
|
|
1323
|
-
const
|
|
1327
|
+
const pinsPerRow = Math.ceil(numberOfPins / rows);
|
|
1328
|
+
const rowSpacing = 2.54;
|
|
1329
|
+
const bodyWidth = (pinsPerRow - 1) * pitch + outerDiameter + pitch / 2;
|
|
1330
|
+
const bodyDepthTotal = rows > 1 ? (rows - 1) * rowSpacing + bodyDepth : bodyDepth;
|
|
1324
1331
|
const gapWidth = pinThickness * 1.6;
|
|
1325
|
-
const xoff = -((
|
|
1332
|
+
const xoff = -((pinsPerRow - 1) / 2) * pitch;
|
|
1333
|
+
const bodyCenterY = rows > 1 ? -((rows - 1) * rowSpacing) / 2 : 0;
|
|
1326
1334
|
const Body = /* @__PURE__ */ jsx(Colorize, { color: "#1a1a1a", children: /* @__PURE__ */ jsxs(Subtract, { children: [
|
|
1327
1335
|
/* @__PURE__ */ jsx(
|
|
1328
1336
|
Cuboid,
|
|
1329
1337
|
{
|
|
1330
1338
|
color: "#000",
|
|
1331
|
-
size: [bodyWidth,
|
|
1332
|
-
center: [0,
|
|
1339
|
+
size: [bodyWidth, bodyDepthTotal, bodyHeight],
|
|
1340
|
+
center: [0, bodyCenterY, bodyHeight / 2]
|
|
1333
1341
|
}
|
|
1334
1342
|
),
|
|
1335
|
-
Array.from(
|
|
1336
|
-
|
|
1337
|
-
|
|
1343
|
+
Array.from({ length: numberOfPins }, (_, i) => {
|
|
1344
|
+
const row = Math.floor(i / pinsPerRow);
|
|
1345
|
+
const col = i % pinsPerRow;
|
|
1346
|
+
const x = xoff + col * pitch;
|
|
1347
|
+
const y = -row * rowSpacing;
|
|
1348
|
+
return innerDiameter ? /* @__PURE__ */ jsx(
|
|
1338
1349
|
Cylinder,
|
|
1339
1350
|
{
|
|
1340
1351
|
height: bodyHeight + 0.1,
|
|
1341
1352
|
radius: innerDiameter / 2,
|
|
1342
|
-
center: [
|
|
1353
|
+
center: [x, y, bodyHeight / 2],
|
|
1343
1354
|
color: "#222"
|
|
1344
1355
|
},
|
|
1345
1356
|
i
|
|
@@ -1347,42 +1358,48 @@ var FemaleHeader = ({
|
|
|
1347
1358
|
Cuboid,
|
|
1348
1359
|
{
|
|
1349
1360
|
size: [gapWidth, gapWidth, bodyHeight],
|
|
1350
|
-
center: [
|
|
1361
|
+
center: [x, y, bodyHeight / 2]
|
|
1351
1362
|
},
|
|
1352
1363
|
i
|
|
1353
|
-
)
|
|
1354
|
-
)
|
|
1364
|
+
);
|
|
1365
|
+
})
|
|
1355
1366
|
] }) });
|
|
1356
1367
|
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
1357
1368
|
Body,
|
|
1358
|
-
Array.from({ length: numberOfPins }, (_, i) =>
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1369
|
+
Array.from({ length: numberOfPins }, (_, i) => {
|
|
1370
|
+
const row = Math.floor(i / pinsPerRow);
|
|
1371
|
+
const col = i % pinsPerRow;
|
|
1372
|
+
const x = xoff + col * pitch;
|
|
1373
|
+
const y = -row * rowSpacing;
|
|
1374
|
+
return /* @__PURE__ */ jsxs(Colorize, { color: "silver", children: [
|
|
1375
|
+
/* @__PURE__ */ jsxs(Hull, { children: [
|
|
1376
|
+
/* @__PURE__ */ jsx(
|
|
1377
|
+
Cuboid,
|
|
1378
|
+
{
|
|
1379
|
+
color: "silver",
|
|
1380
|
+
size: [pinThickness, pinThickness, legsLength * 0.9],
|
|
1381
|
+
center: [x, y, -legsLength / 2 * 0.9]
|
|
1382
|
+
}
|
|
1383
|
+
),
|
|
1384
|
+
/* @__PURE__ */ jsx(
|
|
1385
|
+
Cuboid,
|
|
1386
|
+
{
|
|
1387
|
+
color: "silver",
|
|
1388
|
+
size: [pinThickness / 1.8, pinThickness / 1.8, legsLength],
|
|
1389
|
+
center: [x, y, -legsLength / 2]
|
|
1390
|
+
}
|
|
1391
|
+
)
|
|
1392
|
+
] }),
|
|
1368
1393
|
/* @__PURE__ */ jsx(
|
|
1369
1394
|
Cuboid,
|
|
1370
1395
|
{
|
|
1371
1396
|
color: "silver",
|
|
1372
|
-
size: [
|
|
1373
|
-
center: [
|
|
1397
|
+
size: [gapWidth, gapWidth, gapWidth * 0.5],
|
|
1398
|
+
center: [x, y, gapWidth / 2 * 0.5]
|
|
1374
1399
|
}
|
|
1375
1400
|
)
|
|
1376
|
-
] })
|
|
1377
|
-
|
|
1378
|
-
Cuboid,
|
|
1379
|
-
{
|
|
1380
|
-
color: "silver",
|
|
1381
|
-
size: [gapWidth, gapWidth, gapWidth * 0.5],
|
|
1382
|
-
center: [xoff + i * pitch, 0, gapWidth / 2 * 0.5]
|
|
1383
|
-
}
|
|
1384
|
-
)
|
|
1385
|
-
] }, i))
|
|
1401
|
+
] }, i);
|
|
1402
|
+
})
|
|
1386
1403
|
] });
|
|
1387
1404
|
};
|
|
1388
1405
|
|
|
@@ -3978,7 +3995,9 @@ var Footprinter3d = ({ footprint }) => {
|
|
|
3978
3995
|
}
|
|
3979
3996
|
);
|
|
3980
3997
|
}
|
|
3981
|
-
case "pinrow":
|
|
3998
|
+
case "pinrow": {
|
|
3999
|
+
const rowsMatch = footprint.match(/_rows(\d+)/);
|
|
4000
|
+
const rows = rowsMatch && rowsMatch[1] ? parseInt(rowsMatch[1], 10) : 1;
|
|
3982
4001
|
if (fpJson.male)
|
|
3983
4002
|
return /* @__PURE__ */ jsx(
|
|
3984
4003
|
PinRow,
|
|
@@ -3986,11 +4005,20 @@ var Footprinter3d = ({ footprint }) => {
|
|
|
3986
4005
|
numberOfPins: fpJson.num_pins,
|
|
3987
4006
|
pitch: fpJson.p,
|
|
3988
4007
|
invert: fpJson.invert,
|
|
3989
|
-
faceup: fpJson.faceup
|
|
4008
|
+
faceup: fpJson.faceup,
|
|
4009
|
+
rows
|
|
3990
4010
|
}
|
|
3991
4011
|
);
|
|
3992
4012
|
if (fpJson.female)
|
|
3993
|
-
return /* @__PURE__ */ jsx(
|
|
4013
|
+
return /* @__PURE__ */ jsx(
|
|
4014
|
+
FemaleHeader,
|
|
4015
|
+
{
|
|
4016
|
+
numberOfPins: fpJson.num_pins,
|
|
4017
|
+
pitch: fpJson.p,
|
|
4018
|
+
rows
|
|
4019
|
+
}
|
|
4020
|
+
);
|
|
4021
|
+
}
|
|
3994
4022
|
case "cap": {
|
|
3995
4023
|
switch (fpJson.imperial) {
|
|
3996
4024
|
case "0402":
|