@rulecad/frames 0.0.1 → 0.1.7
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/README.md +555 -21
- package/beam.d.mts +142 -0
- package/beam.mjs +182 -0
- package/catalogue.d.mts +20 -0
- package/catalogue.mjs +239 -0
- package/cutlist.d.mts +88 -0
- package/cutlist.mjs +199 -0
- package/cutsheet.d.mts +23 -0
- package/cutsheet.mjs +118 -0
- package/frames.d.mts +6 -9
- package/frames.mjs +16 -10
- package/ops.d.mts +44 -0
- package/ops.mjs +319 -0
- package/package.json +39 -6
- package/profile.d.mts +268 -0
- package/profile.mjs +462 -0
- package/section.d.mts +43 -0
- package/section.mjs +140 -0
- package/slotnut.d.mts +207 -0
- package/slotnut.mjs +389 -0
package/section.mjs
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
// What a section is worth as a beam, from its outline alone: area, centroid and second moments by the polygon
|
|
2
|
+
// formulas, and the torsion constant by solving Prandtl's stress function over a raster of the section. Loops are
|
|
3
|
+
// closed outlines as [x, y] points in mm: the outside counter-clockwise, each hole clockwise (signedArea says which).
|
|
4
|
+
|
|
5
|
+
/** Twice-signed area's half: positive for a counter-clockwise loop. @param {number[][]} loop @returns {number} */
|
|
6
|
+
export function signedArea(loop) {
|
|
7
|
+
let a = 0;
|
|
8
|
+
for (let i = 0, n = loop.length; i < n; i++) { const [x0, y0] = loop[i], [x1, y1] = loop[(i + 1) % n]; a += x0 * y1 - x1 * y0; }
|
|
9
|
+
return a / 2;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Area, centroid and second moments of area of a section, by the polygon (Green's theorem) formulas, summed over its
|
|
14
|
+
* loops so that a clockwise hole takes away. The second moments are about axes through the centroid, parallel to x and y.
|
|
15
|
+
* @param {number[][][]} loops
|
|
16
|
+
* @returns {{ area: number, centroid: [number, number], inertiaX: number, inertiaY: number, inertiaXY: number }} mm², mm, mm⁴
|
|
17
|
+
*/
|
|
18
|
+
export function polygonSection(loops) {
|
|
19
|
+
let a = 0, sx = 0, sy = 0, ixx = 0, iyy = 0, ixy = 0;
|
|
20
|
+
for (const loop of loops) for (let i = 0, n = loop.length; i < n; i++) {
|
|
21
|
+
const [x0, y0] = loop[i], [x1, y1] = loop[(i + 1) % n], c = x0 * y1 - x1 * y0;
|
|
22
|
+
a += c; sx += (x0 + x1) * c; sy += (y0 + y1) * c;
|
|
23
|
+
ixx += (y0 * y0 + y0 * y1 + y1 * y1) * c; iyy += (x0 * x0 + x0 * x1 + x1 * x1) * c;
|
|
24
|
+
ixy += (x0 * y1 + 2 * x0 * y0 + 2 * x1 * y1 + x1 * y0) * c;
|
|
25
|
+
}
|
|
26
|
+
const area = a / 2;
|
|
27
|
+
if (!(area > 0)) throw new Error(`polygonSection: the loops enclose no area (${area}): the outside runs counter-clockwise and holes clockwise`);
|
|
28
|
+
const cx = sx / (6 * area), cy = sy / (6 * area);
|
|
29
|
+
return { area, centroid: [cx, cy], inertiaX: ixx / 12 - area * cy * cy, inertiaY: iyy / 12 - area * cx * cx, inertiaXY: ixy / 24 - area * cx * cy };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// The cells of a raster whose centres lie inside a loop, row by row (even-odd along each row)
|
|
33
|
+
function fill(loop, x0, y0, h, nx, ny, mark) {
|
|
34
|
+
for (let j = 0; j < ny; j++) {
|
|
35
|
+
const y = y0 + (j + 0.5) * h, xs = [];
|
|
36
|
+
for (let i = 0, n = loop.length; i < n; i++) {
|
|
37
|
+
const [ax, ay] = loop[i], [bx, by] = loop[(i + 1) % n];
|
|
38
|
+
if ((ay <= y && by > y) || (by <= y && ay > y)) xs.push(ax + ((y - ay) * (bx - ax)) / (by - ay));
|
|
39
|
+
}
|
|
40
|
+
xs.sort((p, q) => p - q);
|
|
41
|
+
for (let k = 0; k + 1 < xs.length; k += 2) {
|
|
42
|
+
const from = Math.max(0, Math.ceil((xs[k] - x0) / h - 0.5)), to = Math.min(nx - 1, Math.floor((xs[k + 1] - x0) / h - 0.5));
|
|
43
|
+
for (let i = from; i <= to; i++) mark(j * nx + i);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The torsion constant of a section (St Venant's J, written It on a maker's sheet): torque = G J × twist per length.
|
|
50
|
+
* Prandtl's stress function φ is solved on a raster of square cells: ∇²φ = −2 in the material, φ = 0 on the outside,
|
|
51
|
+
* and φ one unknown constant over each hole, fixed by the hole's own balance (the flow of φ into a hole is twice its
|
|
52
|
+
* area). Then J = 2 ∫φ dA over material and holes. That is why a closed tube is stiff and a slotted one is not: an
|
|
53
|
+
* open slot is outside (φ = 0 along it), a closed hole carries φ across itself.
|
|
54
|
+
* @param {number[][][]} loops the outside counter-clockwise, holes clockwise
|
|
55
|
+
* @param {{ cells?: number, tolerance?: number }} [o] cells: about how many raster cells cover the section's bounding
|
|
56
|
+
* box (40 000: a 20 mm section in 0.1 mm cells); tolerance: where the solver stops, as a share of the load
|
|
57
|
+
* @returns {{ torsion: number, cell: number, cells: number, iterations: number }} mm⁴, the cell's side in mm
|
|
58
|
+
*/
|
|
59
|
+
export function torsionConstant(loops, o = {}) {
|
|
60
|
+
const { cells = 40000, tolerance = 1e-7 } = o;
|
|
61
|
+
if (!(Number.isFinite(cells) && cells >= 100)) throw new Error(`torsionConstant: cells is a number of at least 100 (got ${JSON.stringify(cells)})`);
|
|
62
|
+
let xa = Infinity, xb = -Infinity, ya = Infinity, yb = -Infinity;
|
|
63
|
+
for (const loop of loops) for (const [x, y] of loop) { xa = Math.min(xa, x); xb = Math.max(xb, x); ya = Math.min(ya, y); yb = Math.max(yb, y); }
|
|
64
|
+
if (!(xb > xa && yb > ya)) throw new Error('torsionConstant: the loops have no extent');
|
|
65
|
+
const h = Math.sqrt(((xb - xa) * (yb - ya)) / cells), nx = Math.ceil((xb - xa) / h), ny = Math.ceil((yb - ya) / h);
|
|
66
|
+
const x0 = (xa + xb) / 2 - (nx * h) / 2, y0 = (ya + yb) / 2 - (ny * h) / 2;
|
|
67
|
+
// what each cell is: 0 outside, 1 material, -(k + 1) hole k. Outer loops first, then holes, then islands inside holes
|
|
68
|
+
const what = new Int32Array(nx * ny), order = loops.map((loop, k) => ({ loop, k, a: signedArea(loop) })).sort((p, q) => Math.abs(q.a) - Math.abs(p.a));
|
|
69
|
+
let holes = 0;
|
|
70
|
+
for (const { loop, a } of order) { const tag = a > 0 ? 1 : -(++holes); fill(loop, x0, y0, h, nx, ny, (c) => { what[c] = tag; }); }
|
|
71
|
+
// one unknown per material cell, one per hole
|
|
72
|
+
const dof = new Int32Array(nx * ny).fill(-1); let n = 0;
|
|
73
|
+
for (let c = 0; c < what.length; c++) if (what[c] === 1) dof[c] = n++;
|
|
74
|
+
const material = n, holeCells = new Float64Array(holes);
|
|
75
|
+
for (let c = 0; c < what.length; c++) if (what[c] < 0) { dof[c] = material + (-what[c] - 1); holeCells[-what[c] - 1] += 1; }
|
|
76
|
+
n = material + holes;
|
|
77
|
+
if (!material) throw new Error('torsionConstant: no raster cell lies in the section: use more cells');
|
|
78
|
+
// The five-point Laplacian with the wall half a cell from a cell's centre (so a wall weighs 2). Each link is listed once
|
|
79
|
+
const la = [], lb = [], lw = [], diag = new Float64Array(n), b = new Float64Array(n);
|
|
80
|
+
const link = (i, j, w) => { la.push(i); lb.push(j); lw.push(w); diag[i] += w; if (j >= 0) diag[j] += w; };
|
|
81
|
+
for (let j = 0; j < ny; j++) for (let i = 0; i < nx; i++) {
|
|
82
|
+
const c = j * nx + i, t = what[c];
|
|
83
|
+
if (t !== 1) continue;
|
|
84
|
+
b[dof[c]] = 2 * h * h;
|
|
85
|
+
for (const [di, dj] of [[1, 0], [0, 1], [-1, 0], [0, -1]]) {
|
|
86
|
+
const ii = i + di, jj = j + dj, inside = ii >= 0 && ii < nx && jj >= 0 && jj < ny, tn = inside ? what[jj * nx + ii] : 0;
|
|
87
|
+
if (tn === 1) { if (di + dj > 0) link(dof[c], dof[jj * nx + ii], 1); } // (material to material: once, from the lower cell)
|
|
88
|
+
else if (tn === 0) link(dof[c], -1, 2);
|
|
89
|
+
else link(dof[c], dof[jj * nx + ii], 2);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
for (let k = 0; k < holes; k++) { b[material + k] = 2 * h * h * holeCells[k]; if (!diag[material + k]) { diag[material + k] = 1; b[material + k] = 0; } } // (a hole no material touches carries nothing)
|
|
93
|
+
const A = Int32Array.from(la), B = Int32Array.from(lb), Wt = Float64Array.from(lw), links = A.length;
|
|
94
|
+
const apply = (x, y) => { y.fill(0); for (let e = 0; e < links; e++) { const i = A[e], j = B[e], w = Wt[e]; if (j < 0) y[i] += w * x[i]; else { const d = w * (x[i] - x[j]); y[i] += d; y[j] -= d; } } };
|
|
95
|
+
// conjugate gradients, each unknown scaled by its own diagonal
|
|
96
|
+
const x = new Float64Array(n), r = Float64Array.from(b), z = new Float64Array(n), p = new Float64Array(n), q = new Float64Array(n);
|
|
97
|
+
let rz = 0, bb = 0;
|
|
98
|
+
for (let i = 0; i < n; i++) { z[i] = r[i] / diag[i]; p[i] = z[i]; rz += r[i] * z[i]; bb += b[i] * b[i]; }
|
|
99
|
+
let it = 0;
|
|
100
|
+
for (const most = 20 * Math.max(nx, ny) + 200; it < most; it++) {
|
|
101
|
+
apply(p, q);
|
|
102
|
+
let pq = 0; for (let i = 0; i < n; i++) pq += p[i] * q[i];
|
|
103
|
+
const alpha = rz / pq; let rr = 0;
|
|
104
|
+
for (let i = 0; i < n; i++) { x[i] += alpha * p[i]; r[i] -= alpha * q[i]; rr += r[i] * r[i]; }
|
|
105
|
+
if (rr <= tolerance * tolerance * bb) { it++; break; }
|
|
106
|
+
let next = 0; for (let i = 0; i < n; i++) { z[i] = r[i] / diag[i]; next += r[i] * z[i]; }
|
|
107
|
+
const beta = next / rz; rz = next;
|
|
108
|
+
for (let i = 0; i < n; i++) p[i] = z[i] + beta * p[i];
|
|
109
|
+
}
|
|
110
|
+
let sum = 0;
|
|
111
|
+
for (let i = 0; i < material; i++) sum += x[i];
|
|
112
|
+
for (let k = 0; k < holes; k++) sum += x[material + k] * holeCells[k];
|
|
113
|
+
return { torsion: 2 * sum * h * h, cell: h, cells: nx * ny, iterations: it };
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// ---------- outlines against each other: what a check of a section asks ----------
|
|
117
|
+
const cross = (ax, ay, bx, by) => ax * by - ay * bx;
|
|
118
|
+
/** Whether a point is inside a loop (even-odd). @param {number[]} p @param {number[][]} loop @returns {boolean} */
|
|
119
|
+
export function inside([x, y], loop) {
|
|
120
|
+
let inn = false;
|
|
121
|
+
for (let i = 0, n = loop.length; i < n; i++) { const [ax, ay] = loop[i], [bx, by] = loop[(i + 1) % n]; if ((ay > y) !== (by > y) && x < ax + ((y - ay) * (bx - ax)) / (by - ay)) inn = !inn; }
|
|
122
|
+
return inn;
|
|
123
|
+
}
|
|
124
|
+
function segmentDistance(a, b, c, d) { // the least distance between segments ab and cd (0 where they cross)
|
|
125
|
+
const d1 = cross(b[0] - a[0], b[1] - a[1], c[0] - a[0], c[1] - a[1]), d2 = cross(b[0] - a[0], b[1] - a[1], d[0] - a[0], d[1] - a[1]);
|
|
126
|
+
const d3 = cross(d[0] - c[0], d[1] - c[1], a[0] - c[0], a[1] - c[1]), d4 = cross(d[0] - c[0], d[1] - c[1], b[0] - c[0], b[1] - c[1]);
|
|
127
|
+
if (d1 * d2 < 0 && d3 * d4 < 0) return 0;
|
|
128
|
+
const to = (p, s, e) => { const vx = e[0] - s[0], vy = e[1] - s[1], L = vx * vx + vy * vy, t = L ? Math.max(0, Math.min(1, ((p[0] - s[0]) * vx + (p[1] - s[1]) * vy) / L)) : 0; return Math.hypot(p[0] - s[0] - t * vx, p[1] - s[1] - t * vy); };
|
|
129
|
+
return Math.min(to(a, c, d), to(b, c, d), to(c, a, b), to(d, a, b));
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* The gap between two closed outlines: the least distance between them, or a negative number when they overlap (one
|
|
133
|
+
* crossing or inside the other), whose size is not a depth.
|
|
134
|
+
* @param {number[][]} p @param {number[][]} q @returns {number}
|
|
135
|
+
*/
|
|
136
|
+
export function gap(p, q) {
|
|
137
|
+
let least = Infinity;
|
|
138
|
+
for (let i = 0; i < p.length; i++) for (let j = 0; j < q.length; j++) least = Math.min(least, segmentDistance(p[i], p[(i + 1) % p.length], q[j], q[(j + 1) % q.length]));
|
|
139
|
+
return least === 0 || inside(p[0], q) || inside(q[0], p) ? -1 : least;
|
|
140
|
+
}
|
package/slotnut.d.mts
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {{ value: any, unit?: string, kind: string, source: string, rule?: string, checked?: string }} Figure
|
|
3
|
+
* @typedef {{ kind: 'slot-nut', name: string, title: string, slot: string, thread: string, major: number | null, nutKind: string, entry: string,
|
|
4
|
+
* length: number, width: number, height: number, tongueWidth: number | null, tongueHeight: number, boltLength: number | null,
|
|
5
|
+
* hold: Figure | null, torque: Figure | null, material: string, density: Figure, volume: number, mass: number,
|
|
6
|
+
* figures: Record<string, Figure>, bought: true, printed: false, findings: object[] }} SlotNut
|
|
7
|
+
* volume (mm³) and mass (g) are worked out from the drawn block (body, tongue, less the thread's hole; a T-bolt's shank added)
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* A bought slot nut by name, from its rule set, or from one of your own in the same names.
|
|
11
|
+
* @param {string | { name?: string, part?: string, rules: object }} which 'slot-nut-6-misumi-m5-slide-in', or a rule set with "part": "slot_nut"
|
|
12
|
+
* @param {Record<string, any>} [change] a different or measured figure, by its rule's name
|
|
13
|
+
* @param {{ sets?: object, load?: Function }} [given] rule sets of your own by name (a slot, a thread)
|
|
14
|
+
* @returns {SlotNut}
|
|
15
|
+
*/
|
|
16
|
+
export function slotNutModel(which: string | {
|
|
17
|
+
name?: string;
|
|
18
|
+
part?: string;
|
|
19
|
+
rules: object;
|
|
20
|
+
}, change?: Record<string, any>, given?: {
|
|
21
|
+
sets?: object;
|
|
22
|
+
load?: Function;
|
|
23
|
+
}): SlotNut;
|
|
24
|
+
/**
|
|
25
|
+
* How a bought nut sits in a slot, as findings: does it go in, does it hold, does its tongue stand proud. fail where
|
|
26
|
+
* it cannot be fitted at all.
|
|
27
|
+
* @param {SlotNut | string} nut @param {import('./profile.mjs').Slot | string} slot @param {{ sets?: object, load?: Function }} [given]
|
|
28
|
+
* @returns {object[]} findings, code slot_nut.fit or slot_nut.entry
|
|
29
|
+
*/
|
|
30
|
+
export function nutFit(nut: SlotNut | string, slot: import("./profile.mjs").Slot | string, given?: {
|
|
31
|
+
sets?: object;
|
|
32
|
+
load?: Function;
|
|
33
|
+
}): object[];
|
|
34
|
+
/**
|
|
35
|
+
* A bought nut's reference solid in the slot's frame (x along, y across, z out of the face, the face at z = 0): its
|
|
36
|
+
* body pulled up under the lips, its tongue in the opening, the thread's hole through it; a T-bolt's shank standing out.
|
|
37
|
+
* @param {SlotNut | string} nut @param {{ at?: number[], display?: 'preview' | 'link', given?: object }} [o]
|
|
38
|
+
* at: where its middle goes on the face (default the origin); display: link draws the body alone
|
|
39
|
+
* @returns {object} a JSCAD geom3, with .model
|
|
40
|
+
*/
|
|
41
|
+
export function slotNut(nut: SlotNut | string, o?: {
|
|
42
|
+
at?: number[];
|
|
43
|
+
display?: "preview" | "link";
|
|
44
|
+
given?: object;
|
|
45
|
+
}): object;
|
|
46
|
+
/**
|
|
47
|
+
* The bought nut for a thread in a profile's face: one its maker makes for that slot's nut family, that fits it, of the
|
|
48
|
+
* kind asked (any kind where none is asked), the strongest first. Refused by name where there is none, naming the
|
|
49
|
+
* nuts made for that slot (and, where none of its family's would do, other makers' nuts that fit it by their sizes).
|
|
50
|
+
* @param {string | import('./profile.mjs').Profile} profile a profile's name or model
|
|
51
|
+
* @param {string} face 'top', 'front.2'
|
|
52
|
+
* @param {string} thread 'M5'
|
|
53
|
+
* @param {{ kind?: string, given?: { sets?: object, load?: Function } }} [o]
|
|
54
|
+
* @returns {SlotNut & { face: string, profile: string, fits: object[], others: string[] }} others: the names of other nuts that would also do
|
|
55
|
+
*/
|
|
56
|
+
export function nutFor(profile: string | import("./profile.mjs").Profile, face: string, thread: string, o?: {
|
|
57
|
+
kind?: string;
|
|
58
|
+
given?: {
|
|
59
|
+
sets?: object;
|
|
60
|
+
load?: Function;
|
|
61
|
+
};
|
|
62
|
+
}): SlotNut & {
|
|
63
|
+
face: string;
|
|
64
|
+
profile: string;
|
|
65
|
+
fits: object[];
|
|
66
|
+
others: string[];
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* @typedef {{ kind: 'slot-carrier', name: string, title: string, slot: string, profile: string | null, face: string | null, thread: string, holds: 'nut' | 'insert',
|
|
70
|
+
* clearance: number, section: number[][], cavity: number[][], length: number, count: number, pitch: number, total: number, at: number[],
|
|
71
|
+
* levels: { top: number, bottom: number, shoulder: number, nutBottom?: number, nutTop?: number, roofTop?: number, insertTop?: number },
|
|
72
|
+
* nut: object | null, insert: object | null, screwHole: number, hold: { value: number, punch: number, shoulders: number, shear: number },
|
|
73
|
+
* load: number | null, margin: number | null, volume: number, grams: number, material: string, printer: string, least: number, rests: object[], findings: object[] }} Carrier
|
|
74
|
+
* section: the carrier's section in the slot's frame [y across, z out of the face]; cavity: the slot's, the same way;
|
|
75
|
+
* at: each nut's place along the strip from its start; levels: depths below the face (mm); least: the least gap between carrier and slot
|
|
76
|
+
*/
|
|
77
|
+
/**
|
|
78
|
+
* A printed carrier for a slot: a block drawn from the slot's own rules, the printer's fit clear of it all round, that
|
|
79
|
+
* holds a hex nut (slid into a slot across it, from the side) or a heat-set insert (pressed in from below) and slides
|
|
80
|
+
* along the slot like a bought slide-in nut. Several at a pitch make a strip. Refused by name where the nut or insert
|
|
81
|
+
* does not fit the slot.
|
|
82
|
+
* @param {string | object} where a slot (name or slotModel) or a profile (name or model) with face
|
|
83
|
+
* @param {{ face?: string, thread: string, holds?: 'nut' | 'insert', length?: number, count?: number, pitch?: number, load?: number,
|
|
84
|
+
* printer?: object, material?: string | object, given?: object, sets?: object }} o
|
|
85
|
+
* thread: the screw's; holds: nut (default) or insert; length: of one carrier along the slot (default the nut's or
|
|
86
|
+
* insert's width and the ends', or longer where a load asks it); count and pitch: a strip; load: the pull on each nut
|
|
87
|
+
* (N), sized to hold twice it; printer: its rule set or values (default the X1C: its fit is the clearance); material:
|
|
88
|
+
* pla (default), petg or a rule set; given: profiles and slots of your own; sets: thread sets of your own (fixings)
|
|
89
|
+
* @returns {Carrier}
|
|
90
|
+
*/
|
|
91
|
+
export function carrierModel(where: string | object, o?: {
|
|
92
|
+
face?: string;
|
|
93
|
+
thread: string;
|
|
94
|
+
holds?: "nut" | "insert";
|
|
95
|
+
length?: number;
|
|
96
|
+
count?: number;
|
|
97
|
+
pitch?: number;
|
|
98
|
+
load?: number;
|
|
99
|
+
printer?: object;
|
|
100
|
+
material?: string | object;
|
|
101
|
+
given?: object;
|
|
102
|
+
sets?: object;
|
|
103
|
+
}): Carrier;
|
|
104
|
+
/**
|
|
105
|
+
* A printed carrier's solid, from carrierModel's model or its arguments. In the slot's frame (x along from the strip's
|
|
106
|
+
* start, y across, z out of the face, the face at z = 0), or laid on the bed floor down to print.
|
|
107
|
+
* @param {Carrier | string | object} m @param {object} [o] carrierModel's options, and pose: 'slot' (default) or 'print'
|
|
108
|
+
* @returns {object} a JSCAD geom3, with .model
|
|
109
|
+
*/
|
|
110
|
+
export function carrier(m: Carrier | string | object, o?: object): object;
|
|
111
|
+
/**
|
|
112
|
+
* The rules this module adds, each with what it comes from.
|
|
113
|
+
* @type {Record<string, { value: number, unit: string, rule: string, kind: string, source: string }>}
|
|
114
|
+
*/
|
|
115
|
+
export const CARRIER_DEFAULTS: Record<string, {
|
|
116
|
+
value: number;
|
|
117
|
+
unit: string;
|
|
118
|
+
rule: string;
|
|
119
|
+
kind: string;
|
|
120
|
+
source: string;
|
|
121
|
+
}>;
|
|
122
|
+
export type Figure = {
|
|
123
|
+
value: any;
|
|
124
|
+
unit?: string;
|
|
125
|
+
kind: string;
|
|
126
|
+
source: string;
|
|
127
|
+
rule?: string;
|
|
128
|
+
checked?: string;
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* volume (mm³) and mass (g) are worked out from the drawn block (body, tongue, less the thread's hole; a T-bolt's shank added)
|
|
132
|
+
*/
|
|
133
|
+
export type SlotNut = {
|
|
134
|
+
kind: "slot-nut";
|
|
135
|
+
name: string;
|
|
136
|
+
title: string;
|
|
137
|
+
slot: string;
|
|
138
|
+
thread: string;
|
|
139
|
+
major: number | null;
|
|
140
|
+
nutKind: string;
|
|
141
|
+
entry: string;
|
|
142
|
+
length: number;
|
|
143
|
+
width: number;
|
|
144
|
+
height: number;
|
|
145
|
+
tongueWidth: number | null;
|
|
146
|
+
tongueHeight: number;
|
|
147
|
+
boltLength: number | null;
|
|
148
|
+
hold: Figure | null;
|
|
149
|
+
torque: Figure | null;
|
|
150
|
+
material: string;
|
|
151
|
+
density: Figure;
|
|
152
|
+
volume: number;
|
|
153
|
+
mass: number;
|
|
154
|
+
figures: Record<string, Figure>;
|
|
155
|
+
bought: true;
|
|
156
|
+
printed: false;
|
|
157
|
+
findings: object[];
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* section: the carrier's section in the slot's frame [y across, z out of the face]; cavity: the slot's, the same way;
|
|
161
|
+
* at: each nut's place along the strip from its start; levels: depths below the face (mm); least: the least gap between carrier and slot
|
|
162
|
+
*/
|
|
163
|
+
export type Carrier = {
|
|
164
|
+
kind: "slot-carrier";
|
|
165
|
+
name: string;
|
|
166
|
+
title: string;
|
|
167
|
+
slot: string;
|
|
168
|
+
profile: string | null;
|
|
169
|
+
face: string | null;
|
|
170
|
+
thread: string;
|
|
171
|
+
holds: "nut" | "insert";
|
|
172
|
+
clearance: number;
|
|
173
|
+
section: number[][];
|
|
174
|
+
cavity: number[][];
|
|
175
|
+
length: number;
|
|
176
|
+
count: number;
|
|
177
|
+
pitch: number;
|
|
178
|
+
total: number;
|
|
179
|
+
at: number[];
|
|
180
|
+
levels: {
|
|
181
|
+
top: number;
|
|
182
|
+
bottom: number;
|
|
183
|
+
shoulder: number;
|
|
184
|
+
nutBottom?: number;
|
|
185
|
+
nutTop?: number;
|
|
186
|
+
roofTop?: number;
|
|
187
|
+
insertTop?: number;
|
|
188
|
+
};
|
|
189
|
+
nut: object | null;
|
|
190
|
+
insert: object | null;
|
|
191
|
+
screwHole: number;
|
|
192
|
+
hold: {
|
|
193
|
+
value: number;
|
|
194
|
+
punch: number;
|
|
195
|
+
shoulders: number;
|
|
196
|
+
shear: number;
|
|
197
|
+
};
|
|
198
|
+
load: number | null;
|
|
199
|
+
margin: number | null;
|
|
200
|
+
volume: number;
|
|
201
|
+
grams: number;
|
|
202
|
+
material: string;
|
|
203
|
+
printer: string;
|
|
204
|
+
least: number;
|
|
205
|
+
rests: object[];
|
|
206
|
+
findings: object[];
|
|
207
|
+
};
|