@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/model.d.mts
CHANGED
|
@@ -3,8 +3,11 @@ export function oneOf(what: any, k: any, v: any, list: any): any;
|
|
|
3
3
|
/**
|
|
4
4
|
* A fixing's name read by the grammar, before any rule set is looked at.
|
|
5
5
|
* @param {string} name 'M3', 'M3x12 cap', '1/4-20 x 1/2 cap', 'M4 lock nut', 'K30x10 pan torx'
|
|
6
|
-
* @returns {{ thread: string, form: 'metric' | 'unified' | 'plastic', length: number | null, unit: 'mm' | 'in' | null,
|
|
7
|
-
*
|
|
6
|
+
* @returns {{ thread: string, form: 'metric' | 'unified' | 'plastic', length: number | null, unit: 'mm' | 'in' | null,
|
|
7
|
+
* item: 'thread' | 'screw' | 'nut' | 'washer' | 'insert', head: string | null, nut: string | null, extra: string[],
|
|
8
|
+
* printed?: boolean }}
|
|
9
|
+
* length: as written, in unit (null: the thread's own, mm or inches); extra: words left for the rule set's variants;
|
|
10
|
+
* printed: the word printed was said
|
|
8
11
|
*/
|
|
9
12
|
export function parseName(name: string): {
|
|
10
13
|
thread: string;
|
|
@@ -38,7 +41,8 @@ export function headOf(what: string, m: Fixing, form: string): Head;
|
|
|
38
41
|
/**
|
|
39
42
|
* A nut on a thread, from its figures: refused by name where that size has none.
|
|
40
43
|
* @param {string} what @param {Fixing} m @param {string} kind hex, square or lock
|
|
41
|
-
* @returns {{ kind: string, flats: number, height: number, across: number, figures: string[] }} across: over the
|
|
44
|
+
* @returns {{ kind: string, flats: number, height: number, across: number, figures: string[] }} across: over the
|
|
45
|
+
* corners
|
|
42
46
|
*/
|
|
43
47
|
export function nutOf(what: string, m: Fixing, kind: string): {
|
|
44
48
|
kind: string;
|
|
@@ -57,25 +61,33 @@ export function lengthOf(what: string, m: Fixing, length: number, allow?: boolea
|
|
|
57
61
|
sold: boolean | null;
|
|
58
62
|
};
|
|
59
63
|
/**
|
|
60
|
-
* @typedef {{ value: number | string | number[], unit?: string, kind: string, source: string, rule?: string,
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* @typedef {{
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
64
|
+
* @typedef {{ value: number | string | number[], unit?: string, kind: string, source: string, rule?: string,
|
|
65
|
+
* checked?: string, from?: 'workspace' | 'kit' }} Figure
|
|
66
|
+
* one figure of a thread: its value, how far to trust it (kind: spec, measured, community, estimate, default, derived
|
|
67
|
+
* or given) and where it comes from
|
|
68
|
+
* @typedef {{ form: string, diameter: number, height: number, across: number, key?: number, flats?: number,
|
|
69
|
+
* angle?: number, point?: number, drive?: string, figures: string[] }} Head
|
|
70
|
+
* a head: its diameter (0 for a hexagon head, which has flats, and for a set screw), its height (0 for a set screw),
|
|
71
|
+
* across: the widest it is; figures: the rules it was read from
|
|
72
|
+
* @typedef {{ kind: 'fixing', item: 'thread' | 'screw' | 'nut' | 'washer' | 'insert', name: string, said: string,
|
|
73
|
+
* set: string, thread: string,
|
|
74
|
+
* form: 'metric' | 'unified' | 'plastic', major: number, pitch: number, length: number | null, sold: boolean | null,
|
|
75
|
+
* head: Head | null, nut: { kind: string, flats: number, height: number, across: number, figures: string[] } | null,
|
|
76
|
+
* variant: string | null, made: { heads: string[], nuts: string[], washer: boolean, insert: boolean }, figures:
|
|
77
|
+
* Record<string, Figure> }} Fixing name: the name in its one spelling; said: as it was asked for; set: the rule set's
|
|
78
|
+
* name; major, pitch: the thread, mm; length: a screw's, from under its head (a countersunk screw's and a set
|
|
79
|
+
* screw's: overall), or an insert's; sold: whether that length is in the thread's list (null: it lists none); made:
|
|
80
|
+
* the head forms, nuts, washer and insert this size has figures for
|
|
71
81
|
*/
|
|
72
82
|
/**
|
|
73
83
|
* A fixing by name, from its thread's rule set: a thread ('M3', '1/4-20'), or a whole screw ('M3x12 cap'), nut
|
|
74
84
|
* ('M4 lock nut'), washer or insert on it. See GRAMMAR for what a name may say.
|
|
75
85
|
* @param {string} name
|
|
76
|
-
* @param {Record<string, number | string | number[] | Partial<Figure>>} [change] a different or measured figure, by its
|
|
86
|
+
* @param {Record<string, number | string | number[] | Partial<Figure>>} [change] a different or measured figure, by its
|
|
87
|
+
* rule's name:
|
|
77
88
|
* { clearance: 3.3 } or { pilot: { value: 2.8, kind: 'measured', source: 'my coupon, 2026-11-20' } }
|
|
78
|
-
* @param {{ sets?: object, anyLength?: boolean, variant?: string }} [opts] sets: the workspace's rule sets, by name or
|
|
89
|
+
* @param {{ sets?: object, anyLength?: boolean, variant?: string }} [opts] sets: the workspace's rule sets, by name or
|
|
90
|
+
* as a
|
|
79
91
|
* list, where a set for this thread is used before the kit's (its figures first, the kit's for what it lacks);
|
|
80
92
|
* anyLength: take a length the thread's list does not have; variant: a variant of the rule set, by its name
|
|
81
93
|
* @returns {Fixing}
|
|
@@ -87,7 +99,8 @@ export function fixingModel(name: string, change?: Record<string, number | strin
|
|
|
87
99
|
}): Fixing;
|
|
88
100
|
/**
|
|
89
101
|
* A fixing from what a function was handed: its model as it is, or a name read with the caller's rule sets.
|
|
90
|
-
* @param {string} what the function asking, for its
|
|
102
|
+
* @param {string} what the function asking, for its
|
|
103
|
+
* refusals @param {Fixing | string} m @param {{ sets?: object, anyLength?: boolean }} [o]
|
|
91
104
|
* @returns {Fixing}
|
|
92
105
|
*/
|
|
93
106
|
export function fixingOf(what: string, m: Fixing | string, o?: {
|
|
@@ -95,15 +108,17 @@ export function fixingOf(what: string, m: Fixing | string, o?: {
|
|
|
95
108
|
anyLength?: boolean;
|
|
96
109
|
}): Fixing;
|
|
97
110
|
/**
|
|
98
|
-
* @typedef {{ name: string, figure: (k: string) => (Figure & { name: string, borrowed?: boolean }) | null,
|
|
99
|
-
*
|
|
100
|
-
*
|
|
111
|
+
* @typedef {{ name: string, figure: (k: string) => (Figure & { name: string, borrowed?: boolean }) | null,
|
|
112
|
+
* n: (k: string) => number, cite: (k: string) => string, rest: (k: string) => object }} Printer
|
|
113
|
+
* figure: a rule of the printer's own (never borrowed); n: a basic clearance as a number, the printer's own or, where
|
|
114
|
+
* it has none, the X1C's; cite: the name that number is cited by
|
|
101
115
|
*/
|
|
102
116
|
/**
|
|
103
117
|
* The printer's rules as fixings reads them. Handed nothing, the kit's X1C. Handed a rule set ({ name, rules }), its
|
|
104
118
|
* figures with their kinds and sources. Handed plain numbers (a design's v.x1c), those, marked as given. A basic
|
|
105
|
-
* clearance the printer lacks (hole_comp, fit, layer, line, chamfer, bridge, overhang, slip, press, thread_gap,
|
|
106
|
-
*
|
|
119
|
+
* clearance the printer lacks (hole_comp, fit, layer, line, chamfer, bridge, overhang, slip, press, thread_gap,
|
|
120
|
+
* snap_clearance, pin_press, pin_slip, magnet_press, magnet_glue, magnet_crush, print_gap) is borrowed from the X1C and
|
|
121
|
+
* cited as the X1C's; a measured figure (pilot_m3) is never borrowed, since it was measured on that machine.
|
|
107
122
|
* @param {string} what @param {object} [p] @returns {Printer}
|
|
108
123
|
*/
|
|
109
124
|
export function printerOf(what: string, p?: object): Printer;
|
|
@@ -178,7 +193,8 @@ export const ENGAGEMENT: {
|
|
|
178
193
|
export function engagementOf(material: any): "plastic" | "steel" | "aluminium";
|
|
179
194
|
export function layers(h: any, layer: any): number;
|
|
180
195
|
/**
|
|
181
|
-
* one figure of a thread: its value, how far to trust it (kind: spec, measured, community, estimate, default, derived
|
|
196
|
+
* one figure of a thread: its value, how far to trust it (kind: spec, measured, community, estimate, default, derived
|
|
197
|
+
* or given) and where it comes from
|
|
182
198
|
*/
|
|
183
199
|
export type Figure = {
|
|
184
200
|
value: number | string | number[];
|
|
@@ -190,7 +206,8 @@ export type Figure = {
|
|
|
190
206
|
from?: "workspace" | "kit";
|
|
191
207
|
};
|
|
192
208
|
/**
|
|
193
|
-
* a head: its diameter (0 for a hexagon head, which has flats, and for a set screw), its height (0 for a set screw),
|
|
209
|
+
* a head: its diameter (0 for a hexagon head, which has flats, and for a set screw), its height (0 for a set screw),
|
|
210
|
+
* across: the widest it is; figures: the rules it was read from
|
|
194
211
|
*/
|
|
195
212
|
export type Head = {
|
|
196
213
|
form: string;
|
|
@@ -205,9 +222,10 @@ export type Head = {
|
|
|
205
222
|
figures: string[];
|
|
206
223
|
};
|
|
207
224
|
/**
|
|
208
|
-
* name: the name in its one spelling; said: as it was asked for; set: the rule set's
|
|
209
|
-
* length: a screw's, from under its head (a countersunk screw's and a set
|
|
210
|
-
* is in the thread's list (null: it lists none); made:
|
|
225
|
+
* name: the name in its one spelling; said: as it was asked for; set: the rule set's
|
|
226
|
+
* name; major, pitch: the thread, mm; length: a screw's, from under its head (a countersunk screw's and a set
|
|
227
|
+
* screw's: overall), or an insert's; sold: whether that length is in the thread's list (null: it lists none); made:
|
|
228
|
+
* the head forms, nuts, washer and insert this size has figures for
|
|
211
229
|
*/
|
|
212
230
|
export type Fixing = {
|
|
213
231
|
kind: "fixing";
|
|
@@ -239,8 +257,8 @@ export type Fixing = {
|
|
|
239
257
|
figures: Record<string, Figure>;
|
|
240
258
|
};
|
|
241
259
|
/**
|
|
242
|
-
* figure: a rule of the printer's own (never borrowed); n: a basic clearance as a number, the printer's own or, where
|
|
243
|
-
* has none, the X1C's; cite: the name that number is cited by
|
|
260
|
+
* figure: a rule of the printer's own (never borrowed); n: a basic clearance as a number, the printer's own or, where
|
|
261
|
+
* it has none, the X1C's; cite: the name that number is cited by
|
|
244
262
|
*/
|
|
245
263
|
export type Printer = {
|
|
246
264
|
name: string;
|