jscad-electronics 0.0.211 → 0.0.213
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 +36 -2
- package/dist/index.js +1176 -926
- package/dist/index.js.map +1 -1
- package/dist/vanilla.d.ts +36 -2
- package/dist/vanilla.js +287 -47
- package/dist/vanilla.js.map +1 -1
- package/package.json +2 -2
package/dist/vanilla.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { BufferGeometry } from 'three';
|
|
|
3
3
|
import * as jscadModeling from '@jscad/modeling';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import * as _jscad_modeling_src_geometries_types from '@jscad/modeling/src/geometries/types';
|
|
6
|
-
import { BallBearingModelPropsInput, ButtonScrewModelPropsInput, CableGrommetModelPropsInput, ClampingShaftCollarModelPropsInput, CompressionSpringModelPropsInput, FlangedBushingModelPropsInput, FlatHeadScrewModelPropsInput, SpurGearModelPropsInput, HelicalGearModelPropsInput, HexBoltModelPropsInput, HexNutModelPropsInput, HexSocketBoltModelPropsInput, NemaMotorModelPropsInput, PanScrewModelPropsInput, PlainBushingModelPropsInput, RigidCouplerModelPropsInput, ShaftCollarModelPropsInput, SheetMetalModelPropsInput, ThreadedRodModelPropsInput, TSlotExtrusionModelPropsInput, TSlotGussetModelPropsInput, TSlotInsideCornerModelPropsInput, WormGearModelPropsInput } from '@tscircuit/modelprinter';
|
|
6
|
+
import { BallBearingModelPropsInput, ButtonScrewModelPropsInput, CableGrommetModelPropsInput, ClampingShaftCollarModelPropsInput, CompressionSpringModelPropsInput, FlangedBushingModelPropsInput, FlatHeadScrewModelPropsInput, SpurGearModelPropsInput, HelicalGearModelPropsInput, HexBoltModelPropsInput, HexNutModelPropsInput, HexSocketBoltModelPropsInput, HollowPositioningArmTubeModelPropsInput, NemaMotorModelPropsInput, PanScrewModelPropsInput, PlainBushingModelPropsInput, RigidCouplerModelPropsInput, ShaftCollarModelPropsInput, SheetMetalModelPropsInput, ThreadedRodModelPropsInput, TorsionSpringModelPropsInput, TSlotExtrusionModelPropsInput, TSlotGussetModelPropsInput, TSlotInsideCornerModelPropsInput, WormGearModelPropsInput } from '@tscircuit/modelprinter';
|
|
7
7
|
|
|
8
8
|
type VNode = {
|
|
9
9
|
type: any;
|
|
@@ -241,6 +241,23 @@ type HexSocketBoltProps = HexSocketBoltModelPropsInput & {
|
|
|
241
241
|
declare function createHexSocketBoltGeom(input: HexSocketBoltModelPropsInput): _jscad_modeling_src_geometries_types.Geom3;
|
|
242
242
|
declare function HexSocketBolt({ color, ...props }: HexSocketBoltProps): react_jsx_runtime.JSX.Element;
|
|
243
243
|
|
|
244
|
+
interface HollowPositioningArmTubeMesh {
|
|
245
|
+
positions: number[];
|
|
246
|
+
indices: number[];
|
|
247
|
+
}
|
|
248
|
+
interface HollowPositioningArmTubeMeshOptions {
|
|
249
|
+
radialSegments?: number;
|
|
250
|
+
segmentsPerRib?: number;
|
|
251
|
+
}
|
|
252
|
+
/** One closed annular sweep with open ends and a smooth, continuous wire bore. */
|
|
253
|
+
declare function createHollowPositioningArmTubeMesh(input: HollowPositioningArmTubeModelPropsInput, options?: HollowPositioningArmTubeMeshOptions): HollowPositioningArmTubeMesh;
|
|
254
|
+
|
|
255
|
+
type HollowPositioningArmTubeProps = HollowPositioningArmTubeModelPropsInput & {
|
|
256
|
+
color?: string;
|
|
257
|
+
};
|
|
258
|
+
declare function createHollowPositioningArmTubeGeom(input: HollowPositioningArmTubeModelPropsInput): _jscad_modeling_src_geometries_types.Geom3;
|
|
259
|
+
declare function HollowPositioningArmTube({ color, ...props }: HollowPositioningArmTubeProps): react_jsx_runtime.JSX.Element;
|
|
260
|
+
|
|
244
261
|
type NemaMotorProps = NemaMotorModelPropsInput & {
|
|
245
262
|
bodyColor?: string;
|
|
246
263
|
capColor?: string;
|
|
@@ -355,6 +372,23 @@ type ThreadedRodProps = ThreadedRodModelPropsInput & {
|
|
|
355
372
|
declare function createThreadedRodGeom(input: ThreadedRodModelPropsInput, resolution?: ThreadedRodMeshOptions): _jscad_modeling_src_geometries_types.Geom3;
|
|
356
373
|
declare function ThreadedRod({ color, ...props }: ThreadedRodProps): react_jsx_runtime.JSX.Element;
|
|
357
374
|
|
|
375
|
+
interface TorsionSpringMesh {
|
|
376
|
+
positions: number[];
|
|
377
|
+
indices: number[];
|
|
378
|
+
}
|
|
379
|
+
interface TorsionSpringMeshOptions {
|
|
380
|
+
segmentsPerTurn?: number;
|
|
381
|
+
wireSegments?: number;
|
|
382
|
+
}
|
|
383
|
+
/** Circular normal sections along the shared helix and its tangent legs. */
|
|
384
|
+
declare function createTorsionSpringMesh(input: TorsionSpringModelPropsInput, options?: TorsionSpringMeshOptions): TorsionSpringMesh;
|
|
385
|
+
|
|
386
|
+
type TorsionSpringProps = TorsionSpringModelPropsInput & {
|
|
387
|
+
color?: string;
|
|
388
|
+
};
|
|
389
|
+
declare function createTorsionSpringGeom(input: TorsionSpringModelPropsInput): _jscad_modeling_src_geometries_types.Geom3;
|
|
390
|
+
declare function TorsionSpring({ color, ...props }: TorsionSpringProps): react_jsx_runtime.JSX.Element;
|
|
391
|
+
|
|
358
392
|
interface TSlotExtrusionMesh {
|
|
359
393
|
positions: number[];
|
|
360
394
|
indices: number[];
|
|
@@ -428,4 +462,4 @@ declare function createJSCADRenderer(jscad: typeof jscadModeling): {
|
|
|
428
462
|
};
|
|
429
463
|
};
|
|
430
464
|
|
|
431
|
-
export { BallBearing, type BallBearingMesh, type BallBearingMeshOptions, type BallBearingMeshPart, type BallBearingProps, ButtonScrew, type ButtonScrewMesh, type ButtonScrewMeshOptions, type ButtonScrewProps, CableGrommet, type CableGrommetMesh, type CableGrommetMeshOptions, type CableGrommetProps, ClampingShaftCollar, type ClampingShaftCollarMesh, type ClampingShaftCollarProps, type ColoredGeom, CompressionSpring, type CompressionSpringMesh, type CompressionSpringMeshOptions, type CompressionSpringProps, FlangedBushing, type FlangedBushingMesh, type FlangedBushingProps, FlatHeadScrew, type FlatHeadScrewMesh, type FlatHeadScrewMeshOptions, type FlatHeadScrewProps, Fragment, HelicalGear, type HelicalGearMesh, type HelicalGearProps, HexBolt, type HexBoltMesh, type HexBoltMeshOptions, type HexBoltProps, HexNut, type HexNutMesh, type HexNutMeshOptions, type HexNutProps, HexSocketBolt, type HexSocketBoltMesh, type HexSocketBoltProps, NEMA17, NEMA23, NEMA8, type NemaFrameMotorProps, NemaMotor, type NemaMotorProps, PanScrew, type PanScrewMesh, type PanScrewMeshOptions, type PanScrewProps, PlainBushing, type PlainBushingMesh, type PlainBushingProps, type RenderResult, RigidCoupler, type RigidCouplerMesh, type RigidCouplerProps, ShaftCollar, type ShaftCollarMesh, type ShaftCollarProps, SheetMetal, type SheetMetalMesh, type SheetMetalProps, SpurGear, type SpurGearMesh, type SpurGearProps, TSlotExtrusion, type TSlotExtrusionMesh, type TSlotExtrusionProps, TSlotGusset, type TSlotGussetMesh, type TSlotGussetProps, TSlotInsideCorner, type TSlotInsideCornerMesh, type TSlotInsideCornerProps, ThreadedRod, type ThreadedRodMesh, type ThreadedRodMeshOptions, type ThreadedRodProps, type VNode, WormGear, type WormGearMesh, type WormGearProps, convertCSGToThreeGeom, createBallBearingGeom, createBallBearingMesh, createButtonScrewGeom, createButtonScrewMesh, createCableGrommetGeom, createCableGrommetMesh, createClampingShaftCollarGeom, createClampingShaftCollarMesh, createCompressionSpringGeom, createCompressionSpringMesh, createFlangedBushingGeom, createFlangedBushingMesh, createFlatHeadScrewGeom, createFlatHeadScrewMesh, createHelicalGearGeom, createHelicalGearMesh, createHexBoltGeom, createHexBoltMesh, createHexNutGeom, createHexNutMesh, createHexSocketBoltGeom, createHexSocketBoltMesh, createJSCADRenderer, createPanScrewGeom, createPanScrewMesh, createPlainBushingGeom, createPlainBushingMesh, createRigidCouplerGeom, createRigidCouplerMesh, createShaftCollarGeom, createShaftCollarMesh, createSheetMetalGeom, createSheetMetalMesh, createSpurGearGeom, createSpurGearMesh, createTSlotExtrusionGeom, createTSlotExtrusionMesh, createTSlotGussetGeom, createTSlotGussetMesh, createTSlotInsideCornerGeom, createTSlotInsideCornerMesh, createThreadedRodGeom, createThreadedRodMesh, createWormGearGeom, createWormGearMesh, getJscadModelForFootprint, getJscadModelForFootprintWithPads, h };
|
|
465
|
+
export { BallBearing, type BallBearingMesh, type BallBearingMeshOptions, type BallBearingMeshPart, type BallBearingProps, ButtonScrew, type ButtonScrewMesh, type ButtonScrewMeshOptions, type ButtonScrewProps, CableGrommet, type CableGrommetMesh, type CableGrommetMeshOptions, type CableGrommetProps, ClampingShaftCollar, type ClampingShaftCollarMesh, type ClampingShaftCollarProps, type ColoredGeom, CompressionSpring, type CompressionSpringMesh, type CompressionSpringMeshOptions, type CompressionSpringProps, FlangedBushing, type FlangedBushingMesh, type FlangedBushingProps, FlatHeadScrew, type FlatHeadScrewMesh, type FlatHeadScrewMeshOptions, type FlatHeadScrewProps, Fragment, HelicalGear, type HelicalGearMesh, type HelicalGearProps, HexBolt, type HexBoltMesh, type HexBoltMeshOptions, type HexBoltProps, HexNut, type HexNutMesh, type HexNutMeshOptions, type HexNutProps, HexSocketBolt, type HexSocketBoltMesh, type HexSocketBoltProps, HollowPositioningArmTube, type HollowPositioningArmTubeMesh, type HollowPositioningArmTubeMeshOptions, type HollowPositioningArmTubeProps, NEMA17, NEMA23, NEMA8, type NemaFrameMotorProps, NemaMotor, type NemaMotorProps, PanScrew, type PanScrewMesh, type PanScrewMeshOptions, type PanScrewProps, PlainBushing, type PlainBushingMesh, type PlainBushingProps, type RenderResult, RigidCoupler, type RigidCouplerMesh, type RigidCouplerProps, ShaftCollar, type ShaftCollarMesh, type ShaftCollarProps, SheetMetal, type SheetMetalMesh, type SheetMetalProps, SpurGear, type SpurGearMesh, type SpurGearProps, TSlotExtrusion, type TSlotExtrusionMesh, type TSlotExtrusionProps, TSlotGusset, type TSlotGussetMesh, type TSlotGussetProps, TSlotInsideCorner, type TSlotInsideCornerMesh, type TSlotInsideCornerProps, ThreadedRod, type ThreadedRodMesh, type ThreadedRodMeshOptions, type ThreadedRodProps, TorsionSpring, type TorsionSpringMesh, type TorsionSpringMeshOptions, type TorsionSpringProps, type VNode, WormGear, type WormGearMesh, type WormGearProps, convertCSGToThreeGeom, createBallBearingGeom, createBallBearingMesh, createButtonScrewGeom, createButtonScrewMesh, createCableGrommetGeom, createCableGrommetMesh, createClampingShaftCollarGeom, createClampingShaftCollarMesh, createCompressionSpringGeom, createCompressionSpringMesh, createFlangedBushingGeom, createFlangedBushingMesh, createFlatHeadScrewGeom, createFlatHeadScrewMesh, createHelicalGearGeom, createHelicalGearMesh, createHexBoltGeom, createHexBoltMesh, createHexNutGeom, createHexNutMesh, createHexSocketBoltGeom, createHexSocketBoltMesh, createHollowPositioningArmTubeGeom, createHollowPositioningArmTubeMesh, createJSCADRenderer, createPanScrewGeom, createPanScrewMesh, createPlainBushingGeom, createPlainBushingMesh, createRigidCouplerGeom, createRigidCouplerMesh, createShaftCollarGeom, createShaftCollarMesh, createSheetMetalGeom, createSheetMetalMesh, createSpurGearGeom, createSpurGearMesh, createTSlotExtrusionGeom, createTSlotExtrusionMesh, createTSlotGussetGeom, createTSlotGussetMesh, createTSlotInsideCornerGeom, createTSlotInsideCornerMesh, createThreadedRodGeom, createThreadedRodMesh, createTorsionSpringGeom, createTorsionSpringMesh, createWormGearGeom, createWormGearMesh, getJscadModelForFootprint, getJscadModelForFootprintWithPads, h };
|
package/dist/vanilla.js
CHANGED
|
@@ -183,24 +183,24 @@ var FootprintPlatedHole = ({
|
|
|
183
183
|
import { ballBearingModelDefinitionSchema } from "@tscircuit/modelprinter";
|
|
184
184
|
|
|
185
185
|
// lib/model-registry.ts
|
|
186
|
-
function defineModelRenderer(
|
|
187
|
-
return
|
|
186
|
+
function defineModelRenderer(model27) {
|
|
187
|
+
return model27;
|
|
188
188
|
}
|
|
189
189
|
var ModelRendererRegistry = class {
|
|
190
190
|
models = /* @__PURE__ */ new Map();
|
|
191
|
-
register(
|
|
192
|
-
if (typeof
|
|
191
|
+
register(model27) {
|
|
192
|
+
if (typeof model27.name !== "string" || !/^[a-z]+$/.test(model27.name)) {
|
|
193
193
|
throw new Error(
|
|
194
194
|
"Model renderer names must contain only lowercase letters"
|
|
195
195
|
);
|
|
196
196
|
}
|
|
197
|
-
if (this.models.has(
|
|
198
|
-
throw new Error(`Model renderer "${
|
|
197
|
+
if (this.models.has(model27.name)) {
|
|
198
|
+
throw new Error(`Model renderer "${model27.name}" is already registered`);
|
|
199
199
|
}
|
|
200
|
-
if (
|
|
200
|
+
if (model27.pads !== "none" && model27.pads !== "footprinter") {
|
|
201
201
|
throw new Error('Model renderer pads must be "none" or "footprinter"');
|
|
202
202
|
}
|
|
203
|
-
const { name, schema, render: render2, pads } =
|
|
203
|
+
const { name, schema, render: render2, pads } = model27;
|
|
204
204
|
this.models.set(name, {
|
|
205
205
|
name,
|
|
206
206
|
schema,
|
|
@@ -2739,6 +2739,134 @@ function register12(registry) {
|
|
|
2739
2739
|
registry.register(model12);
|
|
2740
2740
|
}
|
|
2741
2741
|
|
|
2742
|
+
// lib/models/hollowpositioningarmtube/register.tsx
|
|
2743
|
+
import { hollowPositioningArmTubeModelDefinitionSchema } from "@tscircuit/modelprinter";
|
|
2744
|
+
|
|
2745
|
+
// lib/models/hollowpositioningarmtube/mesh.ts
|
|
2746
|
+
import {
|
|
2747
|
+
getHollowPositioningArmTubeDimensions,
|
|
2748
|
+
getHollowPositioningArmTubeFrame,
|
|
2749
|
+
hollowPositioningArmTubeModelPropsSchema
|
|
2750
|
+
} from "@tscircuit/modelprinter";
|
|
2751
|
+
function createHollowPositioningArmTubeMesh(input, options = {}) {
|
|
2752
|
+
const props = hollowPositioningArmTubeModelPropsSchema.parse(input);
|
|
2753
|
+
const dimensions = getHollowPositioningArmTubeDimensions(props);
|
|
2754
|
+
const radialSegments = options.radialSegments ?? 24;
|
|
2755
|
+
const segmentsPerRib = options.segmentsPerRib ?? 4;
|
|
2756
|
+
for (const [name, value, minimum, maximum] of [
|
|
2757
|
+
["radialSegments", radialSegments, 12, 128],
|
|
2758
|
+
["segmentsPerRib", segmentsPerRib, 4, 32]
|
|
2759
|
+
])
|
|
2760
|
+
if (!Number.isInteger(value) || value < minimum || value > maximum || value % 4 !== 0)
|
|
2761
|
+
throw new Error(
|
|
2762
|
+
`${name} must be a multiple of four in [${minimum},${maximum}]`
|
|
2763
|
+
);
|
|
2764
|
+
const { totalLength, bendLength, minimumWallThickness } = dimensions;
|
|
2765
|
+
const innerRadius = props.innerDiameter / 2;
|
|
2766
|
+
const scale = Math.max(totalLength, props.outerDiameter);
|
|
2767
|
+
const tolerance = scale * 1e-10;
|
|
2768
|
+
if (Math.min(innerRadius, minimumWallThickness, totalLength) <= tolerance)
|
|
2769
|
+
throw new Error(
|
|
2770
|
+
"Hollow positioning arm tube wall, bore or length exceeds mesh resolution limit"
|
|
2771
|
+
);
|
|
2772
|
+
const sagitta = Math.min(innerRadius, minimumWallThickness) * 0.02;
|
|
2773
|
+
const angleStep = Math.min(
|
|
2774
|
+
Math.PI / 36,
|
|
2775
|
+
2 * Math.acos(1 - Math.min(sagitta / props.bendRadius, 1))
|
|
2776
|
+
);
|
|
2777
|
+
const bendSteps = props.bendAngle === 0 ? 0 : Math.ceil(props.bendAngle * Math.PI / 180 / angleStep);
|
|
2778
|
+
const ribSteps = props.ribDepth === 0 ? 0 : Math.ceil(totalLength / props.ribPitch * segmentsPerRib);
|
|
2779
|
+
const maximumRings = Math.floor(25e4 / (2 * radialSegments));
|
|
2780
|
+
if (!Number.isSafeInteger(bendSteps + ribSteps) || bendSteps + ribSteps + 5 > maximumRings)
|
|
2781
|
+
throw new Error(
|
|
2782
|
+
"Hollow positioning arm tube exceeds mesh resolution limit (250000 vertices)"
|
|
2783
|
+
);
|
|
2784
|
+
const samples = [
|
|
2785
|
+
0,
|
|
2786
|
+
props.startLength,
|
|
2787
|
+
props.startLength + bendLength,
|
|
2788
|
+
totalLength
|
|
2789
|
+
];
|
|
2790
|
+
for (let i = 1; i < bendSteps; i++)
|
|
2791
|
+
samples.push(props.startLength + bendLength * i / bendSteps);
|
|
2792
|
+
for (let i = 1; i < ribSteps; i++)
|
|
2793
|
+
samples.push(i * props.ribPitch / segmentsPerRib);
|
|
2794
|
+
samples.sort((a, b) => a - b);
|
|
2795
|
+
const stations = samples.filter(
|
|
2796
|
+
(s, i) => i === 0 || s - samples[i - 1] > tolerance
|
|
2797
|
+
);
|
|
2798
|
+
if (totalLength - stations[stations.length - 1] <= tolerance)
|
|
2799
|
+
stations[stations.length - 1] = totalLength;
|
|
2800
|
+
const positions = [];
|
|
2801
|
+
const indices = [];
|
|
2802
|
+
const stride = radialSegments * 2;
|
|
2803
|
+
for (const s of stations) {
|
|
2804
|
+
const { position, normal } = getHollowPositioningArmTubeFrame(props, s);
|
|
2805
|
+
const outerRadius = props.outerDiameter / 2 - (props.ribDepth === 0 ? 0 : props.ribDepth / 2 * (1 + Math.cos(2 * Math.PI * (s / props.ribPitch % 1))));
|
|
2806
|
+
for (const radius of [outerRadius, innerRadius])
|
|
2807
|
+
for (let j = 0; j < radialSegments; j++) {
|
|
2808
|
+
const angle = j * 2 * Math.PI / radialSegments;
|
|
2809
|
+
const cosine = j === radialSegments / 4 || j === 3 * radialSegments / 4 ? 0 : Math.cos(angle);
|
|
2810
|
+
const sine = j === 0 || j === radialSegments / 2 ? 0 : Math.sin(angle);
|
|
2811
|
+
positions.push(
|
|
2812
|
+
position[0] + radius * cosine * normal[0],
|
|
2813
|
+
radius * sine,
|
|
2814
|
+
position[2] + radius * cosine * normal[2]
|
|
2815
|
+
);
|
|
2816
|
+
}
|
|
2817
|
+
}
|
|
2818
|
+
const quad = (a, b, c, d) => {
|
|
2819
|
+
indices.push(a, b, c, a, c, d);
|
|
2820
|
+
};
|
|
2821
|
+
for (let ring = 0; ring + 1 < stations.length; ring++)
|
|
2822
|
+
for (let j = 0; j < radialSegments; j++) {
|
|
2823
|
+
const next = (j + 1) % radialSegments;
|
|
2824
|
+
const a = ring * stride;
|
|
2825
|
+
const b = (ring + 1) * stride;
|
|
2826
|
+
quad(a + j, a + next, b + next, b + j);
|
|
2827
|
+
quad(
|
|
2828
|
+
a + radialSegments + j,
|
|
2829
|
+
b + radialSegments + j,
|
|
2830
|
+
b + radialSegments + next,
|
|
2831
|
+
a + radialSegments + next
|
|
2832
|
+
);
|
|
2833
|
+
}
|
|
2834
|
+
for (let j = 0; j < radialSegments; j++) {
|
|
2835
|
+
const next = (j + 1) % radialSegments;
|
|
2836
|
+
quad(j, radialSegments + j, radialSegments + next, next);
|
|
2837
|
+
const end = (stations.length - 1) * stride;
|
|
2838
|
+
quad(
|
|
2839
|
+
end + j,
|
|
2840
|
+
end + next,
|
|
2841
|
+
end + radialSegments + next,
|
|
2842
|
+
end + radialSegments + j
|
|
2843
|
+
);
|
|
2844
|
+
}
|
|
2845
|
+
return { positions, indices };
|
|
2846
|
+
}
|
|
2847
|
+
|
|
2848
|
+
// lib/models/hollowpositioningarmtube/HollowPositioningArmTube.tsx
|
|
2849
|
+
function createHollowPositioningArmTubeGeom(input) {
|
|
2850
|
+
return indexedMeshToGeom3(createHollowPositioningArmTubeMesh(input));
|
|
2851
|
+
}
|
|
2852
|
+
function HollowPositioningArmTube({
|
|
2853
|
+
color = "#343943",
|
|
2854
|
+
...props
|
|
2855
|
+
}) {
|
|
2856
|
+
return /* @__PURE__ */ jsx(Colorize, { color, children: /* @__PURE__ */ jsx(Custom, { geometry: createHollowPositioningArmTubeGeom(props) }) });
|
|
2857
|
+
}
|
|
2858
|
+
|
|
2859
|
+
// lib/models/hollowpositioningarmtube/register.tsx
|
|
2860
|
+
var model13 = defineModelRenderer({
|
|
2861
|
+
name: "hollowpositioningarmtube",
|
|
2862
|
+
schema: hollowPositioningArmTubeModelDefinitionSchema,
|
|
2863
|
+
render: ({ fn, ...props }) => /* @__PURE__ */ jsx(HollowPositioningArmTube, { ...props }),
|
|
2864
|
+
pads: "none"
|
|
2865
|
+
});
|
|
2866
|
+
function register13(registry) {
|
|
2867
|
+
registry.register(model13);
|
|
2868
|
+
}
|
|
2869
|
+
|
|
2742
2870
|
// lib/models/nema/register.tsx
|
|
2743
2871
|
import { nemaMotorModelDefinitionSchema } from "@tscircuit/modelprinter";
|
|
2744
2872
|
|
|
@@ -3005,14 +3133,14 @@ var NEMA17 = (props) => /* @__PURE__ */ jsx(NemaMotor, { ...props, nemaSize: 17
|
|
|
3005
3133
|
var NEMA23 = (props) => /* @__PURE__ */ jsx(NemaMotor, { ...props, nemaSize: 23 });
|
|
3006
3134
|
|
|
3007
3135
|
// lib/models/nema/register.tsx
|
|
3008
|
-
var
|
|
3136
|
+
var model14 = defineModelRenderer({
|
|
3009
3137
|
name: "nema",
|
|
3010
3138
|
schema: nemaMotorModelDefinitionSchema,
|
|
3011
3139
|
render: ({ fn, ...props }) => /* @__PURE__ */ jsx(NemaMotor, { ...props }),
|
|
3012
3140
|
pads: "none"
|
|
3013
3141
|
});
|
|
3014
|
-
function
|
|
3015
|
-
registry.register(
|
|
3142
|
+
function register14(registry) {
|
|
3143
|
+
registry.register(model14);
|
|
3016
3144
|
}
|
|
3017
3145
|
|
|
3018
3146
|
// lib/models/panscrew/register.tsx
|
|
@@ -3224,14 +3352,14 @@ function PanScrew({ color = "#737e8f", ...props }) {
|
|
|
3224
3352
|
}
|
|
3225
3353
|
|
|
3226
3354
|
// lib/models/panscrew/register.tsx
|
|
3227
|
-
var
|
|
3355
|
+
var model15 = defineModelRenderer({
|
|
3228
3356
|
name: "panscrew",
|
|
3229
3357
|
schema: panScrewModelDefinitionSchema,
|
|
3230
3358
|
render: ({ fn, ...props }) => /* @__PURE__ */ jsx(PanScrew, { ...props }),
|
|
3231
3359
|
pads: "none"
|
|
3232
3360
|
});
|
|
3233
|
-
function
|
|
3234
|
-
registry.register(
|
|
3361
|
+
function register15(registry) {
|
|
3362
|
+
registry.register(model15);
|
|
3235
3363
|
}
|
|
3236
3364
|
|
|
3237
3365
|
// lib/models/plainbushing/register.tsx
|
|
@@ -3294,14 +3422,14 @@ function PlainBushing({
|
|
|
3294
3422
|
}
|
|
3295
3423
|
|
|
3296
3424
|
// lib/models/plainbushing/register.tsx
|
|
3297
|
-
var
|
|
3425
|
+
var model16 = defineModelRenderer({
|
|
3298
3426
|
name: "plainbushing",
|
|
3299
3427
|
schema: plainBushingModelDefinitionSchema,
|
|
3300
3428
|
render: ({ fn, ...props }) => /* @__PURE__ */ jsx(PlainBushing, { ...props }),
|
|
3301
3429
|
pads: "none"
|
|
3302
3430
|
});
|
|
3303
|
-
function
|
|
3304
|
-
registry.register(
|
|
3431
|
+
function register16(registry) {
|
|
3432
|
+
registry.register(model16);
|
|
3305
3433
|
}
|
|
3306
3434
|
|
|
3307
3435
|
// lib/models/rigidcoupler/register.tsx
|
|
@@ -3345,14 +3473,14 @@ function RigidCoupler({
|
|
|
3345
3473
|
}
|
|
3346
3474
|
|
|
3347
3475
|
// lib/models/rigidcoupler/register.tsx
|
|
3348
|
-
var
|
|
3476
|
+
var model17 = defineModelRenderer({
|
|
3349
3477
|
name: "rigidcoupler",
|
|
3350
3478
|
schema: rigidCouplerModelDefinitionSchema,
|
|
3351
3479
|
render: ({ fn, ...props }) => /* @__PURE__ */ jsx(RigidCoupler, { ...props }),
|
|
3352
3480
|
pads: "none"
|
|
3353
3481
|
});
|
|
3354
|
-
function
|
|
3355
|
-
registry.register(
|
|
3482
|
+
function register17(registry) {
|
|
3483
|
+
registry.register(model17);
|
|
3356
3484
|
}
|
|
3357
3485
|
|
|
3358
3486
|
// lib/models/shaftcollar/register.tsx
|
|
@@ -3391,14 +3519,14 @@ function ShaftCollar({ color = "#737e8f", ...props }) {
|
|
|
3391
3519
|
}
|
|
3392
3520
|
|
|
3393
3521
|
// lib/models/shaftcollar/register.tsx
|
|
3394
|
-
var
|
|
3522
|
+
var model18 = defineModelRenderer({
|
|
3395
3523
|
name: "shaftcollar",
|
|
3396
3524
|
schema: shaftCollarModelDefinitionSchema,
|
|
3397
3525
|
render: ({ fn, ...props }) => /* @__PURE__ */ jsx(ShaftCollar, { ...props }),
|
|
3398
3526
|
pads: "none"
|
|
3399
3527
|
});
|
|
3400
|
-
function
|
|
3401
|
-
registry.register(
|
|
3528
|
+
function register18(registry) {
|
|
3529
|
+
registry.register(model18);
|
|
3402
3530
|
}
|
|
3403
3531
|
|
|
3404
3532
|
// lib/models/sheetmetal/register.tsx
|
|
@@ -3558,14 +3686,14 @@ function SheetMetal({ color = "#737e8f", ...props }) {
|
|
|
3558
3686
|
}
|
|
3559
3687
|
|
|
3560
3688
|
// lib/models/sheetmetal/register.tsx
|
|
3561
|
-
var
|
|
3689
|
+
var model19 = defineModelRenderer({
|
|
3562
3690
|
name: "sheetmetal",
|
|
3563
3691
|
schema: sheetMetalModelDefinitionSchema,
|
|
3564
3692
|
render: ({ fn, ...props }) => /* @__PURE__ */ jsx(SheetMetal, { ...props }),
|
|
3565
3693
|
pads: "none"
|
|
3566
3694
|
});
|
|
3567
|
-
function
|
|
3568
|
-
registry.register(
|
|
3695
|
+
function register19(registry) {
|
|
3696
|
+
registry.register(model19);
|
|
3569
3697
|
}
|
|
3570
3698
|
|
|
3571
3699
|
// lib/models/spurgear/register.tsx
|
|
@@ -3580,14 +3708,14 @@ function SpurGear({ color = "#737e8f", ...props }) {
|
|
|
3580
3708
|
}
|
|
3581
3709
|
|
|
3582
3710
|
// lib/models/spurgear/register.tsx
|
|
3583
|
-
var
|
|
3711
|
+
var model20 = defineModelRenderer({
|
|
3584
3712
|
name: "spurgear",
|
|
3585
3713
|
schema: spurGearModelDefinitionSchema,
|
|
3586
3714
|
render: ({ fn, ...props }) => /* @__PURE__ */ jsx(SpurGear, { ...props }),
|
|
3587
3715
|
pads: "none"
|
|
3588
3716
|
});
|
|
3589
|
-
function
|
|
3590
|
-
registry.register(
|
|
3717
|
+
function register20(registry) {
|
|
3718
|
+
registry.register(model20);
|
|
3591
3719
|
}
|
|
3592
3720
|
|
|
3593
3721
|
// lib/models/threadedrod/register.tsx
|
|
@@ -3689,14 +3817,118 @@ function ThreadedRod({ color = "#737e8f", ...props }) {
|
|
|
3689
3817
|
}
|
|
3690
3818
|
|
|
3691
3819
|
// lib/models/threadedrod/register.tsx
|
|
3692
|
-
var
|
|
3820
|
+
var model21 = defineModelRenderer({
|
|
3693
3821
|
name: "threadedrod",
|
|
3694
3822
|
schema: threadedRodModelDefinitionSchema,
|
|
3695
3823
|
render: ({ fn, ...props }) => /* @__PURE__ */ jsx(ThreadedRod, { ...props }),
|
|
3696
3824
|
pads: "none"
|
|
3697
3825
|
});
|
|
3698
|
-
function
|
|
3699
|
-
registry.register(
|
|
3826
|
+
function register21(registry) {
|
|
3827
|
+
registry.register(model21);
|
|
3828
|
+
}
|
|
3829
|
+
|
|
3830
|
+
// lib/models/torsionspring/register.tsx
|
|
3831
|
+
import { torsionSpringModelDefinitionSchema } from "@tscircuit/modelprinter";
|
|
3832
|
+
|
|
3833
|
+
// lib/models/torsionspring/mesh.ts
|
|
3834
|
+
import {
|
|
3835
|
+
torsionSpringModelPropsSchema,
|
|
3836
|
+
getTorsionSpringDimensions,
|
|
3837
|
+
getTorsionSpringFrame
|
|
3838
|
+
} from "@tscircuit/modelprinter";
|
|
3839
|
+
function createTorsionSpringMesh(input, options = {}) {
|
|
3840
|
+
const p = torsionSpringModelPropsSchema.parse(input), d = getTorsionSpringDimensions(p);
|
|
3841
|
+
const segmentsPerTurn = options.segmentsPerTurn ?? 64, wireSegments = options.wireSegments ?? 24;
|
|
3842
|
+
for (const [name, value, minimum, maximum] of [
|
|
3843
|
+
["segmentsPerTurn", segmentsPerTurn, 16, 256],
|
|
3844
|
+
["wireSegments", wireSegments, 8, 64]
|
|
3845
|
+
])
|
|
3846
|
+
if (!Number.isInteger(value) || value < minimum || value > maximum || value % 4 !== 0)
|
|
3847
|
+
throw new Error(
|
|
3848
|
+
`${name} must be a multiple of four in [${minimum},${maximum}]`
|
|
3849
|
+
);
|
|
3850
|
+
const steps = Math.ceil(p.turns * segmentsPerTurn);
|
|
3851
|
+
if ((steps + 3) * wireSegments + 2 > 25e4)
|
|
3852
|
+
throw new Error("Spring exceeds mesh resolution limit (250000 vertices)");
|
|
3853
|
+
const scale = Math.max(
|
|
3854
|
+
p.outerDiameter,
|
|
3855
|
+
d.axialAdvance,
|
|
3856
|
+
p.startLegLength,
|
|
3857
|
+
p.endLegLength
|
|
3858
|
+
);
|
|
3859
|
+
if (Math.min(
|
|
3860
|
+
p.wireDiameter,
|
|
3861
|
+
p.startLegLength,
|
|
3862
|
+
p.endLegLength,
|
|
3863
|
+
d.insideDiameter,
|
|
3864
|
+
p.pitch - p.wireDiameter
|
|
3865
|
+
) <= scale * 1e-10)
|
|
3866
|
+
throw new Error("Spring clearance exceeds mesh resolution limits");
|
|
3867
|
+
const distances = [
|
|
3868
|
+
0,
|
|
3869
|
+
...Array.from(
|
|
3870
|
+
{ length: steps + 1 },
|
|
3871
|
+
(_, i) => p.startLegLength + d.coilLength * i / steps
|
|
3872
|
+
),
|
|
3873
|
+
d.centerlineLength
|
|
3874
|
+
];
|
|
3875
|
+
const frameProps = { ...p, leftHand: false };
|
|
3876
|
+
const positions = [], indices = [];
|
|
3877
|
+
for (const distance2 of distances) {
|
|
3878
|
+
const f = getTorsionSpringFrame(frameProps, distance2);
|
|
3879
|
+
for (let j = 0; j < wireSegments; j++) {
|
|
3880
|
+
const angle = 2 * Math.PI * j / wireSegments;
|
|
3881
|
+
const c = j === wireSegments / 4 || j === 3 * wireSegments / 4 ? 0 : Math.cos(angle);
|
|
3882
|
+
const s = j === 0 || j === wireSegments / 2 ? 0 : Math.sin(angle);
|
|
3883
|
+
for (let axis = 0; axis < 3; axis++)
|
|
3884
|
+
positions.push(
|
|
3885
|
+
f.position[axis] + p.wireDiameter / 2 * (f.normal[axis] * c + f.binormal[axis] * s)
|
|
3886
|
+
);
|
|
3887
|
+
}
|
|
3888
|
+
}
|
|
3889
|
+
for (let i = 0; i < distances.length - 1; i++)
|
|
3890
|
+
for (let j = 0; j < wireSegments; j++) {
|
|
3891
|
+
const n = (j + 1) % wireSegments, a = i * wireSegments, b = (i + 1) * wireSegments;
|
|
3892
|
+
indices.push(a + j, a + n, b + j, a + n, b + n, b + j);
|
|
3893
|
+
}
|
|
3894
|
+
const firstCenter = positions.length / 3;
|
|
3895
|
+
positions.push(
|
|
3896
|
+
...getTorsionSpringFrame(frameProps, 0).position,
|
|
3897
|
+
...getTorsionSpringFrame(frameProps, d.centerlineLength).position
|
|
3898
|
+
);
|
|
3899
|
+
const end = (distances.length - 1) * wireSegments;
|
|
3900
|
+
for (let j = 0; j < wireSegments; j++) {
|
|
3901
|
+
const n = (j + 1) % wireSegments;
|
|
3902
|
+
indices.push(firstCenter, n, j, firstCenter + 1, end + j, end + n);
|
|
3903
|
+
}
|
|
3904
|
+
if (p.leftHand) {
|
|
3905
|
+
for (let i = 1; i < positions.length; i += 3) positions[i] = -positions[i];
|
|
3906
|
+
for (let i = 0; i < indices.length; i += 3)
|
|
3907
|
+
[indices[i + 1], indices[i + 2]] = [indices[i + 2], indices[i + 1]];
|
|
3908
|
+
}
|
|
3909
|
+
return { positions, indices };
|
|
3910
|
+
}
|
|
3911
|
+
|
|
3912
|
+
// lib/models/torsionspring/TorsionSpring.tsx
|
|
3913
|
+
function createTorsionSpringGeom(input) {
|
|
3914
|
+
return indexedMeshToGeom3(createTorsionSpringMesh(input));
|
|
3915
|
+
}
|
|
3916
|
+
function TorsionSpring({
|
|
3917
|
+
color = "#929ba6",
|
|
3918
|
+
...props
|
|
3919
|
+
}) {
|
|
3920
|
+
return /* @__PURE__ */ jsx(Colorize, { color, children: /* @__PURE__ */ jsx(Custom, { geometry: createTorsionSpringGeom(props) }) });
|
|
3921
|
+
}
|
|
3922
|
+
|
|
3923
|
+
// lib/models/torsionspring/register.tsx
|
|
3924
|
+
var model22 = defineModelRenderer({
|
|
3925
|
+
name: "torsionspring",
|
|
3926
|
+
schema: torsionSpringModelDefinitionSchema,
|
|
3927
|
+
render: ({ fn, ...props }) => /* @__PURE__ */ jsx(TorsionSpring, { ...props }),
|
|
3928
|
+
pads: "none"
|
|
3929
|
+
});
|
|
3930
|
+
function register22(registry) {
|
|
3931
|
+
registry.register(model22);
|
|
3700
3932
|
}
|
|
3701
3933
|
|
|
3702
3934
|
// lib/models/tslotextrusion/register.tsx
|
|
@@ -3846,14 +4078,14 @@ function TSlotExtrusion({
|
|
|
3846
4078
|
}
|
|
3847
4079
|
|
|
3848
4080
|
// lib/models/tslotextrusion/register.tsx
|
|
3849
|
-
var
|
|
4081
|
+
var model23 = defineModelRenderer({
|
|
3850
4082
|
name: "tslotextrusion",
|
|
3851
4083
|
schema: tSlotExtrusionModelDefinitionSchema,
|
|
3852
4084
|
render: ({ fn, ...props }) => /* @__PURE__ */ jsx(TSlotExtrusion, { ...props }),
|
|
3853
4085
|
pads: "none"
|
|
3854
4086
|
});
|
|
3855
|
-
function
|
|
3856
|
-
registry.register(
|
|
4087
|
+
function register23(registry) {
|
|
4088
|
+
registry.register(model23);
|
|
3857
4089
|
}
|
|
3858
4090
|
|
|
3859
4091
|
// lib/models/tslotgusset/register.tsx
|
|
@@ -3906,14 +4138,14 @@ function TSlotGusset({ color = "#8995a3", ...props }) {
|
|
|
3906
4138
|
}
|
|
3907
4139
|
|
|
3908
4140
|
// lib/models/tslotgusset/register.tsx
|
|
3909
|
-
var
|
|
4141
|
+
var model24 = defineModelRenderer({
|
|
3910
4142
|
name: "tslotgusset",
|
|
3911
4143
|
schema: tSlotGussetModelDefinitionSchema,
|
|
3912
4144
|
render: ({ fn, ...props }) => /* @__PURE__ */ jsx(TSlotGusset, { ...props }),
|
|
3913
4145
|
pads: "none"
|
|
3914
4146
|
});
|
|
3915
|
-
function
|
|
3916
|
-
registry.register(
|
|
4147
|
+
function register24(registry) {
|
|
4148
|
+
registry.register(model24);
|
|
3917
4149
|
}
|
|
3918
4150
|
|
|
3919
4151
|
// lib/models/tslotinsidecorner/register.tsx
|
|
@@ -3993,14 +4225,14 @@ function TSlotInsideCorner({
|
|
|
3993
4225
|
}
|
|
3994
4226
|
|
|
3995
4227
|
// lib/models/tslotinsidecorner/register.tsx
|
|
3996
|
-
var
|
|
4228
|
+
var model25 = defineModelRenderer({
|
|
3997
4229
|
name: "tslotinsidecorner",
|
|
3998
4230
|
schema: tSlotInsideCornerModelDefinitionSchema,
|
|
3999
4231
|
render: ({ fn, ...props }) => /* @__PURE__ */ jsx(TSlotInsideCorner, { ...props }),
|
|
4000
4232
|
pads: "none"
|
|
4001
4233
|
});
|
|
4002
|
-
function
|
|
4003
|
-
registry.register(
|
|
4234
|
+
function register25(registry) {
|
|
4235
|
+
registry.register(model25);
|
|
4004
4236
|
}
|
|
4005
4237
|
|
|
4006
4238
|
// lib/models/wormgear/register.tsx
|
|
@@ -4192,14 +4424,14 @@ function WormGear({ color = "#737e8f", ...props }) {
|
|
|
4192
4424
|
}
|
|
4193
4425
|
|
|
4194
4426
|
// lib/models/wormgear/register.tsx
|
|
4195
|
-
var
|
|
4427
|
+
var model26 = defineModelRenderer({
|
|
4196
4428
|
name: "wormgear",
|
|
4197
4429
|
schema: wormGearModelDefinitionSchema,
|
|
4198
4430
|
render: ({ fn, ...props }) => /* @__PURE__ */ jsx(WormGear, { ...props }),
|
|
4199
4431
|
pads: "none"
|
|
4200
4432
|
});
|
|
4201
|
-
function
|
|
4202
|
-
registry.register(
|
|
4433
|
+
function register26(registry) {
|
|
4434
|
+
registry.register(model26);
|
|
4203
4435
|
}
|
|
4204
4436
|
|
|
4205
4437
|
// lib/generated/model-renderers.ts
|
|
@@ -4228,6 +4460,8 @@ function registerAllModelRenderers(registry) {
|
|
|
4228
4460
|
register22(registry);
|
|
4229
4461
|
register23(registry);
|
|
4230
4462
|
register24(registry);
|
|
4463
|
+
register25(registry);
|
|
4464
|
+
register26(registry);
|
|
4231
4465
|
}
|
|
4232
4466
|
|
|
4233
4467
|
// lib/default-model-registry.ts
|
|
@@ -11784,10 +12018,10 @@ var SOT143 = ({ footprint = "sot143" }) => {
|
|
|
11784
12018
|
var Footprinter3d = ({ footprint }) => {
|
|
11785
12019
|
const modelFn = mp3.string(footprint.split("_", 1)[0]).params().fn;
|
|
11786
12020
|
if (mp3.getModelNames().includes(modelFn)) {
|
|
11787
|
-
const
|
|
11788
|
-
const renderer = modelRendererRegistry.get(
|
|
12021
|
+
const model27 = mp3.string(footprint).json();
|
|
12022
|
+
const renderer = modelRendererRegistry.get(model27.fn);
|
|
11789
12023
|
if (renderer) {
|
|
11790
|
-
return renderer.render(
|
|
12024
|
+
return renderer.render(model27);
|
|
11791
12025
|
}
|
|
11792
12026
|
}
|
|
11793
12027
|
let normalizedFootprint = footprint;
|
|
@@ -12750,6 +12984,7 @@ export {
|
|
|
12750
12984
|
HexBolt,
|
|
12751
12985
|
HexNut,
|
|
12752
12986
|
HexSocketBolt,
|
|
12987
|
+
HollowPositioningArmTube,
|
|
12753
12988
|
NEMA17,
|
|
12754
12989
|
NEMA23,
|
|
12755
12990
|
NEMA8,
|
|
@@ -12764,6 +12999,7 @@ export {
|
|
|
12764
12999
|
TSlotGusset,
|
|
12765
13000
|
TSlotInsideCorner,
|
|
12766
13001
|
ThreadedRod,
|
|
13002
|
+
TorsionSpring,
|
|
12767
13003
|
WormGear,
|
|
12768
13004
|
convertCSGToThreeGeom,
|
|
12769
13005
|
createBallBearingGeom,
|
|
@@ -12788,6 +13024,8 @@ export {
|
|
|
12788
13024
|
createHexNutMesh,
|
|
12789
13025
|
createHexSocketBoltGeom,
|
|
12790
13026
|
createHexSocketBoltMesh,
|
|
13027
|
+
createHollowPositioningArmTubeGeom,
|
|
13028
|
+
createHollowPositioningArmTubeMesh,
|
|
12791
13029
|
createJSCADRenderer,
|
|
12792
13030
|
createPanScrewGeom,
|
|
12793
13031
|
createPanScrewMesh,
|
|
@@ -12809,6 +13047,8 @@ export {
|
|
|
12809
13047
|
createTSlotInsideCornerMesh,
|
|
12810
13048
|
createThreadedRodGeom,
|
|
12811
13049
|
createThreadedRodMesh,
|
|
13050
|
+
createTorsionSpringGeom,
|
|
13051
|
+
createTorsionSpringMesh,
|
|
12812
13052
|
createWormGearGeom,
|
|
12813
13053
|
createWormGearMesh,
|
|
12814
13054
|
getJscadModelForFootprint,
|