@rulecad/frames 0.0.1 → 0.1.8

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/fitting.d.mts ADDED
@@ -0,0 +1,262 @@
1
+ /** @internal A face's slot, its cell, its nuts' thread and a tongue's room. @param {string} what @param {any} p @param {any} face @param {any} thread @param {any} nut @param {number} fit @param {any} given @returns {any} */
2
+ export function slotSide(what: string, p: any, face: any, thread: any, nut: any, fit: number, given: any): any;
3
+ /** @internal A loop's concave corners rounded by r. @param {number[][]} loop @param {number} r @param {any} [only] @param {number} [steps] @returns {number[][]} */
4
+ export function roundConcave(loop: number[][], r: number, only?: any, steps?: number): number[][];
5
+ /** @internal A tongue's section. @param {number} a0 @param {number} a1 @param {number} depth @param {boolean} lean @param {number} root @param {number} [sink] @returns {number[][]} */
6
+ export function tongueLoop(a0: number, a1: number, depth: number, lean: boolean, root: number, sink?: number): number[][];
7
+ /**
8
+ * A fitting bent by its load, by finite elements on cubes (@rulecad/fea): cells in the part where inside() holds at
9
+ * their sample points, held where held() holds, the force shared over the nodes where loaded() holds. Read: the
10
+ * loaded nodes' mean movement along the force, and the peak von Mises stress away from the screws (the clamp's own
11
+ * edge is where the model, not the part, is stiff), lifted from a cell's centre to the surface.
12
+ * @param {{ box: { lo: number[], hi: number[] }, inside: (p: number[]) => boolean, held: (p: number[]) => boolean, loaded: (p: number[]) => boolean, near: (p: number[]) => boolean,
13
+ * force: number[], thin: number, E: number, nu: number, key: string, budget?: number, cache?: { get: (k: string) => any, set: (k: string, v: any) => void } }} o
14
+ * @returns {{ deflection: number, stress: number, cell: number, across: number, cells: number }}
15
+ */
16
+ export function fittingFE(o: {
17
+ box: {
18
+ lo: number[];
19
+ hi: number[];
20
+ };
21
+ inside: (p: number[]) => boolean;
22
+ held: (p: number[]) => boolean;
23
+ loaded: (p: number[]) => boolean;
24
+ near: (p: number[]) => boolean;
25
+ force: number[];
26
+ thin: number;
27
+ E: number;
28
+ nu: number;
29
+ key: string;
30
+ budget?: number;
31
+ cache?: {
32
+ get: (k: string) => any;
33
+ set: (k: string, v: any) => void;
34
+ };
35
+ }): {
36
+ deflection: number;
37
+ stress: number;
38
+ cell: number;
39
+ across: number;
40
+ cells: number;
41
+ };
42
+ /** @internal The least thickness from t at which every side takes a sold screw. @param {number} t @param {number} step @param {any[]} sides @param {string} thread @returns {any} */
43
+ export function sold(t: number, step: number, sides: any[], thread: string): any;
44
+ /** @internal A screw's head and hole figures. @param {string} what @param {string} thread @param {string} head @param {any} pr @returns {any} */
45
+ export function screwOf(what: string, thread: string, head: string, pr: any): any;
46
+ /**
47
+ * @typedef {{ kind: 'fitting', fitting: 'bracket', name: string, title: string, profile: string, other: string, faces: { b: string, a: string }, thread: string, head: string,
48
+ * brace: boolean, width: number, thickness: number, leg: number, screwAt: number, round: number, braceSize: number, hole: number, tongues: { b: object, a: object },
49
+ * screws: { leg: 'b' | 'a', thread: string, head: string, grip: number, at: number[], axis: number[], nut: string }[], load: { force: number, what: string, at: number[], direction: number[] },
50
+ * stiffness: { linear: number, bending: number, kind: string, rule: string }, stress: number, margin: number, deflection: number, fe: object,
51
+ * volume: number, grams: number, material: string, printer: string, section: number[][], findings: object[], rests: object[] }} Bracket
52
+ */
53
+ /**
54
+ * A printed corner bracket for a profile, from its rules: the width of the face's cell, the thread its slot nuts are
55
+ * made for, a tongue on each leg that keys into the slot, and legs sized from a named load by finite elements to about
56
+ * twice the margin. Laid on its side it prints without supports, its first layer the whole L.
57
+ * @param {string | object} profile b's profile (the beam whose face the base leg lies on), by name or model
58
+ * @param {{ other?: string | object, face?: string, otherFace?: string, thread?: string, head?: 'cap' | 'button', nut?: string, brace?: boolean, load?: number, width?: number,
59
+ * printer?: object, material?: string | object, given?: object, cache?: object }} [o]
60
+ * other: a's profile, for the upright leg (default the same); face, otherFace: the faces the legs lie on (default top);
61
+ * thread: the screws' (default the largest a slot nut is made for in both slots); head: cap (default) or button; nut: a
62
+ * kind of slot nut, for the tongue's depth (default the tallest tongue of any kind); brace: fill the inside corner with
63
+ * a web; load: the design load in N, across beam a at the upright's screw (default 100); width: across the bracket
64
+ * (default the face's cell); cache: { get, set } for the finite elements' results
65
+ * @returns {Bracket}
66
+ */
67
+ export function bracketModel(profile: string | object, o?: {
68
+ other?: string | object;
69
+ face?: string;
70
+ otherFace?: string;
71
+ thread?: string;
72
+ head?: "cap" | "button";
73
+ nut?: string;
74
+ brace?: boolean;
75
+ load?: number;
76
+ width?: number;
77
+ printer?: object;
78
+ material?: string | object;
79
+ given?: object;
80
+ cache?: object;
81
+ }): Bracket;
82
+ /**
83
+ * A printed corner bracket's solid, from bracketModel's model or its arguments: laid on its side to print (pose
84
+ * 'print', the default), or in its fitted frame (pose 'fit': x along b's face away from a, y up a, z across, the corner
85
+ * line on the slots' centre). tongues: false leaves them off (the body alone, which may not overlap a beam's envelope);
86
+ * ops: booleans to join and cut with ({ union, subtract }, as @rulecad/shapes' ops gives), JSCAD's where left out.
87
+ * @param {object | string} m a Bracket, or bracketModel's profile @param {object} [o] bracketModel's options, pose, tongues and ops
88
+ * @returns {object} a JSCAD geom3, with .model
89
+ */
90
+ export function bracket(m: object | string, o?: object): object;
91
+ /**
92
+ * @typedef {{ kind: 'fitting', fitting: 'gusset' | 'splice', shape: string, name: string, title: string, profile: string, face: string, thread: string, head: string,
93
+ * width: number, thickness: number, arm: number, round: number, hole: number, outline: number[][], tongues: object[], screws: { leg: 'b' | 'a', thread: string, head: string, grip: number, at: number[], axis: number[], nut: string }[],
94
+ * load: object, stiffness: object, stress: number, margin: number, deflection: number, fe: object, volume: number, grams: number, material: string, printer: string, findings: object[], rests: object[] }} Plate
95
+ */
96
+ /**
97
+ * A printed flat plate over a joint: a gusset (shape L, T or cross) or a splice plate (shape splice), on the faces of
98
+ * beams of one profile that lie in one plane. Each arm runs along a beam's slot with `count` screws into slot nuts and
99
+ * a tongue that keys into the slot; the inside corners are rounded half an arm's width. Sized from the named load (in
100
+ * the plate's plane, across beam a at its farthest screw, b's screws held) by finite elements to about twice the
101
+ * margin. It prints contact face up, its tongues on top.
102
+ * @param {string | object} profile @param {{ shape?: 'L' | 'T' | 'cross' | 'splice', face?: string, thread?: string, head?: 'cap' | 'button', nut?: string, count?: number, load?: number, width?: number,
103
+ * printer?: object, material?: string | object, given?: object, cache?: object }} [o] count: screws on each arm (default 2)
104
+ * @returns {Plate}
105
+ */
106
+ export function plateModel(profile: string | object, o?: {
107
+ shape?: "L" | "T" | "cross" | "splice";
108
+ face?: string;
109
+ thread?: string;
110
+ head?: "cap" | "button";
111
+ nut?: string;
112
+ count?: number;
113
+ load?: number;
114
+ width?: number;
115
+ printer?: object;
116
+ material?: string | object;
117
+ given?: object;
118
+ cache?: object;
119
+ }): Plate;
120
+ /**
121
+ * A printed plate's solid, from plateModel's model or its arguments: contact face up to print (pose 'print', the
122
+ * default; its frame's z then runs down into the beams, so the plate is turned over), or in its fitted frame (pose
123
+ * 'fit': x along b, y along a, the contact face at z = 0 and the plate on +z, away from the beams). tongues: false leaves
124
+ * them off; ops: booleans to join and cut with, as bracket's.
125
+ * @param {object | string} m a Plate, or plateModel's profile @param {object} [o] plateModel's options, pose, tongues and ops
126
+ * @returns {object} a JSCAD geom3, with .model
127
+ */
128
+ export function plate(m: object | string, o?: object): object;
129
+ /**
130
+ * The rules the fittings add, each with what it rests on.
131
+ * @type {Record<string, { value: number, unit: string, rule: string, kind: string, source: string, checked: string }>}
132
+ */
133
+ export const FITTING_DEFAULTS: Record<string, {
134
+ value: number;
135
+ unit: string;
136
+ rule: string;
137
+ kind: string;
138
+ source: string;
139
+ checked: string;
140
+ }>;
141
+ export namespace FITTINGS {
142
+ namespace bracket {
143
+ let what: string;
144
+ let joins: string[];
145
+ }
146
+ namespace gusset {
147
+ let what_1: string;
148
+ export { what_1 as what };
149
+ let joins_1: string[];
150
+ export { joins_1 as joins };
151
+ }
152
+ namespace splice {
153
+ let what_2: string;
154
+ export { what_2 as what };
155
+ let joins_2: string[];
156
+ export { joins_2 as joins };
157
+ }
158
+ }
159
+ export function printerOf(what: string, p: any): any;
160
+ export function pfig(pr: any, k: string): number;
161
+ export function materialOf(what: string, m: any): any;
162
+ export function options(what: string, o: any, keys: string[]): void;
163
+ export function profileOf(what: string, p: any, given: any): any;
164
+ export function ccw(pts: number[][]): number[][];
165
+ export function combine(parts: any[], cuts: any[], ops: any): any;
166
+ export type Bracket = {
167
+ kind: "fitting";
168
+ fitting: "bracket";
169
+ name: string;
170
+ title: string;
171
+ profile: string;
172
+ other: string;
173
+ faces: {
174
+ b: string;
175
+ a: string;
176
+ };
177
+ thread: string;
178
+ head: string;
179
+ brace: boolean;
180
+ width: number;
181
+ thickness: number;
182
+ leg: number;
183
+ screwAt: number;
184
+ round: number;
185
+ braceSize: number;
186
+ hole: number;
187
+ tongues: {
188
+ b: object;
189
+ a: object;
190
+ };
191
+ screws: {
192
+ leg: "b" | "a";
193
+ thread: string;
194
+ head: string;
195
+ grip: number;
196
+ at: number[];
197
+ axis: number[];
198
+ nut: string;
199
+ }[];
200
+ load: {
201
+ force: number;
202
+ what: string;
203
+ at: number[];
204
+ direction: number[];
205
+ };
206
+ stiffness: {
207
+ linear: number;
208
+ bending: number;
209
+ kind: string;
210
+ rule: string;
211
+ };
212
+ stress: number;
213
+ margin: number;
214
+ deflection: number;
215
+ fe: object;
216
+ volume: number;
217
+ grams: number;
218
+ material: string;
219
+ printer: string;
220
+ section: number[][];
221
+ findings: object[];
222
+ rests: object[];
223
+ };
224
+ export type Plate = {
225
+ kind: "fitting";
226
+ fitting: "gusset" | "splice";
227
+ shape: string;
228
+ name: string;
229
+ title: string;
230
+ profile: string;
231
+ face: string;
232
+ thread: string;
233
+ head: string;
234
+ width: number;
235
+ thickness: number;
236
+ arm: number;
237
+ round: number;
238
+ hole: number;
239
+ outline: number[][];
240
+ tongues: object[];
241
+ screws: {
242
+ leg: "b" | "a";
243
+ thread: string;
244
+ head: string;
245
+ grip: number;
246
+ at: number[];
247
+ axis: number[];
248
+ nut: string;
249
+ }[];
250
+ load: object;
251
+ stiffness: object;
252
+ stress: number;
253
+ margin: number;
254
+ deflection: number;
255
+ fe: object;
256
+ volume: number;
257
+ grams: number;
258
+ material: string;
259
+ printer: string;
260
+ findings: object[];
261
+ rests: object[];
262
+ };