@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/threads.d.mts CHANGED
@@ -1,35 +1,43 @@
1
1
  /**
2
- * @typedef {{ kind: 'thread', thread: string, form: 'metric' | 'unified' | 'trapezoidal', internal: boolean, hand: 'right' | 'left', starts: number, pitch: number, lead: number, length: number,
3
- * major: number, basic: { major: number, pitch: number, minor: number }, drawn: { major: number, minor: number }, depth: number, standardDepth: number, crest: number,
4
- * flank: { up: number, down: number }, overhang: { standard: number, drawn: number, limit: number }, clearance: number, gap: number, comp: number, mate: 'printed' | 'bought', overlap: number, standardOverlap: number,
5
- * leadIn: number, run: number, segments: number, triangles: number, display: 'thread' | 'plain', top: '+z' | '-z', axis: 'x' | 'y' | 'z', flat: number | null, engaged: number,
6
- * outline: { lo: number, hi: number, flatLo: number, rise: number, flatHi: number, fall: number }, rests: object[], findings: object[] }} Thread
7
- * thread: as it is written ('M10', 'Tr8x8(P2)'); lead: the travel in one turn, pitch times starts; major: the nominal diameter;
8
- * basic: the standard's basic diameters of this member; drawn: its diameters as drawn (an internal thread's are its cutter's);
9
- * depth: a tooth's height as drawn, and standardDepth the standard's; crest: the flat left on a tooth;
10
- * flank: each flank's angle from the axis's normal, the one facing up and the one facing down as printed;
11
- * overhang: what the down-facing flank overhangs from upright, by the standard and as drawn, and the printer's limit;
12
- * clearance: the gap between this thread and its mate, on the radius; gap: this member's share of it; comp: the hole compensation across an internal thread;
13
- * overlap: how far its flanks overlap its mate's, on the radius, and standardOverlap the standard's; leadIn: the lead-in's size on the radius, run: its length along the axis;
14
- * triangles: the most the solid has; flat: on its side, how far from the axis its flat lies; engaged: the share of a turn left with thread
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', 'Tr8x8(P2)',
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', pitch?: number, mate?: 'printed' | 'bought', gap?: number,
23
- * flanks?: 'printed' | 'standard', leadIn?: number, segments?: number, display?: 'thread' | 'plain', top?: '+z' | '-z', axis?: 'x' | 'y' | 'z', flat?: boolean, variant?: string, sets?: object }} o
24
- * length: of the thread, along its axis; internal: the thread of a nut or a threaded hole (the solid is then its cutter);
25
- * starts: how many threads run side by side (default 1, or what the designation says); hand: right (the default) or left;
26
- * pitch: another pitch on a fixing's diameter (a fine thread); mate: what it screws into, printed (each takes half the
27
- * gap) or bought (this one takes all of it); gap: the gap on the radius, in place of the printer's thread_gap;
28
- * flanks: printed (the down-facing flank laid back to the printer's overhang, the default) or standard (the standard's
29
- * own form); leadIn: the size of the lead-in at each end, on the radius (default a tooth's height); segments: faces
30
- * round, a multiple of 4 from 12 to 144 (default 48): it bounds the triangle count; display: thread, or plain for a
31
- * plain cylinder; top: which end is up when it prints, +z (as drawn, the default) or -z; axis: z standing up (the
32
- * default), x or y lying on its side, which needs flat: true (a flat to lie on, or a pointed roof in a hole)
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, caps?: boolean | 'low' | 'high' }} o
58
- * low, high: how each end is finished: chamfer or plain on a screw, flare on a nut; inside: faces turned inwards (a nut's bore);
59
- * caps: close both ends (the default), one, or neither
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', pitch?: number, mate?: 'printed' | 'bought', gap?: number,
81
- * flanks?: 'printed' | 'standard', leadIn?: number, segments?: number, display?: 'thread' | 'plain', top?: '+z' | '-z', axis?: 'x' | 'y' | 'z', flat?: boolean, variant?: string, sets?: object }} o as threadModel
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, starts, segments, display, flat)
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 `at`. */
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 a screw's numbers @param {Thread} t
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 long as the nut is high
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 times starts; major: the nominal diameter;
147
- * basic: the standard's basic diameters of this member; drawn: its diameters as drawn (an internal thread's are its cutter's);
148
- * depth: a tooth's height as drawn, and standardDepth the standard's; crest: the flat left on a tooth;
149
- * flank: each flank's angle from the axis's normal, the one facing up and the one facing down as printed;
150
- * overhang: what the down-facing flank overhangs from upright, by the standard and as drawn, and the printer's limit;
151
- * clearance: the gap between this thread and its mate, on the radius; gap: this member's share of it; comp: the hole compensation across an internal thread;
152
- * overlap: how far its flanks overlap its mate's, on the radius, and standardOverlap the standard's; leadIn: the lead-in's size on the radius, run: its length along the axis;
153
- * triangles: the most the solid has; flat: on its side, how far from the axis its flat lies; engaged: the share of a turn left with thread
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";