@rulecad/frames 0.1.7 → 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/join.mjs ADDED
@@ -0,0 +1,257 @@
1
+ // Joins between beams: how two beams are joined says what is done to each (its operations), what holds them (the
2
+ // screws now, the fittings in later releases), and how stiff the joint is taken to be when a frame is solved.
3
+ //
4
+ // A join names an end of one beam (a) and a place on another (b): a face with a distance from b's end a for a join
5
+ // that puts an end against a face (blind, end-tap, bracket and the rest), or b's end for one that meets end to end or
6
+ // at a corner (splice, mitre, cube). The addresses are beam.mjs's (back@120, a, a.1). Units: mm, N, radians.
7
+ import { parseName, engagement, fixingModel, DEFAULTS as FIX } from '@rulecad/fixings';
8
+ import { beamAnchor } from './beam.mjs';
9
+ import { boughtFittings, boughtFittingModel } from './bought.mjs';
10
+
11
+ const CHECKED = '2026-11-16';
12
+ const shown = (v) => { const s = v === undefined ? 'nothing' : JSON.stringify(v) ?? String(v); return s.length > 80 ? `${s.slice(0, 77)}...` : s; };
13
+ const SIDES = { face: 'a face with a distance (back@120, top@50%)', end: 'an end, a or b', either: 'a face with a distance (back@120), or an end (a or b)' };
14
+ const FITTINGS = ['printed', 'bought']; // (or a bought fitting's set by name: bought.mjs)
15
+
16
+ /**
17
+ * The kinds of join, each with what it derives, what b is (a face, an end, or either), whether the end must meet a
18
+ * slot, and, for a kind with a fitting, what that fitting is, the printed fitting (fitting.mjs) that "fitting":
19
+ * "printed" draws where there is one, the kind of bought fitting (bought.mjs) a set's name gives where one is taken,
20
+ * and the release that brings the rest.
21
+ * @type {Record<string, { what: string, b: 'face' | 'end' | 'either', slot: boolean, head?: string, made: boolean, fitting?: string, printed?: 'bracket' | 'gusset' | 'splice', bought?: string, later?: string }>}
22
+ */
23
+ export const JOINS = {
24
+ blind: { what: 'a tap in the end of a, a button-head screw in it, the head in a slot of b, and an access hole across b for the key', b: 'face', slot: true, head: 'button', made: true },
25
+ 'end-tap': { what: 'a tap in the end of a, and a cap screw into it through a hole drilled across b', b: 'face', slot: false, head: 'cap', made: true },
26
+ bracket: { what: 'a corner bracket, printed or bought, with its slot nuts and screws', b: 'face', slot: true, made: false, fitting: 'a corner bracket', printed: 'bracket', bought: 'corner-bracket' },
27
+ gusset: { what: 'a flat plate (L, T or cross), printed or bought, over the joint', b: 'face', slot: true, made: false, fitting: 'a gusset plate', printed: 'gusset', bought: 'joining-plate' },
28
+ cube: { what: 'a three-way corner taking the beam ends', b: 'end', slot: false, made: false, fitting: 'a three-way corner', later: 'a later release (printed and bought)' },
29
+ hidden: { what: 'a bought inner connector in the slots', b: 'face', slot: true, made: false, fitting: 'an inner connector', bought: 'inner-connector' },
30
+ anchor: { what: 'a bought anchor connector, and its pocket in the end of a', b: 'face', slot: true, made: false, fitting: 'an anchor connector', bought: 'anchor-connector' },
31
+ mitre: { what: 'two mitred ends, and a corner key or plate', b: 'end', slot: false, made: false, fitting: 'a corner key or plate', later: 'a later release (printed and bought)' },
32
+ pivot: { what: 'a hinge or pivot, which also adds a joint so it moves', b: 'face', slot: true, made: false, fitting: 'a pivot and its joint', later: 'a later release, with the joint it adds (a hinge goes on a door as an item now)' },
33
+ splice: { what: 'two beams end to end, with a joining plate', b: 'end', slot: false, made: false, fitting: 'a splice plate', printed: 'splice', bought: 'joining-plate' },
34
+ printed: { what: 'a printed node that sockets the beam ends', b: 'either', slot: false, made: false, fitting: 'a printed node', later: 'a later release' },
35
+ };
36
+
37
+ // One kind's stiffness for a 20 mm series profile: bending (about either axis across the beam) and twist, N mm/rad
38
+ const guess = (kind, bending, twist, why) => ({
39
+ bending: { value: bending, unit: 'N mm/rad', rule: `How stiffly a ${kind} join holds the end of a against turning across its axis, for a 20 mm series profile: ${why}`, kind: 'estimate', source: 'A working guess of @rulecad/frames, made without a measurement or a published figure: the joint rig (issue 264) measures it and cad measured replaces it', checked: CHECKED },
40
+ twist: { value: twist, unit: 'N mm/rad', rule: `How stiffly a ${kind} join holds the end of a against twisting about its own axis, for a 20 mm series profile: ${why}`, kind: 'estimate', source: 'A working guess of @rulecad/frames, made without a measurement or a published figure: the joint rig (issue 264) measures it and cad measured replaces it', checked: CHECKED },
41
+ });
42
+
43
+ /**
44
+ * Each kind's stiffness, bending and twist, for a 20 mm series profile, as springs at the end of a in a frame's solve
45
+ * (@rulecad/fea/frame's end joins). Every one is an estimate: a joint's stiffness is the honest unknown of a frame, and
46
+ * the joint rig measures it. A profile of another size is scaled by the cube of its width over 20 mm (JOIN_SCALE).
47
+ * @type {Record<string, { bending: object, twist: object }>}
48
+ */
49
+ export const JOIN_STIFFNESS = {
50
+ blind: guess('blind', 1.5e6, 3e5, 'one screw on the beam\'s axis, clamped by its head on the slot\'s lips: the lips bend first, and twist is held by friction alone'),
51
+ 'end-tap': guess('end-tap', 2e6, 4e5, 'one screw on the beam\'s axis, its head on the far face of b: stiffer than a blind join, as b\'s far wall clamps too; twist by friction alone'),
52
+ bracket: guess('bracket', 3e6, 1e6, 'a bought cast bracket and two slot nuts; a printed bracket is taken at JOIN_PRINTED of it'),
53
+ gusset: guess('gusset', 6e6, 3e6, 'a flat plate over the joint with two or more screws each side: the widest stance of any kind'),
54
+ cube: guess('cube', 3e6, 2e6, 'a three-way corner with the ends screwed into it'),
55
+ hidden: guess('hidden', 1.5e6, 5e5, 'an inner connector clamped in the slots, held by friction and a set screw'),
56
+ anchor: guess('anchor', 2e6, 5e5, 'an anchor connector in a pocket, pulled tight by its screw'),
57
+ mitre: guess('mitre', 1e6, 5e5, 'two mitred ends held by a corner key or plate: the key\'s own stiffness'),
58
+ pivot: guess('pivot', 1.5e6, 5e5, 'a pivot, free about its pin (its joint says which way): this figure is for the other two rotations'),
59
+ splice: guess('splice', 5e6, 3e6, 'two ends held by a plate along both beams'),
60
+ printed: guess('printed', 5e5, 3e5, 'a printed node: plastic, so far softer than the aluminium it joins'),
61
+ };
62
+ /** A printed fitting's stiffness beside a bought one's, and the size scale, each with what it rests on. */
63
+ export const JOIN_SCALE = {
64
+ printed: { value: 0.3, unit: '', rule: 'A printed fitting\'s stiffness as a share of the bought one\'s: PLA or PETG has a modulus of about 2 to 3.5 GPa against cast aluminium\'s 70 GPa, and a printed fitting is drawn thicker to make some of that up', kind: 'estimate', source: 'A working guess of @rulecad/frames: the joint rig (issue 264) measures it', checked: CHECKED },
65
+ size: { value: 3, unit: '', rule: 'A join on a profile of another size is scaled by its width over 20 mm to this power: a guess between a bolted joint (its screw grows with the profile) and a section\'s own bending stiffness', kind: 'estimate', source: 'A working guess of @rulecad/frames', checked: CHECKED },
66
+ };
67
+
68
+ /** How deep a join taps the end of a, with what it rests on. */
69
+ export const JOIN_TAP = { value: 1.5, unit: 'diameters', rule: 'A join taps the end of a as deep as the thread engagement asks in the beam\'s metal (engagement in @rulecad/fixings), with the screw\'s tip room (fixings.tip_room) and this many diameters more, so a screw of a sold length both engages fully and stops short of the bottom: the step between sold lengths is up to one diameter, and half a diameter more keeps a screw that only just needs the next length off the bottom', kind: 'default', source: 'A working figure of @rulecad/frames, from the steps in the m5 set\'s sold lengths (20, 25, 30, 35 mm)', checked: CHECKED };
70
+ const classOf = (mat) => { const E = mat?.modulus; return E == null ? 'aluminium' : E < 20000 ? 'plastic' : E < 100000 ? 'aluminium' : 'steel'; };
71
+
72
+ /**
73
+ * The rule set a workspace keeps its measured joins in, by name: "joins" (part "joins"). The kit holds no file of it:
74
+ * its starting figures are JOIN_STIFFNESS's estimates, and cad measured writes a copy into the workspace the first time
75
+ * the joint rig is measured, each figure the rig measured then marked measured with its date.
76
+ */
77
+ export const JOIN_SET = 'joins';
78
+ const ruleKey = (kind) => kind.replace(/-/g, '_');
79
+ /** The kinds whose fitting can be printed (a bracket, a gusset, a splice), each with a share of its fitting's own stiffness. */
80
+ const SHARED = Object.keys(JOINS).filter((k) => JOINS[k].printed);
81
+ /**
82
+ * A printed fitting's joint as a share of the fitting's own stiffness by finite elements: the slot nuts, the lips and
83
+ * the contact are not in that figure, so the joint is softer. 1 until the joint rig measures it.
84
+ * @param {string} kind
85
+ */
86
+ const printedShare = (kind) => ({ value: 1, unit: '', rule: `A ${kind} join with a printed fitting, as a share of the fitting's own bending stiffness by finite elements: that figure leaves out the slot nuts, the lips and where the faces touch, so the joint is softer than it. Taken whole until the joint rig measures the joint`, kind: 'estimate', source: 'A working figure of @rulecad/frames, with no measurement behind it: the joint rig (issue 264) measures it and cad measured replaces it', checked: CHECKED });
87
+
88
+ /**
89
+ * The joins rule set as the kit starts it: each kind's bending and twist (<kind>_bending, <kind>_twist, a kind's
90
+ * hyphen as an underscore: end_tap_bending) from JOIN_STIFFNESS, and for each kind with a printed fitting its share
91
+ * (<kind>_printed_share). cad measured writes the workspace's copy from it.
92
+ * @returns {{ name: string, part: string, _doc: string, rules: Record<string, { value: number, unit: string, rule: string, kind: string, source: string, checked: string }> }}
93
+ */
94
+ export function joinRuleSet() {
95
+ const rules = {};
96
+ for (const [kind, s] of Object.entries(JOIN_STIFFNESS)) for (const k of ['bending', 'twist']) rules[`${ruleKey(kind)}_${k}`] = { ...s[k] };
97
+ for (const kind of SHARED) rules[`${ruleKey(kind)}_printed_share`] = printedShare(kind);
98
+ return { _doc: 'How stiff each kind of join between two beams is, for a 20 mm series profile: the springs at a beam\'s end in a frame\'s solve. Started from @rulecad/frames\' estimates (JOIN_STIFFNESS); the joint rig (examples/bench/projects/benchmarks/MEASURE.md) measures them and cad measured writes each here as measured.', name: JOIN_SET, part: 'joins', rules };
99
+ }
100
+
101
+ // A figure of the workspace's joins set where it has one, else the kit's
102
+ const ownRule = (given, key) => { const r = given?.sets?.[JOIN_SET]?.rules?.[key]; return r && typeof r.value === 'number' && Number.isFinite(r.value) && r.value > 0 ? r : null; };
103
+ const measuredOn = (r) => (r?.kind === 'measured' ? r.checked ?? null : null);
104
+
105
+ /**
106
+ * The stiffness a join of this kind is taken to have between these beams, as numbers and as an end join for
107
+ * @rulecad/fea/frame ({ rx: twist, ry, rz: bending, in N mm/rad }), with what it rests on. A figure the workspace's
108
+ * joins set holds (given.sets.joins, measured on the joint rig) is taken before the kit's estimate; measured says the
109
+ * date each was measured, or null.
110
+ * @param {string} kind @param {object} beam the beam whose end is joined (a) @param {{ fitting?: 'printed' | 'bought', given?: { sets?: object } }} [o]
111
+ * @returns {{ bending: number, twist: number, scale: number, printed: boolean, end: { rx: number, ry: number, rz: number }, kind: string, measured: { bending: string | null, twist: string | null }, share: object | null, rests: object[] }}
112
+ */
113
+ export function joinStiffness(kind, beam, o = {}) {
114
+ const s = JOIN_STIFFNESS[kind];
115
+ if (!s) throw new Error(`joinStiffness: no kind of join ${shown(kind)}: there are ${Object.keys(JOINS).join(', ')}`);
116
+ const key = ruleKey(kind), rb = ownRule(o.given, `${key}_bending`) ?? s.bending, rt = ownRule(o.given, `${key}_twist`) ?? s.twist;
117
+ const share = SHARED.includes(kind) ? ownRule(o.given, `${key}_printed_share`) ?? printedShare(kind) : null;
118
+ const w = Math.max(beam.profile.width, beam.profile.height), scale = (w / 20) ** JOIN_SCALE.size.value, printed = o.fitting === 'printed' && JOINS[kind].fitting && kind !== 'printed' ? JOIN_SCALE.printed.value : 1;
119
+ const bending = rb.value * scale * printed, twist = rt.value * scale * printed, measured = { bending: measuredOn(rb), twist: measuredOn(rt) };
120
+ const named = (r, k) => ({ value: r.value, unit: r.unit, kind: r.kind, source: r.source, name: `${JOIN_SET}.${key}_${k}`, ...(r.kind === 'measured' ? { checked: r.checked } : {}) });
121
+ return { bending, twist, scale, printed: printed !== 1, end: { rx: twist, ry: bending, rz: bending }, kind: measured.bending && measured.twist ? 'measured' : 'estimate', measured, share,
122
+ rests: [named(rb, 'bending'), named(rt, 'twist'), ...(scale !== 1 ? [JOIN_SCALE.size] : []), ...(printed !== 1 ? [JOIN_SCALE.printed] : [])].map((r) => ({ value: r.value, unit: r.unit, kind: r.kind, source: r.source, ...(r.name ? { name: r.name } : {}), ...(r.checked ? { checked: r.checked } : {}) })) };
123
+ }
124
+
125
+ const boughtKindOf = (name, given) => { try { return boughtFittingModel(name, { given }).fittingKind; } catch { return null; } };
126
+
127
+ /**
128
+ * A join's stiffness with a bought fitting: its set's own figures (each an estimate until the joint rig measures it,
129
+ * and saying so), or the kind's estimate where the set gives none, in joinStiffness's shape.
130
+ * @param {string} kind @param {object} beam a's @param {object} fm boughtFittingModel's
131
+ */
132
+ export function boughtStiffness(kind, beam, fm) {
133
+ const k = joinStiffness(kind, beam);
134
+ if (!fm.stiffness) return { ...k, bought: { set: fm.set, own: false } };
135
+ const bending = fm.stiffness.bending, twist = fm.stiffness.twist ?? k.twist, measured = { bending: fm.stiffness.measured?.bending ?? null, twist: fm.stiffness.twist != null ? fm.stiffness.measured?.twist ?? null : k.measured.twist };
136
+ return { bending, twist, scale: 1, printed: false, end: { rx: twist, ry: bending, rz: bending }, kind: fm.stiffness.kind, measured, share: null, bought: { set: fm.set, own: true, rule: fm.stiffness.rule, source: fm.stiffness.source },
137
+ rests: fm.stiffness.rests.map((r) => ({ value: r.value, unit: r.unit, kind: r.kind, source: `${r.name}: ${r.source}` })) };
138
+ }
139
+
140
+ // The place across the beam from a place, on the same line (front.1 for back.1), or null
141
+ function across(b, p) {
142
+ return b.places.find((q) => Math.abs(q.normal[0] + p.normal[0]) < 1e-9 && Math.abs(q.normal[1] + p.normal[1]) < 1e-9 && Math.abs(p.normal[0] * (q.at[1] - p.at[1]) - p.normal[1] * (q.at[0] - p.at[0])) < 1e-6) ?? null;
143
+ }
144
+
145
+ /**
146
+ * A join between two beams as numbers: the operations it puts on each, the screws that hold it (each by the bore in
147
+ * a's end it goes into), the fitting a later release draws for it, its stiffness, and what to know. Bad input is
148
+ * refused by name.
149
+ * @param {string} kind one of JOINS
150
+ * @param {{ beam: object, end: string }} a a beam's model and its end: a, b, or one bore of it (a.2) where the end has several
151
+ * @param {{ beam: object, address: string }} b a beam's model and a place on it: a face with a distance (back@120), or an end
152
+ * @param {{ screw?: string, fitting?: string, given?: object, mitre?: { angle: number, a: { about: string, long: string }, b: { about: string, long: string } } }} [o] screw: the screw a blind or end-tap join takes, by its thread and head ("M5 button"; the bore's thread with the kind's head where left out);
153
+ * mitre: for a mitre join, each end's cut from square in degrees and, for each beam, the face the corner lies in (about)
154
+ * and the side its length is measured on (long, the outside): worked out from where the beams are (cad does)
155
+ * @returns {{ kind: string, what: string, says: string, a: { end: string, bores: string[], ops: object[] }, b: { address: string, place: string | null, face: string | null, slot: string | null, distance: number | null, end: string | null, ops: object[], across?: { place: string, slot: string | null } },
156
+ * screws: { screw: string, thread: string, head: string, bore: string }[], fitting: { what: string, later: string, choice: string | null } | null, stiffness: object, findings: object[] }}
157
+ */
158
+ export function joinModel(kind, a, b, o = {}) {
159
+ const what = `joinModel`;
160
+ const spec = JOINS[kind];
161
+ if (!spec) throw new Error(`${what}: no kind of join ${shown(kind)}: there are ${Object.keys(JOINS).join(', ')}`);
162
+ if (a?.beam?.kind !== 'beam' || b?.beam?.kind !== 'beam') throw new Error(`${what}: a and b are each { beam, ... } with a beam's model (beamModel)`);
163
+ if (!o || typeof o !== 'object' || Array.isArray(o)) throw new Error(`${what}: the options are { screw, fitting, mitre, given } (got ${shown(o)})`);
164
+ for (const k of Object.keys(o)) if (!['screw', 'fitting', 'mitre', 'given'].includes(k)) throw new Error(`${what}: no option "${k}": it takes screw, fitting, mitre, given`);
165
+ const A = a.beam, B = b.beam, w = `${what}: a ${kind} join of ${A.name} to ${B.name}`, given = o.given ?? {};
166
+ // a bought fitting by its set's name: one of the kind this join takes
167
+ const sets = spec.bought ? boughtFittings(given).filter((n) => boughtKindOf(n, given) === spec.bought) : [];
168
+ const named = o.fitting != null && !FITTINGS.includes(o.fitting) && typeof o.fitting === 'string' && boughtFittings(given).includes(o.fitting);
169
+ if (o.fitting != null && !FITTINGS.includes(o.fitting) && !named) throw new Error(`${w}: fitting is ${FITTINGS.join(' or ')}, or a bought fitting's set by name${sets.length ? ` (${sets.join(', ')})` : ''} (got ${shown(o.fitting)})`);
170
+ if (o.fitting != null && !spec.fitting) throw new Error(`${w}: a ${kind} join has no fitting to choose: its screws hold it. Leave fitting out`);
171
+ if (named && !spec.bought) throw new Error(`${w}: a ${kind} join takes no bought fitting yet (${spec.fitting} comes with ${spec.later})${spec.printed ? ': give "fitting": "printed"' : ''}`);
172
+ if (o.screw != null && !['blind', 'end-tap'].includes(kind)) throw new Error(`${w}: a ${kind} join's screws come with its fitting (${spec.printed ? 'a printed one\'s thread is its slot nuts\', its lengths chosen by its fastens' : spec.bought ? 'a bought one\'s are its set\'s' : spec.later}): leave screw out`);
173
+ // a: an end, or one bore of it
174
+ const end = typeof a.end === 'string' ? a.end.trim() : null;
175
+ if (!end || !/^[ab](\.\d+)?$/.test(end)) throw new Error(`${w}: a is an end of the beam, a or b, or one bore in it (a.1) (got ${shown(a.end)})`);
176
+ // b: a face with a distance, or an end, as the kind takes
177
+ const address = typeof b.address === 'string' ? b.address.trim() : null, isEnd = address != null && /^[ab]$/.test(address);
178
+ if (!address || (spec.b === 'face' && isEnd) || (spec.b === 'end' && !isEnd)) throw new Error(`${w}: b is ${SIDES[spec.b]} on the other beam, as a ${kind} join meets it (got ${shown(b.address)})`);
179
+ if (!isEnd && !address.includes('@')) throw new Error(`${w}: b names a face with a distance from its end a, where the end of a meets it: ${address}@120, ${address}@-20 or ${address}@50% (got ${shown(address)})`);
180
+ const at = beamAnchor(B, address); // (refused by name where the face is not one of B's, or past its end)
181
+ const place = isEnd ? null : B.places.find((x) => x.name === at.name || (x.face === at.name && x.name.endsWith('.1')));
182
+ const out = { kind, what: spec.what, says: '', a: { end, bores: [], ops: [] }, b: { address, place: place?.name ?? null, face: place?.face ?? null, slot: place?.slot ?? null, distance: isEnd ? null : at.distance, end: isEnd ? address : null, ops: [] },
183
+ screws: [], fitting: spec.fitting ? { what: spec.fitting, ...(spec.later ? { later: spec.later } : {}), choice: o.fitting ?? null } : null, stiffness: joinStiffness(kind, A, named ? {} : o), findings: [] };
184
+ const says = `${A.name} end ${end} to ${B.name} ${address}`;
185
+ out.says = says;
186
+ if (spec.slot && place && !place.slot) {
187
+ out.findings.push({ level: 'fail', code: 'join.geometry', text: `${says}: a ${kind} join meets a slot, and ${B.name}'s ${place.name} is a closed face: join it to a face with a slot${kind === 'blind' ? ', or use an end-tap join' : ''}`, refs: { kind, place: place.name } });
188
+ return out;
189
+ }
190
+ // a mitre: each end cut at the angle that meets the other, about the face the corner lies in, long on the outside
191
+ if (kind === 'mitre' && o.mitre != null) {
192
+ const m = o.mitre, FACES = ['top', 'bottom', 'front', 'back'];
193
+ if (!(typeof m.angle === 'number' && m.angle > 0 && m.angle < 90)) throw new Error(`${w}: mitre.angle is each end's cut from square, above 0 and under 90 degrees (got ${shown(m.angle)}): the beams meet at a corner, not in line or doubled back`);
194
+ for (const side of ['a', 'b']) if (!m[side] || !FACES.includes(m[side].about) || !FACES.includes(m[side].long)) throw new Error(`${w}: mitre.${side} is { about, long }, each a face: ${FACES.join(', ')} (got ${shown(m[side])})`);
195
+ out.a.ops.push({ op: 'mitre', at: end, angle: m.angle, about: m.a.about, long: m.a.long });
196
+ out.b.ops.push({ op: 'mitre', at: address, angle: m.angle, about: m.b.about, long: m.b.long });
197
+ }
198
+ // a printed fitting this release draws: the caller places it from where the beams are and adds its screws
199
+ // (cad's joins do: lib/fittings.mjs), and its own stiffness by finite elements replaces the estimate
200
+ if (spec.printed && o.fitting === 'printed') { out.fitting.made = true; out.fitting.printed = spec.printed; return out; }
201
+ // a bought one: its set says its screws, nuts and holes (the caller places it from where the beams are and adds its
202
+ // fastens: cad's joins do), the hole a beam needs for it, whether it fits these profiles, and its stiffness
203
+ if (named) {
204
+ let fm;
205
+ try { fm = boughtFittingModel(o.fitting, { given, profile: B.profile, other: A.profile, join: kind }); } catch (x) { throw new Error(`${w}: fitting: ${String(x.message).replace(/^\w+: /, '')}`); }
206
+ if (kind === 'splice' && fm.shape !== 'straight') throw new Error(`${w}: a splice join takes a straight joining plate, and ${fm.set} is ${fm.shape === 'L' ? 'an' : 'a'} ${fm.shape}: give it on a gusset join`);
207
+ if (kind === 'gusset' && fm.shape === 'straight') throw new Error(`${w}: a gusset join takes an L, T or cross plate, and ${fm.set} is straight: give it on a splice join`);
208
+ out.fitting.made = true; out.fitting.bought = fm;
209
+ out.stiffness = boughtStiffness(kind, A, fm);
210
+ const misfit = fm.findings.filter((x) => x.code === 'fitting.fit' && x.level === 'fail');
211
+ out.fitting.fits = !misfit.length;
212
+ out.findings.push(...misfit.map((x) => ({ ...x, text: `${says}: ${x.text}. Until one fits, the join places no fitting and adds no screws` })));
213
+ // an anchor's pocket: a hole across a near its end, into a slotted face, down to the bore its post goes in
214
+ if (!misfit.length) for (const op of fm.ops) {
215
+ const face = A.places.find((q) => q.slot)?.name;
216
+ if (!face) throw new Error(`${w}: ${fm.set}'s guide goes in a hole drilled into a slot of ${A.name}, and it has no slotted face`);
217
+ const e = end[0], d = e === 'a' ? op.distance : -op.distance;
218
+ out.a.ops.push({ op: 'drill', at: `${face}@${d}`, diameter: op.diameter, depth: +(Math.min(A.profile.width, A.profile.height) / 2).toFixed(3) });
219
+ }
220
+ return out;
221
+ }
222
+ if (!spec.made) {
223
+ const cut = out.a.ops.length > 0;
224
+ const printed = spec.printed ? ` A printed one is drawn now: give "fitting": "printed".` : '';
225
+ const bought = spec.bought ? ` ${sets.length ? `A bought one is a set: give "fitting": "${sets[0]}"${sets.length > 1 ? ` (or ${sets.slice(1).join(', ')})` : ''}` : `A bought one is a rule set of part "fitting" (fitting_kind ${spec.bought}): the kit has none yet`}.` : '';
226
+ const then = cut ? `The mitres are cut; the corner key or plate comes with ${spec.later}` : spec.later ? `${spec.fitting[0].toUpperCase()}${spec.fitting.slice(1)} comes with ${spec.later}` : `${spec.fitting[0].toUpperCase()}${spec.fitting.slice(1)} is added once one is chosen`;
227
+ out.findings.push({ level: 'warn', code: 'join.fitting', text: `${says}: a ${kind} join is ${spec.what}. ${then}: until then this join is checked where it meets and stiffens the frame by its estimate, and adds no ${cut ? '' : 'operations, '}fittings or screws.${printed}${bought}`, refs: { kind, ...(spec.later ? { later: spec.later } : {}), ...(sets.length ? { sets } : {}) } });
228
+ return out;
229
+ }
230
+ // blind and end-tap: a screw in each bore of a's end named, tapped
231
+ const e = end[0], bores = A.bores.filter((x) => x.end === e && (end.length === 1 || x.name === end));
232
+ if (!A.profile.bores.length) throw new Error(`${w}: ${A.profile.name} has no bore in its ends to tap, and a ${kind} join screws into one: join it with a bracket or a gusset`);
233
+ if (!bores.length) throw new Error(`${w}: ${A.name} has no bore ${end}: its end ${e} has ${A.bores.filter((x) => x.end === e).map((x) => x.name).join(', ')}`);
234
+ if (bores.length > 1) throw new Error(`${w}: end ${e} of ${A.name} has ${bores.length} bores (${bores.map((x) => x.name).join(', ')}), each meeting ${B.name} at its own place: give a join for each, a: ${bores.map((x) => x.name).join(' and ')}`);
235
+ const bore = bores[0];
236
+ let thread = bore.thread, head = spec.head, length = null;
237
+ if (o.screw != null) {
238
+ let n;
239
+ try { n = parseName(String(o.screw)); } catch (x) { throw new Error(`${w}: screw: ${String(x.message).replace(/^\w+: /, '')}`); }
240
+ if (!['screw', 'thread'].includes(n.item)) throw new Error(`${w}: screw names a screw by its thread and head ("M5 button"): ${o.screw} is not a screw`);
241
+ thread = n.thread; head = n.head ?? head; length = n.length;
242
+ }
243
+ if (thread == null) throw new Error(`${w}: ${A.profile.name}'s bores name no thread (bore_thread): give the screw, { screw: 'M5 button' }`);
244
+ out.a.bores = [bore.name];
245
+ let depth;
246
+ try { const need = engagement(thread, { depth: 1, material: classOf(A.material) }).need; depth = +(need + FIX.tip_room.value + JOIN_TAP.value * fixingModel(thread).major).toFixed(2); }
247
+ catch (x) { throw new Error(`${w}: screw: ${String(x.message).replace(/^\w+: /, '')}`); }
248
+ out.a.ops.push({ op: 'tap', at: bore.name, thread, depth });
249
+ const far = across(B, place);
250
+ if (!far) throw new Error(`${w}: ${B.name} has no face across from ${place.name} on the same line, for the ${kind === 'blind' ? 'key\'s access hole' : 'screw\'s hole'}`);
251
+ const there = `${far.name}@${address.split('@')[1].trim()}`;
252
+ out.b.across = { place: far.name, slot: far.slot };
253
+ out.b.ops.push(kind === 'blind' ? { op: 'access', at: there, thread, ...(['cap', 'button', 'countersunk'].includes(head) ? { head } : {}), through: 'beam' } : { op: 'drill', at: there, thread, kind: 'clearance', through: 'beam' });
254
+ out.screws.push({ screw: `${thread}${length != null ? `x${length}` : ''} ${head}`, thread, head, bore: bore.name });
255
+ if (kind === 'blind' && head !== 'button') out.findings.push({ level: 'info', code: 'join.fitting', text: `${says}: a blind join's head slides in ${B.name}'s slot, and a button head is the usual one; ${head} is checked as drawn`, refs: { kind, head } });
256
+ return out;
257
+ }
package/ops.mjs CHANGED
@@ -30,7 +30,7 @@ export const OPS = {
30
30
  cut: { what: 'a square cut to length', at: 'end', keys: [] },
31
31
  mitre: { what: 'an end cut at an angle, about a named face', at: 'end', keys: ['angle', 'about', 'long'] },
32
32
  tap: { what: 'a thread cut in an end bore', at: 'bore', keys: ['thread', 'depth'] },
33
- access: { what: 'a hole across the beam, in line with a slot, for a key', at: 'face', keys: ['thread', 'diameter', 'depth'] },
33
+ access: { what: 'a hole across the beam, in line with a slot, for a key', at: 'face', keys: ['thread', 'head', 'diameter', 'depth', 'through'] },
34
34
  drill: { what: 'a hole through one wall or right through, plain or tapped', at: 'face', keys: ['thread', 'kind', 'diameter', 'depth', 'through'] },
35
35
  counterbore: { what: 'a seat for a head in a face, with the screw\'s hole through the wall', at: 'face', keys: ['thread', 'head', 'diameter', 'depth'] },
36
36
  pocket: { what: 'a milled pocket by outline', at: 'face', keys: ['size', 'outline', 'radius', 'depth'] },
@@ -155,8 +155,8 @@ export function opsOf(b, list, anchorOf) {
155
155
  if (thread != null && typeof thread !== 'string') throw new Error(`${ow}: thread is a thread's name, such as M5 (got ${shown(thread)})`);
156
156
  if (thread == null && o.diameter == null) throw new Error(`${ow}: give a thread (M5) or a diameter in mm`);
157
157
  const through = o.through ?? 'wall';
158
- if (o.op === 'drill' && !['wall', 'beam'].includes(through)) throw new Error(`${ow}: through is wall (through one wall, the default) or beam (right through) (got ${shown(o.through)})`);
159
- const deep = num('depth') ?? sideOf(o.op === 'drill' ? through : 'wall');
158
+ if (o.op !== 'counterbore' && !['wall', 'beam'].includes(through)) throw new Error(`${ow}: through is wall (through one wall, the default) or beam (${o.op === 'access' ? 'through every wall on its line, to the slot on the far side, where a blind join\'s head sits' : 'right through'}) (got ${shown(o.through)})`);
159
+ const deep = num('depth') ?? sideOf(o.op === 'counterbore' ? 'wall' : through);
160
160
  let diameter = num('diameter'), kind = null, rest = null, key = null, seat = null, fig = null;
161
161
  try {
162
162
  if (thread != null) fig = fixFigures(thread);
@@ -166,8 +166,10 @@ export function opsOf(b, list, anchorOf) {
166
166
  if (thread == null && kind !== 'clearance') throw new Error(`a ${kind} hole is sized by its thread: give thread`);
167
167
  if (thread != null && diameter == null) { const h = holeModel(thread, { kind, printer: MACHINED, lead: 0, depth: deep, through: true }); diameter = h.diameter; rest = h.basis.rule; }
168
168
  } else if (o.op === 'access') {
169
- key = fig?.key ?? null;
170
- if (diameter == null && key == null) throw new Error(`${thread}'s set names no hex key (head_key) to size an access hole for: give a diameter`);
169
+ const head = o.head ?? 'cap', figure = ACCESS_KEYS[head];
170
+ if (!figure) throw new Error(`head is the screw's head the key turns, ${Object.keys(ACCESS_KEYS).join(', ')} (got ${shown(o.head)})`);
171
+ key = fig ? (isNum(fig.figures[figure]?.value) ? fig.figures[figure].value : null) : null;
172
+ if (diameter == null && key == null) throw new Error(`${thread}'s set names no hex key for a ${head} head (${figure}) to size an access hole for: give a diameter`);
171
173
  if (diameter == null) {
172
174
  const corners = key / Math.cos(Math.PI / 6), fit = ['clearance_close', 'clearance', 'clearance_loose'].map((n) => [n, fig.figures[n]?.value]).find(([, v]) => isNum(v) && v > corners);
173
175
  diameter = fit ? fit[1] : r3(corners + OP_DEFAULTS.key.value); rest = fit ? `${fig.set}.${fit[0]}` : 'OP_DEFAULTS.key';
@@ -178,9 +180,9 @@ export function opsOf(b, list, anchorOf) {
178
180
  }
179
181
  } catch (e) { throw new Error(`${ow}: ${String(e.message).replace(/^(hole|counterbore): /, '')}`); }
180
182
  const depth = o.op === 'counterbore' ? Math.max(wall, seat.depth) : deep;
181
- Object.assign(op, { thread, kind, diameter: r3(diameter), depth: r3(depth), through: o.op === 'drill' ? through : 'wall', ...(seat ? { seat } : {}), ...(key ? { key } : {}), ...(rest ? { rule: rest } : {}) });
183
+ Object.assign(op, { thread, kind, diameter: r3(diameter), depth: r3(depth), through: o.op === 'counterbore' ? 'wall' : through, ...(seat ? { seat } : {}), ...(key ? { key } : {}), ...(rest ? { rule: rest } : {}) });
182
184
  const from = `${mm(z)} mm from end a${z > L / 2 ? ` (${mm(L - z)} from end b)` : ''}`;
183
- op.line = o.op === 'access' ? `access hole Ø${mm(diameter)} mm in ${place.name}, ${from}, ${mm(depth)} mm deep${key ? ` for a ${mm(key)} mm key` : ''}`
185
+ op.line = o.op === 'access' ? `access hole Ø${mm(diameter)} mm in ${place.name}, ${from}, ${mm(depth)} mm deep${through === 'beam' ? ' (through to the far side)' : ''}${key ? ` for a ${mm(key)} mm key` : ''}`
184
186
  : o.op === 'drill' ? `drill Ø${mm(diameter)} mm${kind === 'tap' ? ` and tap ${thread}` : ''} in ${place.name}, ${from}, ${through === 'beam' ? 'right through' : 'through one wall'} (${mm(depth)} mm)`
185
187
  : `counterbore Ø${mm(seat.diameter)} x ${mm(seat.depth)} mm for ${thread} ${seat.head} head in ${place.name}, ${from}, with a Ø${mm(diameter)} mm hole through the wall (${mm(depth)} mm)`;
186
188
  if (kind === 'tap') {
@@ -243,6 +245,9 @@ export function opsOf(b, list, anchorOf) {
243
245
  return { ops: out, findings };
244
246
  }
245
247
 
248
+ // The hex key of each head an access hole is for, by its figure in the thread's set: a cap screw's (head_key), a
249
+ // button head's (button_key, a size smaller from M4 up), a countersunk head's
250
+ const ACCESS_KEYS = { cap: 'head_key', button: 'button_key', countersunk: 'countersunk_key' };
246
251
  // A thread's figures through fixings: its set, major diameter, pitch, hex key and clearance figures
247
252
  function fixFigures(thread) {
248
253
  const fx = fixingModel(thread), v = (n) => (isNum(fx.figures[n]?.value) ? fx.figures[n].value : null);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rulecad/frames",
3
- "version": "0.1.7",
4
- "description": "Structures from beams: a profile (aluminium extrusion of any maker, tube, angle or a printed beam) as a model from its rule set, its section as an outline, and what that section is worth as a beam beside the maker's figures. A beam of it: its mass, its anchors, the operations on it (cut, mitre, tap, access, drill, counterbore, pocket, notch, deburr) checked, and its solid as a light box or the true section. A frame's cut list (the bars to buy, packed with the saw's kerf) and a cut-and-drill sheet per beam. Slot nuts: the bought nuts by maker and kind, the nut for a face, and a printed carrier for a nut or an insert. Joins, fittings and guides follow.",
3
+ "version": "0.1.8",
4
+ "description": "Structures from beams: a profile (aluminium extrusion of any maker, tube, angle or a printed beam) as a model from its rule set, its section as an outline, and what that section is worth as a beam beside the maker's figures. A beam of it: its mass, its anchors, the operations on it (cut, mitre, tap, access, drill, counterbore, pocket, notch, deburr) checked, and its solid as a light box or the true section. A frame's cut list (the bars to buy, packed with the saw's kerf) and a cut-and-drill sheet per beam. Slot nuts: the bought nuts by maker and kind, the nut for a face, and a printed carrier for a nut or an insert. Joins between beams by kind: the operations each puts on both beams, its screws, and its stiffness for a frame's solve. Printed fittings for those joins: a corner bracket (braced or not), gusset plates (L, T, cross) and a splice plate, drawn from the profile's and the thread's rules, keyed into the slot, sized from a named load by finite elements and reporting grams, stiffness and margin. Panels cut to a bay with clips at a pitch, an in-slot edge, corners, slot covers and gasket strips; a door's hinges, handle, latch and magnet catch; end caps, feet, levelling feet, castor plates and stacking feet, each printed from the same rules. Guides: miniature rails on a slotted face, their holes, screws, slot nuts and carriages' travel, the carriages' loads against their ratings, and a printed jig that centres a rail. Jigs for hand tools, generated from a beam's operations: a drill guide that puts a bush where the sheet dimensions a hole, a tap guide over an end, a cut-length stop with its gauge, and a squaring corner. Squaring a bay by its diagonals: their length and the difference to accept.",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {
@@ -15,25 +15,58 @@
15
15
  "profile.mjs",
16
16
  "beam.mjs",
17
17
  "ops.mjs",
18
+ "join.mjs",
18
19
  "cutlist.mjs",
19
20
  "cutsheet.mjs",
20
21
  "slotnut.mjs",
22
+ "fitting.mjs",
23
+ "panel.mjs",
24
+ "door.mjs",
25
+ "ends.mjs",
26
+ "services.mjs",
27
+ "bought.mjs",
28
+ "guide.mjs",
29
+ "wheels.mjs",
30
+ "rods.mjs",
31
+ "jig.mjs",
32
+ "square.mjs",
21
33
  "section.mjs",
22
34
  "catalogue.mjs",
23
35
  "frames.d.mts",
24
36
  "profile.d.mts",
25
37
  "beam.d.mts",
26
38
  "ops.d.mts",
39
+ "join.d.mts",
27
40
  "cutlist.d.mts",
28
41
  "cutsheet.d.mts",
29
42
  "slotnut.d.mts",
43
+ "fitting.d.mts",
44
+ "panel.d.mts",
45
+ "door.d.mts",
46
+ "ends.d.mts",
47
+ "services.d.mts",
48
+ "bought.d.mts",
49
+ "guide.d.mts",
50
+ "wheels.d.mts",
51
+ "rods.d.mts",
52
+ "jig.d.mts",
53
+ "square.d.mts",
30
54
  "section.d.mts",
31
55
  "catalogue.d.mts",
32
56
  "README.md",
33
- "LICENSE"
57
+ "LICENSE",
58
+ "CHANGELOG.md"
34
59
  ],
35
60
  "license": "MIT",
36
- "keywords": ["aluminium-extrusion", "t-slot", "v-slot", "frames", "3d-printing", "jscad", "cad"],
61
+ "keywords": [
62
+ "aluminium-extrusion",
63
+ "t-slot",
64
+ "v-slot",
65
+ "frames",
66
+ "3d-printing",
67
+ "jscad",
68
+ "cad"
69
+ ],
37
70
  "engines": {
38
71
  "node": ">=20.10"
39
72
  },
@@ -54,7 +87,8 @@
54
87
  "@jscad/modeling": "^2.12.0"
55
88
  },
56
89
  "dependencies": {
57
- "@rulecad/fixings": "^0.1.1",
58
- "@rulecad/rules": "^0.3.14"
90
+ "@rulecad/fea": "^0.2.10",
91
+ "@rulecad/fixings": "^0.1.4",
92
+ "@rulecad/rules": "^0.3.16"
59
93
  }
60
94
  }
package/panel.d.mts ADDED
@@ -0,0 +1,225 @@
1
+ /** @internal The common setup of a printed part: printer, plastic and their figures. @param {string} what @param {object} o @returns {any} */
2
+ export function partSetup(what: string, o: object): any;
3
+ /** @internal A sheet's thickness, refused by name. @param {string} what @param {any} t @returns {number} */
4
+ export function sheetThickness(what: string, t: any): number;
5
+ /** @internal A load in N, refused by name. @param {string} what @param {any} F @param {string} said @returns {void} */
6
+ export function loadOk(what: string, F: any, said: string): void;
7
+ /**
8
+ * @internal A part printed on its side: its section in (y, z) of the fitted frame (as X, Y) extruded w along the slot
9
+ * (Z), a tongue into the slot under it, and holes square to the face, each a teardrop with its point cut flat just over
10
+ * the round so a head's seat is whole. holes: { thread, y, top, kind }, from the face at height top down through the
11
+ * part and its tongue, or { thread, y, depth, kind, from: 'face' }, a blind hole up from the contact face; pockets: { y, top, d, depth }, round pockets from the face at height top.
12
+ * @param {{ loop: number[][], width: number, tongue?: object, holes?: object[], pockets?: object[], pr: object, ops?: object }} o
13
+ * @returns {object} a JSCAD geom3 in its print pose
14
+ */
15
+ export function sidePart({ loop, width, tongue, holes, pockets, pr, ops }: {
16
+ loop: number[][];
17
+ width: number;
18
+ tongue?: object;
19
+ holes?: object[];
20
+ pockets?: object[];
21
+ pr: object;
22
+ ops?: object;
23
+ }): object;
24
+ /** @internal A finished part's volume and grams from its solid. @param {object} m @param {object} solid @param {number} density @returns {void} */
25
+ export function weigh(m: object, solid: object, density: number): void;
26
+ /**
27
+ * @typedef {{ kind: 'panel', name: string, title: string, sheet: string, thickness: number, size: number[], corner: number, area: number, grams: number, holes: { thread: string, at: number[], diameter: number }[],
28
+ * findings: object[], rests: object[] }} Panel
29
+ */
30
+ /**
31
+ * A panel: a sheet of a material and thickness cut to a size, its corners rounded, with holes where screws pass. Its
32
+ * mass is the sheet's density times its volume less the holes. A thickness no stockist commonly holds is a warning.
33
+ * @param {string} sheet acrylic, polycarbonate or aluminium @param {number} thickness mm
34
+ * @param {{ size: number[], corner?: number, holes?: { thread: string, at: number[] }[], printer?: object }} o size: [x, y] in mm; holes at [x, y] from the panel's corner
35
+ * @returns {Panel}
36
+ */
37
+ export function panelModel(sheet: string, thickness: number, o?: {
38
+ size: number[];
39
+ corner?: number;
40
+ holes?: {
41
+ thread: string;
42
+ at: number[];
43
+ }[];
44
+ printer?: object;
45
+ }): Panel;
46
+ /**
47
+ * A panel's solid: the sheet from [0, 0] to its size on x and y, z from 0 to its thickness, its corners rounded and its
48
+ * holes cut. @param {Panel} m panelModel's @param {{ printer?: object, ops?: object }} [o] ops: booleans to cut with, JSCAD's where left out
49
+ * @returns {object} a JSCAD geom3, with .model
50
+ */
51
+ export function panel(m: Panel, o?: {
52
+ printer?: object;
53
+ ops?: object;
54
+ }): object;
55
+ /**
56
+ * A printed clip that holds a panel's edge down on a beam's face: a block on the face, screwed into a slot nut on the
57
+ * slot's centre line, keyed into the slot by a tongue, reaching over the panel's edge with a step as deep as the sheet.
58
+ * Sized from a named load (the panel pushed out at the clip) by beam formulas to about twice the margin; then made
59
+ * thick enough that a screw sold engages its nut and stops short of the slot's floor. It prints on its side.
60
+ * @param {string | object} profile @param {{ sheet: number, face?: string, thread?: string, head?: 'cap' | 'button', nut?: string, load?: number, grip?: number, printer?: object, material?: string | object, given?: object }} o
61
+ * sheet: the panel's thickness; grip: how far it reaches over the panel (default PANEL_DEFAULTS.grip)
62
+ * @returns {object} the clip's model: edge (where the panel's edge goes, from the slot's centre line), height, screws, grams, margin, findings
63
+ */
64
+ export function panelClipModel(profile: string | object, o?: {
65
+ sheet: number;
66
+ face?: string;
67
+ thread?: string;
68
+ head?: "cap" | "button";
69
+ nut?: string;
70
+ load?: number;
71
+ grip?: number;
72
+ printer?: object;
73
+ material?: string | object;
74
+ given?: object;
75
+ }): object;
76
+ /**
77
+ * A panel clip's solid, from panelClipModel's model: on its side to print (pose 'print'), or fitted (pose 'fit').
78
+ * tongues: false leaves the tongue off; ops: booleans to join and cut with.
79
+ * @param {object} m @param {{ pose?: 'print' | 'fit', tongues?: boolean, ops?: object, printer?: object }} [o] @returns {object} a JSCAD geom3, with .model
80
+ */
81
+ export function panelClip(m: object, o?: {
82
+ pose?: "print" | "fit";
83
+ tongues?: boolean;
84
+ ops?: object;
85
+ printer?: object;
86
+ }): object;
87
+ /**
88
+ * A printed corner piece over a panel's corner where two beams meet: an L on both beams' faces, a screw into each slot
89
+ * past the crossing, a step as deep as the sheet over the panel's corner, rounded where the panel's corner sits.
90
+ * Its frame: the two slots' centre lines along x and y, crossing at the origin, the panel's corner toward +x +y, z out
91
+ * of the faces. It prints its top face down.
92
+ * @param {string | object} profile @param {{ sheet: number, face?: string, thread?: string, head?: 'cap' | 'button', nut?: string, load?: number, grip?: number, printer?: object, material?: string | object, given?: object }} o
93
+ * @returns {object} the corner's model
94
+ */
95
+ export function panelCornerModel(profile: string | object, o?: {
96
+ sheet: number;
97
+ face?: string;
98
+ thread?: string;
99
+ head?: "cap" | "button";
100
+ nut?: string;
101
+ load?: number;
102
+ grip?: number;
103
+ printer?: object;
104
+ material?: string | object;
105
+ given?: object;
106
+ }): object;
107
+ /**
108
+ * A panel corner's solid: top face down to print (pose 'print'), or fitted (pose 'fit').
109
+ * @param {object} m @param {{ pose?: 'print' | 'fit', tongues?: boolean, ops?: object, printer?: object }} [o] @returns {object} a JSCAD geom3, with .model
110
+ */
111
+ export function panelCorner(m: object, o?: {
112
+ pose?: "print" | "fit";
113
+ tongues?: boolean;
114
+ ops?: object;
115
+ printer?: object;
116
+ }): object;
117
+ /**
118
+ * A printed cover that closes a slot nothing uses: a thin flange on the face, a stem in the slot's opening and a barb
119
+ * under each lip, leaning 45° so it prints. It prints lying down, its flange on the bed.
120
+ * @param {string | object} profile @param {{ length: number, face?: string, printer?: object, material?: string | object, given?: object }} o
121
+ * @returns {object} its model
122
+ */
123
+ export function slotCoverModel(profile: string | object, o?: {
124
+ length: number;
125
+ face?: string;
126
+ printer?: object;
127
+ material?: string | object;
128
+ given?: object;
129
+ }): object;
130
+ /** A slot cover's solid: flange down to print (pose 'print'), or fitted (pose 'fit'). @param {object} m @param {{ pose?: 'print' | 'fit' }} [o] @returns {object} */
131
+ export function slotCover(m: object, o?: {
132
+ pose?: "print" | "fit";
133
+ }): object;
134
+ /**
135
+ * A printed edge that holds a sheet thinner than a slot's opening in the slot: a channel as wide as the opening less
136
+ * the fit, a groove as wide as the sheet with the fit, as deep as the lip and the cavity allow. Refused by name where
137
+ * the sheet leaves walls thinner than the printer's lines allow. It prints lying down, its groove up.
138
+ * @param {string | object} profile @param {{ sheet: number, length: number, face?: string, printer?: object, material?: string | object, given?: object }} o
139
+ * @returns {object} its model: depth (how far the sheet goes into the slot past the face)
140
+ */
141
+ export function panelEdgeModel(profile: string | object, o?: {
142
+ sheet: number;
143
+ length: number;
144
+ face?: string;
145
+ printer?: object;
146
+ material?: string | object;
147
+ given?: object;
148
+ }): object;
149
+ /** An in-slot panel edge's solid: floor down to print, or fitted. @param {object} m @param {{ pose?: 'print' | 'fit' }} [o] @returns {object} */
150
+ export function panelEdge(m: object, o?: {
151
+ pose?: "print" | "fit";
152
+ }): object;
153
+ /**
154
+ * A printed gasket strip for a door's gap: a hollow triangle of thin walls, its base taped to the door's inner face,
155
+ * as high as the gap and the squeeze, so the closing door presses it onto the beam's face. Its walls lean 30° from
156
+ * upright, so it prints lying on its base and folds rather than buckles. Best in PETG, which springs back where PLA creeps.
157
+ * @param {{ gap: number, length: number, squeeze?: number, printer?: object, material?: string | object }} o
158
+ * @returns {object} its model: strain (its walls' at the squeeze) against the plastic's limit
159
+ */
160
+ export function gasketStripModel(o?: {
161
+ gap: number;
162
+ length: number;
163
+ squeeze?: number;
164
+ printer?: object;
165
+ material?: string | object;
166
+ }): object;
167
+ /** A gasket strip's solid, base down (its print pose and, turned over onto the door, its fitted one). @param {object} m @returns {object} */
168
+ export function gasketStrip(m: object): object;
169
+ /**
170
+ * The sheets a panel is cut from, each with its density (from the maker's data sheet) and the thicknesses stockists
171
+ * commonly hold.
172
+ * @type {Record<string, { what: string, density: object, thicknesses: object }>}
173
+ */
174
+ export const SHEETS: Record<string, {
175
+ what: string;
176
+ density: object;
177
+ thicknesses: object;
178
+ }>;
179
+ export namespace PANEL_DEFAULTS {
180
+ namespace gap {
181
+ export { text as rule };
182
+ export { kind };
183
+ export { source };
184
+ export { CHECKED as checked };
185
+ export { unit };
186
+ export { value };
187
+ }
188
+ namespace grip { }
189
+ namespace load { }
190
+ namespace pitch { }
191
+ namespace corner { }
192
+ namespace walls { }
193
+ namespace barb { }
194
+ namespace lap { }
195
+ namespace squeeze { }
196
+ }
197
+ export function bendT(M: number, b: number, S: number, k: number): number;
198
+ export function bendMargin(M: number, b: number, h: number, S: number): number;
199
+ export function sideToFit(w: number): number[];
200
+ export { closing as closingFindings };
201
+ export type Panel = {
202
+ kind: "panel";
203
+ name: string;
204
+ title: string;
205
+ sheet: string;
206
+ thickness: number;
207
+ size: number[];
208
+ corner: number;
209
+ area: number;
210
+ grams: number;
211
+ holes: {
212
+ thread: string;
213
+ at: number[];
214
+ diameter: number;
215
+ }[];
216
+ findings: object[];
217
+ rests: object[];
218
+ };
219
+ declare const CHECKED: "2026-11-17";
220
+ declare function closing(m: any, { S, sizeText, marginText, pose }: {
221
+ S: any;
222
+ sizeText: any;
223
+ marginText: any;
224
+ pose: any;
225
+ }): void;