jscad-electronics 0.0.141 → 0.0.142

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
@@ -5114,6 +5114,242 @@ var SmdPinHeader = ({
5114
5114
  }) });
5115
5115
  };
5116
5116
 
5117
+ // lib/RJ45.tsx
5118
+ var range2 = (length) => Array.from({ length }, (_, index) => index);
5119
+ var RJ45 = ({
5120
+ bodyWidth = 16.26,
5121
+ bodyDepth = 15.88,
5122
+ bodyHeight = 13.5,
5123
+ bodyCenterY = -0.96,
5124
+ ledPins = false,
5125
+ firstPinLeft = false,
5126
+ firstPinTop = false,
5127
+ signalPitch = 1.02,
5128
+ signalRowPitch = 1.78,
5129
+ signalHoleDiameter = 0.9144,
5130
+ shieldPinX = 8.13,
5131
+ shieldPinY = 0.13,
5132
+ shieldHoleDiameter = 1.8,
5133
+ locatorHoleX = 6.35,
5134
+ locatorHoleY = -3.43,
5135
+ locatorHoleDiameter = 3.25,
5136
+ ledPinX = 4.57,
5137
+ ledPinPitch = 2.29,
5138
+ ledPinY = 5.7,
5139
+ openingDirection,
5140
+ shellColor = "#b7bdc2",
5141
+ housingColor = "#20242a",
5142
+ contactColor = "#d6a928"
5143
+ }) => {
5144
+ const frontDirection = openingDirection ?? (bodyCenterY > 0 ? 1 : -1);
5145
+ const frontY = bodyCenterY + frontDirection * bodyDepth / 2;
5146
+ const shellThickness = Math.min(0.38, bodyWidth * 0.024);
5147
+ const openingWidth = Math.max(bodyWidth - 2.5, bodyWidth * 0.72);
5148
+ const openingHeight = Math.min(bodyHeight - 2.4, 9.6);
5149
+ const openingCenterZ = 1.3 + openingHeight / 2;
5150
+ const cavityDepth = Math.min(4.4, bodyDepth * 0.34);
5151
+ const cavityCenterY = frontY - frontDirection * cavityDepth / 2;
5152
+ const backWallY = frontY - frontDirection * (cavityDepth + shellThickness * 0.7);
5153
+ const signalLeadRadius = Math.max(
5154
+ 0.22,
5155
+ Math.min(signalHoleDiameter * 0.36, 0.38)
5156
+ );
5157
+ const signalPinPositions = range2(8).map((index) => {
5158
+ const defaultX = (3.5 - index) * signalPitch;
5159
+ const defaultY = index % 2 === 0 ? -signalRowPitch / 2 : signalRowPitch / 2;
5160
+ return {
5161
+ x: firstPinLeft ? -defaultX : defaultX,
5162
+ y: firstPinTop ? -defaultY : defaultY
5163
+ };
5164
+ });
5165
+ const ledPinPositions = [
5166
+ -ledPinX - ledPinPitch,
5167
+ -ledPinX,
5168
+ ledPinX,
5169
+ ledPinX + ledPinPitch
5170
+ ];
5171
+ const contactPitch = openingWidth / 10;
5172
+ const contactY = frontY - frontDirection * Math.max(cavityDepth * 0.48, 1.2);
5173
+ const contactZ = openingCenterZ + openingHeight * 0.18;
5174
+ const frontLipY = frontY + frontDirection * shellThickness * 0.2;
5175
+ return /* @__PURE__ */ jsxs(Fragment2, { children: [
5176
+ /* @__PURE__ */ jsxs(Colorize, { color: shellColor, children: [
5177
+ /* @__PURE__ */ jsxs(Subtract, { children: [
5178
+ /* @__PURE__ */ jsx(
5179
+ Cuboid,
5180
+ {
5181
+ center: [0, bodyCenterY, bodyHeight / 2],
5182
+ size: [bodyWidth, bodyDepth, bodyHeight]
5183
+ }
5184
+ ),
5185
+ /* @__PURE__ */ jsx(
5186
+ Cuboid,
5187
+ {
5188
+ center: [0, cavityCenterY, openingCenterZ],
5189
+ size: [
5190
+ openingWidth,
5191
+ cavityDepth + shellThickness * 2,
5192
+ openingHeight
5193
+ ]
5194
+ }
5195
+ )
5196
+ ] }),
5197
+ /* @__PURE__ */ jsx(
5198
+ Cuboid,
5199
+ {
5200
+ center: [0, frontLipY, 0.72],
5201
+ size: [openingWidth + 0.5, shellThickness * 1.25, 1.05]
5202
+ }
5203
+ ),
5204
+ [-1, 1].map((direction) => /* @__PURE__ */ jsx(
5205
+ Cuboid,
5206
+ {
5207
+ center: [direction * shieldPinX, shieldPinY, 0.25],
5208
+ size: [
5209
+ Math.max(shieldHoleDiameter * 0.46, 0.65),
5210
+ Math.max(shieldHoleDiameter * 0.72, 1.1),
5211
+ 3.4
5212
+ ]
5213
+ },
5214
+ `shield-tab:${direction}`
5215
+ )),
5216
+ [-1, 1].map((direction) => /* @__PURE__ */ jsx(
5217
+ Cuboid,
5218
+ {
5219
+ center: [
5220
+ direction * bodyWidth * 0.24,
5221
+ bodyCenterY - frontDirection * bodyDepth * 0.08,
5222
+ bodyHeight + 0.04
5223
+ ],
5224
+ size: [bodyWidth * 0.22, bodyDepth * 0.42, 0.1]
5225
+ },
5226
+ `top-seam:${direction}`
5227
+ ))
5228
+ ] }),
5229
+ /* @__PURE__ */ jsxs(Colorize, { color: housingColor, children: [
5230
+ /* @__PURE__ */ jsxs(Subtract, { children: [
5231
+ /* @__PURE__ */ jsx(
5232
+ RoundedCuboid,
5233
+ {
5234
+ center: [0, cavityCenterY, openingCenterZ],
5235
+ size: [
5236
+ openingWidth - 0.2,
5237
+ cavityDepth + shellThickness * 0.5,
5238
+ openingHeight - 0.2
5239
+ ],
5240
+ roundRadius: 0.22
5241
+ }
5242
+ ),
5243
+ /* @__PURE__ */ jsx(
5244
+ Cuboid,
5245
+ {
5246
+ center: [
5247
+ 0,
5248
+ cavityCenterY - frontDirection * shellThickness * 0.2,
5249
+ openingCenterZ - 0.05
5250
+ ],
5251
+ size: [
5252
+ openingWidth - 1.25,
5253
+ cavityDepth + shellThickness,
5254
+ openingHeight - 1.35
5255
+ ]
5256
+ }
5257
+ )
5258
+ ] }),
5259
+ /* @__PURE__ */ jsx(
5260
+ Cuboid,
5261
+ {
5262
+ center: [0, backWallY, openingCenterZ],
5263
+ size: [openingWidth - 1.15, shellThickness, openingHeight - 1.25]
5264
+ }
5265
+ ),
5266
+ /* @__PURE__ */ jsx(
5267
+ RoundedCuboid,
5268
+ {
5269
+ center: [0, frontY - frontDirection * cavityDepth * 0.28, 1.55],
5270
+ size: [openingWidth - 2.6, cavityDepth * 0.5, 1.15],
5271
+ roundRadius: 0.16
5272
+ }
5273
+ ),
5274
+ [-1, 1].map((direction) => /* @__PURE__ */ jsx(
5275
+ Cylinder,
5276
+ {
5277
+ center: [direction * locatorHoleX, locatorHoleY, -0.25],
5278
+ radius: Math.max(locatorHoleDiameter * 0.41, 0.65),
5279
+ height: 2.7
5280
+ },
5281
+ `locator:${direction}`
5282
+ ))
5283
+ ] }),
5284
+ /* @__PURE__ */ jsxs(Colorize, { color: contactColor, children: [
5285
+ signalPinPositions.map(({ x, y }, index) => /* @__PURE__ */ jsx(
5286
+ Cylinder,
5287
+ {
5288
+ center: [x, y, 0.15],
5289
+ radius: signalLeadRadius,
5290
+ height: 3.1
5291
+ },
5292
+ `signal-lead:${index}`
5293
+ )),
5294
+ range2(8).map((index) => /* @__PURE__ */ jsx(
5295
+ Translate,
5296
+ {
5297
+ offset: [
5298
+ (index - 3.5) * contactPitch,
5299
+ contactY,
5300
+ contactZ + (index % 2 === 0 ? 0.03 : -0.03)
5301
+ ],
5302
+ children: /* @__PURE__ */ jsx(Rotate, { rotation: [frontDirection * 0.2, 0, 0], children: /* @__PURE__ */ jsx(
5303
+ RoundedCuboid,
5304
+ {
5305
+ size: [Math.max(contactPitch * 0.28, 0.28), 3.25, 0.16],
5306
+ roundRadius: 0.05
5307
+ }
5308
+ ) })
5309
+ },
5310
+ `socket-contact:${index}`
5311
+ )),
5312
+ ledPins && ledPinPositions.map((x, index) => /* @__PURE__ */ jsx(
5313
+ Cylinder,
5314
+ {
5315
+ center: [x, ledPinY, 0.15],
5316
+ radius: signalLeadRadius,
5317
+ height: 3.1
5318
+ },
5319
+ `led-lead:${index}`
5320
+ ))
5321
+ ] }),
5322
+ ledPins && /* @__PURE__ */ jsxs(Fragment2, { children: [
5323
+ /* @__PURE__ */ jsx(
5324
+ RoundedCuboid,
5325
+ {
5326
+ color: "#73b744",
5327
+ center: [
5328
+ -bodyWidth / 2 + 2.05,
5329
+ frontY + frontDirection * shellThickness * 0.35,
5330
+ bodyHeight - 2.05
5331
+ ],
5332
+ size: [2.15, shellThickness * 1.55, 1.45],
5333
+ roundRadius: 0.18
5334
+ }
5335
+ ),
5336
+ /* @__PURE__ */ jsx(
5337
+ RoundedCuboid,
5338
+ {
5339
+ color: "#e0aa35",
5340
+ center: [
5341
+ bodyWidth / 2 - 2.05,
5342
+ frontY + frontDirection * shellThickness * 0.35,
5343
+ bodyHeight - 2.05
5344
+ ],
5345
+ size: [2.15, shellThickness * 1.55, 1.45],
5346
+ roundRadius: 0.18
5347
+ }
5348
+ )
5349
+ ] })
5350
+ ] });
5351
+ };
5352
+
5117
5353
  // lib/Footprinter3d.tsx
