jscad-electronics 0.0.111 → 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/vanilla.js CHANGED
@@ -3933,12 +3933,198 @@ var SOD323FL = () => {
3933
3933
  ] });
3934
3934
  };
3935
3935
 
3936
+ // lib/AxialCapacitor.tsx
3937
+ var AxialCapacitor = ({ pitch = 10 }) => {
3938
+ const heightToCenterOfCapacitor = 0.5 + 4 / 2;
3939
+ return /* @__PURE__ */ jsxs(Fragment2, { children: [
3940
+ /* @__PURE__ */ jsx(Cylinder, { height: 4, radius: 0.5, center: [-pitch / 2, 0, 0.5] }),
3941
+ /* @__PURE__ */ jsx(
3942
+ Sphere,
3943
+ {
3944
+ radius: 0.5,
3945
+ center: [-pitch / 2, 0, heightToCenterOfCapacitor]
3946
+ }
3947
+ ),
3948
+ /* @__PURE__ */ jsx(Translate, { x: -2.5, y: 0, z: heightToCenterOfCapacitor, children: /* @__PURE__ */ jsxs(Rotate, { rotation: [0, Math.PI / 2, 0], children: [
3949
+ /* @__PURE__ */ jsx(
3950
+ Cylinder,
3951
+ {
3952
+ height: pitch,
3953
+ radius: 0.5,
3954
+ center: [0, 0, heightToCenterOfCapacitor]
3955
+ }
3956
+ ),
3957
+ /* @__PURE__ */ jsx(Colorize, { color: "#d2b48c", children: /* @__PURE__ */ jsx(
3958
+ Cylinder,
3959
+ {
3960
+ height: 5,
3961
+ radius: 1.3,
3962
+ center: [0, 0, heightToCenterOfCapacitor]
3963
+ }
3964
+ ) })
3965
+ ] }) }),
3966
+ /* @__PURE__ */ jsx(Cylinder, { height: 4, radius: 0.5, center: [pitch / 2, 0, 0.5] }),
3967
+ /* @__PURE__ */ jsx(Sphere, { radius: 0.5, center: [pitch / 2, 0, heightToCenterOfCapacitor] })
3968
+ ] });
3969
+ };
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
+
3936
4120
  // lib/Footprinter3d.tsx
3937
4121
  var Footprinter3d = ({ footprint }) => {
3938
4122
  const fpJson = fp.string(footprint).json();
3939
4123
  switch (fpJson.fn) {
3940
4124
  case "dip":
3941
4125
  return /* @__PURE__ */ jsx(Dip, { numPins: fpJson.num_pins, pitch: fpJson.p, bodyWidth: fpJson.w });
4126
+ case "axial":
4127
+ return /* @__PURE__ */ jsx(AxialCapacitor, { pitch: fpJson.p });
3942
4128
  case "tssop":
3943
4129
  return /* @__PURE__ */ jsx(
3944
4130
  Tssop,
@@ -4170,6 +4356,23 @@ var Footprinter3d = ({ footprint }) => {
4170
4356
  return /* @__PURE__ */ jsx(TO220, {});
4171
4357
  case "to92":
4172
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
+ );
4173
4376
  }
4174
4377
  const colorMatch = footprint.match(/_color\(([^)]+)\)/);
4175
4378
  const color = colorMatch ? colorMatch[1] : void 0;