jscad-electronics 0.0.150 → 0.0.151
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 +10 -1
- package/dist/index.js +492 -296
- package/dist/index.js.map +1 -1
- package/dist/vanilla.js +186 -0
- package/dist/vanilla.js.map +1 -1
- package/package.json +1 -1
package/dist/vanilla.js
CHANGED
|
@@ -4986,6 +4986,185 @@ var JSTZH1_5mm = ({
|
|
|
4986
4986
|
] });
|
|
4987
4987
|
};
|
|
4988
4988
|
|
|
4989
|
+
// lib/JSTPH2_0mm.tsx
|
|
4990
|
+
var JSTPH2_0mm = ({
|
|
4991
|
+
numPins = 2,
|
|
4992
|
+
showPins = true,
|
|
4993
|
+
showFootprint = true,
|
|
4994
|
+
bodyColor = "#f5f5f5",
|
|
4995
|
+
pinColor = "#635959"
|
|
4996
|
+
}) => {
|
|
4997
|
+
const pitch = 2;
|
|
4998
|
+
const bodyHeight = 6;
|
|
4999
|
+
const bodyDepth = 4.5;
|
|
5000
|
+
const wallThickness = 0.5;
|
|
5001
|
+
const hollowHeight = bodyHeight * 0.6;
|
|
5002
|
+
const pinTailLength = 3.4;
|
|
5003
|
+
const pinTop = 5.5;
|
|
5004
|
+
const pinThickness = 0.5;
|
|
5005
|
+
const pinLength = pinTailLength + pinTop;
|
|
5006
|
+
const bodyWidth = (numPins - 1) * pitch + 3.9;
|
|
5007
|
+
const startX = -((numPins - 1) * pitch) / 2;
|
|
5008
|
+
const latchWindowWidth = 1;
|
|
5009
|
+
const latchWindowHeight = 1.8;
|
|
5010
|
+
const latchWindowInset = 0.7;
|
|
5011
|
+
const topReliefWidth = 0.8;
|
|
5012
|
+
const topReliefDepth = 0.65;
|
|
5013
|
+
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
5014
|
+
/* @__PURE__ */ jsx(Translate, { offset: [0, 0, bodyHeight], children: /* @__PURE__ */ jsx(Rotate, { angles: [Math.PI, 0, 0], children: /* @__PURE__ */ jsx(Colorize, { color: bodyColor, children: /* @__PURE__ */ jsxs(Subtract, { children: [
|
|
5015
|
+
/* @__PURE__ */ jsx(
|
|
5016
|
+
Cuboid,
|
|
5017
|
+
{
|
|
5018
|
+
size: [bodyWidth, bodyDepth, bodyHeight],
|
|
5019
|
+
center: [0, 0, bodyHeight / 2]
|
|
5020
|
+
}
|
|
5021
|
+
),
|
|
5022
|
+
/* @__PURE__ */ jsx(
|
|
5023
|
+
Cuboid,
|
|
5024
|
+
{
|
|
5025
|
+
size: [
|
|
5026
|
+
bodyWidth - wallThickness * 2,
|
|
5027
|
+
bodyDepth - wallThickness * 2,
|
|
5028
|
+
hollowHeight
|
|
5029
|
+
],
|
|
5030
|
+
center: [0, 0, hollowHeight / 2]
|
|
5031
|
+
}
|
|
5032
|
+
),
|
|
5033
|
+
/* @__PURE__ */ jsx(
|
|
5034
|
+
Cuboid,
|
|
5035
|
+
{
|
|
5036
|
+
size: [bodyWidth, bodyDepth / 3, hollowHeight],
|
|
5037
|
+
center: [0, 0, hollowHeight / 6]
|
|
5038
|
+
}
|
|
5039
|
+
),
|
|
5040
|
+
/* @__PURE__ */ jsx(
|
|
5041
|
+
Cuboid,
|
|
5042
|
+
{
|
|
5043
|
+
size: [
|
|
5044
|
+
bodyWidth - wallThickness * 2,
|
|
5045
|
+
wallThickness / 2,
|
|
5046
|
+
hollowHeight
|
|
5047
|
+
],
|
|
5048
|
+
center: [
|
|
5049
|
+
0,
|
|
5050
|
+
bodyDepth / 2 - wallThickness / 4,
|
|
5051
|
+
hollowHeight / 2
|
|
5052
|
+
]
|
|
5053
|
+
}
|
|
5054
|
+
),
|
|
5055
|
+
/* @__PURE__ */ jsx(
|
|
5056
|
+
Cuboid,
|
|
5057
|
+
{
|
|
5058
|
+
size: [
|
|
5059
|
+
bodyWidth - wallThickness * 2,
|
|
5060
|
+
wallThickness / 2,
|
|
5061
|
+
hollowHeight
|
|
5062
|
+
],
|
|
5063
|
+
center: [
|
|
5064
|
+
0,
|
|
5065
|
+
-bodyDepth / 2 + wallThickness / 4,
|
|
5066
|
+
hollowHeight / 2
|
|
5067
|
+
]
|
|
5068
|
+
}
|
|
5069
|
+
),
|
|
5070
|
+
/* @__PURE__ */ jsx(
|
|
5071
|
+
Cuboid,
|
|
5072
|
+
{
|
|
5073
|
+
size: [
|
|
5074
|
+
latchWindowWidth,
|
|
5075
|
+
bodyDepth + wallThickness,
|
|
5076
|
+
latchWindowHeight
|
|
5077
|
+
],
|
|
5078
|
+
center: [-bodyWidth / 2 + latchWindowInset, 0, bodyHeight / 2]
|
|
5079
|
+
}
|
|
5080
|
+
),
|
|
5081
|
+
/* @__PURE__ */ jsx(
|
|
5082
|
+
Cuboid,
|
|
5083
|
+
{
|
|
5084
|
+
size: [
|
|
5085
|
+
latchWindowWidth,
|
|
5086
|
+
bodyDepth + wallThickness,
|
|
5087
|
+
latchWindowHeight
|
|
5088
|
+
],
|
|
5089
|
+
center: [bodyWidth / 2 - latchWindowInset, 0, bodyHeight / 2]
|
|
5090
|
+
}
|
|
5091
|
+
),
|
|
5092
|
+
/* @__PURE__ */ jsx(
|
|
5093
|
+
Cuboid,
|
|
5094
|
+
{
|
|
5095
|
+
size: [wallThickness * 3, topReliefWidth, topReliefDepth],
|
|
5096
|
+
center: [-bodyWidth / 2, 0, topReliefDepth / 2]
|
|
5097
|
+
}
|
|
5098
|
+
),
|
|
5099
|
+
/* @__PURE__ */ jsx(Translate, { offset: [-bodyWidth / 2, 0, topReliefDepth], children: /* @__PURE__ */ jsx(Rotate, { angles: [0, Math.PI / 2, 0], children: /* @__PURE__ */ jsx(
|
|
5100
|
+
Cylinder,
|
|
5101
|
+
{
|
|
5102
|
+
height: wallThickness * 3,
|
|
5103
|
+
radius: topReliefWidth / 2
|
|
5104
|
+
}
|
|
5105
|
+
) }) }),
|
|
5106
|
+
/* @__PURE__ */ jsx(
|
|
5107
|
+
Cuboid,
|
|
5108
|
+
{
|
|
5109
|
+
size: [wallThickness * 3, topReliefWidth, topReliefDepth],
|
|
5110
|
+
center: [bodyWidth / 2, 0, topReliefDepth / 2]
|
|
5111
|
+
}
|
|
5112
|
+
),
|
|
5113
|
+
/* @__PURE__ */ jsx(Translate, { offset: [bodyWidth / 2, 0, topReliefDepth], children: /* @__PURE__ */ jsx(Rotate, { angles: [0, Math.PI / 2, 0], children: /* @__PURE__ */ jsx(
|
|
5114
|
+
Cylinder,
|
|
5115
|
+
{
|
|
5116
|
+
height: wallThickness * 3,
|
|
5117
|
+
radius: topReliefWidth / 2
|
|
5118
|
+
}
|
|
5119
|
+
) }) })
|
|
5120
|
+
] }) }) }) }),
|
|
5121
|
+
showPins && Array.from({ length: numPins }).map((_, i) => /* @__PURE__ */ jsx(Colorize, { color: pinColor, children: /* @__PURE__ */ jsx(
|
|
5122
|
+
Cuboid,
|
|
5123
|
+
{
|
|
5124
|
+
size: [pinThickness, pinThickness, pinLength],
|
|
5125
|
+
center: [startX + i * pitch, 0, (pinTop - pinTailLength) / 2]
|
|
5126
|
+
}
|
|
5127
|
+
) }, i)),
|
|
5128
|
+
showFootprint && Array.from({ length: numPins }).map((_, i) => {
|
|
5129
|
+
const isPin1 = i === 0;
|
|
5130
|
+
const hole = isPin1 ? {
|
|
5131
|
+
type: "pcb_plated_hole",
|
|
5132
|
+
pcb_plated_hole_id: `jstph_${i}`,
|
|
5133
|
+
shape: "circular_hole_with_rect_pad",
|
|
5134
|
+
x: startX + i * pitch,
|
|
5135
|
+
y: 0,
|
|
5136
|
+
hole_diameter: 0.73,
|
|
5137
|
+
rect_pad_width: 1.2,
|
|
5138
|
+
rect_pad_height: 1.2,
|
|
5139
|
+
hole_shape: "circle",
|
|
5140
|
+
pad_shape: "rect",
|
|
5141
|
+
layers: ["top", "bottom"],
|
|
5142
|
+
port_hints: [`${i + 1}`]
|
|
5143
|
+
} : {
|
|
5144
|
+
type: "pcb_plated_hole",
|
|
5145
|
+
pcb_plated_hole_id: `jstph_${i}`,
|
|
5146
|
+
shape: "pill",
|
|
5147
|
+
x: startX + i * pitch,
|
|
5148
|
+
y: 0,
|
|
5149
|
+
hole_height: 0.73,
|
|
5150
|
+
hole_width: 0.73,
|
|
5151
|
+
outer_height: 1.2,
|
|
5152
|
+
outer_width: 1.2,
|
|
5153
|
+
layers: ["top", "bottom"],
|
|
5154
|
+
port_hints: [`${i + 1}`]
|
|
5155
|
+
};
|
|
5156
|
+
return /* @__PURE__ */ jsx(
|
|
5157
|
+
FootprintPlatedHole,
|
|
5158
|
+
{
|
|
5159
|
+
hole,
|
|
5160
|
+
isPin1
|
|
5161
|
+
},
|
|
5162
|
+
`footprint_${i}`
|
|
5163
|
+
);
|
|
5164
|
+
})
|
|
5165
|
+
] });
|
|
5166
|
+
};
|
|
5167
|
+
|
|
4989
5168
|
// lib/Crystal.tsx
|
|
4990
5169
|
var getTerminalPoints = ([centerX, centerY], width10, length, chamfer, isPinOne) => {
|
|
4991
5170
|
const xDirection = Math.sign(centerX);
|
|
@@ -6286,6 +6465,10 @@ var Footprinter3d = ({ footprint }) => {
|
|
|
6286
6465
|
const pinMatch = footprint.match(/jstzh1_5mm(\d+)?/);
|
|
6287
6466
|
const numPins = pinMatch && pinMatch[1] ? pinMatch[1] : "7";
|
|
6288
6467
|
normalizedFootprint = `zh${numPins}`;
|
|
6468
|
+
} else if (footprint.startsWith("jstph2_0mm")) {
|
|
6469
|
+
const pinMatch = footprint.match(/jstph2_0mm(\d+)?/);
|
|
6470
|
+
const numPins = pinMatch && pinMatch[1] ? pinMatch[1] : "2";
|
|
6471
|
+
normalizedFootprint = `jst${numPins}_ph`;
|
|
6289
6472
|
}
|
|
6290
6473
|
const fpJson = fp5.string(normalizedFootprint).json();
|
|
6291
6474
|
const colorMatch = footprint.match(/_color\(([^)]+)\)/);
|
|
@@ -6527,6 +6710,9 @@ var Footprinter3d = ({ footprint }) => {
|
|
|
6527
6710
|
if (fpJson.zh) {
|
|
6528
6711
|
return /* @__PURE__ */ jsx(JSTZH1_5mm, { numPins: fpJson.num_pins });
|
|
6529
6712
|
}
|
|
6713
|
+
if (fpJson.ph) {
|
|
6714
|
+
return /* @__PURE__ */ jsx(JSTPH2_0mm, { numPins: fpJson.num_pins });
|
|
6715
|
+
}
|
|
6530
6716
|
break;
|
|
6531
6717
|
case "fpc":
|
|
6532
6718
|
return /* @__PURE__ */ jsx(
|