5118
5354
  var Footprinter3d = ({ footprint }) => {
5119
5355
  let normalizedFootprint = footprint;
@@ -5324,6 +5560,30 @@ var Footprinter3d = ({ footprint }) => {
5324
5560
  mountPadLength: fpJson.mpl
5325
5561
  }
5326
5562
  );
5563
+ case "rj45":
5564
+ return /* @__PURE__ */ jsx(
5565
+ RJ45,
5566
+ {
5567
+ bodyWidth: fpJson.w,
5568
+ bodyDepth: fpJson.h,
5569
+ bodyCenterY: fpJson.bodyy,
5570
+ ledPins: fpJson.ledpins || fpJson.num_pins === 14,
5571
+ firstPinLeft: fpJson.firstpinleft,
5572
+ firstPinTop: fpJson.firstpintop,
5573
+ signalPitch: fpJson.p,
5574
+ signalRowPitch: fpJson.py,
5575
+ signalHoleDiameter: fpJson.id,
5576
+ shieldPinX: fpJson.shieldx,
5577
+ shieldPinY: fpJson.shieldy,
5578
+ shieldHoleDiameter: fpJson.shieldid,
5579
+ locatorHoleX: fpJson.holex,
5580
+ locatorHoleY: fpJson.holey,
5581
+ locatorHoleDiameter: fpJson.holed,
5582
+ ledPinX: fpJson.ledx,
5583
+ ledPinPitch: fpJson.ledp,
5584
+ ledPinY: fpJson.ledy
5585
+ }
5586
+ );
5327
5587
  case "soic":
5328
5588
  return /* @__PURE__ */ jsx(
5329
5589
  SOIC,