jscad-electronics 0.0.182 → 0.0.183
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 +2 -1
- package/dist/index.js +342 -296
- package/dist/index.js.map +1 -1
- package/dist/vanilla.d.ts +2 -1
- package/dist/vanilla.js +74 -28
- package/dist/vanilla.js.map +1 -1
- package/package.json +2 -2
package/dist/vanilla.d.ts
CHANGED
|
@@ -28,12 +28,13 @@ type NemaMotorProps = NemaMotorModelPropsInput & {
|
|
|
28
28
|
bodyColor?: string;
|
|
29
29
|
capColor?: string;
|
|
30
30
|
shaftColor?: string;
|
|
31
|
+
screwColor?: string;
|
|
31
32
|
};
|
|
32
33
|
type NemaFrameMotorProps = Omit<NemaMotorProps, "nemaSize">;
|
|
33
34
|
/** Mounting face at Z=0, body along -Z, shaft along +Z; all lengths in mm.
|
|
34
35
|
* Parameters follow the modelprinter NEMA contract; JSCAD builds all geometry.
|
|
35
36
|
*/
|
|
36
|
-
declare function NemaMotor({ bodyColor, capColor, shaftColor, ...props }: NemaMotorProps): react_jsx_runtime.JSX.Element;
|
|
37
|
+
declare function NemaMotor({ bodyColor, capColor, shaftColor, screwColor, ...props }: NemaMotorProps): react_jsx_runtime.JSX.Element;
|
|
37
38
|
declare const NEMA8: (props: NemaFrameMotorProps) => react_jsx_runtime.JSX.Element;
|
|
38
39
|
declare const NEMA17: (props: NemaFrameMotorProps) => react_jsx_runtime.JSX.Element;
|
|
39
40
|
declare const NEMA23: (props: NemaFrameMotorProps) => react_jsx_runtime.JSX.Element;
|
package/dist/vanilla.js
CHANGED
|
@@ -527,12 +527,34 @@ function createNemaMotorSections(input) {
|
|
|
527
527
|
add("frontCap", front, -holeDepth, 0, holes);
|
|
528
528
|
add("frontCap", front, -p.frontCapLength, -holeDepth);
|
|
529
529
|
add("body", core, -p.bodyLength + p.rearCapLength, -p.frontCapLength);
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
530
|
+
if (p.backFace === "plain") {
|
|
531
|
+
add(
|
|
532
|
+
"rearCap",
|
|
533
|
+
p.mountingHoleThrough ? core : front,
|
|
534
|
+
-p.bodyLength,
|
|
535
|
+
-p.bodyLength + p.rearCapLength
|
|
536
|
+
);
|
|
537
|
+
} else {
|
|
538
|
+
const halfPitch = p.backFaceHoleSpacing / 2;
|
|
539
|
+
const rearHoles = [-halfPitch, halfPitch].flatMap(
|
|
540
|
+
(x) => [-halfPitch, halfPitch].map(
|
|
541
|
+
(y) => circle(p.backFaceHoleDiameter / 2, x, y)
|
|
542
|
+
)
|
|
543
|
+
);
|
|
544
|
+
add(
|
|
545
|
+
"rearCap",
|
|
546
|
+
front,
|
|
547
|
+
-p.bodyLength,
|
|
548
|
+
-p.bodyLength + p.backFaceHoleDepth,
|
|
549
|
+
rearHoles
|
|
550
|
+
);
|
|
551
|
+
add(
|
|
552
|
+
"rearCap",
|
|
553
|
+
front,
|
|
554
|
+
-p.bodyLength + p.backFaceHoleDepth,
|
|
555
|
+
-p.bodyLength + p.rearCapLength
|
|
556
|
+
);
|
|
557
|
+
}
|
|
536
558
|
add("pilot", circle(p.pilotDiameter / 2), 0, p.pilotLength);
|
|
537
559
|
const r = p.shaftDiameter / 2;
|
|
538
560
|
const round = circle(r);
|
|
@@ -561,30 +583,54 @@ function NemaMotor({
|
|
|
561
583
|
bodyColor = "#242830",
|
|
562
584
|
capColor = "#aeb5bd",
|
|
563
585
|
shaftColor = "#b8bec6",
|
|
586
|
+
screwColor = "#626b78",
|
|
564
587
|
...props
|
|
565
588
|
}) {
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
589
|
+
const p = resolveNemaMotorProps(props);
|
|
590
|
+
const screw = p.backFace === "screws" ? jscad2.transforms.rotateX(
|
|
591
|
+
Math.PI,
|
|
592
|
+
createHexSocketBoltGeom({
|
|
593
|
+
metricSize: p.backFaceScrewSize,
|
|
594
|
+
length: p.backFaceHoleDepth,
|
|
595
|
+
showThreads: false
|
|
596
|
+
})
|
|
597
|
+
) : void 0;
|
|
598
|
+
const halfPitch = p.backFaceHoleSpacing / 2;
|
|
599
|
+
return /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
600
|
+
createNemaMotorSections(p).map((section, index) => {
|
|
601
|
+
const outline = jscad2.geometries.geom2.fromPoints(section.outline);
|
|
602
|
+
const profile = section.holes.length ? jscad2.booleans.subtract(
|
|
603
|
+
outline,
|
|
604
|
+
...section.holes.map((h2) => jscad2.geometries.geom2.fromPoints(h2))
|
|
605
|
+
) : outline;
|
|
606
|
+
const geometry = jscad2.transforms.translate(
|
|
607
|
+
[0, 0, section.zMin],
|
|
608
|
+
jscad2.extrusions.extrudeLinear(
|
|
609
|
+
{ height: section.zMax - section.zMin },
|
|
610
|
+
profile
|
|
611
|
+
)
|
|
612
|
+
);
|
|
613
|
+
return /* @__PURE__ */ jsx(
|
|
614
|
+
Colorize,
|
|
615
|
+
{
|
|
616
|
+
color: section.name === "body" ? bodyColor : section.name === "shaft" ? shaftColor : capColor,
|
|
617
|
+
children: /* @__PURE__ */ jsx(Custom, { geometry })
|
|
618
|
+
},
|
|
619
|
+
`${section.name}-${index}`
|
|
620
|
+
);
|
|
621
|
+
}),
|
|
622
|
+
screw && [-halfPitch, halfPitch].flatMap(
|
|
623
|
+
(x) => [-halfPitch, halfPitch].map((y) => /* @__PURE__ */ jsx(Colorize, { color: screwColor, children: /* @__PURE__ */ jsx(
|
|
624
|
+
Custom,
|
|
625
|
+
{
|
|
626
|
+
geometry: jscad2.transforms.translate(
|
|
627
|
+
[x, y, -p.bodyLength],
|
|
628
|
+
screw
|
|
629
|
+
)
|
|
630
|
+
}
|
|
631
|
+
) }, `rear-screw-${x}-${y}`))
|
|
632
|
+
)
|
|
633
|
+
] });
|
|
588
634
|
}
|
|
589
635
|
var NEMA8 = (props) => /* @__PURE__ */ jsx(NemaMotor, { ...props, nemaSize: 8 });
|
|
590
636
|
var NEMA17 = (props) => /* @__PURE__ */ jsx(NemaMotor, { ...props, nemaSize: 17 });
|