@rulecad/fixings 0.1.8 → 0.2.0
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/CHANGELOG.md +36 -0
- package/README.md +1 -1
- package/bolts.d.mts +26 -18
- package/bolts.mjs +201 -49
- package/draw.d.mts +4 -2
- package/draw.mjs +58 -17
- package/fixings.d.mts +9 -6
- package/fixings.mjs +185 -26
- package/hardware.d.mts +42 -20
- package/hardware.mjs +388 -80
- package/holes.d.mts +32 -25
- package/holes.mjs +243 -61
- package/magnets.d.mts +45 -30
- package/magnets.mjs +521 -122
- package/model.d.mts +47 -29
- package/model.mjs +751 -134
- package/package.json +16 -30
- package/pins.d.mts +46 -32
- package/pins.mjs +480 -113
- package/seats.d.mts +61 -30
- package/seats.mjs +770 -144
- package/snaps.d.mts +32 -24
- package/snaps.mjs +770 -180
- package/strength.d.mts +65 -35
- package/strength.mjs +850 -181
- package/threads.d.mts +59 -42
- package/threads.mjs +910 -193
package/threads.d.mts
CHANGED
|
@@ -1,35 +1,43 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef {{ kind: 'thread', thread: string, form: 'metric' | 'unified' | 'trapezoidal', internal: boolean,
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
2
|
+
* @typedef {{ kind: 'thread', thread: string, form: 'metric' | 'unified' | 'trapezoidal', internal: boolean,
|
|
3
|
+
* hand: 'right' | 'left', starts: number, pitch: number, lead: number, length: number,
|
|
4
|
+
* major: number, basic: { major: number, pitch: number, minor: number }, drawn: { major: number, minor: number },
|
|
5
|
+
* depth: number, standardDepth: number, crest: number, flank: { up: number, down: number }, overhang:
|
|
6
|
+
* { standard: number, drawn: number, limit: number }, clearance: number, gap: number, comp: number, mate: 'printed' |
|
|
7
|
+
* 'bought', overlap: number, standardOverlap: number, leadIn: number, run: number, segments: number, triangles:
|
|
8
|
+
* number, display: 'thread' | 'plain', top: '+z' | '-z', axis: 'x' | 'y' | 'z', flat: number | null, engaged: number,
|
|
9
|
+
* outline: { lo: number, hi: number, flatLo: number, rise: number, flatHi: number, fall: number }, rests: object[],
|
|
10
|
+
* findings: object[] }} Thread thread: as it is written ('M10', 'Tr8x8(P2)'); lead: the travel in one turn, pitch
|
|
11
|
+
* times starts; major: the nominal diameter; basic: the standard's basic diameters of this member; drawn: its
|
|
12
|
+
* diameters as drawn (an internal thread's are its cutter's); depth: a tooth's height as drawn, and standardDepth the
|
|
13
|
+
* standard's; crest: the flat left on a tooth; flank: each flank's angle from the axis's normal, the one facing up
|
|
14
|
+
* and the one facing down as printed; overhang: what the down-facing flank overhangs from upright, by the standard
|
|
15
|
+
* and as drawn, and the printer's limit; clearance: the gap between this thread and its mate, on the radius; gap:
|
|
16
|
+
* this member's share of it; comp: the hole compensation across an internal thread; overlap: how far its flanks
|
|
17
|
+
* overlap its mate's, on the radius, and standardOverlap the standard's; leadIn: the lead-in's size on the radius,
|
|
18
|
+
* run: its length along the axis; triangles: the most the solid has; flat: on its side, how far from the axis its
|
|
19
|
+
* flat lies; engaged: the share of a turn left with thread
|
|
15
20
|
*/
|
|
16
21
|
/**
|
|
17
22
|
* A thread to print, as numbers: its profile as drawn, the clearance to its mate, how its flanks print, and what each
|
|
18
23
|
* figure rests on. Refused by name where the printer cannot resolve the pitch (with the smallest thread that would
|
|
19
24
|
* print), and where it is asked for lying on its side without a flat.
|
|
20
|
-
* @param {Fixing | string | object} spec a fixing's name or model ('M10', '1/4-20'), a trapezoidal thread ('Tr8x2',
|
|
25
|
+
* @param {Fixing | string | object} spec a fixing's name or model ('M10', '1/4-20'), a trapezoidal thread ('Tr8x2',
|
|
26
|
+
* 'Tr8x8(P2)',
|
|
21
27
|
* 'T8' for the catalogue's lead screw), a lead screw's or its nut's rule set, or { form, diameter, pitch, starts }
|
|
22
|
-
* @param {{ length: number, internal?: boolean, printer?: object, starts?: number, hand?: 'right' | 'left',
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
28
|
+
* @param {{ length: number, internal?: boolean, printer?: object, starts?: number, hand?: 'right' | 'left',
|
|
29
|
+
* pitch?: number, mate?: 'printed' | 'bought', gap?: number,
|
|
30
|
+
* flanks?: 'printed' | 'standard', leadIn?: number, segments?: number, display?: 'thread' | 'plain', top?: '+z' |
|
|
31
|
+
* '-z', axis?: 'x' | 'y' | 'z', flat?: boolean, variant?: string, sets?: object }} o length: of the thread, along its
|
|
32
|
+
* axis; internal: the thread of a nut or a threaded hole (the solid is then its cutter); starts: how many threads run
|
|
33
|
+
* side by side (default 1, or what the designation says); hand: right (the default) or left; pitch: another pitch on
|
|
34
|
+
* a fixing's diameter (a fine thread); mate: what it screws into, printed (each takes half the gap) or bought (this
|
|
35
|
+
* one takes all of it); gap: the gap on the radius, in place of the printer's thread_gap; flanks: printed (the
|
|
36
|
+
* down-facing flank laid back to the printer's overhang, the default) or standard (the standard's own form); leadIn:
|
|
37
|
+
* the size of the lead-in at each end, on the radius (default a tooth's height); segments: faces round, a multiple of
|
|
38
|
+
* 4 from 12 to 144 (default 48): it bounds the triangle count; display: thread, or plain for a plain cylinder; top:
|
|
39
|
+
* which end is up when it prints, +z (as drawn, the default) or -z; axis: z standing up (the default), x or y lying
|
|
40
|
+
* on its side, which needs flat: true (a flat to lie on, or a pointed roof in a hole)
|
|
33
41
|
* @returns {Thread}
|
|
34
42
|
*/
|
|
35
43
|
export function threadModel(spec: Fixing | string | object, o?: {
|
|
@@ -54,9 +62,10 @@ export function threadModel(spec: Fixing | string | object, o?: {
|
|
|
54
62
|
/**
|
|
55
63
|
* A thread's surface between two heights, for a solid that carries a thread as part of itself (a threaded screw, a
|
|
56
64
|
* threaded nut): its triangles and its two end rings, to be joined to the rest.
|
|
57
|
-
* @param {Thread} t @param {{ z0: number, z1: number, low?: string, high?: string, inside?: boolean,
|
|
58
|
-
*
|
|
59
|
-
*
|
|
65
|
+
* @param {Thread} t @param {{ z0: number, z1: number, low?: string, high?: string, inside?: boolean,
|
|
66
|
+
* caps?: boolean | 'low' | 'high' }} o
|
|
67
|
+
* low, high: how each end is finished: chamfer or plain on a screw, flare on a nut; inside: faces turned inwards (a
|
|
68
|
+
* nut's bore); caps: close both ends (the default), one, or neither
|
|
60
69
|
* @returns {{ tris: number[][][], lo: number[][], hi: number[][] }}
|
|
61
70
|
*/
|
|
62
71
|
export function threadSurface(t: Thread, o: {
|
|
@@ -77,8 +86,10 @@ export function threadSurface(t: Thread, o: {
|
|
|
77
86
|
* is long. Each end has its lead-in. With display: 'plain' it is a plain cylinder: a screw's at its crests, a hole's at
|
|
78
87
|
* its crests too (the bore you would see).
|
|
79
88
|
* @param {Fixing | string | object} spec as threadModel
|
|
80
|
-
* @param {{ length: number, internal?: boolean, printer?: object, starts?: number, hand?: 'right' | 'left',
|
|
81
|
-
*
|
|
89
|
+
* @param {{ length: number, internal?: boolean, printer?: object, starts?: number, hand?: 'right' | 'left',
|
|
90
|
+
* pitch?: number, mate?: 'printed' | 'bought', gap?: number,
|
|
91
|
+
* flanks?: 'printed' | 'standard', leadIn?: number, segments?: number, display?: 'thread' | 'plain', top?: '+z' |
|
|
92
|
+
* '-z', axis?: 'x' | 'y' | 'z', flat?: boolean, variant?: string, sets?: object }} o as threadModel
|
|
82
93
|
* @returns {object} a JSCAD geom3, with .model holding threadModel's numbers. Lying on its side (axis x or y) it runs
|
|
83
94
|
* along that axis from the origin, its flat facing down (a screw's) or its roof up (a hole's)
|
|
84
95
|
*/
|
|
@@ -104,7 +115,8 @@ export function thread(spec: Fixing | string | object, o?: {
|
|
|
104
115
|
/**
|
|
105
116
|
* A threaded hole, as numbers in a hole's shape: hole(m, { kind: 'thread' }) is this. The thread is modelled, so a
|
|
106
117
|
* printed part takes a screw with no tap, no insert and no nut.
|
|
107
|
-
* @param {string} what @param {Fixing} fx @param {object} o hole's options, and a thread's (mate, gap, flanks, hand,
|
|
118
|
+
* @param {string} what @param {Fixing} fx @param {object} o hole's options, and a thread's (mate, gap, flanks, hand,
|
|
119
|
+
* starts, segments, display, flat)
|
|
108
120
|
* @param {{ into: string, axis: 'x' | 'y' | 'z', across: boolean }} dir
|
|
109
121
|
* @returns {object} a Hole, with thread holding threadModel's numbers
|
|
110
122
|
*/
|
|
@@ -113,12 +125,14 @@ export function threadedHoleModel(what: string, fx: Fixing, o: object, dir: {
|
|
|
113
125
|
axis: "x" | "y" | "z";
|
|
114
126
|
across: boolean;
|
|
115
127
|
}): object;
|
|
116
|
-
/** A threaded hole's cutter, from its model: drawn going down from the face, then turned to go along `into` from
|
|
128
|
+
/** A threaded hole's cutter, from its model: drawn going down from the face, then turned to go along `into` from
|
|
129
|
+
* `at`. */
|
|
117
130
|
export function threadedHole(h: any, at: any): any;
|
|
118
131
|
/**
|
|
119
132
|
* A screw with its thread drawn, as one closed solid, in a screw's own place: the face its head seats on at z = 0, the
|
|
120
133
|
* thread down to z = -length. It prints standing on its head, so the model it is given is a thread with top: '-z'.
|
|
121
|
-
* @param {{ head: string, length: number, headDiameter: number, headHeight: number, flats?: number, sink?: number }} s
|
|
134
|
+
* @param {{ head: string, length: number, headDiameter: number, headHeight: number, flats?: number, sink?: number }} s
|
|
135
|
+
* a screw's numbers @param {Thread} t
|
|
122
136
|
* @returns {object} a JSCAD geom3
|
|
123
137
|
*/
|
|
124
138
|
export function threadedScrew(s: {
|
|
@@ -132,7 +146,8 @@ export function threadedScrew(s: {
|
|
|
132
146
|
/**
|
|
133
147
|
* A nut with its thread drawn, as one closed solid in a nut's own place: on z from 0 to its height, a hexagon's
|
|
134
148
|
* corner on x. It prints as it stands.
|
|
135
|
-
* @param {{ kind: string, across: number, height: number }} nut a nut's numbers @param {Thread} t an internal thread as
|
|
149
|
+
* @param {{ kind: string, across: number, height: number }} nut a nut's numbers @param {Thread} t an internal thread as
|
|
150
|
+
* long as the nut is high
|
|
136
151
|
* @returns {object} a JSCAD geom3
|
|
137
152
|
*/
|
|
138
153
|
export function threadedNut(nut: {
|
|
@@ -143,14 +158,16 @@ export function threadedNut(nut: {
|
|
|
143
158
|
/** The forms of thread there are profiles for. */
|
|
144
159
|
export const THREAD_FORMS: string[];
|
|
145
160
|
/**
|
|
146
|
-
* thread: as it is written ('M10', 'Tr8x8(P2)'); lead: the travel in one turn, pitch
|
|
147
|
-
* basic: the standard's basic diameters of this member; drawn: its
|
|
148
|
-
* depth: a tooth's height as drawn, and standardDepth the
|
|
149
|
-
* flank: each flank's angle from the axis's normal, the one facing up
|
|
150
|
-
* overhang: what the down-facing flank overhangs from upright, by the standard
|
|
151
|
-
* clearance: the gap between this thread and its mate, on the radius; gap:
|
|
152
|
-
*
|
|
153
|
-
*
|
|
161
|
+
* thread: as it is written ('M10', 'Tr8x8(P2)'); lead: the travel in one turn, pitch
|
|
162
|
+
* times starts; major: the nominal diameter; basic: the standard's basic diameters of this member; drawn: its
|
|
163
|
+
* diameters as drawn (an internal thread's are its cutter's); depth: a tooth's height as drawn, and standardDepth the
|
|
164
|
+
* standard's; crest: the flat left on a tooth; flank: each flank's angle from the axis's normal, the one facing up
|
|
165
|
+
* and the one facing down as printed; overhang: what the down-facing flank overhangs from upright, by the standard
|
|
166
|
+
* and as drawn, and the printer's limit; clearance: the gap between this thread and its mate, on the radius; gap:
|
|
167
|
+
* this member's share of it; comp: the hole compensation across an internal thread; overlap: how far its flanks
|
|
168
|
+
* overlap its mate's, on the radius, and standardOverlap the standard's; leadIn: the lead-in's size on the radius,
|
|
169
|
+
* run: its length along the axis; triangles: the most the solid has; flat: on its side, how far from the axis its
|
|
170
|
+
* flat lies; engaged: the share of a turn left with thread
|
|
154
171
|
*/
|
|
155
172
|
export type Thread = {
|
|
156
173
|
kind: "thread";
|