@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/CHANGELOG.md +23 -0
- package/README.md +1182 -21
- package/beam.d.mts +145 -0
- package/beam.mjs +201 -0
- package/bought.d.mts +60 -0
- package/bought.mjs +195 -0
- package/catalogue.d.mts +20 -0
- package/catalogue.mjs +268 -0
- package/cutlist.d.mts +88 -0
- package/cutlist.mjs +199 -0
- package/cutsheet.d.mts +23 -0
- package/cutsheet.mjs +118 -0
- package/door.d.mts +127 -0
- package/door.mjs +254 -0
- package/ends.d.mts +130 -0
- package/ends.mjs +290 -0
- package/fitting.d.mts +262 -0
- package/fitting.mjs +535 -0
- package/frames.d.mts +18 -9
- package/frames.mjs +43 -10
- package/guide.d.mts +140 -0
- package/guide.mjs +269 -0
- package/jig.d.mts +146 -0
- package/jig.mjs +332 -0
- package/join.d.mts +244 -0
- package/join.mjs +257 -0
- package/ops.d.mts +44 -0
- package/ops.mjs +324 -0
- package/package.json +75 -8
- package/panel.d.mts +225 -0
- package/panel.mjs +374 -0
- package/profile.d.mts +268 -0
- package/profile.mjs +462 -0
- package/rods.d.mts +195 -0
- package/rods.mjs +475 -0
- package/section.d.mts +43 -0
- package/section.mjs +140 -0
- package/services.d.mts +335 -0
- package/services.mjs +486 -0
- package/slotnut.d.mts +210 -0
- package/slotnut.mjs +394 -0
- package/square.d.mts +23 -0
- package/square.mjs +42 -0
- package/wheels.d.mts +141 -0
- package/wheels.mjs +337 -0
package/fitting.mjs
ADDED
|
@@ -0,0 +1,535 @@
|
|
|
1
|
+
// Printed fittings for joins: a corner bracket (with or without a brace) and flat plates over a joint (a gusset, L, T
|
|
2
|
+
// or cross, and a splice plate). Each is drawn from the profile's and the thread's rules, so one generator serves every
|
|
3
|
+
// profile: its width is the face's cell, its screws the thread a slot nut is made for, a tongue on each leg keys into
|
|
4
|
+
// the slot, sized from the slot's lip and the nut's own tongue with the printer's fit. Each is sized from a named load
|
|
5
|
+
// by finite elements on the part as drawn, to about twice the margin, and reports its grams, its stiffness and its
|
|
6
|
+
// margin. Each prints without supports, laid as its model says, with a plain first layer.
|
|
7
|
+
//
|
|
8
|
+
// A bracket's frame: x along the base leg (on b's face, away from a), y out of b's face (along a), z across, the corner
|
|
9
|
+
// line on the slot's centre at z = 0. Its print pose: laid on its side, z up from the bed (z = 0 to its width). A
|
|
10
|
+
// plate's frame: x along b, y along a, the joint's middle at the origin, z out of the beams' faces, its contact face at
|
|
11
|
+
// z = 0; it prints contact face up (its tongues on top). Units: mm, N, grams.
|
|
12
|
+
import jscad from '@jscad/modeling';
|
|
13
|
+
import { hole, holeModel, counterbore, fixingModel } from '@rulecad/fixings';
|
|
14
|
+
import { grid as feGrid, analyse } from '@rulecad/fea';
|
|
15
|
+
import x1c from '@rulecad/rules/x1c.json' with { type: 'json' };
|
|
16
|
+
import pla from '@rulecad/rules/pla.json' with { type: 'json' };
|
|
17
|
+
import petg from '@rulecad/rules/petg.json' with { type: 'json' };
|
|
18
|
+
import { profileModel } from './profile.mjs';
|
|
19
|
+
import { nutFor, NUT_KINDS } from './slotnut.mjs';
|
|
20
|
+
|
|
21
|
+
const { polygon, cuboid } = jscad.primitives, { extrudeLinear } = jscad.extrusions, { subtract, union, intersect } = jscad.booleans;
|
|
22
|
+
const { translate, transform } = jscad.transforms, { generalize } = jscad.modifiers, { measureVolume } = jscad.measurements;
|
|
23
|
+
const CHECKED = '2026-11-17';
|
|
24
|
+
const isNum = (x) => typeof x === 'number' && Number.isFinite(x);
|
|
25
|
+
const shown = (v) => { const s = v === undefined ? 'nothing' : JSON.stringify(v) ?? String(v); return s.length > 80 ? `${s.slice(0, 77)}...` : s; };
|
|
26
|
+
const mm = (x) => String(+Number(x).toFixed(2));
|
|
27
|
+
const r3 = (x) => +x.toFixed(3);
|
|
28
|
+
const up = (x, step) => Math.ceil(x / step - 1e-9) * step;
|
|
29
|
+
const finding = (level, text, code, extra = {}) => ({ level, text, code, ...extra });
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The rules the fittings add, each with what it rests on.
|
|
33
|
+
* @type {Record<string, { value: number, unit: string, rule: string, kind: string, source: string, checked: string }>}
|
|
34
|
+
*/
|
|
35
|
+
export const FITTING_DEFAULTS = {
|
|
36
|
+
margin: { value: 2, unit: '× load', rule: 'A printed fitting is sized so its peak stress at the design load is about half the plastic\'s strength', kind: 'default', source: 'The kit\'s standard for printed parts: sized from the load with about twice the margin', checked: CHECKED },
|
|
37
|
+
spread: { value: 1.5, unit: '× margin', rule: 'Sizing stops once the margin lies between the margin asked and this many times it, or the part is as thin as it may be: a thicker part only wastes plastic', kind: 'default', source: 'A working figure of @rulecad/frames: design small', checked: CHECKED },
|
|
38
|
+
load: { value: 100, unit: 'N', rule: 'The design load where none is given: 100 N across beam a at the fitting\'s screw, about a 10 kg mass pulled sideways', kind: 'default', source: 'A working figure of @rulecad/frames, so every fitting is sized and compared at one named load; give the load your frame carries', checked: CHECKED },
|
|
39
|
+
least: { value: 1, unit: '× major', rule: 'A leg or plate under a screw\'s head is no thinner than the thread\'s major diameter, so the head\'s clamp does not dish it', kind: 'estimate', source: 'A working margin of @rulecad/frames, to be checked by test (Frames 2.13)', checked: CHECKED },
|
|
40
|
+
round: { value: 1, unit: '× thickness', rule: 'A bracket\'s inside corner is rounded to this many times its leg\'s thickness, so the bend that loads it most has no sharp corner to start a crack', kind: 'estimate', source: 'A working figure of @rulecad/frames: the finite elements read the stress there', checked: CHECKED },
|
|
41
|
+
brace: { value: 2, unit: '× thickness', rule: 'A braced bracket fills its inside corner with a web this many times the leg\'s thickness along each leg, its two ends rounded half a thickness', kind: 'estimate', source: 'A working figure of @rulecad/frames', checked: CHECKED },
|
|
42
|
+
reach: { value: 1, unit: 'mm', rule: 'Room left between a screw\'s head and the nearest wall of the fitting, for the head to seat and the key to turn', kind: 'default', source: 'A working figure of @rulecad/frames', checked: CHECKED },
|
|
43
|
+
end: { value: 1, unit: '× hole', rule: 'Plastic from a screw\'s hole to the end of its leg or arm: the hole\'s diameter, and the head\'s radius with the reach where that is more', kind: 'estimate', source: 'A working margin of @rulecad/frames, to be checked by test (Frames 2.13)', checked: CHECKED },
|
|
44
|
+
pitch: { value: 1, unit: 'mm', rule: 'Between two screws on one arm of a plate: the larger of the head and the nut along the slot, and this much more', kind: 'default', source: 'A working figure of @rulecad/frames', checked: CHECKED },
|
|
45
|
+
floor: { value: 0.3, unit: 'mm', rule: 'A screw into a slot nut stops at least this far short of the slot\'s floor, as cad\'s fasten check holds it (FASTEN.floor): a fitting is made thick enough that a length sold engages its nut fully and stops there', kind: 'default', source: 'A working figure of @rulecad/cad, mirrored here so the fitting and the check agree', checked: CHECKED },
|
|
46
|
+
cells: { value: 3, unit: 'cells', rule: 'The finite elements put at least this many cubes across the thinnest leg or plate', kind: 'default', source: 'A working figure of @rulecad/frames; @rulecad/fea\'s README shows a member three cells thick reads within about 20% in bending', checked: CHECKED },
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/** The kinds of printed fitting, each with what it is and the join kinds that use it. */
|
|
50
|
+
export const FITTINGS = {
|
|
51
|
+
bracket: { what: 'a corner bracket: an L with a leg on each beam, a screw and slot nut in each, a brace across its inside corner where asked', joins: ['bracket'] },
|
|
52
|
+
gusset: { what: 'a flat plate over a joint, on the faces of both beams: L for a corner, T where a meets b along its length, cross where four arms meet', joins: ['gusset'] },
|
|
53
|
+
splice: { what: 'a flat plate along two beams that meet end to end', joins: ['splice'] },
|
|
54
|
+
};
|
|
55
|
+
const SHAPES = ['L', 'T', 'cross'];
|
|
56
|
+
|
|
57
|
+
// ---------- shared ----------
|
|
58
|
+
/** @internal A printer's rule set from what is given (x1c where nothing is). @param {string} what @param {any} p @returns {any} */
|
|
59
|
+
export const printerOf = (what, p) => {
|
|
60
|
+
if (p == null) return x1c;
|
|
61
|
+
if (typeof p !== 'object' || Array.isArray(p)) throw new Error(`${what}: printer is a rule set ({ name, rules }) or its values ({ fit: 0.2, layer: 0.2 }), not ${shown(p)}`);
|
|
62
|
+
return p.rules ? p : { name: p.name ?? 'the printer', rules: Object.fromEntries(Object.entries(p).filter(([, v]) => isNum(v)).map(([k, v]) => [k, { value: v, kind: 'given', source: 'given as a number' }])) };
|
|
63
|
+
};
|
|
64
|
+
/** @internal A printer's figure, x1c's where it has none. @param {any} pr @param {string} k @returns {number} */
|
|
65
|
+
export const pfig = (pr, k) => (isNum(pr.rules?.[k]?.value) ? pr.rules[k].value : x1c.rules[k].value);
|
|
66
|
+
const MATERIALS = { pla, petg };
|
|
67
|
+
/** @internal A plastic's rule set, pla or petg by name. @param {string} what @param {any} m @returns {any} */
|
|
68
|
+
export const materialOf = (what, m) => {
|
|
69
|
+
const set = typeof m === 'string' ? MATERIALS[m.toLowerCase()] : m?.rules ? m : null;
|
|
70
|
+
if (!set) throw new Error(`${what}: material is pla, petg or a material's rule set with strength, modulus and density (got ${shown(m)})`);
|
|
71
|
+
for (const k of ['strength', 'modulus', 'density']) if (!isNum(set.rules[k]?.value)) throw new Error(`${what}: ${set.name} has no ${k}`);
|
|
72
|
+
return set;
|
|
73
|
+
};
|
|
74
|
+
/** @internal Options refused by name. @param {string} what @param {any} o @param {string[]} keys */
|
|
75
|
+
export const options = (what, o, keys) => {
|
|
76
|
+
if (o == null || typeof o !== 'object' || Array.isArray(o)) throw new Error(`${what}: options are { ${keys.join(', ')} } (got ${shown(o)})`);
|
|
77
|
+
for (const k of Object.keys(o)) if (!keys.includes(k)) throw new Error(`${what}: no option "${k}": it takes ${keys.join(', ')}`);
|
|
78
|
+
};
|
|
79
|
+
/** @internal A profile's model by name or model. @param {string} what @param {any} p @param {any} given @returns {any} */
|
|
80
|
+
export const profileOf = (what, p, given) => {
|
|
81
|
+
if (p?.kind === 'profile') return p;
|
|
82
|
+
if (typeof p !== 'string') throw new Error(`${what}: the profile is a profile's name ('2020-misumi-hfs5') or its model (profileModel) (got ${shown(p)})`);
|
|
83
|
+
try { return profileModel(p, {}, given); } catch (e) { throw new Error(`${what}: ${String(e.message).replace(/^profileModel: /, '')}`); }
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// A face's slot, the cell's width across it, the thread its nuts are made for (the largest, where none is asked) and
|
|
87
|
+
// how deep a tongue may reach into its opening: the lip, less the tallest nut tongue of that thread, less the fit
|
|
88
|
+
/** @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} */
|
|
89
|
+
export function slotSide(what, p, face, thread, nut, fit, given) {
|
|
90
|
+
const m = /^(top|bottom|front|back)(?:\.(\d+))?$/.exec(String(face ?? ''));
|
|
91
|
+
if (!m) throw new Error(`${what}: face is top, bottom, front or back, with .2 for its second slot (got ${shown(face)})`);
|
|
92
|
+
const places = p.faces[m[1]], i = m[2] ? +m[2] : 1, place = places?.[i - 1];
|
|
93
|
+
if (!place) throw new Error(`${what}: ${p.name}'s ${m[1]} face has ${places?.length ?? 0} slots (got ${shown(face)})`);
|
|
94
|
+
if (!place.slot) throw new Error(`${what}: ${p.name}'s ${face} face is closed: a fitting's screws go into a slot nut, so it needs a face with a slot`);
|
|
95
|
+
const slot = p.slots[place.slot], cell = Math.abs(place.along[0]) > 0.5 ? p.pitch[0] : p.pitch[1];
|
|
96
|
+
if (nut != null && !NUT_KINDS.includes(nut)) throw new Error(`${what}: nut is a kind of slot nut, ${NUT_KINDS.join(', ')} (got ${shown(nut)})`);
|
|
97
|
+
const nutsOf = (t) => (nut ? [nut] : NUT_KINDS).map((kind) => { try { return nutFor(p, face, t, { kind, given }); } catch { return null; } }).filter(Boolean);
|
|
98
|
+
let t = thread, nuts;
|
|
99
|
+
if (t == null) {
|
|
100
|
+
for (const c of ['M10', 'M8', 'M6', 'M5', 'M4', 'M3']) { nuts = nutsOf(c); if (nuts.length) { t = c; break; } }
|
|
101
|
+
if (t == null) { try { nutFor(p, face, 'M5', { given }); } catch (e) { throw new Error(`${what}: ${String(e.message).replace(/^nutFor: /, '')}`); } }
|
|
102
|
+
} else nuts = nutsOf(t);
|
|
103
|
+
if (!nuts.length) { try { nutFor(p, face, t, { ...(nut ? { kind: nut } : {}), given }); } catch (e) { throw new Error(`${what}: ${String(e.message).replace(/^nutFor: /, '')}`); } }
|
|
104
|
+
const tallest = Math.max(...nuts.map((n) => n.tongueHeight ?? 0)), depth = r3(slot.lip - tallest - fit);
|
|
105
|
+
return { face: `${m[1]}${places.length > 1 ? `.${i}` : ''}`, slot, cell, thread: t, nuts, nut: nuts[0], tongue: { width: r3(slot.opening - 2 * fit), depth: Math.max(0, depth), under: tallest } };
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// A polygon's concave corners (counter-clockwise loop) rounded by r: an arc tangent to both edges
|
|
109
|
+
/** @internal A loop's concave corners rounded by r. @param {number[][]} loop @param {number} r @param {any} [only] @param {number} [steps] @returns {number[][]} */
|
|
110
|
+
export function roundConcave(loop, r, only = null, steps = 10) {
|
|
111
|
+
const pts = loop.filter((p, i) => { const q = loop[(i + 1) % loop.length]; return Math.hypot(p[0] - q[0], p[1] - q[1]) > 1e-9; }), out = [], n = pts.length;
|
|
112
|
+
for (let i = 0; i < n; i++) {
|
|
113
|
+
const a = pts[(i + n - 1) % n], p = pts[i], b = pts[(i + 1) % n];
|
|
114
|
+
const turn = (p[0] - a[0]) * (b[1] - p[1]) - (p[1] - a[1]) * (b[0] - p[0]);
|
|
115
|
+
if (turn >= -1e-12 || r <= 0 || (only && !only(i))) { out.push(p); continue; }
|
|
116
|
+
const u1 = [a[0] - p[0], a[1] - p[1]], u2 = [b[0] - p[0], b[1] - p[1]], l1 = Math.hypot(...u1), l2 = Math.hypot(...u2);
|
|
117
|
+
u1[0] /= l1; u1[1] /= l1; u2[0] /= l2; u2[1] /= l2;
|
|
118
|
+
const th = Math.acos(Math.max(-1, Math.min(1, u1[0] * u2[0] + u1[1] * u2[1]))), d = r / Math.tan(th / 2);
|
|
119
|
+
const bis = [u1[0] + u2[0], u1[1] + u2[1]], bl = Math.hypot(...bis), c = [p[0] + (bis[0] / bl) * (r / Math.sin(th / 2)), p[1] + (bis[1] / bl) * (r / Math.sin(th / 2))];
|
|
120
|
+
const t1 = [p[0] + u1[0] * d, p[1] + u1[1] * d], t2 = [p[0] + u2[0] * d, p[1] + u2[1] * d];
|
|
121
|
+
const a0 = Math.atan2(t1[1] - c[1], t1[0] - c[0]); let da = Math.atan2(t2[1] - c[1], t2[0] - c[0]) - a0;
|
|
122
|
+
while (da > Math.PI) da -= 2 * Math.PI; while (da < -Math.PI) da += 2 * Math.PI;
|
|
123
|
+
for (let s = 0; s <= steps; s++) out.push([c[0] + r * Math.cos(a0 + (da * s) / steps), c[1] + r * Math.sin(a0 + (da * s) / steps)]);
|
|
124
|
+
}
|
|
125
|
+
return out;
|
|
126
|
+
}
|
|
127
|
+
const area2 = (pts) => pts.reduce((s, p, i) => s + p[0] * pts[(i + 1) % pts.length][1] - pts[(i + 1) % pts.length][0] * p[1], 0) / 2;
|
|
128
|
+
/** @internal A loop turned counter-clockwise. @param {number[][]} pts @returns {number[][]} */
|
|
129
|
+
export const ccw = (pts) => (area2(pts) > 0 ? pts : [...pts].reverse());
|
|
130
|
+
function inPoly(pts, x, y) {
|
|
131
|
+
let c = false;
|
|
132
|
+
for (let i = 0, j = pts.length - 1; i < pts.length; j = i++) { const [xi, yi] = pts[i], [xj, yj] = pts[j]; if ((yi > y) !== (yj > y) && x < ((xj - xi) * (y - yi)) / (yj - yi) + xi) c = !c; }
|
|
133
|
+
return c;
|
|
134
|
+
}
|
|
135
|
+
// A prism: a loop in (u, v) extruded h along w, the frame's axes named by a cyclic turn (so the solid stays outside out)
|
|
136
|
+
const TURNS = { xyz: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0], yzx: [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0], zxy: [0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0] };
|
|
137
|
+
// A boolean's result, its vertices snapped and coplanar faces merged and triangulated: the unions of the tongues with
|
|
138
|
+
// the body otherwise leave seams that a slicer reads as gaps
|
|
139
|
+
const clean = (g) => generalize({ snap: true, triangulate: true }, g);
|
|
140
|
+
// The parts joined and the cutters taken away: by JSCAD, cleaned, or by the booleans handed in ({ union, subtract }: a
|
|
141
|
+
// workspace's Manifold, whose result is watertight for the overlap check that follows)
|
|
142
|
+
/** @internal Parts joined, cutters taken away. @param {any[]} parts @param {any[]} cuts @param {any} ops @returns {any} */
|
|
143
|
+
export const combine = (parts, cuts, ops) => (ops ? ops.subtract(ops.union(...parts), ...cuts) : clean(subtract(union(...parts), ...cuts)));
|
|
144
|
+
const prism = (loop, h, turn = 'xyz', at = [0, 0, 0]) => translate(at, transform([...TURNS[turn], 0, 0, 0, 1], extrudeLinear({ height: h }, polygon({ points: ccw(loop) }))));
|
|
145
|
+
|
|
146
|
+
// A tongue's section across its slot: n out of the contact face (0 to depth), a across from a0 to a1; its side toward
|
|
147
|
+
// -a leans 45° where it prints over the bed (lean), so it needs no support; its roots rounded by the fit, sunk into
|
|
148
|
+
// the body by `sink` so the union is one solid
|
|
149
|
+
/** @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[][]} */
|
|
150
|
+
export function tongueLoop(a0, a1, depth, lean, root, sink = 0.5) {
|
|
151
|
+
const pts = [[-sink, a0 - 2 * root], [0, a0 - 2 * root], [0, a0], [depth, a0 + (lean ? depth : 0)], [depth, a1], [0, a1], [0, a1 + 2 * root], [-sink, a1 + 2 * root]];
|
|
152
|
+
return roundConcave(ccw(pts), root, null, 6);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// A tongue's stretch [lo, hi] along its slot, broken round each screw (at) by gap each side: the screw passes the slot's
|
|
156
|
+
// opening clear of it, and the hole stays a closed hole through the leg. Pieces shorter than `least` are left out.
|
|
157
|
+
function pieces(lo, hi, at, gap, least = 2) {
|
|
158
|
+
const out = []; let from = lo;
|
|
159
|
+
for (const c of [...at].sort((a, b) => a - b)) { if (c + gap < lo || c - gap > hi) continue; if (c - gap - from >= least) out.push([from, c - gap]); from = Math.max(from, c + gap); }
|
|
160
|
+
if (hi - from >= least) out.push([from, hi]);
|
|
161
|
+
return out;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// ---------- finite elements on the part as drawn ----------
|
|
165
|
+
const MEMO = new Map();
|
|
166
|
+
/**
|
|
167
|
+
* A fitting bent by its load, by finite elements on cubes (@rulecad/fea): cells in the part where inside() holds at
|
|
168
|
+
* their sample points, held where held() holds, the force shared over the nodes where loaded() holds. Read: the
|
|
169
|
+
* loaded nodes' mean movement along the force, and the peak von Mises stress away from the screws (the clamp's own
|
|
170
|
+
* edge is where the model, not the part, is stiff), lifted from a cell's centre to the surface.
|
|
171
|
+
* @param {{ box: { lo: number[], hi: number[] }, inside: (p: number[]) => boolean, held: (p: number[]) => boolean, loaded: (p: number[]) => boolean, near: (p: number[]) => boolean,
|
|
172
|
+
* force: number[], thin: number, E: number, nu: number, key: string, budget?: number, cache?: { get: (k: string) => any, set: (k: string, v: any) => void } }} o
|
|
173
|
+
* @returns {{ deflection: number, stress: number, cell: number, across: number, cells: number }}
|
|
174
|
+
*/
|
|
175
|
+
export function fittingFE(o) {
|
|
176
|
+
const key = o.key, kept = o.cache?.get(key), hit = kept ?? MEMO.get(key);
|
|
177
|
+
if (hit) { if (o.cache && !kept) o.cache.set(key, hit); return hit; }
|
|
178
|
+
const { lo, hi } = o.box, span = hi.map((x, k) => x - lo[k]), budget = o.budget ?? 12000;
|
|
179
|
+
let cell = o.thin / FITTING_DEFAULTS.cells.value;
|
|
180
|
+
const count = (h) => span.reduce((t, x) => t * Math.max(1, Math.ceil(x / h)), 1);
|
|
181
|
+
while (count(cell) > budget) cell *= 1.08;
|
|
182
|
+
const n = span.map((x) => Math.max(1, Math.ceil(x / cell))), g = feGrid({ nx: n[0], ny: n[1], nz: n[2], h: cell });
|
|
183
|
+
const density = new Float64Array(g.cells), q = [0.25, 0.75];
|
|
184
|
+
for (let k = 0; k < n[2]; k++) for (let j = 0; j < n[1]; j++) for (let i = 0; i < n[0]; i++) {
|
|
185
|
+
let s = 0;
|
|
186
|
+
for (const a of q) for (const b of q) for (const c of q) if (o.inside([lo[0] + (i + a) * cell, lo[1] + (j + b) * cell, lo[2] + (k + c) * cell])) s++;
|
|
187
|
+
density[(k * n[1] + j) * n[0] + i] = s / 8;
|
|
188
|
+
}
|
|
189
|
+
const onPart = new Uint8Array(g.nodes);
|
|
190
|
+
for (let e = 0; e < g.cells; e++) if (density[e] >= 0.5) for (let c = 0; c < 8; c++) onPart[g.edof[e * 24 + 3 * c] / 3] = 1;
|
|
191
|
+
const fixed = new Uint8Array(g.dofs), load = new Float64Array(g.dofs), loadedNodes = [];
|
|
192
|
+
for (let k = 0; k <= n[2]; k++) for (let j = 0; j <= n[1]; j++) for (let i = 0; i <= n[0]; i++) {
|
|
193
|
+
const id = g.node(i, j, k); if (!onPart[id]) continue;
|
|
194
|
+
const p = [lo[0] + i * cell, lo[1] + j * cell, lo[2] + k * cell];
|
|
195
|
+
if (o.held(p)) for (let d = 0; d < 3; d++) fixed[3 * id + d] = 1;
|
|
196
|
+
else if (o.loaded(p)) loadedNodes.push(id);
|
|
197
|
+
}
|
|
198
|
+
if (!loadedNodes.length || !fixed.some((x) => x)) throw new Error(`fittingFE: the grid of ${mm(cell)} mm cubes found ${loadedNodes.length ? 'nothing held' : 'nothing loaded'}: the fitting is too small for it`);
|
|
199
|
+
for (const id of loadedNodes) for (let d = 0; d < 3; d++) load[3 * id + d] = o.force[d] / loadedNodes.length;
|
|
200
|
+
// (conjugate gradients: on grids this small, a few thousand cubes, they take under a second where fea's multigrid and
|
|
201
|
+
// direct solvers take fifteen or more)
|
|
202
|
+
const a = analyse({ grid: g, density, material: { E: o.E, nu: o.nu }, fixed, loads: [load], method: 'cg' });
|
|
203
|
+
const F = Math.hypot(...o.force), dir = o.force.map((x) => x / F), u = a.u[0];
|
|
204
|
+
const deflection = loadedNodes.reduce((t, id) => t + u[3 * id] * dir[0] + u[3 * id + 1] * dir[1] + u[3 * id + 2] * dir[2], 0) / loadedNodes.length;
|
|
205
|
+
const across = Math.max(2, Math.round(o.thin / cell)), lift = across / (across - 1);
|
|
206
|
+
let stress = 0;
|
|
207
|
+
for (let e = 0; e < g.cells; e++) {
|
|
208
|
+
if (density[e] < 0.5) continue;
|
|
209
|
+
const i = e % n[0], j = Math.floor(e / n[0]) % n[1], k = Math.floor(e / (n[0] * n[1])), p = [lo[0] + (i + 0.5) * cell, lo[1] + (j + 0.5) * cell, lo[2] + (k + 0.5) * cell];
|
|
210
|
+
if (o.near(p)) continue;
|
|
211
|
+
stress = Math.max(stress, a.stress[0][e] * lift);
|
|
212
|
+
}
|
|
213
|
+
const out = { deflection: r3(Math.abs(deflection)), stress: r3(stress), cell: r3(cell), across, cells: g.cells };
|
|
214
|
+
MEMO.set(key, out); o.cache?.set(key, out);
|
|
215
|
+
return out;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// Size a part's thickness from its load: from a start, thicker by the square root of the shortfall (stress goes with
|
|
219
|
+
// the square of a bending member's thickness) until the margin is met, thinner while it is more than spread times it
|
|
220
|
+
function sizeBy(start, least, step, solve, want) {
|
|
221
|
+
let t = Math.max(least, up(start, step)), r = solve(t), tries = 0;
|
|
222
|
+
const spread = FITTING_DEFAULTS.spread.value;
|
|
223
|
+
while (tries++ < 8) {
|
|
224
|
+
if (r.margin < want - 1e-9) { const next = up(t * Math.max(1.05, Math.sqrt(want / r.margin)), step); t = next; r = solve(t); continue; }
|
|
225
|
+
if (r.margin > spread * want && t > least + 1e-9) { const next = Math.max(least, up(t * Math.sqrt((1.5 * want) / r.margin), step)); if (next >= t - 1e-9) break; const s = solve(next); if (s.margin < want - 1e-9) break; t = next; r = s; continue; }
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
return r;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// Where a screw's tip may stop under the face for a slot nut, as cad's fasten check holds it: past the nut's thread
|
|
232
|
+
// (from its tongue, lip less the tongue's height, down through its body) by the thread it needs (a hex nut's height,
|
|
233
|
+
// or all the nut has), and the floor's margin short of the slot's floor. A fitting t thick takes a screw of a sold
|
|
234
|
+
// length L where t + lo <= L <= t + hi.
|
|
235
|
+
function tipWindow(sd, thread) {
|
|
236
|
+
const n = sd.nut, tongue = n.tongueHeight ?? 0, from = sd.slot.lip - tongue, has = tongue + n.height;
|
|
237
|
+
let hex = has; try { hex = fixingModel(thread).figures.nut_height?.value ?? has; } catch {}
|
|
238
|
+
return { lo: r3(from + Math.min(has, hex)), hi: r3(sd.slot.cavityDepth - FITTING_DEFAULTS.floor.value) };
|
|
239
|
+
}
|
|
240
|
+
const soldOf = (thread) => { try { return [...(fixingModel(thread).figures.lengths?.value ?? [])].sort((a, b) => a - b); } catch { return []; } };
|
|
241
|
+
// The least thickness from t up, in steps, at which every side takes a sold screw; with the lengths, or null
|
|
242
|
+
/** @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} */
|
|
243
|
+
export function sold(t, step, sides, thread) {
|
|
244
|
+
const lengths = soldOf(thread), wins = sides.map((sd) => tipWindow(sd, thread));
|
|
245
|
+
if (!lengths.length) return null;
|
|
246
|
+
for (let k = 0; k <= 80; k++) {
|
|
247
|
+
const tt = r3(t + k * step), got = wins.map((w) => lengths.find((L) => L >= tt + w.lo - 1e-9 && L <= tt + w.hi + 1e-9) ?? null);
|
|
248
|
+
if (got.every((L) => L != null)) return { t: tt, lengths: got, windows: wins };
|
|
249
|
+
}
|
|
250
|
+
return null;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// The figures a screw's head and hole give a fitting
|
|
254
|
+
/** @internal A screw's head and hole figures. @param {string} what @param {string} thread @param {string} head @param {any} pr @returns {any} */
|
|
255
|
+
export function screwOf(what, thread, head, pr) {
|
|
256
|
+
let fx;
|
|
257
|
+
try { fx = fixingModel(thread); } catch (e) { throw new Error(`${what}: thread: ${String(e.message).replace(/^\w+: /, '')}`); }
|
|
258
|
+
const fig = head === 'cap' ? 'head' : `${head}_head`, dk = fx.figures[fig]?.value;
|
|
259
|
+
if (!isNum(dk)) throw new Error(`${what}: head is cap or button (got ${shown(head)}): ${thread} has no ${fig}`);
|
|
260
|
+
const hd = holeModel(thread, { kind: 'clearance', printer: pr }).diameter;
|
|
261
|
+
return { thread: fx.thread, major: fx.major, head, dk, hd };
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// ---------- a corner bracket ----------
|
|
265
|
+
/**
|
|
266
|
+
* @typedef {{ kind: 'fitting', fitting: 'bracket', name: string, title: string, profile: string, other: string, faces: { b: string, a: string }, thread: string, head: string,
|
|
267
|
+
* brace: boolean, width: number, thickness: number, leg: number, screwAt: number, round: number, braceSize: number, hole: number, tongues: { b: object, a: object },
|
|
268
|
+
* 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[] },
|
|
269
|
+
* stiffness: { linear: number, bending: number, kind: string, rule: string }, stress: number, margin: number, deflection: number, fe: object,
|
|
270
|
+
* volume: number, grams: number, material: string, printer: string, section: number[][], findings: object[], rests: object[] }} Bracket
|
|
271
|
+
*/
|
|
272
|
+
/**
|
|
273
|
+
* A printed corner bracket for a profile, from its rules: the width of the face's cell, the thread its slot nuts are
|
|
274
|
+
* made for, a tongue on each leg that keys into the slot, and legs sized from a named load by finite elements to about
|
|
275
|
+
* twice the margin. Laid on its side it prints without supports, its first layer the whole L.
|
|
276
|
+
* @param {string | object} profile b's profile (the beam whose face the base leg lies on), by name or model
|
|
277
|
+
* @param {{ other?: string | object, face?: string, otherFace?: string, thread?: string, head?: 'cap' | 'button', nut?: string, brace?: boolean, load?: number, width?: number,
|
|
278
|
+
* printer?: object, material?: string | object, given?: object, cache?: object }} [o]
|
|
279
|
+
* other: a's profile, for the upright leg (default the same); face, otherFace: the faces the legs lie on (default top);
|
|
280
|
+
* thread: the screws' (default the largest a slot nut is made for in both slots); head: cap (default) or button; nut: a
|
|
281
|
+
* kind of slot nut, for the tongue's depth (default the tallest tongue of any kind); brace: fill the inside corner with
|
|
282
|
+
* a web; load: the design load in N, across beam a at the upright's screw (default 100); width: across the bracket
|
|
283
|
+
* (default the face's cell); cache: { get, set } for the finite elements' results
|
|
284
|
+
* @returns {Bracket}
|
|
285
|
+
*/
|
|
286
|
+
export function bracketModel(profile, o = {}) {
|
|
287
|
+
const what = 'bracketModel';
|
|
288
|
+
options(what, o, ['other', 'face', 'otherFace', 'thread', 'head', 'nut', 'brace', 'load', 'width', 'printer', 'material', 'given', 'cache']);
|
|
289
|
+
const given = o.given ?? {}, pb = profileOf(what, profile, given), pa = o.other == null ? pb : profileOf(what, o.other, given);
|
|
290
|
+
const pr = printerOf(what, o.printer), mat = materialOf(what, o.material ?? 'pla'), fit = pfig(pr, 'fit'), layer = pfig(pr, 'layer');
|
|
291
|
+
if (o.brace != null && typeof o.brace !== 'boolean') throw new Error(`${what}: brace is true or false (got ${shown(o.brace)})`);
|
|
292
|
+
if (o.load != null && !(isNum(o.load) && o.load > 0)) throw new Error(`${what}: load is the design load in N, above 0: the force across beam a at the bracket's screw (got ${shown(o.load)})`);
|
|
293
|
+
if (o.width != null && !(isNum(o.width) && o.width > 0)) throw new Error(`${what}: width is across the bracket in mm, above 0 (got ${shown(o.width)})`);
|
|
294
|
+
if (o.thread != null && typeof o.thread !== 'string') throw new Error(`${what}: thread is a thread as written, such as M5 (got ${shown(o.thread)})`);
|
|
295
|
+
const head = o.head ?? 'cap';
|
|
296
|
+
if (!['cap', 'button'].includes(head)) throw new Error(`${what}: head is cap or button (got ${shown(o.head)})`);
|
|
297
|
+
let sb = slotSide(what, pb, o.face ?? 'top', o.thread, o.nut, fit, given);
|
|
298
|
+
const sa = slotSide(what, pa, o.otherFace ?? 'top', o.thread ?? sb.thread, o.nut, fit, given);
|
|
299
|
+
if (sa.thread !== sb.thread) sb = slotSide(what, pb, o.face ?? 'top', sa.thread, o.nut, fit, given);
|
|
300
|
+
const sc = screwOf(what, sb.thread, head, pr), brace = !!o.brace, F = o.load ?? FITTING_DEFAULTS.load.value, E = mat.rules.modulus.value, nu = mat.rules.poisson?.value ?? 0.36, S = mat.rules.strength.value;
|
|
301
|
+
const w = r3(o.width ?? Math.min(sb.cell, sa.cell)), c = w / 2, want = FITTING_DEFAULTS.margin.value, least = r3(Math.max(FITTING_DEFAULTS.least.value * sc.major, 2 * layer));
|
|
302
|
+
if (w < sc.dk + 2 * FITTING_DEFAULTS.reach.value) throw new Error(`${what}: a bracket ${mm(w)} mm wide leaves no room round ${sc.thread}'s ${mm(sc.dk)} mm head: ${mm(sc.dk + 2 * FITTING_DEFAULTS.reach.value)} mm or more`);
|
|
303
|
+
const reach = FITTING_DEFAULTS.reach.value, endBy = Math.max(FITTING_DEFAULTS.end.value * sc.hd, sc.dk / 2 + reach);
|
|
304
|
+
// the screws stand where an unbraced bracket's would, clear of its round; a brace fills the corner past them, with a
|
|
305
|
+
// pocket round each head down to the leg for the head and the key
|
|
306
|
+
const geom = (t) => {
|
|
307
|
+
const rf = FITTING_DEFAULTS.round.value * t, h = brace ? FITTING_DEFAULTS.brace.value * t : 0, rb = brace ? t / 2 : rf;
|
|
308
|
+
const s = r3(t + rf + sc.dk / 2 + reach), L = r3(up(Math.max(s + endBy, t + h + rb + 2 * reach), 0.5));
|
|
309
|
+
const corner = brace ? [[t + h, t], [t, t + h]] : [[t, t]];
|
|
310
|
+
const section = roundConcave([[0, 0], [L, 0], [L, t], ...corner, [t, L], [0, L]], rb, null, 12).map(([x, y]) => [r3(x), r3(y)]);
|
|
311
|
+
return { t, rf: r3(rb), h: r3(h), s, L, section, pocket: brace ? r3(sc.dk / 2 + reach) : 0 };
|
|
312
|
+
};
|
|
313
|
+
const dB = sb.tongue.depth, dA = sa.tongue.depth;
|
|
314
|
+
const solve = (t) => {
|
|
315
|
+
const G = geom(t), { s, L, section } = G, r = sc.hd / 2, grip = sc.dk / 2;
|
|
316
|
+
const tw = (side) => side.tongue.width;
|
|
317
|
+
const inside = ([x, y, z]) => {
|
|
318
|
+
if (z < 0 || z > w) return false;
|
|
319
|
+
if (Math.hypot(x - s, z - c) < r && y < t + 1) return false; // the base leg's hole
|
|
320
|
+
if (Math.hypot(y - s, z - c) < r && x < t + 1) return false; // the upright's
|
|
321
|
+
if (G.pocket && ((Math.hypot(x - s, z - c) < G.pocket && y > t) || (Math.hypot(y - s, z - c) < G.pocket && x > t))) return false; // the heads' pockets in the brace
|
|
322
|
+
if (inPoly(section, x, y)) return true;
|
|
323
|
+
if (y < 0 && y > -dB && x >= 0 && x <= L && z >= c - tw(sb) / 2 - y && z <= c + tw(sb) / 2) return true;
|
|
324
|
+
return x < 0 && x > -dA && y >= 0 && y <= L && z >= c - tw(sa) / 2 - x && z <= c + tw(sa) / 2;
|
|
325
|
+
};
|
|
326
|
+
const held = ([x, y, z]) => Math.hypot(x - s, z - c) <= grip && y <= t + 1e-6;
|
|
327
|
+
const loaded = ([x, y, z]) => Math.hypot(y - s, z - c) <= grip && x <= t + 1e-6;
|
|
328
|
+
const near = ([x, y, z]) => Math.hypot(x - s, z - c) <= grip + 1.5 * (t / 3) || Math.hypot(y - s, z - c) <= grip + 1.5 * (t / 3);
|
|
329
|
+
const key = JSON.stringify(['bracket', 1, section, G.pocket, w, c, r, grip, dB, dA, tw(sb), tw(sa), F, E, nu]);
|
|
330
|
+
const fe = fittingFE({ key, box: { lo: [-dA, -dB, 0], hi: [L, L, w] }, inside, held, loaded, near, force: [-F, 0, 0], thin: t, E, nu, cache: o.cache });
|
|
331
|
+
return { G, fe, margin: S / Math.max(fe.stress, 1e-9) };
|
|
332
|
+
};
|
|
333
|
+
// the start: the base leg bent at its root by F at the upright's screw, s from the corner, a stress raiser of 1.5
|
|
334
|
+
const start = Math.sqrt((want * 6 * F * 1.5 * (2.5 * least + sc.dk / 2)) / (w * S));
|
|
335
|
+
let { G, fe, margin } = sizeBy(start, least, layer, solve, want);
|
|
336
|
+
// thick enough that a length sold engages each slot nut fully and stops short of the slot's floor
|
|
337
|
+
const fits = sold(G.t, layer, [sb, sa], sb.thread), sized = G.t;
|
|
338
|
+
if (fits && fits.t > G.t + 1e-9) ({ G, fe, margin } = solve(fits.t));
|
|
339
|
+
const { t, s, L } = G;
|
|
340
|
+
const linear = r3(F / Math.max(fe.deflection, 1e-9)), bending = Math.round((F * s * s) / Math.max(fe.deflection, 1e-9));
|
|
341
|
+
const out = [], name = `bracket-${pb.name.replace(/^profile-/, '')}${pa !== pb ? `-${pa.name.replace(/^profile-/, '')}` : ''}-${sb.thread.toLowerCase()}${brace ? '-braced' : ''}`;
|
|
342
|
+
const model = { kind: 'fitting', fitting: 'bracket', name, title: `printed corner bracket${brace ? ', braced,' : ''} for ${pb.name.replace(/^profile-/, '')}${pa !== pb ? ` to ${pa.name.replace(/^profile-/, '')}` : ''}, ${sb.thread}`,
|
|
343
|
+
profile: pb.name, other: pa.name, faces: { b: sb.face, a: sa.face }, thread: sb.thread, head, brace, width: w, thickness: r3(t), leg: L, screwAt: s, round: G.rf, braceSize: G.h, pocket: G.pocket, hole: sc.hd,
|
|
344
|
+
tongues: { b: { slot: sb.slot.name, ...sb.tongue, nut: sb.nut.name }, a: { slot: sa.slot.name, ...sa.tongue, nut: sa.nut.name } },
|
|
345
|
+
screws: [{ leg: 'b', thread: sb.thread, head, grip: r3(t), at: [s, t, 0], axis: [0, -1, 0], nut: sb.nut.name, nutKind: sb.nut.nutKind, length: fits?.lengths[0] ?? null }, { leg: 'a', thread: sb.thread, head, grip: r3(t), at: [t, s, 0], axis: [-1, 0, 0], nut: sa.nut.name, nutKind: sa.nut.nutKind, length: fits?.lengths[1] ?? null }],
|
|
346
|
+
sized: r3(sized),
|
|
347
|
+
load: { force: F, what: `${F} N across beam a at the upright's screw, ${mm(s)} mm from the corner, opening or closing it`, at: [0, s, 0], direction: [-1, 0, 0] },
|
|
348
|
+
stiffness: { linear, bending, kind: 'derived', rule: `By finite elements on the bracket as drawn, its base leg held under its screw's head and ${F} N on the upright's: ${linear} N/mm at the screw, and ${bending} N mm/rad about the corner (the force times the screw's distance squared, over its movement). The slot nuts, the lips and the screws\' own give are not in it, so the joint is softer: an estimate until the joint rig (issue 264) measures it` },
|
|
349
|
+
stress: fe.stress, margin: r3(margin), deflection: fe.deflection, fe, volume: 0, grams: 0, material: mat.name, printer: pr.name, section: G.section, findings: out,
|
|
350
|
+
rests: [{ name: `${mat.name}.strength`, value: S }, { name: `${mat.name}.modulus`, value: E }, { name: `${pr.name}.fit`, value: fit }, ...['margin', 'least', 'round', 'brace', 'reach', 'end', 'cells'].map((k) => ({ name: `FITTING_DEFAULTS.${k}`, value: FITTING_DEFAULTS[k].value, kind: FITTING_DEFAULTS[k].kind }))] };
|
|
351
|
+
const solid = bracketSolid(model, pr);
|
|
352
|
+
model.volume = r3(measureVolume(solid)); model.grams = r3((model.volume * mat.rules.density.value) / 1000);
|
|
353
|
+
addFindings(model, { least, S, F, sc, sides: { b: sb, a: sa }, pr, pose: 'laid on its side, the whole L on the bed', fits });
|
|
354
|
+
return model;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
function addFindings(m, { least, S, F, sc, sides, pr, pose, fits }) {
|
|
358
|
+
const out = m.findings, want = FITTING_DEFAULTS.margin.value, thinnest = m.sized <= least + 1e-9, thicker = m.thickness > m.sized + 1e-9;
|
|
359
|
+
const why = `${thinnest ? `as thin as ${sc.thread} lets it be, ${mm(least)} mm` : `sized from the load, ${mm(m.sized)} mm`}${thicker ? `, then thickened so a length sold fits: ${[...new Set(fits.lengths)].map((L) => `${sc.thread}x${L}`).join(' and ')} engages its slot nut fully and stops short of the slot's floor` : ''}`;
|
|
360
|
+
if (!fits) out.push(finding('warn', `no ${sc.thread} ${sc.head} screw sold engages its slot nut fully and stops short of the slot's floor through a fitting up to 16 mm thicker: the screw's length is the fasten check's to choose`, 'fitting.screw', { values: { thickness: m.thickness } }));
|
|
361
|
+
else out.push(finding('pass', `${[...new Set(fits.lengths)].map((L) => `${sc.thread}x${L} ${sc.head}`).join(' and ')}: through ${mm(m.thickness)} mm of fitting, ${[...new Set(fits.windows.map((w, i) => `its tip ${mm(fits.lengths[i] - m.thickness)} mm under the face, between ${mm(w.lo)} (its nut's thread engaged) and ${mm(w.hi)} (the slot's floor less ${FITTING_DEFAULTS.floor.value} mm)`))].join('; ')}`, 'fitting.screw', { values: { lengths: fits.lengths, windows: fits.windows } }));
|
|
362
|
+
out.push(finding('info', `${m.title}: ${mm(m.thickness)} mm thick (${why}), ${m.fitting === 'bracket' ? `legs ${mm(m.leg)} mm, the screws ${mm(m.screwAt)} mm from the corner` : `arms ${mm(m.arm)} mm from the joint, ${m.screws.length} screws`}, ${mm(m.width)} mm wide`, 'fitting.size', { values: { thickness: m.thickness, width: m.width, ...(m.leg ? { leg: m.leg } : { arm: m.arm }) } }));
|
|
363
|
+
for (const [k, sd] of Object.entries(sides)) {
|
|
364
|
+
if (!sd) continue;
|
|
365
|
+
out.push(finding(sd.tongue.depth > 0 ? 'pass' : 'info', sd.tongue.depth > 0 ? `the ${k === 'b' ? (m.fitting === 'bracket' ? 'base leg' : 'arms on b') : (m.fitting === 'bracket' ? 'upright' : 'arms on a')}'s tongue keys into ${sd.slot.name}: ${mm(sd.tongue.width)} mm wide (the ${mm(sd.slot.opening)} mm opening less ${pr.name}'s fit each side), ${mm(sd.tongue.depth)} mm deep (the ${mm(sd.slot.lip)} mm lip less the ${mm(sd.tongue.under)} mm a ${sd.thread} slot nut's tongue rises into it, less the fit)` : `${sd.slot.name}'s ${mm(sd.slot.lip)} mm lip leaves no room for a tongue over a ${sd.thread} slot nut's ${mm(sd.tongue.under)} mm tongue: the ${k} side lies flat on the face`, 'fitting.tongue', { values: { ...sd.tongue }, refs: { slot: sd.slot.name, nut: sd.nut.name } }));
|
|
366
|
+
}
|
|
367
|
+
const fe = m.fe, ok = m.margin >= want - 1e-9;
|
|
368
|
+
out.push(finding(ok ? 'pass' : 'fail', `under ${m.load.what}, the stress peaks at ${mm(fe.stress)} MPa away from the screws, ${mm(m.margin)} times under ${m.material.toUpperCase()}'s ${S} MPa (${ok ? `within the ${want}× asked` : `short of the ${want}× asked`}); it moves ${mm(fe.deflection)} mm there (finite elements on ${mm(fe.cell)} mm cubes, ${fe.across} across its thickness: an estimate, as cells this coarse read a part 10 to 20% stiffer than it is)`, 'fitting.margin', { values: { load: F, stress: fe.stress, strength: S, margin: m.margin, deflection: fe.deflection, cell: fe.cell } }));
|
|
369
|
+
out.push(finding('info', `its own stiffness by finite elements: ${m.stiffness.linear} N/mm at the loaded screw, ${m.stiffness.bending} N mm/rad about the joint. The slot nuts, the lips and the screws are not in it, so the joint is softer: an estimate until the joint rig (issue 264) measures it`, 'fitting.stiffness', { values: { linear: m.stiffness.linear, bending: m.stiffness.bending } }));
|
|
370
|
+
// each screw pulls its nut with about the load: the nut's rating, and the head bearing on the plastic
|
|
371
|
+
// (a plate's screws are in shear across the slot: its lips and the clamp hold that, which the rig measures)
|
|
372
|
+
const each = F;
|
|
373
|
+
for (const [k, sd] of Object.entries(m.fitting === 'bracket' ? sides : {})) {
|
|
374
|
+
if (!sd) continue;
|
|
375
|
+
const hold = sd.nut.hold?.value, bearing = r3(each / ((Math.PI / 4) * (sc.dk ** 2 - sc.hd ** 2))), crush = r3(S / bearing);
|
|
376
|
+
if (isNum(hold)) out.push(finding(hold >= want * each ? 'pass' : 'fail', `${sd.nut.name} holds ${hold} N (${sd.nut.hold.kind}), ${mm(hold / each)} times the ${mm(each)} N its screw pulls`, 'fitting.nut', { values: { hold, pull: each }, refs: { nut: sd.nut.name, side: k } }));
|
|
377
|
+
out.push(finding(crush >= want ? 'pass' : 'fail', `a ${sc.thread} ${sc.head} head bears on the plastic at ${mm(bearing)} MPa under ${mm(each)} N, ${mm(crush)} times under its ${S} MPa`, 'fitting.bearing', { values: { bearing, margin: crush } }));
|
|
378
|
+
}
|
|
379
|
+
out.push(finding('info', `it is drawn to print ${pose}: a plain first layer, its screw holes ${m.fitting === 'bracket' ? 'lying on their side as teardrops' : 'upright'}, ${m.fitting === 'bracket' ? 'each tongue\'s lower side leaning 45°' : 'its tongues on top'}, no supports (printcheck's check() reads the solid)`, 'fitting.printable', { values: { pose } }));
|
|
380
|
+
out.push(finding('info', `it weighs ${mm(m.grams)} g of ${m.material} (${mm(m.volume)} mm³)`, 'fitting.mass', { values: { grams: m.grams, volume: m.volume } }));
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
function bracketSolid(m, pr, tongues = true, ops = null) {
|
|
384
|
+
const w = m.width, c = w / 2, t = m.thickness, L = m.leg, s = m.screwAt, root = pfig(pr, 'fit');
|
|
385
|
+
const parts = [extrudeLinear({ height: w }, polygon({ points: ccw(m.section) }))];
|
|
386
|
+
const tb = m.tongues.b, ta = m.tongues.a;
|
|
387
|
+
// the base leg's tongue under y = 0, along x: its loop in (y, z) as (-n, a), extruded along x (turn yzx)
|
|
388
|
+
const gap = m.hole / 2 + 1;
|
|
389
|
+
if (tongues && tb.depth > 0) for (const [p, q] of pieces(root, L - root, [s], gap)) parts.push(prism(tongueLoop(c - tb.width / 2, c + tb.width / 2, tb.depth, true, root).map(([n, a]) => [-n, a]), q - p, 'yzx', [p, 0, 0]));
|
|
390
|
+
// the upright's under x = 0, along y: its loop in (z, x) as (a, -n), extruded along y (turn zxy)
|
|
391
|
+
if (tongues && ta.depth > 0) for (const [p, q] of pieces(root, L - root, [s], gap)) parts.push(prism(tongueLoop(c - ta.width / 2, c + ta.width / 2, ta.depth, true, root).map(([n, a]) => [a, -n]), q - p, 'zxy', [0, p, 0]));
|
|
392
|
+
const fx = { printer: pr }, h = m.braceSize, deep = (d) => t + d + 2, r = m.hole / 2;
|
|
393
|
+
// through each leg a teardrop hole, its roof cut flat a fiftieth over the round (a bridge of 0.8 of its radius, which
|
|
394
|
+
// the printer spans), so the head's seat is whole out to the head's edge; braced, a teardrop pocket for the head and
|
|
395
|
+
// the key through the brace above it
|
|
396
|
+
const flat = (g) => intersect(g, cuboid({ size: [4 * L, 4 * L, c + 1.02 * r + 1], center: [L / 2, L / 2, (c + 1.02 * r - 1) / 2] }));
|
|
397
|
+
const holes = [flat(hole(m.thread, { kind: 'clearance', into: '-y', depth: deep(tb.depth), at: [s, t + 1, c], ...fx })), flat(hole(m.thread, { kind: 'clearance', into: '-x', depth: deep(ta.depth), at: [t + 1, s, c], ...fx }))];
|
|
398
|
+
// (each pocket kept above its leg's face, so the round-topped hole alone passes the leg under the head)
|
|
399
|
+
const above = (g, k) => intersect(g, cuboid({ size: [4 * L, 4 * L, 4 * L], center: k === 'y' ? [L / 2, t + 2 * L, c] : [t + 2 * L, L / 2, c] }));
|
|
400
|
+
if (m.brace) holes.push(above(counterbore(m.thread, { head: m.head, depth: h + 1, diameter: 2 * m.pocket, length: h + 1 + deep(tb.depth), into: '-y', at: [s, t + h + 1, c], ...fx }), 'y'),
|
|
401
|
+
above(counterbore(m.thread, { head: m.head, depth: h + 1, diameter: 2 * m.pocket, length: h + 1 + deep(ta.depth), into: '-x', at: [t + h + 1, s, c], ...fx }), 'x'));
|
|
402
|
+
return combine(parts, holes, ops);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* A printed corner bracket's solid, from bracketModel's model or its arguments: laid on its side to print (pose
|
|
407
|
+
* '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
|
|
408
|
+
* line on the slots' centre). tongues: false leaves them off (the body alone, which may not overlap a beam's envelope);
|
|
409
|
+
* ops: booleans to join and cut with ({ union, subtract }, as @rulecad/shapes' ops gives), JSCAD's where left out.
|
|
410
|
+
* @param {object | string} m a Bracket, or bracketModel's profile @param {object} [o] bracketModel's options, pose, tongues and ops
|
|
411
|
+
* @returns {object} a JSCAD geom3, with .model
|
|
412
|
+
*/
|
|
413
|
+
export function bracket(m, o = {}) {
|
|
414
|
+
const { pose = 'print', tongues = true, ops = null, ...rest } = o ?? {};
|
|
415
|
+
if (!['print', 'fit'].includes(pose)) throw new Error(`bracket: pose is print or fit (got ${shown(pose)})`);
|
|
416
|
+
const model = m?.fitting === 'bracket' ? m : bracketModel(m, rest), solid = bracketSolid(model, printerOf('bracket', rest.printer), tongues !== false, ops);
|
|
417
|
+
return Object.assign(pose === 'fit' ? translate([0, 0, -model.width / 2], solid) : solid, { model });
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
// ---------- flat plates: gussets and splice plates ----------
|
|
421
|
+
/**
|
|
422
|
+
* @typedef {{ kind: 'fitting', fitting: 'gusset' | 'splice', shape: string, name: string, title: string, profile: string, face: string, thread: string, head: string,
|
|
423
|
+
* 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 }[],
|
|
424
|
+
* 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
|
|
425
|
+
*/
|
|
426
|
+
/**
|
|
427
|
+
* A printed flat plate over a joint: a gusset (shape L, T or cross) or a splice plate (shape splice), on the faces of
|
|
428
|
+
* beams of one profile that lie in one plane. Each arm runs along a beam's slot with `count` screws into slot nuts and
|
|
429
|
+
* a tongue that keys into the slot; the inside corners are rounded half an arm's width. Sized from the named load (in
|
|
430
|
+
* the plate's plane, across beam a at its farthest screw, b's screws held) by finite elements to about twice the
|
|
431
|
+
* margin. It prints contact face up, its tongues on top.
|
|
432
|
+
* @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,
|
|
433
|
+
* printer?: object, material?: string | object, given?: object, cache?: object }} [o] count: screws on each arm (default 2)
|
|
434
|
+
* @returns {Plate}
|
|
435
|
+
*/
|
|
436
|
+
export function plateModel(profile, o = {}) {
|
|
437
|
+
const what = 'plateModel';
|
|
438
|
+
options(what, o, ['shape', 'face', 'thread', 'head', 'nut', 'count', 'load', 'width', 'printer', 'material', 'given', 'cache']);
|
|
439
|
+
const given = o.given ?? {}, p = profileOf(what, profile, given), shape = o.shape ?? 'L';
|
|
440
|
+
if (![...SHAPES, 'splice'].includes(shape)) throw new Error(`${what}: shape is L, T, cross or splice (got ${shown(o.shape)})`);
|
|
441
|
+
const count = o.count ?? 2;
|
|
442
|
+
if (!(Number.isInteger(count) && count >= 1 && count <= 6)) throw new Error(`${what}: count is the screws on each arm, a whole number from 1 to 6 (got ${shown(o.count)})`);
|
|
443
|
+
if (o.load != null && !(isNum(o.load) && o.load > 0)) throw new Error(`${what}: load is the design load in N, above 0 (got ${shown(o.load)})`);
|
|
444
|
+
if (o.width != null && !(isNum(o.width) && o.width > 0)) throw new Error(`${what}: width is an arm's, in mm, above 0 (got ${shown(o.width)})`);
|
|
445
|
+
if (o.thread != null && typeof o.thread !== 'string') throw new Error(`${what}: thread is a thread as written, such as M5 (got ${shown(o.thread)})`);
|
|
446
|
+
const head = o.head ?? 'cap';
|
|
447
|
+
if (!['cap', 'button'].includes(head)) throw new Error(`${what}: head is cap or button (got ${shown(o.head)})`);
|
|
448
|
+
const pr = printerOf(what, o.printer), mat = materialOf(what, o.material ?? 'pla'), fit = pfig(pr, 'fit'), layer = pfig(pr, 'layer');
|
|
449
|
+
const sd = slotSide(what, p, o.face ?? 'front', o.thread, o.nut, fit, given), sc = screwOf(what, sd.thread, head, pr);
|
|
450
|
+
const F = o.load ?? FITTING_DEFAULTS.load.value, E = mat.rules.modulus.value, nu = mat.rules.poisson?.value ?? 0.36, S = mat.rules.strength.value, want = FITTING_DEFAULTS.margin.value;
|
|
451
|
+
const w = r3(o.width ?? sd.cell), half = w / 2, R = r3(half), reach = FITTING_DEFAULTS.reach.value;
|
|
452
|
+
if (w < sc.dk + 2 * reach) throw new Error(`${what}: an arm ${mm(w)} mm wide leaves no room round ${sc.thread}'s ${mm(sc.dk)} mm head: ${mm(sc.dk + 2 * reach)} mm or more`);
|
|
453
|
+
const nutLen = Math.max(...sd.nuts.map((n) => n.length)), pitch = r3(up(Math.max(sc.dk, nutLen) + FITTING_DEFAULTS.pitch.value, 0.5));
|
|
454
|
+
// the first screw on an arm from the joint's edge: clear of the inside round's start (about 0.3 of its radius along the
|
|
455
|
+
// arm's middle) and then of the head and the nut
|
|
456
|
+
const first = r3(up((shape === 'splice' ? 0 : R * 0.3) + Math.max(sc.dk / 2 + reach, nutLen / 2 + fit), 0.5)), endBy = Math.max(FITTING_DEFAULTS.end.value * sc.hd, sc.dk / 2 + reach);
|
|
457
|
+
const arm = r3(up(first + (count - 1) * pitch + endBy, 0.5)); // from the joint's edge
|
|
458
|
+
// the arms, each a direction from the joint's middle: b's along x, a's along y; a splice's both along x, from x = 0
|
|
459
|
+
const dirs = shape === 'splice' ? [[1, 0, 'b'], [-1, 0, 'a']] : [[1, 0, 'b'], ...(shape !== 'L' ? [[-1, 0, 'b']] : []), [0, 1, 'a'], ...(shape === 'cross' ? [[0, -1, 'a']] : [])];
|
|
460
|
+
const reachOf = shape === 'splice' ? arm : half + arm;
|
|
461
|
+
const outline = (() => {
|
|
462
|
+
if (shape === 'splice') return [[-arm, -half], [arm, -half], [arm, half], [-arm, half]];
|
|
463
|
+
const E2 = (d) => (dirs.some(([x, y]) => x === d[0] && y === d[1]) ? reachOf : half), xp = E2([1, 0]), xm = E2([-1, 0]), yp = E2([0, 1]), ym = E2([0, -1]);
|
|
464
|
+
const pts = [[-xm, -half], ...(ym > half ? [[-half, -half], [-half, -ym], [half, -ym], [half, -half]] : []), [xp, -half], [xp, half], ...(yp > half ? [[half, half], [half, yp], [-half, yp], [-half, half]] : []), [-xm, half]];
|
|
465
|
+
return roundConcave(pts, R, null, 12).map(([x, y]) => [r3(x), r3(y)]);
|
|
466
|
+
})();
|
|
467
|
+
const screws = [];
|
|
468
|
+
for (const [dx, dy, leg] of dirs) for (let k = 0; k < count; k++) { const d = (shape === 'splice' ? 0 : half) + first + k * pitch; screws.push({ leg, at: [r3(dx * d), r3(dy * d)] }); }
|
|
469
|
+
const solve = (t) => {
|
|
470
|
+
const r = sc.hd / 2, grip = sc.dk / 2, far = Math.max(...screws.filter((x) => x.leg === 'a').map((x) => Math.hypot(...x.at))), loadAt = screws.filter((x) => x.leg === 'a' && Math.abs(Math.hypot(...x.at) - far) < 1e-6);
|
|
471
|
+
const along = shape === 'splice' ? [0, 1] : [1, 0]; // across beam a, in the plane
|
|
472
|
+
const inside = ([x, y, z]) => z >= 0 && z <= t && inPoly(outline, x, y) && !screws.some((q) => Math.hypot(x - q.at[0], y - q.at[1]) < r);
|
|
473
|
+
const held = ([x, y]) => screws.some((q) => q.leg === 'b' && Math.hypot(x - q.at[0], y - q.at[1]) <= grip);
|
|
474
|
+
const loaded = ([x, y]) => loadAt.some((q) => Math.hypot(x - q.at[0], y - q.at[1]) <= grip);
|
|
475
|
+
const near = ([x, y]) => screws.some((q) => Math.hypot(x - q.at[0], y - q.at[1]) <= grip + t / 2);
|
|
476
|
+
const xs = outline.map((q) => q[0]), ys = outline.map((q) => q[1]);
|
|
477
|
+
const key = JSON.stringify(['plate', 1, outline, screws, t, r, grip, F, E, nu]);
|
|
478
|
+
const fe = fittingFE({ key, box: { lo: [Math.min(...xs), Math.min(...ys), 0], hi: [Math.max(...xs), Math.max(...ys), t] }, inside, held, loaded, near, force: [F * along[0], F * along[1], 0], thin: t, E, nu, cache: o.cache });
|
|
479
|
+
return { t, fe, margin: S / Math.max(fe.stress, 1e-9), far };
|
|
480
|
+
};
|
|
481
|
+
const least = r3(Math.max(FITTING_DEFAULTS.least.value * sc.major, 2 * layer));
|
|
482
|
+
let r = sizeBy(least, least, layer, solve, want);
|
|
483
|
+
const fits = sold(r.t, layer, [sd], sd.thread), sizedT = r.t;
|
|
484
|
+
if (fits && fits.t > r.t + 1e-9) r = solve(fits.t);
|
|
485
|
+
const { t, fe, margin, far } = r;
|
|
486
|
+
const linear = r3(F / Math.max(fe.deflection, 1e-9)), bending = Math.round((F * far * far) / Math.max(fe.deflection, 1e-9));
|
|
487
|
+
const fitting = shape === 'splice' ? 'splice' : 'gusset', short = p.name.replace(/^profile-/, '');
|
|
488
|
+
const model = { kind: 'fitting', fitting, shape, name: `${fitting === 'splice' ? 'splice' : `gusset-${shape.toLowerCase()}`}-${short}-${sd.thread.toLowerCase()}${count !== 2 ? `-x${count}` : ''}`,
|
|
489
|
+
title: `printed ${fitting === 'splice' ? 'splice plate' : `${shape} gusset`} for ${short}, ${sd.thread}, ${count} screw${count > 1 ? 's' : ''} an arm`,
|
|
490
|
+
profile: p.name, face: sd.face, thread: sd.thread, head, width: w, thickness: r3(t), arm, round: R, hole: sc.hd, outline, count, pitch,
|
|
491
|
+
tongues: dirs.map(([dx, dy, leg]) => ({ leg, along: [dx, dy], slot: sd.slot.name, ...sd.tongue, nut: sd.nut.name })),
|
|
492
|
+
screws: screws.map((q) => ({ leg: q.leg, thread: sd.thread, head, grip: r3(t), at: [q.at[0], q.at[1], 0], axis: [0, 0, -1], nut: sd.nut.name, nutKind: sd.nut.nutKind, length: fits?.lengths[0] ?? null })), sized: r3(sizedT),
|
|
493
|
+
load: { force: F, what: `${F} N in the plate's plane across beam a at its farthest screw, ${mm(far)} mm from the joint, b's screws held`, at: [...(screws.find((q) => q.leg === 'a' && Math.abs(Math.hypot(...q.at) - far) < 1e-6)?.at ?? [0, 0]), 0], direction: shape === 'splice' ? [0, 1, 0] : [1, 0, 0] },
|
|
494
|
+
stiffness: { linear, bending, kind: 'derived', rule: `By finite elements on the plate as drawn, b's screws held under their heads and ${F} N in its plane on a's farthest: ${linear} N/mm there, and ${bending} N mm/rad about the joint (the force times that screw's distance squared, over its movement). The slot nuts, the lips and the screws' own give are not in it, so the joint is softer: an estimate until the joint rig (issue 264) measures it` },
|
|
495
|
+
stress: fe.stress, margin: r3(margin), deflection: fe.deflection, fe, volume: 0, grams: 0, material: mat.name, printer: pr.name, findings: [],
|
|
496
|
+
rests: [{ name: `${mat.name}.strength`, value: S }, { name: `${mat.name}.modulus`, value: E }, { name: `${pr.name}.fit`, value: fit }, ...['margin', 'least', 'reach', 'end', 'pitch', 'cells'].map((k) => ({ name: `FITTING_DEFAULTS.${k}`, value: FITTING_DEFAULTS[k].value, kind: FITTING_DEFAULTS[k].kind }))] };
|
|
497
|
+
const solid = plateSolid(model, pr);
|
|
498
|
+
model.volume = r3(measureVolume(solid)); model.grams = r3((model.volume * mat.rules.density.value) / 1000);
|
|
499
|
+
addFindings(model, { least, S, F, sc, sides: { b: sd }, pr, pose: 'contact face up, its head side on the bed', fits });
|
|
500
|
+
return model;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
function plateSolid(m, pr, tongues = true, ops = null) {
|
|
504
|
+
// (drawn turned over about x: its y runs the other way, so a's arm lies along -y here and along +y once fitted)
|
|
505
|
+
const t = m.thickness, half = m.width / 2, root = pfig(pr, 'fit'), parts = [extrudeLinear({ height: t }, polygon({ points: ccw(m.outline.map(([x, y]) => [x, -y])) }))];
|
|
506
|
+
// its tongues stand on its top (the contact face, in print), along each arm's slot line; in its print frame the
|
|
507
|
+
// plate is turned over, so the tongue of an arm reaches to the arm's end from the joint's far edge (or from 0 for a splice)
|
|
508
|
+
for (const tg of m.tongues) {
|
|
509
|
+
if (!(tg.depth > 0) || !tongues) continue;
|
|
510
|
+
const from = m.fitting === 'splice' ? 0 : -half, to = (m.fitting === 'splice' ? 0 : half) + m.arm - root, loop = tongueLoop(-tg.width / 2, tg.width / 2, tg.depth, false, root);
|
|
511
|
+
const [dx, ny] = tg.along, dy = -ny, start = tg.leg === 'a' && m.fitting !== 'splice' ? half + root : from;
|
|
512
|
+
// along x: the loop in (y, z) = (a, t + n), extruded along x (yzx); along y: in (z, x) = (t + n, a), extruded along y (zxy)
|
|
513
|
+
const d = dx !== 0 ? dx : dy, [lo, hi] = d > 0 ? [start, to] : [-to, -start];
|
|
514
|
+
const at = m.screws.filter((q) => (dx !== 0 ? Math.abs(q.at[1]) < 1e-6 : Math.abs(q.at[0]) < 1e-6)).map((q) => (dx !== 0 ? q.at[0] : -q.at[1]));
|
|
515
|
+
for (const [p, q] of pieces(lo, hi, at, m.hole / 2 + 1)) parts.push(dx !== 0 ? prism(loop.map(([n, a]) => [a, t + n]), q - p, 'yzx', [p, 0, 0]) : prism(loop.map(([n, a]) => [t + n, a]), q - p, 'zxy', [0, p, 0]));
|
|
516
|
+
}
|
|
517
|
+
const fx = { printer: pr }, holes = m.screws.map((q) => hole(m.thread, { kind: 'clearance', into: '+z', depth: t + 4, at: [q.at[0], -q.at[1], -1], ...fx, depth: t + 2 + Math.max(0, ...m.tongues.map((g) => g.depth)) }));
|
|
518
|
+
return combine(parts, holes, ops);
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
/**
|
|
522
|
+
* A printed plate's solid, from plateModel's model or its arguments: contact face up to print (pose 'print', the
|
|
523
|
+
* default; its frame's z then runs down into the beams, so the plate is turned over), or in its fitted frame (pose
|
|
524
|
+
* '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
|
|
525
|
+
* them off; ops: booleans to join and cut with, as bracket's.
|
|
526
|
+
* @param {object | string} m a Plate, or plateModel's profile @param {object} [o] plateModel's options, pose, tongues and ops
|
|
527
|
+
* @returns {object} a JSCAD geom3, with .model
|
|
528
|
+
*/
|
|
529
|
+
export function plate(m, o = {}) {
|
|
530
|
+
const { pose = 'print', tongues = true, ops = null, ...rest } = o ?? {};
|
|
531
|
+
if (!['print', 'fit'].includes(pose)) throw new Error(`plate: pose is print or fit (got ${shown(pose)})`);
|
|
532
|
+
const model = m?.fitting === 'gusset' || m?.fitting === 'splice' ? m : plateModel(m, rest), solid = plateSolid(model, printerOf('plate', rest.printer), tongues !== false, ops);
|
|
533
|
+
// fitted: the contact face (z = t in print) at z = 0 and the plate above it: turned over about x
|
|
534
|
+
return Object.assign(pose === 'fit' ? transform([1, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, model.thickness, 1], solid) : solid, { model });
|
|
535
|
+
}
|
package/frames.d.mts
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
1
|
+
export * from "./profile.mjs";
|
|
2
|
+
export { beamSheet } from "./cutsheet.mjs";
|
|
3
|
+
export { squareness } from "./square.mjs";
|
|
4
|
+
export { beamModel, beam, beamAnchor, printable } from "./beam.mjs";
|
|
5
|
+
export { OPS, OP_DEFAULTS } from "./ops.mjs";
|
|
6
|
+
export { JOINS, JOIN_STIFFNESS, JOIN_SCALE, JOIN_TAP, JOIN_SET, joinRuleSet, joinStiffness, joinModel, boughtStiffness } from "./join.mjs";
|
|
7
|
+
export { BOUGHT_KINDS, boughtFittings, boughtFittingModel, boughtFitting, printedCost } from "./bought.mjs";
|
|
8
|
+
export { CUT_DEFAULTS, beamMarks, packBars, cutList, cutListText } from "./cutlist.mjs";
|
|
9
|
+
export { slotNutModel, nutFit, slotNut, nutFor, carrierModel, carrier, CARRIER_DEFAULTS, NUT_KINDS } from "./slotnut.mjs";
|
|
10
|
+
export { FITTINGS, FITTING_DEFAULTS, bracketModel, bracket, plateModel, plate, fittingFE } from "./fitting.mjs";
|
|
11
|
+
export { SHEETS, PANEL_DEFAULTS, panelModel, panel, panelClipModel, panelClip, panelCornerModel, panelCorner, slotCoverModel, slotCover, panelEdgeModel, panelEdge, gasketStripModel, gasketStrip } from "./panel.mjs";
|
|
12
|
+
export { DOOR_DEFAULTS, hingeModel, hinge, handleModel, handle, latchModel, latch, magnetCatchModel, magnetCatch } from "./door.mjs";
|
|
13
|
+
export { SERVICE_DEFAULTS, FANS, DIN_RAIL, deviceMountModel, deviceMount, fanMountModel, fanMount, dragChainEndModel, dragChainEnd, dinRailAdapterModel, dinRailAdapter, cableClipModel, cableClip, runClips, tieAnchorModel, tieAnchor, spoolHolderModel, spoolHolder } from "./services.mjs";
|
|
14
|
+
export { GUIDE_KINDS, GUIDE_DEFAULTS, rails, railModel, rail, carriage, carriageMargin, guideFit, railTerms, railJigModel, railJig } from "./guide.mjs";
|
|
15
|
+
export { WHEEL_DEFAULTS, wheels, trackFit, wheelsModel, wheelPlate, vWheel, wheelMargin, sliderModel, slider } from "./wheels.mjs";
|
|
16
|
+
export { ROD_DEFAULTS, rodsLayout, rodHolderModel, rodHolder, motorPlateModel, motorPlate, rodCarriageModel, rodCarriage, endstopMountModel, endstopMount, rodMargin } from "./rods.mjs";
|
|
17
|
+
export { END_DEFAULTS, endCapModel, endCap, footModel, foot, levellingFootModel, levellingFoot, castorPlateModel, castorPlate, stackingFootModel, stackingFoot } from "./ends.mjs";
|
|
18
|
+
export { JIG_KINDS, JIG_DEFAULTS, drillGuideModel, drillGuide, tapGuideModel, tapGuide, lengthStopModel, lengthStop, squareCornerModel, squareCorner } from "./jig.mjs";
|