jscad-electronics 0.0.112 → 0.0.114
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 +16 -1
- package/dist/index.js +255 -85
- package/dist/index.js.map +1 -1
- package/dist/vanilla.js +168 -1
- package/dist/vanilla.js.map +1 -1
- package/package.json +2 -2
package/dist/vanilla.js
CHANGED
|
@@ -692,7 +692,8 @@ var PinRow = ({
|
|
|
692
692
|
const shortSidePinLength = 3;
|
|
693
693
|
const xoff = -((pinsPerRow - 1) / 2) * pitch;
|
|
694
694
|
const bodyCenterY = rows > 1 ? -((rows - 1) * rowSpacing) / 2 : 0;
|
|
695
|
-
const
|
|
695
|
+
const zOffset = !smd && !rightangle ? -bodyHeight - 1.6 : 0;
|
|
696
|
+
const flipZ = (z) => (invert || faceup ? -z + bodyHeight : z) + zOffset;
|
|
696
697
|
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
697
698
|
/* @__PURE__ */ jsx(Translate, { y: rightangle ? -3 : 0, children: /* @__PURE__ */ jsx(
|
|
698
699
|
Cuboid,
|
|
@@ -3968,6 +3969,155 @@ var AxialCapacitor = ({ pitch = 10 }) => {
|
|
|
3968
3969
|
] });
|
|
3969
3970
|
};
|
|
3970
3971
|
|
|
3972
|
+
// lib/stampboard.tsx
|
|
3973
|
+
var StampBoard = ({
|
|
3974
|
+
bodyWidth = 21,
|
|
3975
|
+
boardThickness = 0.5,
|
|
3976
|
+
leadWidth = 1.6,
|
|
3977
|
+
leadLength = 2.4,
|
|
3978
|
+
leadsPitch = 2.54,
|
|
3979
|
+
leadsLeft,
|
|
3980
|
+
leadsRight,
|
|
3981
|
+
leadsTop,
|
|
3982
|
+
leadsBottom,
|
|
3983
|
+
innerHoles = true,
|
|
3984
|
+
innerHoleEdgeDistance = 1.61,
|
|
3985
|
+
innerHoleDiameter = 1
|
|
3986
|
+
}) => {
|
|
3987
|
+
const halfBoardWidth = bodyWidth / 2;
|
|
3988
|
+
const boardCenterZ = boardThickness / 2;
|
|
3989
|
+
const boardHeight = boardThickness * 1.05;
|
|
3990
|
+
const holeRadius = innerHoleDiameter / 2;
|
|
3991
|
+
const bodyLength10 = Math.max(leadsLeft || 0, leadsRight || 0, leadsTop || 0, leadsBottom || 0) * leadsPitch || 51;
|
|
3992
|
+
const pads = [];
|
|
3993
|
+
const holes = [];
|
|
3994
|
+
if (leadsRight) {
|
|
3995
|
+
const yOffset = -((leadsRight - 1) / 2) * leadsPitch;
|
|
3996
|
+
for (let i = 0; i < leadsRight; i++) {
|
|
3997
|
+
const y = yOffset + i * leadsPitch;
|
|
3998
|
+
pads.push({
|
|
3999
|
+
x: -halfBoardWidth + leadLength / 2,
|
|
4000
|
+
y: -y,
|
|
4001
|
+
// Flip y
|
|
4002
|
+
pl: leadLength,
|
|
4003
|
+
pw: leadWidth
|
|
4004
|
+
});
|
|
4005
|
+
if (innerHoles) {
|
|
4006
|
+
holes.push(
|
|
4007
|
+
{ x: -halfBoardWidth, y: -y },
|
|
4008
|
+
{ x: -halfBoardWidth + innerHoleEdgeDistance, y: -y }
|
|
4009
|
+
);
|
|
4010
|
+
}
|
|
4011
|
+
}
|
|
4012
|
+
}
|
|
4013
|
+
if (leadsLeft) {
|
|
4014
|
+
const yOffset = -((leadsLeft - 1) / 2) * leadsPitch;
|
|
4015
|
+
for (let i = 0; i < leadsLeft; i++) {
|
|
4016
|
+
const y = yOffset + i * leadsPitch;
|
|
4017
|
+
pads.push({
|
|
4018
|
+
x: halfBoardWidth - leadLength / 2,
|
|
4019
|
+
y: -y,
|
|
4020
|
+
// Flip y
|
|
4021
|
+
pl: leadLength,
|
|
4022
|
+
pw: leadWidth
|
|
4023
|
+
});
|
|
4024
|
+
if (innerHoles) {
|
|
4025
|
+
holes.push(
|
|
4026
|
+
{ x: halfBoardWidth, y: -y },
|
|
4027
|
+
{ x: halfBoardWidth - innerHoleEdgeDistance, y: -y }
|
|
4028
|
+
);
|
|
4029
|
+
}
|
|
4030
|
+
}
|
|
4031
|
+
}
|
|
4032
|
+
if (leadsTop) {
|
|
4033
|
+
const xOffset = -((leadsTop - 1) / 2) * leadsPitch;
|
|
4034
|
+
for (let i = 0; i < leadsTop; i++) {
|
|
4035
|
+
const x = xOffset + i * leadsPitch;
|
|
4036
|
+
pads.push({
|
|
4037
|
+
x: -x,
|
|
4038
|
+
// Flip x
|
|
4039
|
+
y: -bodyLength10 / 2 + leadLength / 2,
|
|
4040
|
+
pl: leadWidth,
|
|
4041
|
+
pw: leadLength
|
|
4042
|
+
});
|
|
4043
|
+
if (innerHoles) {
|
|
4044
|
+
holes.push(
|
|
4045
|
+
{ x: -x, y: -bodyLength10 / 2 },
|
|
4046
|
+
{ x: -x, y: -bodyLength10 / 2 + innerHoleEdgeDistance }
|
|
4047
|
+
);
|
|
4048
|
+
}
|
|
4049
|
+
}
|
|
4050
|
+
}
|
|
4051
|
+
if (leadsBottom) {
|
|
4052
|
+
const xOffset = -((leadsBottom - 1) / 2) * leadsPitch;
|
|
4053
|
+
for (let i = 0; i < leadsBottom; i++) {
|
|
4054
|
+
const x = xOffset + i * leadsPitch;
|
|
4055
|
+
pads.push({
|
|
4056
|
+
x: -x,
|
|
4057
|
+
// Flip x
|
|
4058
|
+
y: bodyLength10 / 2 - leadLength / 2,
|
|
4059
|
+
pl: leadWidth,
|
|
4060
|
+
pw: leadLength
|
|
4061
|
+
});
|
|
4062
|
+
if (innerHoles) {
|
|
4063
|
+
holes.push(
|
|
4064
|
+
{ x: -x, y: bodyLength10 / 2 },
|
|
4065
|
+
{ x: -x, y: bodyLength10 / 2 - innerHoleEdgeDistance }
|
|
4066
|
+
);
|
|
4067
|
+
}
|
|
4068
|
+
}
|
|
4069
|
+
}
|
|
4070
|
+
const boardBody = /* @__PURE__ */ jsx(Colorize, { color: "#008080", children: /* @__PURE__ */ jsxs(Subtract, { children: [
|
|
4071
|
+
/* @__PURE__ */ jsx(
|
|
4072
|
+
Cuboid,
|
|
4073
|
+
{
|
|
4074
|
+
center: [0, 0, boardCenterZ],
|
|
4075
|
+
size: [bodyWidth, bodyLength10, boardThickness]
|
|
4076
|
+
}
|
|
4077
|
+
),
|
|
4078
|
+
pads.map((pad, index) => /* @__PURE__ */ jsx(
|
|
4079
|
+
Cuboid,
|
|
4080
|
+
{
|
|
4081
|
+
center: [pad.x, pad.y, boardCenterZ],
|
|
4082
|
+
size: [pad.pl + 0.01, pad.pw + 0.01, boardHeight]
|
|
4083
|
+
},
|
|
4084
|
+
index
|
|
4085
|
+
))
|
|
4086
|
+
] }) });
|
|
4087
|
+
const holePads = innerHoles && holes.map((hole, index) => /* @__PURE__ */ jsx(
|
|
4088
|
+
Cylinder,
|
|
4089
|
+
{
|
|
4090
|
+
color: "black",
|
|
4091
|
+
center: [hole.x, hole.y, boardCenterZ],
|
|
4092
|
+
radius: holeRadius,
|
|
4093
|
+
height: boardThickness * 1.07
|
|
4094
|
+
},
|
|
4095
|
+
index
|
|
4096
|
+
));
|
|
4097
|
+
const rectPads = pads.map((pad, index) => /* @__PURE__ */ jsx(
|
|
4098
|
+
Cuboid,
|
|
4099
|
+
{
|
|
4100
|
+
center: [pad.x, pad.y, boardCenterZ],
|
|
4101
|
+
size: [pad.pl + 0.01, pad.pw + 0.01, boardHeight]
|
|
4102
|
+
},
|
|
4103
|
+
index
|
|
4104
|
+
));
|
|
4105
|
+
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
4106
|
+
boardBody,
|
|
4107
|
+
/* @__PURE__ */ jsx(Colorize, { color: "#FFD700", children: innerHoles ? /* @__PURE__ */ jsxs(Subtract, { children: [
|
|
4108
|
+
/* @__PURE__ */ jsx(Union, { children: pads.map((pad, index) => /* @__PURE__ */ jsx(
|
|
4109
|
+
Cuboid,
|
|
4110
|
+
{
|
|
4111
|
+
center: [pad.x, pad.y, boardCenterZ],
|
|
4112
|
+
size: [pad.pl + 0.01, pad.pw + 0.01, boardHeight]
|
|
4113
|
+
},
|
|
4114
|
+
index
|
|
4115
|
+
)) }),
|
|
4116
|
+
holePads
|
|
4117
|
+
] }) : rectPads })
|
|
4118
|
+
] });
|
|
4119
|
+
};
|
|
4120
|
+
|
|
3971
4121
|
// lib/Footprinter3d.tsx
|
|
3972
4122
|
var Footprinter3d = ({ footprint }) => {
|
|
3973
4123
|
const fpJson = fp.string(footprint).json();
|
|
@@ -4207,6 +4357,23 @@ var Footprinter3d = ({ footprint }) => {
|
|
|
4207
4357
|
return /* @__PURE__ */ jsx(TO220, {});
|
|
4208
4358
|
case "to92":
|
|
4209
4359
|
return /* @__PURE__ */ jsx(TO92, {});
|
|
4360
|
+
case "stampboard":
|
|
4361
|
+
case "stampreceiver":
|
|
4362
|
+
return /* @__PURE__ */ jsx(
|
|
4363
|
+
StampBoard,
|
|
4364
|
+
{
|
|
4365
|
+
bodyWidth: fpJson.w,
|
|
4366
|
+
leadsLeft: fpJson.left,
|
|
4367
|
+
leadsRight: fpJson.right,
|
|
4368
|
+
leadsTop: fpJson.top,
|
|
4369
|
+
leadsBottom: fpJson.bottom,
|
|
4370
|
+
leadsPitch: fpJson.p,
|
|
4371
|
+
leadWidth: fpJson.pw,
|
|
4372
|
+
leadLength: fpJson.pl,
|
|
4373
|
+
innerHoles: fpJson.innerhole,
|
|
4374
|
+
innerHoleEdgeDistance: fpJson.innerholeedgedistance
|
|
4375
|
+
}
|
|
4376
|
+
);
|
|
4210
4377
|
}
|
|
4211
4378
|
const colorMatch = footprint.match(/_color\(([^)]+)\)/);
|
|
4212
4379
|
const color = colorMatch ? colorMatch[1] : void 0;
|