@rulecad/fixings 0.0.1 → 0.1.3

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/strength.d.mts ADDED
@@ -0,0 +1,306 @@
1
+ /**
2
+ * Whether enough thread is engaged, against the engagement rule for what the thread is in: 1 diameter in steel, 2 in
3
+ * aluminium, 2.5 in plastic (the engagement rule set of @rulecad/rules).
4
+ * @param {Fixing | string} m a fixing's model or name @param {{ depth: number, material: string | object, sets?: object }} o
5
+ * depth: the length of thread engaged, in mm; material: a class (plastic, aluminium, steel), a material of the kit
6
+ * (pla, petg, al6061, al7075, s275, ss304) or a material's rule set
7
+ * @returns {{ thread: string, depth: number, need: number, turns: number, diameters: number, class: string, material: string | null, enough: boolean, rests: object[], findings: object[] }}
8
+ * need: the depth that would do; turns: threads engaged; diameters: the depth in diameters of the screw
9
+ */
10
+ export function engagement(m: Fixing | string, o?: {
11
+ depth: number;
12
+ material: string | object;
13
+ sets?: object;
14
+ }): {
15
+ thread: string;
16
+ depth: number;
17
+ need: number;
18
+ turns: number;
19
+ diameters: number;
20
+ class: string;
21
+ material: string | null;
22
+ enough: boolean;
23
+ rests: object[];
24
+ findings: object[];
25
+ };
26
+ /**
27
+ * The load that strips an internal thread, from its shear area and the strength of what it is cut or formed in,
28
+ * against the screw's own proof load. The shear area is the handbook's for a 60° thread at its basic sizes,
29
+ * 0.875 π d Le; the shear strength is the material's strength over √3, an estimate.
30
+ * @param {Fixing | string} m @param {{ depth: number, material: string | object, screw?: 'steel' | 'stainless', proof?: number, load?: number, sets?: object }} o
31
+ * depth: the length of thread engaged; material: what the internal thread is in; screw: steel (its property class, the
32
+ * default) or stainless; proof: another screw's proof stress in MPa (830 for class 10.9); load: the load the joint
33
+ * carries along the screw, in N, to hold with twice the margin
34
+ * @returns {{ thread: string, depth: number, material: string, area: number, shear: number, strip: number, stressArea: number, proof: number, margin: number, depthFor: number, load: number | null, rests: object[], findings: object[] }}
35
+ * area: the internal thread's shear area, mm²; shear: the shear strength taken, MPa; strip: the load that strips the thread, N;
36
+ * proof: the screw's proof load, N; margin: strip over proof (under 1: the thread goes first); depthFor: the depth at which the thread is as strong as the screw
37
+ */
38
+ export function stripping(m: Fixing | string, o?: {
39
+ depth: number;
40
+ material: string | object;
41
+ screw?: "steel" | "stainless";
42
+ proof?: number;
43
+ load?: number;
44
+ sets?: object;
45
+ }): {
46
+ thread: string;
47
+ depth: number;
48
+ material: string;
49
+ area: number;
50
+ shear: number;
51
+ strip: number;
52
+ stressArea: number;
53
+ proof: number;
54
+ margin: number;
55
+ depthFor: number;
56
+ load: number | null;
57
+ rests: object[];
58
+ findings: object[];
59
+ };
60
+ /**
61
+ * The clamp force a tightening torque gives, or the torque for a clamp force: T = K d F, with the nut factor K an
62
+ * estimate (0.2 unless given). Give torque or force.
63
+ * @param {Fixing | string} m @param {{ torque?: number, force?: number, K?: number, screw?: 'steel' | 'stainless', proof?: number, sets?: object }} o
64
+ * torque: in N·m; force: the clamp force (preload) wanted, in N; K: another nut factor (a lubricated thread's is lower)
65
+ * @returns {{ thread: string, torque: number, force: number, K: number, proof: number, share: number, full: { force: number, torque: number }, rests: object[], findings: object[] }}
66
+ * share: the force as a share of the screw's proof load; full: the force and torque of a screw tightened to three quarters of its proof load
67
+ */
68
+ export function preload(m: Fixing | string, o?: {
69
+ torque?: number;
70
+ force?: number;
71
+ K?: number;
72
+ screw?: "steel" | "stainless";
73
+ proof?: number;
74
+ sets?: object;
75
+ }): {
76
+ thread: string;
77
+ torque: number;
78
+ force: number;
79
+ K: number;
80
+ proof: number;
81
+ share: number;
82
+ full: {
83
+ force: number;
84
+ torque: number;
85
+ };
86
+ rests: object[];
87
+ findings: object[];
88
+ };
89
+ /**
90
+ * The tightening torque for a clamp force: preload the other way round.
91
+ * @param {Fixing | string} m @param {{ force: number, K?: number, screw?: 'steel' | 'stainless', proof?: number, sets?: object }} o
92
+ * @returns {{ thread: string, torque: number, force: number, K: number, proof: number, share: number, full: { force: number, torque: number }, rests: object[], findings: object[] }}
93
+ */
94
+ export function torqueFor(m: Fixing | string, o?: {
95
+ force: number;
96
+ K?: number;
97
+ screw?: "steel" | "stainless";
98
+ proof?: number;
99
+ sets?: object;
100
+ }): {
101
+ thread: string;
102
+ torque: number;
103
+ force: number;
104
+ K: number;
105
+ proof: number;
106
+ share: number;
107
+ full: {
108
+ force: number;
109
+ torque: number;
110
+ };
111
+ rests: object[];
112
+ findings: object[];
113
+ };
114
+ /**
115
+ * The pressure under a screw's head against what it sits on, and the washer that would bring it within. The head
116
+ * bears on the ring between its own diameter and the clearance hole as drawn; the limit is the material's strength.
117
+ * @param {Fixing | string} m @param {{ head?: string, material: string | object, force?: number, torque?: number, K?: number, hole?: string, printer?: object, screw?: 'steel' | 'stainless', proof?: number, sets?: object }} o
118
+ * head: cap, button, hex, countersunk or pan (default the model's, else cap); material: what the head sits on;
119
+ * force: the clamp force in N, or torque: the tightening torque in N·m (default a screw tightened fully, to three
120
+ * quarters of its proof load); hole: clearance (the default), close or loose
121
+ * @returns {{ thread: string, head: string, material: string, force: number, area: number, pressure: number, limit: number, within: boolean,
122
+ * washer: { diameter: number, area: number, pressure: number, within: boolean } | null, most: { force: number, torque: number, washerForce: number | null, washerTorque: number | null }, rests: object[], findings: object[] }}
123
+ * area: the bearing ring under the head, mm²; pressure and limit in MPa; washer: the same under the thread's plain washer;
124
+ * most: the greatest clamp force the seat takes and the torque for it, bare and on the washer
125
+ */
126
+ export function seating(m: Fixing | string, o?: {
127
+ head?: string;
128
+ material: string | object;
129
+ force?: number;
130
+ torque?: number;
131
+ K?: number;
132
+ hole?: string;
133
+ printer?: object;
134
+ screw?: "steel" | "stainless";
135
+ proof?: number;
136
+ sets?: object;
137
+ }): {
138
+ thread: string;
139
+ head: string;
140
+ material: string;
141
+ force: number;
142
+ area: number;
143
+ pressure: number;
144
+ limit: number;
145
+ within: boolean;
146
+ washer: {
147
+ diameter: number;
148
+ area: number;
149
+ pressure: number;
150
+ within: boolean;
151
+ } | null;
152
+ most: {
153
+ force: number;
154
+ torque: number;
155
+ washerForce: number | null;
156
+ washerTorque: number | null;
157
+ };
158
+ rests: object[];
159
+ findings: object[];
160
+ };
161
+ /**
162
+ * The sold length of screw that passes through a stack of parts and engages enough at the far end, without bottoming
163
+ * out or standing proud: the shortest that does. Refused by name where no sold length fits, with the nearest.
164
+ * @param {number | number[]} stack the thicknesses the screw passes through under its head, in order, in mm (a countersunk
165
+ * screw's length includes its head, so its stack does too)
166
+ * @param {Fixing | string} m a thread or a screw ('M3', 'M3 button'): its head form is the model's, else cap
167
+ * @param {{ into: string | { kind: string, depth?: number, room?: number, through?: boolean, material?: string, nut?: string, length?: number }, head?: string, washer?: boolean, sunk?: number, sets?: object }} o
168
+ * into: what the screw ends in: 'pilot', 'tap', 'thread' (a printed one), 'insert' or 'nut', or the same with its
169
+ * depth (a blind hole's), room (how far the screw may go past where its thread starts), through (it may come out
170
+ * the far side), material (a tapped or printed thread's), nut (hex, square, lock) or length (another insert's);
171
+ * washer: a plain washer under the head; sunk: how far the head's seat lies under the first face (a counterbore's depth)
172
+ * @returns {{ name: string, thread: string, head: string, length: number, grip: number, engaged: number, need: number, room: number | null, spare: number | null, depth: number | null, into: string,
173
+ * lengths: { length: number, name: string, engaged: number, fits: 'short' | 'fits' | 'long' }[], rests: object[], findings: object[] }}
174
+ * grip: what the screw passes before its thread engages; engaged: thread in the far end; room: how far it may go (null: no limit);
175
+ * spare: room left past its tip; depth: for a blind hole not given a depth, the depth to draw; lengths: every sold length with its verdict
176
+ */
177
+ export function lengthFor(stack: number | number[], m: Fixing | string, o?: {
178
+ into: string | {
179
+ kind: string;
180
+ depth?: number;
181
+ room?: number;
182
+ through?: boolean;
183
+ material?: string;
184
+ nut?: string;
185
+ length?: number;
186
+ };
187
+ head?: string;
188
+ washer?: boolean;
189
+ sunk?: number;
190
+ sets?: object;
191
+ }): {
192
+ name: string;
193
+ thread: string;
194
+ head: string;
195
+ length: number;
196
+ grip: number;
197
+ engaged: number;
198
+ need: number;
199
+ room: number | null;
200
+ spare: number | null;
201
+ depth: number | null;
202
+ into: string;
203
+ lengths: {
204
+ length: number;
205
+ name: string;
206
+ engaged: number;
207
+ fits: "short" | "fits" | "long";
208
+ }[];
209
+ rests: object[];
210
+ findings: object[];
211
+ };
212
+ /**
213
+ * A load shared between a group of screws that stand side by side, by the elastic method about the group's centroid:
214
+ * the force across the joint shared equally, a twist about the screws' axis shared in proportion to each screw's
215
+ * distance from the centroid, the pull along the screws shared equally, and a moment that tips the joint by tension
216
+ * growing with the distance from the centroid. Screws in one line (or one alone) cannot share a moment about that line
217
+ * by tension: the part tips about the edge of the face it is clamped by, `pivot` from the line, and the screws hold it.
218
+ * @param {number[][]} places each screw's place across the joint, [x, y] in mm; the screws stand along z
219
+ * @param {{ force?: number[], moment?: number[], at?: number[], pivot?: number }} [o]
220
+ * force: [x, y, z] in N on the part the screws hold, z along the screws, positive pulling it off the joint;
221
+ * moment: [x, y, z] in N·m on that part, about `at`; at: where the force acts, [x, y] or [x, y, z] in mm, z the
222
+ * height off the joint's face (default the centroid); pivot: for screws in a line, how far the clamped face
223
+ * reaches past the line, in mm
224
+ * @returns {{ count: number, centroid: number[], polar: number, line: boolean, screws: { at: number[], shear: number, tension: number, across: number[] }[], turns: number | null, rests: object[] }}
225
+ * polar: the sum of the squared distances from the centroid, mm²; screws: each one's shear (N, across the joint) and
226
+ * 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)
228
+ */
229
+ export function screwGroup(places: number[][], o?: {
230
+ force?: number[];
231
+ moment?: number[];
232
+ at?: number[];
233
+ pivot?: number;
234
+ }): {
235
+ count: number;
236
+ centroid: number[];
237
+ polar: number;
238
+ line: boolean;
239
+ screws: {
240
+ at: number[];
241
+ shear: number;
242
+ tension: number;
243
+ across: number[];
244
+ }[];
245
+ turns: number | null;
246
+ rests: object[];
247
+ };
248
+ /**
249
+ * One screw of a joint under its share of a load: how many times that load it holds before the screw yields, the
250
+ * internal thread strips, and the clamped parts slip, at its preload. The screw takes its preload and the whole pull
251
+ * on it (a printed part is far softer than a steel screw, so little of the pull goes into easing the clamp), with
252
+ * its shear, against its proof load; the thread takes the same pull and preload against its stripping load; the clamp
253
+ * is eased by the whole pull for slipping, the safe side each time. With no torque given, the preload is the most that
254
+ * leaves the thread twice the pull, within the seat and three quarters of the proof load, and the torque for it is said.
255
+ * @param {Fixing | string} m @param {{ tension?: number, shear?: number, depth?: number, material?: string | object, end?: string, torque?: number, most?: number, K?: number, friction?: number, screw?: 'steel' | 'stainless', proof?: number, sets?: object }} o
256
+ * tension, shear: the screw's share, in N; depth and material: the thread engaged and what it is in (a pilot, tap or
257
+ * printed thread), or end: 'insert' or 'nut' where the thread is metal; torque: the tightening torque given, N·m;
258
+ * most: the most clamp force the seat under the head takes, N; friction: between the clamped parts (default fixings.clamp_friction)
259
+ * @returns {{ thread: string, tension: number, shear: number, preload: { force: number, torque: number, given: boolean }, proof: number, strip: number | null,
260
+ * margins: { screw: number, thread: number | null, slip: number | null }, margin: number, governs: string, rests: object[], findings: object[] }}
261
+ * margins: how many times the load each holds (null: not checked); margin: the least of the screw's and the thread's
262
+ */
263
+ export function screwLoad(m: Fixing | string, o?: {
264
+ tension?: number;
265
+ shear?: number;
266
+ depth?: number;
267
+ material?: string | object;
268
+ end?: string;
269
+ torque?: number;
270
+ most?: number;
271
+ K?: number;
272
+ friction?: number;
273
+ screw?: "steel" | "stainless";
274
+ proof?: number;
275
+ sets?: object;
276
+ }): {
277
+ thread: string;
278
+ tension: number;
279
+ shear: number;
280
+ preload: {
281
+ force: number;
282
+ torque: number;
283
+ given: boolean;
284
+ };
285
+ proof: number;
286
+ strip: number | null;
287
+ margins: {
288
+ screw: number;
289
+ thread: number | null;
290
+ slip: number | null;
291
+ };
292
+ margin: number;
293
+ governs: string;
294
+ rests: object[];
295
+ findings: object[];
296
+ };
297
+ /** The materials there are rule sets for in the kit, by name. */
298
+ export const MATERIALS: string[];
299
+ /** The classes of material the engagement rules know. */
300
+ export const MATERIAL_CLASSES: string[];
301
+ /** What a screw can end in, for lengthFor. */
302
+ export const ENDS: string[];
303
+ /**
304
+ * a fixing's model, as fixingModel gives it
305
+ */
306
+ export type Fixing = import("./model.mjs").Fixing;