@rulecad/fixings 0.1.3 → 0.1.5

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/pins.d.mts ADDED
@@ -0,0 +1,220 @@
1
+ /**
2
+ * A snap pin: a peg with a barbed, slotted head that pushes into a hole and clicks behind it, its two halves bending
3
+ * inward as cantilevers on the way through. Printed standing up: the barb's lead is a cone and its back a 45°
4
+ * chamfer by default, so nothing overhangs past the printer's limit; a square back (back 90) holds for good but
5
+ * overhangs by the lip. The halves are modelled as snap hooks of the slot's length, the peg's half-thickness and
6
+ * four fifths of its diameter wide (a half-round's worth), with the lip as the undercut.
7
+ * @param {{ diameter: number, length: number, lip?: number, slot?: number, gap?: number, lead?: number, back?: number, head?: number }} p
8
+ * diameter: the peg's; length: the shaft below the barb; lip: the barb's overhang (default 0.4); slot: the split's
9
+ * length down from the tip (default 3 × diameter); gap: the split's width (default 1); lead: the tip cone's angle
10
+ * from the axis, degrees (default 45); back: the barb's back angle (default 45); head: a flange at the foot, its
11
+ * radius past the peg (default diameter / 2)
12
+ * @param {{ union: Function, subtract: Function }} [ops] the booleans to build it with: a design's v.ops, so a design on
13
+ * Manifold gets a pin Manifold reads as a closed solid (JSCAD's own leave seams it can't)
14
+ * @returns {object} a JSCAD geom3 standing on its foot at z = 0
15
+ */
16
+ export function snapPin({ diameter: d, length: L, lip, slot, gap, lead, back, head }: {
17
+ diameter: number;
18
+ length: number;
19
+ lip?: number;
20
+ slot?: number;
21
+ gap?: number;
22
+ lead?: number;
23
+ back?: number;
24
+ head?: number;
25
+ }, ops?: {
26
+ union: Function;
27
+ subtract: Function;
28
+ }): object;
29
+ /**
30
+ * The socket for a snap pin: a block with a hole the peg's diameter plus the clearance, through it, so the barb
31
+ * clicks out on the far side.
32
+ * @param {{ diameter: number, depth: number, clearance?: number, wall?: number }} p depth: the block's thickness along
33
+ * the pin (the shaft's length, so the barb clears); clearance: round the peg, each side (default the X1C's
34
+ * snap_clearance, 0.2); wall: round the hole (default 3)
35
+ * @returns {object} a JSCAD geom3
36
+ */
37
+ export function snapSocket({ diameter: d, depth, clearance, wall }: {
38
+ diameter: number;
39
+ depth: number;
40
+ clearance?: number;
41
+ wall?: number;
42
+ }): object;
43
+ /**
44
+ * A snap pin's forces: its two halves as snap hooks (snapHalf), together.
45
+ * @param {{ diameter: number, lip?: number, slot?: number, gap?: number, lead?: number, back?: number }} p
46
+ * @param {{ E: number, friction?: number }} m E: the plastic's modulus, MPa; friction: μ between barb and hole (default 0.3)
47
+ * @returns {{ stiffness: number, strain: (travel: number) => number, travel: (strain: number) => number, stress: (travel: number) => number,
48
+ * force: number, insertion: number, removal: number, holds: boolean, undercut: (strain: number) => number }}
49
+ * force: to close the halves by the lip, N; insertion and removal: along the pin, N (removal Infinity where the
50
+ * barb's back is square: it holds); undercut: the most the halves may close at a strain
51
+ */
52
+ export function snapPinModel({ diameter: d, lip, slot, gap, lead, back }: {
53
+ diameter: number;
54
+ lip?: number;
55
+ slot?: number;
56
+ gap?: number;
57
+ lead?: number;
58
+ back?: number;
59
+ }, m: {
60
+ E: number;
61
+ friction?: number;
62
+ }): {
63
+ stiffness: number;
64
+ strain: (travel: number) => number;
65
+ travel: (strain: number) => number;
66
+ stress: (travel: number) => number;
67
+ force: number;
68
+ insertion: number;
69
+ removal: number;
70
+ holds: boolean;
71
+ undercut: (strain: number) => number;
72
+ };
73
+ /**
74
+ * A pin's name read by the grammar.
75
+ * @param {string} name 'snap pin 4x6', 'snap pin 2.5x4 barb 0.3', 'dowel 3x12', 'dowel 3x12 ISO 2338', 'filament pin 1.75x12', 'printed pin 4x10'
76
+ * @returns {{ kind: 'snap' | 'dowel' | 'filament' | 'printed', diameter: number, length: number, barb: number | null, standard: string | null }}
77
+ */
78
+ export function parsePin(name: string): {
79
+ kind: "snap" | "dowel" | "filament" | "printed";
80
+ diameter: number;
81
+ length: number;
82
+ barb: number | null;
83
+ standard: string | null;
84
+ };
85
+ /**
86
+ * @typedef {{ kind: 'pin', type: 'snap' | 'dowel' | 'filament' | 'printed', name: string, said: string, diameter: number, length: number,
87
+ * made: 'bought' | 'cut' | 'printed', standard: string | null, fit: 'snap' | 'press' | 'slip', material: string, pinMaterial: string,
88
+ * hole: { diameter: number, nominal: number, comp: number, clearance: number, into: string, axis: 'x' | 'y' | 'z', teardrop: boolean, rules: string[] },
89
+ * snap: { lip: number, slot: number, gap: number, lead: number, back: number, head: number, insertion: number, removal: number, force: number, strain: number, holds: boolean } | null,
90
+ * grams: number, shear: number, bearing: number, pull: number | null, load: number | null, margin: number | null, governs: string | null,
91
+ * thickness: number | null, rests: object[], findings: object[] }} Pin
92
+ * diameter, length: the pin's (a snap pin's length is its shaft, foot to barb); made: bought (a dowel), cut (filament) or printed;
93
+ * fit: how it sits in its hole; material: the part's plastic, which the pin bears on; pinMaterial: the pin's own;
94
+ * hole: what to draw for it (diameter as drawn; nominal: the pin's; comp: hole compensation added; clearance: added
95
+ * across past that, less than 0 for a press); snap: a snap pin's figures and forces (insertion and removal along the
96
+ * pin, N; force: to close the halves; strain: at the halves' roots, closed by the barb); shear: what the pin carries
97
+ * across its shear planes, N; bearing: what the printed hole takes before it crushes, N; pull: what a snap pin holds
98
+ * along its axis, N; load and margin: the load given (across the pin, N) and the least of shear, bearing and pull over it
99
+ */
100
+ /**
101
+ * A pin as a model by name: its hole's fit from the printer's rules, its mass, what it carries, and for a snap pin the
102
+ * force to push it in and pull it out. Refused by name where it does not fit its part: a plain pin longer than the
103
+ * thickness it goes in stands proud; a snap pin's shaft shorter than the thickness never lets its barb out, and one
104
+ * more than fixings.snap_play longer rattles.
105
+ * @param {string | Pin} p a pin's name (see PIN_GRAMMAR) or its model
106
+ * @param {{ fit?: 'press' | 'slip', printer?: object, material?: string | object, pinMaterial?: string | object, load?: number, pull?: number,
107
+ * thickness?: number, grip?: number, planes?: number, axis?: 'x' | 'y' | 'z', into?: string, anyLength?: boolean, sets?: object,
108
+ * slot?: number, gap?: number, lead?: number, back?: number, head?: number, friction?: number }} [o]
109
+ * fit: a plain pin's, press (the default) or slip; printer: the printer's rule set or values (default the X1C);
110
+ * material: the part's plastic (default PLA); pinMaterial: a printed or filament pin's (default the part's);
111
+ * load: across the pin, N, which its shear and the hole's bearing are held to with fixings.load_margin; pull: along a
112
+ * snap pin, N; thickness: what the pin goes through or into, along it, mm; grip: the shortest length of pin in one
113
+ * part, which bears the load (default half the thickness, or of the length); planes: shear planes (default 1, two
114
+ * parts); axis or into: the hole's way (a hole lying on its side is a teardrop); anyLength: a dowel length the sold
115
+ * list does not have; slot, gap, lead, back, head, friction: a snap pin's, as snapPin and snapPinModel take them
116
+ * @returns {Pin}
117
+ */
118
+ export function pinModel(p: string | Pin, o?: {
119
+ fit?: "press" | "slip";
120
+ printer?: object;
121
+ material?: string | object;
122
+ pinMaterial?: string | object;
123
+ load?: number;
124
+ pull?: number;
125
+ thickness?: number;
126
+ grip?: number;
127
+ planes?: number;
128
+ axis?: "x" | "y" | "z";
129
+ into?: string;
130
+ anyLength?: boolean;
131
+ sets?: object;
132
+ slot?: number;
133
+ gap?: number;
134
+ lead?: number;
135
+ back?: number;
136
+ head?: number;
137
+ friction?: number;
138
+ }): Pin;
139
+ /**
140
+ * The hole for a pin, to subtract: round standing up, a teardrop lying on its side, the diameter pinModel gives it.
141
+ * @param {string | Pin} p @param {object} [o] as pinModel, and at: the point on the face where the hole starts; depth:
142
+ * how deep (default the thickness, else the pin's length); through: out of the far face (default true where depth is the thickness)
143
+ * @returns {object} a JSCAD geom3 with .model holding pinModel's numbers
144
+ */
145
+ export function pinHole(p: string | Pin, o?: object): object;
146
+ /**
147
+ * A pin's solid, standing on the bed at z = 0: a snap pin as snapPin draws it from its model's figures, a plain pin a
148
+ * cylinder with its ends eased (a dowel's are rounded, a printed pin's chamfered against the first layer's spread).
149
+ * @param {string | Pin} p @param {object} [o] as pinModel @param {{ union: Function, subtract: Function }} [ops] for a snap pin
150
+ * @returns {object} a JSCAD geom3 with .model
151
+ */
152
+ export function pin(p: string | Pin, o?: object, ops?: {
153
+ union: Function;
154
+ subtract: Function;
155
+ }): object;
156
+ /** The kinds of pin there are: a printed snap pin, a bought steel dowel, a cut length of filament, a printed plain pin. */
157
+ export const PIN_KINDS: string[];
158
+ /** The fits a plain pin takes in its hole: press (it grips) and slip (it turns, a hinge pin). */
159
+ export const PIN_FITS: string[];
160
+ /**
161
+ * The grammar a pin's name is read by. parsePin reads it and nothing else does.
162
+ * @type {string}
163
+ */
164
+ export const PIN_GRAMMAR: string;
165
+ export function isPinName(name: unknown): boolean;
166
+ /**
167
+ * diameter, length: the pin's (a snap pin's length is its shaft, foot to barb); made: bought (a dowel), cut (filament) or printed;
168
+ * fit: how it sits in its hole; material: the part's plastic, which the pin bears on; pinMaterial: the pin's own;
169
+ * hole: what to draw for it (diameter as drawn; nominal: the pin's; comp: hole compensation added; clearance: added
170
+ * across past that, less than 0 for a press); snap: a snap pin's figures and forces (insertion and removal along the
171
+ * pin, N; force: to close the halves; strain: at the halves' roots, closed by the barb); shear: what the pin carries
172
+ * across its shear planes, N; bearing: what the printed hole takes before it crushes, N; pull: what a snap pin holds
173
+ * along its axis, N; load and margin: the load given (across the pin, N) and the least of shear, bearing and pull over it
174
+ */
175
+ export type Pin = {
176
+ kind: "pin";
177
+ type: "snap" | "dowel" | "filament" | "printed";
178
+ name: string;
179
+ said: string;
180
+ diameter: number;
181
+ length: number;
182
+ made: "bought" | "cut" | "printed";
183
+ standard: string | null;
184
+ fit: "snap" | "press" | "slip";
185
+ material: string;
186
+ pinMaterial: string;
187
+ hole: {
188
+ diameter: number;
189
+ nominal: number;
190
+ comp: number;
191
+ clearance: number;
192
+ into: string;
193
+ axis: "x" | "y" | "z";
194
+ teardrop: boolean;
195
+ rules: string[];
196
+ };
197
+ snap: {
198
+ lip: number;
199
+ slot: number;
200
+ gap: number;
201
+ lead: number;
202
+ back: number;
203
+ head: number;
204
+ insertion: number;
205
+ removal: number;
206
+ force: number;
207
+ strain: number;
208
+ holds: boolean;
209
+ } | null;
210
+ grams: number;
211
+ shear: number;
212
+ bearing: number;
213
+ pull: number | null;
214
+ load: number | null;
215
+ margin: number | null;
216
+ governs: string | null;
217
+ thickness: number | null;
218
+ rests: object[];
219
+ findings: object[];
220
+ };
package/pins.mjs ADDED
@@ -0,0 +1,300 @@
1
+ // Pins: what holds two printed parts together with no thread. A snap pin, a printed peg split down its middle with a
2
+ // barb at its tip, clicks through a hole and holds; a plain pin, a bought steel dowel, a cut length of filament or a
3
+ // printed peg, is pressed into its hole (it grips) or slides in it (it turns, a hinge pin). Each is a model by name
4
+ // (pinModel: 'snap pin 4x6', 'dowel 3x12', 'filament pin 1.75x12', 'printed pin 4x10'), its hole's fit read from the
5
+ // printer's rules, its mass, what it carries in shear and what the printed hole takes in bearing, and for a snap pin
6
+ // the force to push it in and pull it out. pinHole is the hole to subtract, pin the pin's solid. snapPin, snapSocket and
7
+ // snapPinModel draw and size a snap pin from plain figures, as @rulecad/flexures has drawn them since 0.5 (it
8
+ // re-exports them from here). Units: mm, N, MPa, grams.
9
+ import jscad from '@jscad/modeling';
10
+ import { teardropHole } from '@rulecad/shapes';
11
+ import pinSet from '@rulecad/rules/pins.json' with { type: 'json' };
12
+ import { DEFAULTS, printerOf, rest, finding, positive, oneOf, isNum, shown, mm, r3 } from './model.mjs';
13
+ import { along, bore, lathe, LIGHT } from './draw.mjs';
14
+ import { directionOf, pointOf, optionsOf, said } from './holes.mjs';
15
+ import { materialOf, weakest } from './strength.mjs';
16
+
17
+ const { cuboid, cylinder } = jscad.primitives;
18
+ const { union, subtract } = jscad.booleans;
19
+ const block = (x, y, z, size) => cuboid({ center: [x, y, z], size });
20
+ const n1 = (x) => +x.toFixed(1), n2 = (x) => +x.toFixed(2);
21
+ const PINS = pinSet.rules;
22
+
23
+ // ---------- a snap pin from plain figures (as @rulecad/flexures drew it) ----------
24
+ /**
25
+ * A snap pin: a peg with a barbed, slotted head that pushes into a hole and clicks behind it, its two halves bending
26
+ * inward as cantilevers on the way through. Printed standing up: the barb's lead is a cone and its back a 45°
27
+ * chamfer by default, so nothing overhangs past the printer's limit; a square back (back 90) holds for good but
28
+ * overhangs by the lip. The halves are modelled as snap hooks of the slot's length, the peg's half-thickness and
29
+ * four fifths of its diameter wide (a half-round's worth), with the lip as the undercut.
30
+ * @param {{ diameter: number, length: number, lip?: number, slot?: number, gap?: number, lead?: number, back?: number, head?: number }} p
31
+ * diameter: the peg's; length: the shaft below the barb; lip: the barb's overhang (default 0.4); slot: the split's
32
+ * length down from the tip (default 3 × diameter); gap: the split's width (default 1); lead: the tip cone's angle
33
+ * from the axis, degrees (default 45); back: the barb's back angle (default 45); head: a flange at the foot, its
34
+ * radius past the peg (default diameter / 2)
35
+ * @param {{ union: Function, subtract: Function }} [ops] the booleans to build it with: a design's v.ops, so a design on
36
+ * Manifold gets a pin Manifold reads as a closed solid (JSCAD's own leave seams it can't)
37
+ * @returns {object} a JSCAD geom3 standing on its foot at z = 0
38
+ */
39
+ export function snapPin({ diameter: d, length: L, lip = 0.4, slot, gap = 1, lead = 45, back = 45, head }, ops = { union, subtract }) {
40
+ const r = d / 2, s = slot ?? 3 * d, flange = head ?? r, seg = 48;
41
+ const fall = back >= 90 ? 0 : lip / Math.tan((back * Math.PI) / 180), rise = (r + lip) / Math.tan((lead * Math.PI) / 180);
42
+ const foot = cylinder({ radius: r + flange, height: 2, center: [0, 0, 1], segments: seg }), shaft = cylinder({ radius: r, height: L + fall + 0.01, center: [0, 0, 2 + (L + fall) / 2], segments: seg });
43
+ const z0 = 2 + L, barbBack = jscad.primitives.cylinderElliptic({ height: Math.max(fall, 0.01), startRadius: [r, r], endRadius: [r + lip, r + lip], center: [0, 0, z0 + Math.max(fall, 0.01) / 2], segments: seg });
44
+ const barbTip = jscad.primitives.cylinderElliptic({ height: rise, startRadius: [r + lip, r + lip], endRadius: [0.01, 0.01], center: [0, 0, z0 + fall + rise / 2], segments: seg });
45
+ const split = block(0, 0, z0 + fall + rise - s / 2 + 1, [2 * (r + lip) + 2, gap, s + 2]);
46
+ return ops.subtract(ops.union(foot, shaft, barbBack, barbTip), split);
47
+ }
48
+ /**
49
+ * The socket for a snap pin: a block with a hole the peg's diameter plus the clearance, through it, so the barb
50
+ * clicks out on the far side.
51
+ * @param {{ diameter: number, depth: number, clearance?: number, wall?: number }} p depth: the block's thickness along
52
+ * the pin (the shaft's length, so the barb clears); clearance: round the peg, each side (default the X1C's
53
+ * snap_clearance, 0.2); wall: round the hole (default 3)
54
+ * @returns {object} a JSCAD geom3
55
+ */
56
+ export function snapSocket({ diameter: d, depth, clearance = printerOf('snapSocket').n('snap_clearance'), wall = 3 }) {
57
+ const Ro = d / 2 + clearance + wall;
58
+ return subtract(block(0, 0, depth / 2, [2 * Ro, 2 * Ro, depth]), cylinder({ radius: d / 2 + clearance, height: depth + 2, center: [0, 0, depth / 2], segments: 48 }));
59
+ }
60
+
61
+ // One half of a snap pin as a snap hook: a cantilever of length L, thickness t and width w, deflected by the undercut
62
+ // y on the way in. Stiffness E w t³ / 4L³ (3EI/L³); the strain at its root for a travel δ is 3tδ / 2L²; the force
63
+ // along the push over a face at α from the beam W = P (μ + tan α) / (1 − μ tan α), Infinity where the face is square
64
+ // or friction locks it (the BASF and Bayer snap-fit design guides).
65
+ function snapHalf({ length: L, thickness: t, width: w, undercut: y, lead, back }, { E, friction: mu = 0.3 }) {
66
+ const stiffness = (E * w * t ** 3) / (4 * L ** 3), strain = (dd) => (3 * t * dd) / (2 * L * L), travel = (e) => (2 * L * L * e) / (3 * t);
67
+ const P = stiffness * y, push = (deg) => { const tan = Math.tan((deg * Math.PI) / 180); return deg >= 90 || mu * tan >= 1 ? Infinity : (P * (mu + tan)) / (1 - mu * tan); };
68
+ return { stiffness, strain, travel, stress: (dd) => E * strain(dd), force: P, insertion: push(lead), removal: push(back), holds: !Number.isFinite(push(back)), undercut: (e) => travel(e) };
69
+ }
70
+ const above = (what, k, v, unit = 'mm') => { if (!(isNum(v) && v > 0)) throw new Error(`${what}: ${k} is a number above 0${unit ? `, in ${unit}` : ''} (got ${shown(v)})`); return v; };
71
+ /**
72
+ * A snap pin's forces: its two halves as snap hooks (snapHalf), together.
73
+ * @param {{ diameter: number, lip?: number, slot?: number, gap?: number, lead?: number, back?: number }} p
74
+ * @param {{ E: number, friction?: number }} m E: the plastic's modulus, MPa; friction: μ between barb and hole (default 0.3)
75
+ * @returns {{ stiffness: number, strain: (travel: number) => number, travel: (strain: number) => number, stress: (travel: number) => number,
76
+ * force: number, insertion: number, removal: number, holds: boolean, undercut: (strain: number) => number }}
77
+ * force: to close the halves by the lip, N; insertion and removal: along the pin, N (removal Infinity where the
78
+ * barb's back is square: it holds); undercut: the most the halves may close at a strain
79
+ */
80
+ export function snapPinModel({ diameter: d, lip = 0.4, slot, gap = 1, lead = 45, back = 45 }, m) {
81
+ const what = 'snapPinModel';
82
+ if (!(m && m.E > 0)) throw new Error(`${what}: the material needs a modulus E above 0 MPa (got ${m?.E})`);
83
+ above(what, 'diameter', d); above(what, 'lip', lip);
84
+ if (slot !== undefined) above(what, 'slot', slot);
85
+ if (!(isNum(gap) && gap >= 0 && gap < d)) throw new Error(`${what}: gap is the split's width, 0 mm or more and narrower than the ${mm(d)} mm peg (got ${shown(gap)})`);
86
+ const half = snapHalf({ length: slot ?? 3 * d, thickness: (d - gap) / 2, width: 0.8 * d, undercut: lip, lead, back }, m);
87
+ return { ...half, stiffness: 2 * half.stiffness, force: 2 * half.force, insertion: 2 * half.insertion, removal: 2 * half.removal };
88
+ }
89
+
90
+ // ---------- pins by name ----------
91
+ /** The kinds of pin there are: a printed snap pin, a bought steel dowel, a cut length of filament, a printed plain pin. */
92
+ export const PIN_KINDS = ['snap', 'dowel', 'filament', 'printed'];
93
+ /** The fits a plain pin takes in its hole: press (it grips) and slip (it turns, a hinge pin). */
94
+ export const PIN_FITS = ['press', 'slip'];
95
+ /**
96
+ * The grammar a pin's name is read by. parsePin reads it and nothing else does.
97
+ * @type {string}
98
+ */
99
+ export const PIN_GRAMMAR = [
100
+ 'pin = kind diameter "x" length { word } snap pin 4x6, dowel 3x12, filament pin 1.75x12, printed pin 4x10',
101
+ 'kind = "snap pin" | "dowel" | "filament pin" | "printed pin" ("pins" and "dowel pin" are read too)',
102
+ 'diameter = number mm: the peg\'s, below a snap pin\'s barb',
103
+ 'length = number [ "mm" ] mm: a snap pin\'s shaft from its foot to its barb; a plain pin\'s whole length',
104
+ 'word = "barb" number a snap pin\'s barb past its peg (default 0.4)',
105
+ ' | "ISO 8734" | "ISO 2338" a dowel\'s standard: hardened and ground (the default), or unhardened'
106
+ ].join('\n');
107
+ const KIND_WORDS = [[/^snap\s*pins?$/i, 'snap'], [/^dowel(?:\s*pins?)?s?$/i, 'dowel'], [/^filament(?:\s*pins?)?$/i, 'filament'], [/^printed\s*pins?$/i, 'printed']];
108
+ const STANDARDS = { 'iso 8734': 'ISO 8734', 'iso 2338': 'ISO 2338' };
109
+
110
+ /**
111
+ * A pin's name read by the grammar.
112
+ * @param {string} name 'snap pin 4x6', 'snap pin 2.5x4 barb 0.3', 'dowel 3x12', 'dowel 3x12 ISO 2338', 'filament pin 1.75x12', 'printed pin 4x10'
113
+ * @returns {{ kind: 'snap' | 'dowel' | 'filament' | 'printed', diameter: number, length: number, barb: number | null, standard: string | null }}
114
+ */
115
+ export function parsePin(name) {
116
+ const what = 'pin name', help = 'A pin is its kind, then diameter x length in mm: \'snap pin 4x6\', \'dowel 3x12\', \'filament pin 1.75x12\', \'printed pin 4x10\'';
117
+ if (typeof name !== 'string' || !name.trim()) throw new Error(`${what}: give a name, not ${shown(name)}. ${help}`);
118
+ const t = /^\s*([a-z][a-z\s]*?)\s+(\d*\.?\d+)\s*[x×*]\s*(\d*\.?\d+)\s*(?:mm\b)?(.*)$/i.exec(name);
119
+ const kind = t && KIND_WORDS.find(([re]) => re.test(t[1].trim()))?.[1];
120
+ if (!t || !kind) throw new Error(`${what}: "${name}" is no pin. ${help}`);
121
+ const diameter = Number(t[2]), length = Number(t[3]);
122
+ if (!(diameter > 0 && length > 0)) throw new Error(`${what}: "${name}": a pin's diameter and length are above 0 mm`);
123
+ let rest_ = t[4].trim().toLowerCase(), barb = null, standard = null;
124
+ const b = /\bbarb\s+(\d*\.?\d+)\s*(?:mm\b)?/.exec(rest_);
125
+ if (b) { if (kind !== 'snap') throw new Error(`${what}: "${name}": only a snap pin has a barb`); barb = Number(b[1]); if (!(barb > 0)) throw new Error(`${what}: "${name}": a barb is above 0 mm`); rest_ = rest_.replace(b[0], ' '); }
126
+ const s = /\biso\s*(8734|2338)\b/.exec(rest_);
127
+ if (s) { if (kind !== 'dowel') throw new Error(`${what}: "${name}": only a dowel is bought to a standard`); standard = STANDARDS[`iso ${s[1]}`]; rest_ = rest_.replace(s[0], ' '); }
128
+ const left = rest_.split(/[\s,]+/).filter((w) => w && w !== 'pin' && w !== 'pins');
129
+ if (left.length) throw new Error(`${what}: "${name}": nothing is called "${left.join(' ')}". After the size come only "barb 0.4" (a snap pin) or "ISO 8734" / "ISO 2338" (a dowel)`);
130
+ return { kind, diameter, length, barb, standard: kind === 'dowel' ? standard ?? 'ISO 8734' : null };
131
+ }
132
+ /** Whether a text is a pin's name, by the grammar. @param {unknown} name @returns {boolean} */
133
+ export const isPinName = (name) => { try { parsePin(/** @type {string} */ (name)); return true; } catch { return false; } };
134
+ /** A pin's name in its one spelling. */
135
+ const pinName = (p) => `${p.kind === 'snap' ? 'snap pin' : p.kind === 'dowel' ? 'dowel' : `${p.kind} pin`} ${mm(p.diameter)}x${mm(p.length)}${p.barb != null && p.barb !== 0.4 ? ` barb ${mm(p.barb)}` : ''}${p.standard && p.standard !== 'ISO 8734' ? ` ${p.standard}` : ''}`;
136
+ const pinRest = (k) => rest(`pins.${k}`, PINS[k]);
137
+ const nearest = (list, x) => { const below = list.filter((v) => v < x).at(-1), over = list.find((v) => v > x); return [below, over].filter((v) => v != null); };
138
+
139
+ /**
140
+ * @typedef {{ kind: 'pin', type: 'snap' | 'dowel' | 'filament' | 'printed', name: string, said: string, diameter: number, length: number,
141
+ * made: 'bought' | 'cut' | 'printed', standard: string | null, fit: 'snap' | 'press' | 'slip', material: string, pinMaterial: string,
142
+ * hole: { diameter: number, nominal: number, comp: number, clearance: number, into: string, axis: 'x' | 'y' | 'z', teardrop: boolean, rules: string[] },
143
+ * snap: { lip: number, slot: number, gap: number, lead: number, back: number, head: number, insertion: number, removal: number, force: number, strain: number, holds: boolean } | null,
144
+ * grams: number, shear: number, bearing: number, pull: number | null, load: number | null, margin: number | null, governs: string | null,
145
+ * thickness: number | null, rests: object[], findings: object[] }} Pin
146
+ * diameter, length: the pin's (a snap pin's length is its shaft, foot to barb); made: bought (a dowel), cut (filament) or printed;
147
+ * fit: how it sits in its hole; material: the part's plastic, which the pin bears on; pinMaterial: the pin's own;
148
+ * hole: what to draw for it (diameter as drawn; nominal: the pin's; comp: hole compensation added; clearance: added
149
+ * across past that, less than 0 for a press); snap: a snap pin's figures and forces (insertion and removal along the
150
+ * pin, N; force: to close the halves; strain: at the halves' roots, closed by the barb); shear: what the pin carries
151
+ * across its shear planes, N; bearing: what the printed hole takes before it crushes, N; pull: what a snap pin holds
152
+ * along its axis, N; load and margin: the load given (across the pin, N) and the least of shear, bearing and pull over it
153
+ */
154
+
155
+ /**
156
+ * A pin as a model by name: its hole's fit from the printer's rules, its mass, what it carries, and for a snap pin the
157
+ * force to push it in and pull it out. Refused by name where it does not fit its part: a plain pin longer than the
158
+ * thickness it goes in stands proud; a snap pin's shaft shorter than the thickness never lets its barb out, and one
159
+ * more than fixings.snap_play longer rattles.
160
+ * @param {string | Pin} p a pin's name (see PIN_GRAMMAR) or its model
161
+ * @param {{ fit?: 'press' | 'slip', printer?: object, material?: string | object, pinMaterial?: string | object, load?: number, pull?: number,
162
+ * thickness?: number, grip?: number, planes?: number, axis?: 'x' | 'y' | 'z', into?: string, anyLength?: boolean, sets?: object,
163
+ * slot?: number, gap?: number, lead?: number, back?: number, head?: number, friction?: number }} [o]
164
+ * fit: a plain pin's, press (the default) or slip; printer: the printer's rule set or values (default the X1C);
165
+ * material: the part's plastic (default PLA); pinMaterial: a printed or filament pin's (default the part's);
166
+ * load: across the pin, N, which its shear and the hole's bearing are held to with fixings.load_margin; pull: along a
167
+ * snap pin, N; thickness: what the pin goes through or into, along it, mm; grip: the shortest length of pin in one
168
+ * part, which bears the load (default half the thickness, or of the length); planes: shear planes (default 1, two
169
+ * parts); axis or into: the hole's way (a hole lying on its side is a teardrop); anyLength: a dowel length the sold
170
+ * list does not have; slot, gap, lead, back, head, friction: a snap pin's, as snapPin and snapPinModel take them
171
+ * @returns {Pin}
172
+ */
173
+ export function pinModel(p, o = {}) {
174
+ const what = 'pinModel';
175
+ optionsOf(what, o, '{ fit: \'press\', load: 20 }');
176
+ if (p && typeof p === 'object' && p.kind === 'pin') return p;
177
+ const n = parsePin(p), pr = printerOf(what, o.printer), dir = directionOf(what, o, '-z'), out = [], rests = [];
178
+ const mat = materialOf(what, o.material ?? 'pla', o.sets), pinMat = n.kind === 'dowel' ? null : materialOf(what, o.pinMaterial ?? o.material ?? 'pla', o.sets);
179
+ const { f: weak } = weakest(mat), d = n.diameter, L = n.length;
180
+ // The pin itself: a dowel held to what is sold, filament to its own diameter, a printed pin to what prints
181
+ if (n.kind === 'dowel') {
182
+ const ds = PINS.dowel_diameters.value, ls = PINS.dowel_lengths.value;
183
+ if (!ds.includes(d)) throw new Error(`${what}: no ${n.standard} dowel is ${mm(d)} mm across: the nearest ${nearest(ds, d).length > 1 ? 'are' : 'is'} ${nearest(ds, d).map(mm).join(' and ')} mm (pins.dowel_diameters: ${ds.map(mm).join(', ')})`);
184
+ if (!ls.includes(L) && !o.anyLength) throw new Error(`${what}: a dowel is not sold ${mm(L)} mm long: the nearest ${nearest(ls, L).length > 1 ? 'are' : 'is'} ${nearest(ls, L).map(mm).join(' and ')} mm (pins.dowel_lengths). For a length you know you can buy, pass { anyLength: true }`);
185
+ rests.push(pinRest('dowel_diameters'), pinRest('dowel_lengths'), pinRest('dowel_tolerance'));
186
+ } else if (n.kind === 'filament') {
187
+ if (d !== PINS.filament_diameter.value) throw new Error(`${what}: a filament pin is the printer's filament, ${mm(PINS.filament_diameter.value)} mm across (pins.filament_diameter), not ${mm(d)} mm: for a thicker peg, name a printed pin or a dowel`);
188
+ rests.push(pinRest('filament_diameter'), pinRest('filament_tolerance'));
189
+ } else if (d < DEFAULTS.pin_least.value) throw new Error(`${what}: a ${n.kind === 'snap' ? 'snap' : 'printed'} pin ${mm(d)} mm across is under fixings.pin_least, ${mm(DEFAULTS.pin_least.value)} mm: thinner, it is a few lines of plastic and breaks as it goes in. Use filament or a dowel`);
190
+ if (n.kind === 'snap' && o.fit != null) throw new Error(`${what}: a snap pin's fit is its socket's (x1c.snap_clearance): give fit only for a plain pin`);
191
+ const fit = n.kind === 'snap' ? 'snap' : oneOf(what, 'fit', o.fit ?? 'press', PIN_FITS);
192
+
193
+ // The hole: a snap pin's socket is drawn as it is (the peg plus snap_clearance each side); a plain pin's is the pin,
194
+ // plus the hole compensation a printed hole needs, less pin_press or plus pin_slip
195
+ let hole;
196
+ if (n.kind === 'snap') {
197
+ const c = pr.n('snap_clearance'); rests.push(pr.rest('snap_clearance'));
198
+ hole = { diameter: r3(d + 2 * c), nominal: d, comp: 0, clearance: r3(2 * c), rules: [pr.cite('snap_clearance')] };
199
+ out.push(finding('info', `${pinName(n)}'s socket drawn ${mm(hole.diameter)} mm: the ${mm(d)} mm peg plus ${pr.cite('snap_clearance')} ${mm(c)} mm each side (${pr.rest('snap_clearance').kind === 'estimate' ? 'an estimate until the holds coupon measures it' : `${pr.rest('snap_clearance').kind}`}), as drawn, so the split halves close to let the barb through`, 'pin.hole', { values: { diameter: hole.diameter, nominal: d, clearance: hole.clearance }, refs: { pin: pinName(n), rule: pr.cite('snap_clearance') } }));
200
+ } else {
201
+ const comp = pr.n('hole_comp'), k = fit === 'press' ? 'pin_press' : 'pin_slip', c = pr.n(k), clearance = fit === 'press' ? -c : c;
202
+ rests.push(pr.rest('hole_comp'), pr.rest(k));
203
+ hole = { diameter: r3(d + comp + clearance), nominal: d, comp, clearance: r3(clearance), rules: [pr.cite('hole_comp'), pr.cite(k)] };
204
+ out.push(finding('info', `${pinName(n)}'s ${fit} hole drawn ${mm(hole.diameter)} mm: the ${mm(d)} mm pin, plus ${pr.cite('hole_comp')} ${mm(comp)} mm across since a printed hole comes out small, ${fit === 'press' ? 'less' : 'plus'} ${pr.cite(k)} ${mm(c)} mm (${pr.figure(k)?.kind ?? pr.rest(k).kind}) so it ${fit === 'press' ? 'grips' : 'turns'}`, 'pin.hole', { values: { diameter: hole.diameter, nominal: d, comp, clearance: hole.clearance }, refs: { pin: pinName(n), fit, rule: pr.cite(k) } }));
205
+ if (n.kind === 'filament') out.push(finding('info', `filament is ${mm(d)} ± ${mm(PINS.filament_tolerance.value)} mm (pins.filament_tolerance, community): measure the reel the pin is cut from, as a ${fit} fit is closer than that`, 'pin.tolerance', { values: { tolerance: PINS.filament_tolerance.value } }));
206
+ if (n.kind === 'printed') out.push(finding('info', `a printed pin is itself printed, standing, so its size is as close as the printer's: try the ${fit} fit before relying on it`, 'pin.printed'));
207
+ }
208
+ hole.into = dir.into; hole.axis = dir.axis; hole.teardrop = dir.across;
209
+ out.push(finding('pass', dir.across ? `${said(dir.into)}, the hole is a teardrop: a 45° roof, so it prints with no support` : `${said(dir.into)}, a round hole prints as drawn`, 'pin.printable', { values: { into: dir.into } }));
210
+
211
+ // A snap pin's barb and its forces
212
+ let snap = null, solid = null;
213
+ if (n.kind === 'snap') {
214
+ const lip = n.barb ?? 0.4, sp = { diameter: d, length: L, lip, slot: o.slot ?? 3 * d, gap: o.gap ?? 1, lead: o.lead ?? 45, back: o.back ?? 45, head: o.head ?? d / 2 };
215
+ const sm = snapPinModel(sp, { E: mat.modulus.value, ...(o.friction != null ? { friction: o.friction } : {}) }), strain = sm.strain(lip);
216
+ snap = { ...sp, insertion: n2(sm.insertion), removal: Number.isFinite(sm.removal) ? n2(sm.removal) : Infinity, force: n2(sm.force), strain: +strain.toFixed(4), holds: sm.holds };
217
+ rests.push(rest(mat.modulus.name, mat.modulus));
218
+ out.push(finding('info', `${pinName(n)}: ${mm(snap.insertion)} N to push in and ${sm.holds ? 'it holds for good (a square back)' : `${mm(snap.removal)} N to pull out`}, its halves bending ${mm(n2(strain * 100))}% at their roots as the ${mm(lip)} mm barb closes them (two snap hooks, 3ty / 2L², on ${mat.modulus.name} ${mm(mat.modulus.value)} MPa, μ ${mm(o.friction ?? 0.3)})`, 'pin.snap', { values: { insertion: snap.insertion, removal: snap.removal, strain: snap.strain } }));
219
+ solid = snapPin(sp);
220
+ }
221
+
222
+ // Mass: a solid's volume by its density
223
+ const area = (Math.PI * d * d) / 4, density = n.kind === 'dowel' ? { ...DEFAULTS.steel_density, name: 'fixings.steel_density' } : pinMat.density;
224
+ if (!density) throw new Error(`${what}: ${pinMat.name} has no density in its rule set, so the pin cannot be weighed`);
225
+ const volume = solid ? jscad.measurements.measureVolume(solid) : area * L, grams = +((volume * density.value) / 1000).toFixed(3);
226
+ rests.push(rest(density.name, density));
227
+
228
+ // What it fits: a plain pin no longer than the part; a snap pin's shaft as long as the part, and a little more
229
+ let thickness = null;
230
+ if (o.thickness != null) {
231
+ thickness = positive(what, 'thickness', o.thickness);
232
+ if (n.kind === 'snap') {
233
+ const play = DEFAULTS.snap_play.value;
234
+ if (L < thickness - 1e-9) throw new Error(`${what}: ${pinName(n)}'s shaft is ${mm(L)} mm long, and the parts it goes through are ${mm(thickness)} mm thick: it is too short for its part, and the barb never clicks out past the far face. Use a shaft of ${mm(thickness)} mm to ${mm(thickness + play)} mm`);
235
+ if (L > thickness + play + 1e-9) throw new Error(`${what}: ${pinName(n)}'s shaft is ${mm(L)} mm long, and the parts it goes through are ${mm(thickness)} mm thick: it is too long for its part, so the barb clicks out ${mm(r3(L - thickness))} mm past the far face and the pin rattles (fixings.snap_play allows ${mm(play)} mm). Use a shaft of ${mm(thickness)} mm to ${mm(thickness + play)} mm`);
236
+ rests.push(rest('fixings.snap_play', DEFAULTS.snap_play));
237
+ out.push(finding('pass', `${pinName(n)}'s ${mm(L)} mm shaft through ${mm(thickness)} mm of parts: the barb clicks out ${mm(r3(L - thickness))} mm past the far face (fixings.snap_play allows ${mm(play)} mm)`, 'pin.length', { values: { length: L, thickness } }));
238
+ } else {
239
+ if (L > thickness + 1e-9) {
240
+ const fits = n.kind === 'dowel' ? PINS.dowel_lengths.value.filter((x) => x <= thickness).at(-1) : null;
241
+ throw new Error(`${what}: ${pinName(n)} is ${mm(L)} mm long, and the parts it goes in hold ${mm(thickness)} mm of it: it is too long for its part, and stands ${mm(r3(L - thickness))} mm proud. ${fits != null ? `The longest dowel that fits is ${mm(fits)} mm (pins.dowel_lengths)` : `Cut it to ${mm(thickness)} mm`}, or make the parts thicker`);
242
+ }
243
+ out.push(finding('pass', `${pinName(n)}, ${mm(L)} mm long, in ${mm(thickness)} mm of parts: it stands proud of nothing`, 'pin.length', { values: { length: L, thickness } }));
244
+ }
245
+ }
246
+
247
+ // Strength: the pin's shear across its planes, and the printed hole's bearing on its grip; a snap pin also its pull
248
+ const planes = o.planes ?? 1;
249
+ if (!(Number.isInteger(planes) && planes >= 1)) throw new Error(`${what}: planes is how many shear planes the pin crosses, a whole number from 1 (two parts; got ${shown(o.planes)})`);
250
+ const grip = o.grip != null ? positive(what, 'grip', o.grip) : (thickness ?? L) / 2, ratio = DEFAULTS.shear_ratio.value;
251
+ let tau, tauSays;
252
+ if (n.kind === 'dowel') { tau = PINS.dowel_shear.value; tauSays = `pins.dowel_shear ${mm(tau)} MPa, an estimate that understates a hardened pin`; rests.push(pinRest('dowel_shear')); }
253
+ else {
254
+ const along_ = n.kind === 'filament' ? pinMat.strength : weakest(pinMat).f; // (filament: the strand's own strength; a printed pin stands, so its shear plane is a layer's)
255
+ tau = along_.value * ratio; tauSays = `${along_.name} ${mm(along_.value)} MPa × fixings.shear_ratio ${mm(+ratio.toFixed(3))}, an estimate`; rests.push(rest(along_.name, along_), rest('fixings.shear_ratio', DEFAULTS.shear_ratio));
256
+ }
257
+ const shearArea = n.kind === 'snap' ? area - (o.gap ?? 1) * d : area, shear = n1(tau * shearArea * planes), bearing = n1(weak.value * d * grip);
258
+ rests.push(rest(weak.name, weak));
259
+ let pull = null;
260
+ if (snap) { const tensile = n1(weakest(pinMat).f.value * shearArea); pull = Number.isFinite(snap.removal) ? Math.min(snap.removal, tensile) : tensile; }
261
+ const caps = { shear, bearing, ...(pull != null ? { pull } : {}) };
262
+ const load = o.load != null ? positive(what, 'load (across the pin, in N)', o.load) : null, pullLoad = o.pull != null ? positive(what, 'pull (along the pin, in N)', o.pull) : null;
263
+ if (pullLoad != null && !snap) throw new Error(`${what}: pull is along a snap pin: a plain pin holds by its press fit, which these sums do not give, so hold it along by a shoulder or glue`);
264
+ const margins = { ...(load != null ? { shear: n2(shear / load), bearing: n2(bearing / load) } : {}), ...(pullLoad != null ? { pull: n2(pull / pullLoad) } : {}) };
265
+ const governs = Object.keys(margins).length ? Object.entries(margins).sort((x, y) => x[1] - y[1])[0][0] : null, margin = governs ? margins[governs] : null;
266
+ const want = DEFAULTS.load_margin.value, says = `${pinName(n)} carries ${mm(shear)} N in shear (${planes} plane${planes > 1 ? 's' : ''}, ${tauSays}); the printed hole takes ${mm(bearing)} N in bearing on ${mm(grip)} mm of grip (${weak.name} ${mm(weak.value)} MPa, taken as what it bears: an estimate)${pull != null ? `; it holds ${mm(pull)} N along` : ''}`;
267
+ if (margin == null) out.push(finding('info', `${says}: give load to have it checked`, 'pin.strength', { values: caps }));
268
+ else out.push(finding(margin >= want ? 'pass' : margin >= 1 ? 'warn' : 'fail', `${says}: ${load != null ? `${mm(load)} N across` : ''}${load != null && pullLoad != null ? ' and ' : ''}${pullLoad != null ? `${mm(pullLoad)} N along` : ''} leaves ${mm(margin)} times over in ${governs}${margin >= want ? '' : margin >= 1 ? `, under the ${mm(want)} times fixings.load_margin asks` : ': it gives way'}`,
269
+ 'pin.strength', { values: { ...caps, load, pull: pullLoad, margin, governs } }));
270
+ rests.push(rest('fixings.load_margin', DEFAULTS.load_margin));
271
+ out.push(finding('info', `${pinName(n)} weighs ${mm(grams)} g`, 'pin.mass', { values: { grams } }));
272
+ return { kind: 'pin', type: n.kind, name: pinName(n), said: String(p), diameter: d, length: L, made: n.kind === 'dowel' ? 'bought' : n.kind === 'filament' ? 'cut' : 'printed', standard: n.standard, fit,
273
+ material: mat.name, pinMaterial: pinMat ? pinMat.name : 'steel', hole, snap, grams, shear, bearing, pull, load, margin, governs, thickness, rests, findings: out };
274
+ }
275
+ /**
276
+ * The hole for a pin, to subtract: round standing up, a teardrop lying on its side, the diameter pinModel gives it.
277
+ * @param {string | Pin} p @param {object} [o] as pinModel, and at: the point on the face where the hole starts; depth:
278
+ * how deep (default the thickness, else the pin's length); through: out of the far face (default true where depth is the thickness)
279
+ * @returns {object} a JSCAD geom3 with .model holding pinModel's numbers
280
+ */
281
+ export function pinHole(p, o = {}) {
282
+ const what = 'pinHole', m = pinModel(p, optionsOf(what, o, '{ fit: \'slip\', depth: 6 }')), at = pointOf(what, o.at);
283
+ const depth = o.depth != null ? positive(what, 'depth', o.depth) : m.thickness ?? m.length, through = o.through ?? (o.depth == null && m.thickness != null);
284
+ if (typeof through !== 'boolean') throw new Error(`${what}: through is true or false (got ${shown(o.through)})`);
285
+ const h = m.hole, g = h.teardrop ? teardropHole({ d: h.diameter, length: depth, at, into: h.into, through }) : along(bore([[h.diameter / 2, depth]], { through }), h.into, at);
286
+ return Object.assign(g, { model: m });
287
+ }
288
+
289
+ /**
290
+ * A pin's solid, standing on the bed at z = 0: a snap pin as snapPin draws it from its model's figures, a plain pin a
291
+ * cylinder with its ends eased (a dowel's are rounded, a printed pin's chamfered against the first layer's spread).
292
+ * @param {string | Pin} p @param {object} [o] as pinModel @param {{ union: Function, subtract: Function }} [ops] for a snap pin
293
+ * @returns {object} a JSCAD geom3 with .model
294
+ */
295
+ export function pin(p, o = {}, ops) {
296
+ const m = pinModel(p, o);
297
+ if (m.snap) { const { lip, slot, gap, lead, back, head } = m.snap; return Object.assign(snapPin({ diameter: m.diameter, length: m.length, lip, slot, gap, lead, back, head }, ops), { model: m }); }
298
+ const r = m.diameter / 2, c = Math.min(m.made === 'printed' ? printerOf('pin', o.printer).n('chamfer') : 0.2, r / 3, m.length / 4);
299
+ return Object.assign(lathe([[0, 0], [r - c, 0], [r, c], [r, m.length - c], [r - c, m.length], [0, m.length]], m.made === 'printed' ? 48 : LIGHT * 2), { model: m });
300
+ }
package/seats.mjs CHANGED
@@ -329,8 +329,10 @@ export function insertBoss(m, o = {}) {
329
329
  */
330
330
  export function printable(x) {
331
331
  const bought = (thread, item) => [finding('fail', `${a(thread)} ${item === 'thread' ? 'fixing' : item} is bought and fitted, not printed: its hole and its seat are what print (hole, counterbore, nutPocket)${['screw', 'nut'].includes(item) ? `, or draw it with its thread to print it ({ display: 'thread' })` : ''}`, 'fixing.printable')];
332
+ if (x?.kind === 'fixing' && x.printed) return [finding('info', `${x.name} is printed with its thread: printedBoltModel('${x.name}') says how its thread prints and what it holds`, 'fixing.printable')];
332
333
  if (x?.kind === 'fixing') return bought(x.thread, x.item);
333
334
  const model = x?.model && Array.isArray(x.model.findings) ? x.model : x?.model?.model && Array.isArray(x.model.model.findings) ? x.model.model : x;
335
+ if (model?.kind === 'magnet') return [finding('fail', `${model.name} is bought and fitted, not printed: its pocket is what prints (magnetSeat)`, 'magnet.printable')];
334
336
  if (!model || !Array.isArray(model.findings)) throw new Error(`printable: give a fixing's model, or a hole's, a seat's or a thread's (holeModel, counterboreModel, nutPocketModel, threadModel), not ${shown(x)}`);
335
337
  const found = model.findings.filter((f) => typeof f.code === 'string' && f.code.endsWith('.printable'));
336
338
  return !found.length && ['screw', 'nut', 'washer', 'insert'].includes(model.item) ? bought(model.thread, model.item) : found;
package/strength.d.mts CHANGED
@@ -1,3 +1,16 @@
1
+ export function materialOf(what: any, material: any, sets: any): {
2
+ name: any;
3
+ cls: string;
4
+ strength: any;
5
+ across: any;
6
+ modulus: any;
7
+ density: any;
8
+ poisson: any;
9
+ };
10
+ export function weakest(mat: any): {
11
+ f: any;
12
+ note: string;
13
+ };
1
14
  /**
2
15
  * Whether enough thread is engaged, against the engagement rule for what the thread is in: 1 diameter in steel, 2 in
3
16
  * aluminium, 2.5 in plastic (the engagement rule set of @rulecad/rules).
@@ -224,7 +237,7 @@ export function lengthFor(stack: number | number[], m: Fixing | string, o?: {
224
237
  * @returns {{ count: number, centroid: number[], polar: number, line: boolean, screws: { at: number[], shear: number, tension: number, across: number[] }[], turns: number | null, rests: object[] }}
225
238
  * polar: the sum of the squared distances from the centroid, mm²; screws: each one's shear (N, across the joint) and
226
239
  * tension (N, along it: under 0, the load presses that screw's parts together); turns: a twist one screw alone
227
- * cannot hold by shear, in N·m (it holds by friction only)
240
+ * cannot hold by shear, in N·m (it holds by friction only), null when it rounds to 0 at the thousandth
228
241
  */
229
242
  export function screwGroup(places: number[][], o?: {
230
243
  force?: number[];