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