@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/beam.d.mts
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A beam as numbers: a length of a profile, its mass and centre of mass from the section and the alloy, the figures to
|
|
3
|
+
* design it with, and its anchors. A beam is bought: it is cut from stock, and its supply is checked.
|
|
4
|
+
* @param {Profile | string | object} profile a profile's model, or what profileModel takes ('2040-misumi-hfs5', or a rule set)
|
|
5
|
+
* @param {{ length: number, ends?: 'cut' | 'tapped' | ['cut' | 'tapped', 'cut' | 'tapped'] | { a?: 'cut' | 'tapped', b?: 'cut' | 'tapped' },
|
|
6
|
+
* ops?: object[], material?: string, given?: object, cells?: number }} o length: mm, end a to end b (on the long side where
|
|
7
|
+
* an end is mitred); ends: each end cut square (the default), or tapped (a tap op at that end, in the profile's bore_thread);
|
|
8
|
+
* ops: operations, each { op, at, ... } as OPS lists (cut, mitre, tap, access, drill, counterbore, pocket, notch,
|
|
9
|
+
* deburr), placed by an address on the beam (a, a.1, top@120); the model's ops are them worked out, dimensioned from end a; material: a material set's name in place of the profile's
|
|
10
|
+
* alloy (so a frame can be weighed in another metal or a plastic); given: profileModel's third argument; cells: raster
|
|
11
|
+
* cells for the torsion constant where the sheet gives none
|
|
12
|
+
* @returns {Beam}
|
|
13
|
+
*/
|
|
14
|
+
export function beamModel(profile: Profile | string | object, o?: {
|
|
15
|
+
length: number;
|
|
16
|
+
ends?: "cut" | "tapped" | ["cut" | "tapped", "cut" | "tapped"] | {
|
|
17
|
+
a?: "cut" | "tapped";
|
|
18
|
+
b?: "cut" | "tapped";
|
|
19
|
+
};
|
|
20
|
+
ops?: object[];
|
|
21
|
+
material?: string;
|
|
22
|
+
given?: object;
|
|
23
|
+
cells?: number;
|
|
24
|
+
}): Beam;
|
|
25
|
+
/**
|
|
26
|
+
* A beam as a solid, lying along z from end a at z = 0. display: 'link' is a plain box of the section's envelope (a
|
|
27
|
+
* round section a twelve-sided prism): 12 triangles, light enough for a link and an overlap check. 'preview' (the
|
|
28
|
+
* default) is the true section, every slot, bore and hollow, run the whole length. Each operation is cut from it: a
|
|
29
|
+
* mitre from the link too (its envelope changes), the holes, pockets and notches from the preview only.
|
|
30
|
+
* @param {Beam | Profile | string | object} m a beam's model, or a profile with { length } as beamModel takes
|
|
31
|
+
* @param {{ display?: 'link' | 'preview', length?: number, ends?: any, material?: string, given?: object, cells?: number }} [o]
|
|
32
|
+
* @returns {object} a JSCAD geom3, with .model holding beamModel's numbers (its anchors and mass)
|
|
33
|
+
*/
|
|
34
|
+
export function beam(m: Beam | Profile | string | object, o?: {
|
|
35
|
+
display?: "link" | "preview";
|
|
36
|
+
length?: number;
|
|
37
|
+
ends?: any;
|
|
38
|
+
material?: string;
|
|
39
|
+
given?: object;
|
|
40
|
+
cells?: number;
|
|
41
|
+
}): object;
|
|
42
|
+
/**
|
|
43
|
+
* An anchor on a beam by its address: 'a' and 'b' are its ends, 'a.1' the first bore in end a, 'top' the first place on
|
|
44
|
+
* its top face and 'top.2' the second, each with a distance after '@': 'top@120' is 120 mm from end a, 'top@-20' 20 mm
|
|
45
|
+
* from end b, 'top@50%' the middle. A face's place with no distance is at the middle.
|
|
46
|
+
* @param {Beam} b a beam's model @param {string} address
|
|
47
|
+
* @returns {Anchor & { name: string, distance: number | null }}
|
|
48
|
+
*/
|
|
49
|
+
export function beamAnchor(b: Beam, address: string): Anchor & {
|
|
50
|
+
name: string;
|
|
51
|
+
distance: number | null;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* What a printer can make of it, as findings. A beam of a profile is bought and cut from stock, and so is a profile:
|
|
55
|
+
* both fail. Printed beams are a later release.
|
|
56
|
+
* @param {Beam | Profile | object} x a beam's or a profile's model, or a solid beam() made
|
|
57
|
+
* @returns {{ level: 'fail', code: string, text: string }[]}
|
|
58
|
+
*/
|
|
59
|
+
export function printable(x: Beam | Profile | object): {
|
|
60
|
+
level: "fail";
|
|
61
|
+
code: string;
|
|
62
|
+
text: string;
|
|
63
|
+
}[];
|
|
64
|
+
export type Profile = import("./profile.mjs").Profile;
|
|
65
|
+
/**
|
|
66
|
+
* a point, the direction out of the beam there, and
|
|
67
|
+
* a direction square to it that fixes the turn about it: at an end, the beam's up (+y); on a face, along the beam toward end b
|
|
68
|
+
*/
|
|
69
|
+
export type Anchor = {
|
|
70
|
+
origin: number[];
|
|
71
|
+
axis: number[];
|
|
72
|
+
ref: number[];
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* a place a face offers along the whole beam: its slot family (null where the face is closed there), where it meets
|
|
76
|
+
* the face in the section, and how far the slot goes in (0 for a closed face)
|
|
77
|
+
*/
|
|
78
|
+
export type Place = {
|
|
79
|
+
name: string;
|
|
80
|
+
face: "top" | "bottom" | "front" | "back";
|
|
81
|
+
index: number;
|
|
82
|
+
slot: string | null;
|
|
83
|
+
at: [number, number];
|
|
84
|
+
normal: [number, number];
|
|
85
|
+
along: [number, number];
|
|
86
|
+
depth: number;
|
|
87
|
+
};
|
|
88
|
+
export type EndBore = {
|
|
89
|
+
name: string;
|
|
90
|
+
end: "a" | "b";
|
|
91
|
+
at: [number, number];
|
|
92
|
+
diameter: number;
|
|
93
|
+
thread: string | null;
|
|
94
|
+
tapped: boolean;
|
|
95
|
+
};
|
|
96
|
+
export type Beam = {
|
|
97
|
+
kind: "beam";
|
|
98
|
+
name: string;
|
|
99
|
+
title: string;
|
|
100
|
+
profile: Profile;
|
|
101
|
+
length: number;
|
|
102
|
+
ends: {
|
|
103
|
+
a: {
|
|
104
|
+
kind: "cut" | "tapped";
|
|
105
|
+
thread: string | null;
|
|
106
|
+
};
|
|
107
|
+
b: {
|
|
108
|
+
kind: "cut" | "tapped";
|
|
109
|
+
thread: string | null;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
material: {
|
|
113
|
+
name: string;
|
|
114
|
+
density: number | null;
|
|
115
|
+
modulus: number | null;
|
|
116
|
+
given: boolean;
|
|
117
|
+
} | null;
|
|
118
|
+
area: number;
|
|
119
|
+
centroid: [number, number];
|
|
120
|
+
mass: number | null;
|
|
121
|
+
centreOfMass: [number, number, number];
|
|
122
|
+
weight: {
|
|
123
|
+
computed: number | null;
|
|
124
|
+
sheet: number | null;
|
|
125
|
+
difference: number | null;
|
|
126
|
+
};
|
|
127
|
+
figures: Record<string, {
|
|
128
|
+
value: number | null;
|
|
129
|
+
unit: string;
|
|
130
|
+
kind: string;
|
|
131
|
+
source: string;
|
|
132
|
+
from: "sheet" | "outline";
|
|
133
|
+
}>;
|
|
134
|
+
places: Place[];
|
|
135
|
+
bores: EndBore[];
|
|
136
|
+
anchors: Record<string, Anchor>;
|
|
137
|
+
ops: object[];
|
|
138
|
+
bought: true;
|
|
139
|
+
printed: false;
|
|
140
|
+
rests: object[];
|
|
141
|
+
findings: object[];
|
|
142
|
+
};
|
package/beam.mjs
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
// A beam: a length of a profile. Its model holds what the length is worth (mass and centre of mass from the section
|
|
2
|
+
// and the alloy, the figures to design it with), what it is cut from, and the anchors an assembly places it and
|
|
3
|
+
// anything on it by: its two ends, the bores in each end, and every place a face offers (a slot, or a closed face).
|
|
4
|
+
// Its solid comes at two display levels: a plain box for a link, the true section for a preview.
|
|
5
|
+
//
|
|
6
|
+
// A beam lies along z: end a at z = 0, end b at z = length, the section in x and y as profileModel draws it (the
|
|
7
|
+
// middle of its envelope on the z axis, top +y, bottom -y, front -x, back +x). Units: mm, grams, degrees.
|
|
8
|
+
import jscad from '@jscad/modeling';
|
|
9
|
+
import { profileModel, section, beamFigures, outline, DEFAULTS } from './profile.mjs';
|
|
10
|
+
import { opsOf, opCutters } from './ops.mjs';
|
|
11
|
+
|
|
12
|
+
const { cuboid, cylinder, polygon } = jscad.primitives, { extrudeLinear } = jscad.extrusions, { subtract } = jscad.booleans;
|
|
13
|
+
const isNum = (x) => typeof x === 'number' && Number.isFinite(x);
|
|
14
|
+
const shown = (v) => { const s = v === undefined ? 'nothing' : JSON.stringify(v) ?? String(v); return s.length > 80 ? `${s.slice(0, 77)}...` : s; };
|
|
15
|
+
const mm = (x) => String(+Number(x).toFixed(2));
|
|
16
|
+
const FACES = ['top', 'bottom', 'front', 'back'];
|
|
17
|
+
const END_KINDS = ['cut', 'tapped'];
|
|
18
|
+
const DISPLAYS = ['link', 'preview'];
|
|
19
|
+
const OPTIONS = ['length', 'ends', 'ops', 'material', 'given', 'cells', 'display'];
|
|
20
|
+
const ROUND = ['round-tube', 'round-bar'];
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @typedef {import('./profile.mjs').Profile} Profile
|
|
24
|
+
* @typedef {{ origin: number[], axis: number[], ref: number[] }} Anchor a point, the direction out of the beam there, and
|
|
25
|
+
* a direction square to it that fixes the turn about it: at an end, the beam's up (+y); on a face, along the beam toward end b
|
|
26
|
+
* @typedef {{ name: string, face: 'top' | 'bottom' | 'front' | 'back', index: number, slot: string | null, at: [number, number], normal: [number, number], along: [number, number], depth: number }} Place
|
|
27
|
+
* a place a face offers along the whole beam: its slot family (null where the face is closed there), where it meets
|
|
28
|
+
* the face in the section, and how far the slot goes in (0 for a closed face)
|
|
29
|
+
* @typedef {{ name: string, end: 'a' | 'b', at: [number, number], diameter: number, thread: string | null, tapped: boolean }} EndBore
|
|
30
|
+
* @typedef {{ kind: 'beam', name: string, title: string, profile: Profile, length: number,
|
|
31
|
+
* ends: { a: { kind: 'cut' | 'tapped', thread: string | null }, b: { kind: 'cut' | 'tapped', thread: string | null } },
|
|
32
|
+
* material: { name: string, density: number | null, modulus: number | null, given: boolean } | null,
|
|
33
|
+
* area: number, centroid: [number, number], mass: number | null, centreOfMass: [number, number, number],
|
|
34
|
+
* weight: { computed: number | null, sheet: number | null, difference: number | null },
|
|
35
|
+
* figures: Record<string, { value: number | null, unit: string, kind: string, source: string, from: 'sheet' | 'outline' }>,
|
|
36
|
+
* places: Place[], bores: EndBore[], anchors: Record<string, Anchor>, ops: object[], bought: true, printed: false,
|
|
37
|
+
* rests: object[], findings: object[] }} Beam
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
// ends: one kind for both, [a, b], or { a, b }
|
|
41
|
+
function endsOf(what, ends, m) {
|
|
42
|
+
const pair = ends == null ? ['cut', 'cut'] : typeof ends === 'string' ? [ends, ends] : Array.isArray(ends) ? ends : typeof ends === 'object' ? [ends.a ?? 'cut', ends.b ?? 'cut'] : null;
|
|
43
|
+
if (!pair || pair.length !== 2) throw new Error(`${what}: ends is ${END_KINDS.join(' or ')} for both ends, [a, b], or { a, b } (got ${shown(ends)})`);
|
|
44
|
+
if (ends && typeof ends === 'object' && !Array.isArray(ends)) for (const k of Object.keys(ends)) if (!['a', 'b'].includes(k)) throw new Error(`${what}: ends names end a and end b (got "${k}")`);
|
|
45
|
+
const threaded = m.bores.filter((b) => b.thread != null);
|
|
46
|
+
return Object.fromEntries(pair.map((k, i) => {
|
|
47
|
+
const end = 'ab'[i];
|
|
48
|
+
if (!END_KINDS.includes(k)) throw new Error(`${what}: end ${end} is ${END_KINDS.join(' or ')} (got ${shown(k)}). A mitre, a drilled hole and the rest are operations: { ops: [{ op: 'mitre', at: 'a', angle: 45, about: 'top' }] }`);
|
|
49
|
+
if (k === 'tapped' && !threaded.length) throw new Error(`${what}: end ${end} is tapped, and ${m.name} has no bore with a thread to tap (bore_thread): leave it cut, or give the profile a bore_thread`);
|
|
50
|
+
return [end, { kind: k, thread: k === 'tapped' ? threaded[0].thread : null }];
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* A beam as numbers: a length of a profile, its mass and centre of mass from the section and the alloy, the figures to
|
|
56
|
+
* design it with, and its anchors. A beam is bought: it is cut from stock, and its supply is checked.
|
|
57
|
+
* @param {Profile | string | object} profile a profile's model, or what profileModel takes ('2040-misumi-hfs5', or a rule set)
|
|
58
|
+
* @param {{ length: number, ends?: 'cut' | 'tapped' | ['cut' | 'tapped', 'cut' | 'tapped'] | { a?: 'cut' | 'tapped', b?: 'cut' | 'tapped' },
|
|
59
|
+
* ops?: object[], material?: string, given?: object, cells?: number }} o length: mm, end a to end b (on the long side where
|
|
60
|
+
* an end is mitred); ends: each end cut square (the default), or tapped (a tap op at that end, in the profile's bore_thread);
|
|
61
|
+
* ops: operations, each { op, at, ... } as OPS lists (cut, mitre, tap, access, drill, counterbore, pocket, notch,
|
|
62
|
+
* deburr), placed by an address on the beam (a, a.1, top@120); the model's ops are them worked out, dimensioned from end a; material: a material set's name in place of the profile's
|
|
63
|
+
* alloy (so a frame can be weighed in another metal or a plastic); given: profileModel's third argument; cells: raster
|
|
64
|
+
* cells for the torsion constant where the sheet gives none
|
|
65
|
+
* @returns {Beam}
|
|
66
|
+
*/
|
|
67
|
+
export function beamModel(profile, o = {}) {
|
|
68
|
+
const what = 'beamModel';
|
|
69
|
+
if (!o || typeof o !== 'object' || Array.isArray(o)) throw new Error(`${what}: the second argument is { length, ends, material } (got ${shown(o)})`);
|
|
70
|
+
for (const k of Object.keys(o)) if (!OPTIONS.includes(k)) throw new Error(`${what}: no option "${k}": it takes ${OPTIONS.join(', ')}`);
|
|
71
|
+
if (!(isNum(o.length) && o.length > 0)) throw new Error(`${what}: length is a number above 0, in mm from end a to end b (got ${shown(o.length)})`);
|
|
72
|
+
const given = o.given ?? {};
|
|
73
|
+
const base = profile?.kind === 'profile' ? profile : profileModel(profile, {}, given);
|
|
74
|
+
let m = base;
|
|
75
|
+
const changed = o.material != null && o.material !== base.material?.name;
|
|
76
|
+
if (changed) {
|
|
77
|
+
if (typeof o.material !== 'string') throw new Error(`${what}: material is a material set's name, such as al6063-t5 (got ${shown(o.material)})`);
|
|
78
|
+
// the same profile in another material: its own figures, the material changed, and the measured outline kept
|
|
79
|
+
m = profileModel({ name: m.name, part: 'profile', rules: m.figures }, { material: o.material }, { ...given, ...(m.measured ? { outline: m.measured } : {}) });
|
|
80
|
+
}
|
|
81
|
+
const L = o.length, ends = endsOf(what, o.ends, m), s = section(m, { torsion: false }), fig = beamFigures(m, { cells: o.cells });
|
|
82
|
+
if (changed) fig.massPerMetre = { value: s.massPerMetre, unit: 'kg/m', kind: 'derived', source: `worked out from the ${s.measured ? 'measured' : 'drawn'} outline of ${m.name} and the density of ${m.material?.name}`, from: 'outline' };
|
|
83
|
+
const density = m.material?.density ?? null, mass = density != null ? (s.area * L * density) / 1000 : null; // mm² x mm x g/cm³ / 1000 = g
|
|
84
|
+
const sheetMass = !changed && m.sheet.massPerMetre != null ? m.sheet.massPerMetre * L : null; // kg/m x mm = g
|
|
85
|
+
const weight = { computed: mass, sheet: sheetMass, difference: mass != null && sheetMass != null ? mass / sheetMass - 1 : null };
|
|
86
|
+
const centreOfMass = [+s.centroid[0].toFixed(6), +s.centroid[1].toFixed(6), L / 2]; // (to a millionth: a symmetric section's centroid is a rounding error off 0)
|
|
87
|
+
// the places a face offers, numbered along each face (top.1, top.2), with top alone for the first
|
|
88
|
+
const places = [];
|
|
89
|
+
for (const face of FACES) {
|
|
90
|
+
const list = [...m.faces[face]].sort((p, q) => p.index - q.index || (q.at[0] * p.normal[0] + q.at[1] * p.normal[1]) - (p.at[0] * p.normal[0] + p.at[1] * p.normal[1]));
|
|
91
|
+
list.forEach((p, i) => places.push({ name: `${face}.${i + 1}`, face, index: p.index, slot: p.slot, at: [...p.at], normal: [...p.normal], along: [...p.along], depth: p.slot ? m.slots[p.slot].cavityDepth : 0 }));
|
|
92
|
+
}
|
|
93
|
+
const bores = ['a', 'b'].flatMap((end) => m.bores.map((b, i) => ({ name: `${end}.${i + 1}`, end, at: [...b.at], diameter: b.diameter, thread: b.thread, tapped: ends[end].kind === 'tapped' && b.thread != null })));
|
|
94
|
+
const up = [0, 1, 0], anchors = { a: { origin: [0, 0, 0], axis: [0, 0, -1], ref: up }, b: { origin: [0, 0, L], axis: [0, 0, 1], ref: up } };
|
|
95
|
+
for (const b of bores) anchors[b.name] = { origin: [b.at[0], b.at[1], b.end === 'a' ? 0 : L], axis: [0, 0, b.end === 'a' ? -1 : 1], ref: up };
|
|
96
|
+
for (const p of places) {
|
|
97
|
+
const a = { origin: [p.at[0], p.at[1], L / 2], axis: [p.normal[0], p.normal[1], 0], ref: [0, 0, 1] };
|
|
98
|
+
anchors[p.name] = a; if (p.name.endsWith('.1')) anchors[p.face] = a;
|
|
99
|
+
}
|
|
100
|
+
// what to know: the mass beside the sheet's, and the length beside what the profile is sold and cut in
|
|
101
|
+
const findings = [], title = `${m.title}, ${mm(L)} mm`, name = `${m.name} x ${mm(L)}`;
|
|
102
|
+
if (mass == null) findings.push({ level: 'warn', code: 'beam.mass', text: `${name}: ${m.name} names no material with a density, so the beam has no mass: give one ({ material: 'al6063-t5' })`, rule: 'material' });
|
|
103
|
+
else {
|
|
104
|
+
findings.push({ level: 'info', code: 'beam.mass', text: `${name}: ${mm(mass)} g, from the ${s.measured ? 'measured' : 'drawn'} section's ${mm(s.area)} mm² and ${m.material.name}'s density ${density} g/cm³${sheetMass != null ? `; the sheet's ${m.sheet.massPerMetre} kg/m gives ${mm(sheetMass)} g (${weight.difference > 0 ? '+' : ''}${(weight.difference * 100).toFixed(1)}%)` : ''}`, values: { mass, ...(sheetMass != null ? { sheet: sheetMass } : {}) }, refs: { material: m.material.name } });
|
|
105
|
+
if (weight.difference != null && Math.abs(weight.difference) > DEFAULTS.section.value) findings.push({ level: 'warn', code: 'beam.mass', text: `${name}: the section weighs ${weight.difference > 0 ? '+' : ''}${(weight.difference * 100).toFixed(1)}% from the sheet's mass per metre, past the ${DEFAULTS.section.value * 100}% a drawn outline is held to: the drawn section is not the maker's (a hollow or a hooked lip it does not describe), so weigh it by the sheet's ${mm(sheetMass)} g`, rule: 'mass_per_metre', values: { mass, sheet: sheetMass, difference: weight.difference } });
|
|
106
|
+
}
|
|
107
|
+
const { lengths, cutMin, cutMax } = m.supply, longest = Math.max(cutMax ?? 0, ...lengths.filter(isNum));
|
|
108
|
+
if (longest > 0 && L > longest + 1e-9) findings.push({ level: 'warn', code: 'beam.length', text: `${name}: ${mm(L)} mm is longer than ${m.name} is sold or cut in (${mm(longest)} mm): it needs a joint along its length`, rule: cutMax != null ? 'cut_length_max' : 'lengths', values: { length: L, longest } });
|
|
109
|
+
if (cutMin != null && L < cutMin - 1e-9) findings.push({ level: 'warn', code: 'beam.length', text: `${name}: ${mm(L)} mm is shorter than the ${mm(cutMin)} mm the maker cuts ${m.name} to: cut it yourself, or ask`, rule: 'cut_length_min', values: { length: L, cutMin } });
|
|
110
|
+
const rests = [m.figures.area, m.figures.mass_per_metre, ...(m.material ? [m.material.figures.density] : [])].filter(Boolean).map((f) => ({ value: f.value, ...(f.unit ? { unit: f.unit } : {}), kind: f.kind, source: f.source }));
|
|
111
|
+
const b = { kind: 'beam', name, title, profile: m, length: L, ends,
|
|
112
|
+
material: m.material ? { name: m.material.name, density, modulus: m.material.modulus, given: changed } : null,
|
|
113
|
+
area: s.area, centroid: s.centroid, mass, centreOfMass, weight, figures: fig, places, bores, anchors, ops: [], bought: true, printed: false, rests, findings };
|
|
114
|
+
// operations: those given, a tap for an end said to be tapped, and a square cut at an end with no cut of its own
|
|
115
|
+
const given_ = o.ops ?? [];
|
|
116
|
+
if (!Array.isArray(given_)) throw new Error(`${what}: ops is a list of operations, [{ op: 'tap', at: 'a' }] (got ${shown(o.ops)})`);
|
|
117
|
+
const list = [...given_];
|
|
118
|
+
for (const e of ['a', 'b']) if (ends[e].kind === 'tapped' && !list.some((x) => x?.op === 'tap' && String(x.at ?? '').trim()[0] === e)) list.push({ op: 'tap', at: e });
|
|
119
|
+
let done;
|
|
120
|
+
try { done = opsOf(b, list, beamAnchor); } catch (e) { throw new Error(`${what}: ${String(e.message).replace(/^beamAnchor: /, '')}`); }
|
|
121
|
+
for (const x of done.ops) if (x.op === 'tap') { ends[x.end] = { kind: 'tapped', thread: x.thread }; for (const bo of bores) if (x.bores.includes(bo.name)) bo.tapped = true; }
|
|
122
|
+
for (const e of ['a', 'b']) if (!done.ops.some((x) => x.end === e && (x.op === 'cut' || x.op === 'mitre'))) done.ops.push({ op: 'cut', at: e, end: e, face: null, place: null, distance: e === 'a' ? 0 : L, line: `cut end ${e} square`, implied: true });
|
|
123
|
+
b.ops = done.ops.sort((p, q) => p.distance - q.distance); b.findings.push(...done.findings);
|
|
124
|
+
return b;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* A beam as a solid, lying along z from end a at z = 0. display: 'link' is a plain box of the section's envelope (a
|
|
129
|
+
* round section a twelve-sided prism): 12 triangles, light enough for a link and an overlap check. 'preview' (the
|
|
130
|
+
* default) is the true section, every slot, bore and hollow, run the whole length. Each operation is cut from it: a
|
|
131
|
+
* mitre from the link too (its envelope changes), the holes, pockets and notches from the preview only.
|
|
132
|
+
* @param {Beam | Profile | string | object} m a beam's model, or a profile with { length } as beamModel takes
|
|
133
|
+
* @param {{ display?: 'link' | 'preview', length?: number, ends?: any, material?: string, given?: object, cells?: number }} [o]
|
|
134
|
+
* @returns {object} a JSCAD geom3, with .model holding beamModel's numbers (its anchors and mass)
|
|
135
|
+
*/
|
|
136
|
+
export function beam(m, o = {}) {
|
|
137
|
+
const what = 'beam', display = o.display ?? 'preview';
|
|
138
|
+
if (!DISPLAYS.includes(display)) throw new Error(`${what}: display is ${DISPLAYS.join(' or ')} (got ${shown(display)})`);
|
|
139
|
+
const b = m?.kind === 'beam' ? m : beamModel(m, o), p = b.profile, L = b.length;
|
|
140
|
+
let solid;
|
|
141
|
+
if (display === 'link') solid = ROUND.includes(p.family) ? cylinder({ radius: p.width / 2, height: L, segments: 12, center: [0, 0, L / 2] }) : cuboid({ size: [p.width, p.height, L], center: [0, 0, L / 2] });
|
|
142
|
+
else solid = extrudeLinear({ height: L }, polygon({ points: outline(p).loops }));
|
|
143
|
+
const cuts = opCutters(b, { envelope: display === 'link' }); // (a link keeps its box, cut only where an end is mitred)
|
|
144
|
+
if (cuts.length) solid = subtract(solid, ...cuts);
|
|
145
|
+
return Object.assign(solid, { model: b, display });
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* An anchor on a beam by its address: 'a' and 'b' are its ends, 'a.1' the first bore in end a, 'top' the first place on
|
|
150
|
+
* its top face and 'top.2' the second, each with a distance after '@': 'top@120' is 120 mm from end a, 'top@-20' 20 mm
|
|
151
|
+
* from end b, 'top@50%' the middle. A face's place with no distance is at the middle.
|
|
152
|
+
* @param {Beam} b a beam's model @param {string} address
|
|
153
|
+
* @returns {Anchor & { name: string, distance: number | null }}
|
|
154
|
+
*/
|
|
155
|
+
export function beamAnchor(b, address) {
|
|
156
|
+
const what = 'beamAnchor';
|
|
157
|
+
if (b?.kind !== 'beam') throw new Error(`${what}: give a beam's model (beamModel), not ${shown(b)}`);
|
|
158
|
+
if (typeof address !== 'string') throw new Error(`${what}: an address is a string such as 'a', 'a.1', 'top@120', 'top.2@-20' or 'top@50%' (got ${shown(address)})`);
|
|
159
|
+
const [name, at, ...more] = address.trim().split('@');
|
|
160
|
+
const a = b.anchors[name];
|
|
161
|
+
if (!a || more.length) throw new Error(`${what}: ${b.name} has no "${address}": it has ${Object.keys(b.anchors).join(', ')}, and a face's place takes a distance after @ (top@120, top@-20, top@50%)`);
|
|
162
|
+
if (at == null) return { name, ...a, origin: [...a.origin], distance: null };
|
|
163
|
+
if (/^[ab](\.|$)/.test(name)) throw new Error(`${what}: "${address}": an end is where it is, so it takes no distance; a face does (top@120)`);
|
|
164
|
+
const t = at.trim(), share = /^(-?\d+(?:\.\d+)?)%$/.exec(t), L = b.length;
|
|
165
|
+
if (!share && !/^-?\d+(\.\d+)?$/.test(t)) throw new Error(`${what}: "${address}": the distance is in mm from end a (120), from end b when negative (-20), or a share of the length (50%)`);
|
|
166
|
+
const z = share ? (Number(share[1]) / 100) * L : t.startsWith('-') ? L + Number(t) : Number(t);
|
|
167
|
+
if (!(z >= -1e-9 && z <= L + 1e-9)) throw new Error(`${what}: "${address}" is past the end of ${b.name}: it is ${mm(L)} mm long, so a distance is from 0 to ${mm(L)} mm, -${mm(L)} to -0 from end b, or 0% to 100%`);
|
|
168
|
+
return { name, origin: [a.origin[0], a.origin[1], z], axis: [...a.axis], ref: [...a.ref], distance: z };
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* What a printer can make of it, as findings. A beam of a profile is bought and cut from stock, and so is a profile:
|
|
173
|
+
* both fail. Printed beams are a later release.
|
|
174
|
+
* @param {Beam | Profile | object} x a beam's or a profile's model, or a solid beam() made
|
|
175
|
+
* @returns {{ level: 'fail', code: string, text: string }[]}
|
|
176
|
+
*/
|
|
177
|
+
export function printable(x) {
|
|
178
|
+
const m = x?.model?.kind === 'beam' ? x.model : x;
|
|
179
|
+
if (m?.kind === 'beam') return [{ level: 'fail', code: 'beam.printable', text: `${m.name} is a bought beam: cut from ${m.profile.name} stock and fitted, not printed. What prints is the parts that fasten to it` }];
|
|
180
|
+
if (m?.kind === 'profile') return [{ level: 'fail', code: 'beam.printable', text: `${m.name} is a bought profile: beams of it are cut from stock, not printed` }];
|
|
181
|
+
throw new Error(`printable: give a beam's model (beamModel), a profile's (profileModel), or a solid beam() made, not ${shown(x)}`);
|
|
182
|
+
}
|
package/catalogue.d.mts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** The names a profile, a slot and a slot nut are written in: the fields of vocabulary.json. @type {Record<string, { unit?: string, choice?: string[], list?: boolean, says: string }>} */
|
|
2
|
+
export const FIELDS: Record<string, {
|
|
3
|
+
unit?: string;
|
|
4
|
+
choice?: string[];
|
|
5
|
+
list?: boolean;
|
|
6
|
+
says: string;
|
|
7
|
+
}>;
|
|
8
|
+
/** Every rule set frames knows, by its name. @type {Record<string, { name: string, part?: string, rules: Record<string, any> }>} */
|
|
9
|
+
export const SETS: Record<string, {
|
|
10
|
+
name: string;
|
|
11
|
+
part?: string;
|
|
12
|
+
rules: Record<string, any>;
|
|
13
|
+
}>;
|
|
14
|
+
/** The kit's own outlines, by the name of the set each belongs to (rules/outlines/<name>.json). @type {Record<string, { name?: string, source: string, licence: string, loops: number[][][] }>} */
|
|
15
|
+
export const OUTLINES: Record<string, {
|
|
16
|
+
name?: string;
|
|
17
|
+
source: string;
|
|
18
|
+
licence: string;
|
|
19
|
+
loops: number[][][];
|
|
20
|
+
}>;
|
package/catalogue.mjs
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
// The rule sets @rulecad/frames reads, by name: every profile, slot family and slot nut in @rulecad/rules, the threads
|
|
2
|
+
// their bores tap to, the materials they name and the outlines the kit draws itself. Generated from the rules package (one import per set, so a bundler
|
|
3
|
+
// can see them): after adding a set there, add its line here. A test holds the two together.
|
|
4
|
+
import s_al6000_item from '@rulecad/rules/al6000-item.json' with { type: 'json' };
|
|
5
|
+
import s_al6005a_8020 from '@rulecad/rules/al6005a-8020.json' with { type: 'json' };
|
|
6
|
+
import s_al6060_rexroth from '@rulecad/rules/al6060-rexroth.json' with { type: 'json' };
|
|
7
|
+
import s_al6063_t5 from '@rulecad/rules/al6063-t5.json' with { type: 'json' };
|
|
8
|
+
import s_al6063_t66 from '@rulecad/rules/al6063-t66.json' with { type: 'json' };
|
|
9
|
+
import s_al6n01_t5 from '@rulecad/rules/al6n01-t5.json' with { type: 'json' };
|
|
10
|
+
import s_m10 from '@rulecad/rules/m10.json' with { type: 'json' };
|
|
11
|
+
import s_m12 from '@rulecad/rules/m12.json' with { type: 'json' };
|
|
12
|
+
import s_m1_6 from '@rulecad/rules/m1_6.json' with { type: 'json' };
|
|
13
|
+
import s_m2 from '@rulecad/rules/m2.json' with { type: 'json' };
|
|
14
|
+
import s_m2_5 from '@rulecad/rules/m2_5.json' with { type: 'json' };
|
|
15
|
+
import s_m3 from '@rulecad/rules/m3.json' with { type: 'json' };
|
|
16
|
+
import s_m4 from '@rulecad/rules/m4.json' with { type: 'json' };
|
|
17
|
+
import s_m5 from '@rulecad/rules/m5.json' with { type: 'json' };
|
|
18
|
+
import s_m6 from '@rulecad/rules/m6.json' with { type: 'json' };
|
|
19
|
+
import s_m8 from '@rulecad/rules/m8.json' with { type: 'json' };
|
|
20
|
+
import s_profile_1010_8020 from '@rulecad/rules/profile-1010-8020.json' with { type: 'json' };
|
|
21
|
+
import s_profile_1010_makerbeam from '@rulecad/rules/profile-1010-makerbeam.json' with { type: 'json' };
|
|
22
|
+
import s_profile_1020_8020 from '@rulecad/rules/profile-1020-8020.json' with { type: 'json' };
|
|
23
|
+
import s_profile_1515_8020 from '@rulecad/rules/profile-1515-8020.json' with { type: 'json' };
|
|
24
|
+
import s_profile_1515_makerbeam_xl from '@rulecad/rules/profile-1515-makerbeam-xl.json' with { type: 'json' };
|
|
25
|
+
import s_profile_1515_openbeam from '@rulecad/rules/profile-1515-openbeam.json' with { type: 'json' };
|
|
26
|
+
import s_profile_1530_8020 from '@rulecad/rules/profile-1530-8020.json' with { type: 'json' };
|
|
27
|
+
import s_profile_2020_bosch from '@rulecad/rules/profile-2020-bosch.json' with { type: 'json' };
|
|
28
|
+
import s_profile_2020_generic from '@rulecad/rules/profile-2020-generic.json' with { type: 'json' };
|
|
29
|
+
import s_profile_2020_item_5 from '@rulecad/rules/profile-2020-item-5.json' with { type: 'json' };
|
|
30
|
+
import s_profile_2020_misumi_hfs5 from '@rulecad/rules/profile-2020-misumi-hfs5.json' with { type: 'json' };
|
|
31
|
+
import s_profile_2020_motedis_b6 from '@rulecad/rules/profile-2020-motedis-b6.json' with { type: 'json' };
|
|
32
|
+
import s_profile_2020_motedis_i5 from '@rulecad/rules/profile-2020-motedis-i5.json' with { type: 'json' };
|
|
33
|
+
import s_profile_2020_openbuilds from '@rulecad/rules/profile-2020-openbuilds.json' with { type: 'json' };
|
|
34
|
+
import s_profile_2040_bosch from '@rulecad/rules/profile-2040-bosch.json' with { type: 'json' };
|
|
35
|
+
import s_profile_2040_generic from '@rulecad/rules/profile-2040-generic.json' with { type: 'json' };
|
|
36
|
+
import s_profile_2040_item_5 from '@rulecad/rules/profile-2040-item-5.json' with { type: 'json' };
|
|
37
|
+
import s_profile_2040_misumi_hfs5 from '@rulecad/rules/profile-2040-misumi-hfs5.json' with { type: 'json' };
|
|
38
|
+
import s_profile_2040_motedis_i5 from '@rulecad/rules/profile-2040-motedis-i5.json' with { type: 'json' };
|
|
39
|
+
import s_profile_2040_openbuilds from '@rulecad/rules/profile-2040-openbuilds.json' with { type: 'json' };
|
|
40
|
+
import s_profile_2060_misumi_hfs5 from '@rulecad/rules/profile-2060-misumi-hfs5.json' with { type: 'json' };
|
|
41
|
+
import s_profile_2060_openbuilds from '@rulecad/rules/profile-2060-openbuilds.json' with { type: 'json' };
|
|
42
|
+
import s_profile_2080_misumi_hfs5 from '@rulecad/rules/profile-2080-misumi-hfs5.json' with { type: 'json' };
|
|
43
|
+
import s_profile_2080_openbuilds from '@rulecad/rules/profile-2080-openbuilds.json' with { type: 'json' };
|
|
44
|
+
import s_profile_3030_bosch from '@rulecad/rules/profile-3030-bosch.json' with { type: 'json' };
|
|
45
|
+
import s_profile_3030_generic from '@rulecad/rules/profile-3030-generic.json' with { type: 'json' };
|
|
46
|
+
import s_profile_3030_item_6 from '@rulecad/rules/profile-3030-item-6.json' with { type: 'json' };
|
|
47
|
+
import s_profile_3030_item_6l from '@rulecad/rules/profile-3030-item-6l.json' with { type: 'json' };
|
|
48
|
+
import s_profile_3030_misumi_hfs6 from '@rulecad/rules/profile-3030-misumi-hfs6.json' with { type: 'json' };
|
|
49
|
+
import s_profile_3030_motedis_i6 from '@rulecad/rules/profile-3030-motedis-i6.json' with { type: 'json' };
|
|
50
|
+
import s_profile_3060_bosch from '@rulecad/rules/profile-3060-bosch.json' with { type: 'json' };
|
|
51
|
+
import s_profile_3060_item_6 from '@rulecad/rules/profile-3060-item-6.json' with { type: 'json' };
|
|
52
|
+
import s_profile_3060_item_6l from '@rulecad/rules/profile-3060-item-6l.json' with { type: 'json' };
|
|
53
|
+
import s_profile_3060_misumi_hfs6 from '@rulecad/rules/profile-3060-misumi-hfs6.json' with { type: 'json' };
|
|
54
|
+
import s_profile_4040_bosch_l from '@rulecad/rules/profile-4040-bosch-l.json' with { type: 'json' };
|
|
55
|
+
import s_profile_4040_generic from '@rulecad/rules/profile-4040-generic.json' with { type: 'json' };
|
|
56
|
+
import s_profile_4040_item_8 from '@rulecad/rules/profile-4040-item-8.json' with { type: 'json' };
|
|
57
|
+
import s_profile_4040_item_8l from '@rulecad/rules/profile-4040-item-8l.json' with { type: 'json' };
|
|
58
|
+
import s_profile_4040_misumi_hfs8 from '@rulecad/rules/profile-4040-misumi-hfs8.json' with { type: 'json' };
|
|
59
|
+
import s_profile_4040_motedis_b10 from '@rulecad/rules/profile-4040-motedis-b10.json' with { type: 'json' };
|
|
60
|
+
import s_profile_4040_motedis_i8 from '@rulecad/rules/profile-4040-motedis-i8.json' with { type: 'json' };
|
|
61
|
+
import s_profile_4080_bosch_l from '@rulecad/rules/profile-4080-bosch-l.json' with { type: 'json' };
|
|
62
|
+
import s_profile_4080_item_8 from '@rulecad/rules/profile-4080-item-8.json' with { type: 'json' };
|
|
63
|
+
import s_profile_4080_item_8l from '@rulecad/rules/profile-4080-item-8l.json' with { type: 'json' };
|
|
64
|
+
import s_profile_4080_misumi_hfs8 from '@rulecad/rules/profile-4080-misumi-hfs8.json' with { type: 'json' };
|
|
65
|
+
import s_profile_4080_motedis_i8 from '@rulecad/rules/profile-4080-motedis-i8.json' with { type: 'json' };
|
|
66
|
+
import s_profile_4080_openbuilds_cbeam from '@rulecad/rules/profile-4080-openbuilds-cbeam.json' with { type: 'json' };
|
|
67
|
+
import s_profile_4545_bosch_l from '@rulecad/rules/profile-4545-bosch-l.json' with { type: 'json' };
|
|
68
|
+
import s_profile_4545_misumi_hfs8 from '@rulecad/rules/profile-4545-misumi-hfs8.json' with { type: 'json' };
|
|
69
|
+
import s_profile_4590_misumi_hfs8 from '@rulecad/rules/profile-4590-misumi-hfs8.json' with { type: 'json' };
|
|
70
|
+
import s_profile_angle_al_25x25x3 from '@rulecad/rules/profile-angle-al-25x25x3.json' with { type: 'json' };
|
|
71
|
+
import s_profile_angle_steel_30x30x3 from '@rulecad/rules/profile-angle-steel-30x30x3.json' with { type: 'json' };
|
|
72
|
+
import s_profile_angle from '@rulecad/rules/profile-angle.json' with { type: 'json' };
|
|
73
|
+
import s_profile_bar_al_25x5 from '@rulecad/rules/profile-bar-al-25x5.json' with { type: 'json' };
|
|
74
|
+
import s_profile_bar_steel_30x5 from '@rulecad/rules/profile-bar-steel-30x5.json' with { type: 'json' };
|
|
75
|
+
import s_profile_bar from '@rulecad/rules/profile-bar.json' with { type: 'json' };
|
|
76
|
+
import s_profile_channel_al_30x20x2 from '@rulecad/rules/profile-channel-al-30x20x2.json' with { type: 'json' };
|
|
77
|
+
import s_profile_channel from '@rulecad/rules/profile-channel.json' with { type: 'json' };
|
|
78
|
+
import s_profile_custom from '@rulecad/rules/profile-custom.json' with { type: 'json' };
|
|
79
|
+
import s_profile_round_bar_al_10 from '@rulecad/rules/profile-round-bar-al-10.json' with { type: 'json' };
|
|
80
|
+
import s_profile_round_bar_steel_10 from '@rulecad/rules/profile-round-bar-steel-10.json' with { type: 'json' };
|
|
81
|
+
import s_profile_round_bar from '@rulecad/rules/profile-round-bar.json' with { type: 'json' };
|
|
82
|
+
import s_profile_round_tube_al_25x2 from '@rulecad/rules/profile-round-tube-al-25x2.json' with { type: 'json' };
|
|
83
|
+
import s_profile_round_tube_steel_25x2 from '@rulecad/rules/profile-round-tube-steel-25x2.json' with { type: 'json' };
|
|
84
|
+
import s_profile_round_tube from '@rulecad/rules/profile-round-tube.json' with { type: 'json' };
|
|
85
|
+
import s_profile_tube_al_20x20x2 from '@rulecad/rules/profile-tube-al-20x20x2.json' with { type: 'json' };
|
|
86
|
+
import s_profile_tube_al_25x25x2 from '@rulecad/rules/profile-tube-al-25x25x2.json' with { type: 'json' };
|
|
87
|
+
import s_profile_tube_al_40x20x2 from '@rulecad/rules/profile-tube-al-40x20x2.json' with { type: 'json' };
|
|
88
|
+
import s_profile_tube_steel_25x25x2 from '@rulecad/rules/profile-tube-steel-25x25x2.json' with { type: 'json' };
|
|
89
|
+
import s_profile_tube_steel_40x40x2 from '@rulecad/rules/profile-tube-steel-40x40x2.json' with { type: 'json' };
|
|
90
|
+
import s_profile_tube from '@rulecad/rules/profile-tube.json' with { type: 'json' };
|
|
91
|
+
import s_s275 from '@rulecad/rules/s275.json' with { type: 'json' };
|
|
92
|
+
import s_slot_10_bosch_45l from '@rulecad/rules/slot-10-bosch-45l.json' with { type: 'json' };
|
|
93
|
+
import s_slot_10_bosch from '@rulecad/rules/slot-10-bosch.json' with { type: 'json' };
|
|
94
|
+
import s_slot_10_misumi_45 from '@rulecad/rules/slot-10-misumi-45.json' with { type: 'json' };
|
|
95
|
+
import s_slot_10_misumi from '@rulecad/rules/slot-10-misumi.json' with { type: 'json' };
|
|
96
|
+
import s_slot_10_motedis from '@rulecad/rules/slot-10-motedis.json' with { type: 'json' };
|
|
97
|
+
import s_slot_10 from '@rulecad/rules/slot-10.json' with { type: 'json' };
|
|
98
|
+
import s_slot_3_makerbeam_xl from '@rulecad/rules/slot-3-makerbeam-xl.json' with { type: 'json' };
|
|
99
|
+
import s_slot_3_makerbeam from '@rulecad/rules/slot-3-makerbeam.json' with { type: 'json' };
|
|
100
|
+
import s_slot_3_openbeam from '@rulecad/rules/slot-3-openbeam.json' with { type: 'json' };
|
|
101
|
+
import s_slot_5_item from '@rulecad/rules/slot-5-item.json' with { type: 'json' };
|
|
102
|
+
import s_slot_5_motedis from '@rulecad/rules/slot-5-motedis.json' with { type: 'json' };
|
|
103
|
+
import s_slot_6_8020 from '@rulecad/rules/slot-6-8020.json' with { type: 'json' };
|
|
104
|
+
import s_slot_6_bosch from '@rulecad/rules/slot-6-bosch.json' with { type: 'json' };
|
|
105
|
+
import s_slot_6_item_light from '@rulecad/rules/slot-6-item-light.json' with { type: 'json' };
|
|
106
|
+
import s_slot_6_item from '@rulecad/rules/slot-6-item.json' with { type: 'json' };
|
|
107
|
+
import s_slot_6_misumi from '@rulecad/rules/slot-6-misumi.json' with { type: 'json' };
|
|
108
|
+
import s_slot_6_motedis_i from '@rulecad/rules/slot-6-motedis-i.json' with { type: 'json' };
|
|
109
|
+
import s_slot_6_motedis from '@rulecad/rules/slot-6-motedis.json' with { type: 'json' };
|
|
110
|
+
import s_slot_6_openbuilds from '@rulecad/rules/slot-6-openbuilds.json' with { type: 'json' };
|
|
111
|
+
import s_slot_6 from '@rulecad/rules/slot-6.json' with { type: 'json' };
|
|
112
|
+
import s_slot_8_8020 from '@rulecad/rules/slot-8-8020.json' with { type: 'json' };
|
|
113
|
+
import s_slot_8_bosch from '@rulecad/rules/slot-8-bosch.json' with { type: 'json' };
|
|
114
|
+
import s_slot_8_i from '@rulecad/rules/slot-8-i.json' with { type: 'json' };
|
|
115
|
+
import s_slot_8_item_light from '@rulecad/rules/slot-8-item-light.json' with { type: 'json' };
|
|
116
|
+
import s_slot_8_item from '@rulecad/rules/slot-8-item.json' with { type: 'json' };
|
|
117
|
+
import s_slot_8_misumi from '@rulecad/rules/slot-8-misumi.json' with { type: 'json' };
|
|
118
|
+
import s_slot_8_motedis_i from '@rulecad/rules/slot-8-motedis-i.json' with { type: 'json' };
|
|
119
|
+
import s_slot_8 from '@rulecad/rules/slot-8.json' with { type: 'json' };
|
|
120
|
+
import s_slot_nut_6_bosch_m3_roll_in from '@rulecad/rules/slot-nut-6-bosch-m3-roll-in.json' with { type: 'json' };
|
|
121
|
+
import s_slot_nut_6_bosch_m4_drop_in from '@rulecad/rules/slot-nut-6-bosch-m4-drop-in.json' with { type: 'json' };
|
|
122
|
+
import s_slot_nut_6_bosch_m4_roll_in from '@rulecad/rules/slot-nut-6-bosch-m4-roll-in.json' with { type: 'json' };
|
|
123
|
+
import s_slot_nut_6_bosch_m4_slide_in from '@rulecad/rules/slot-nut-6-bosch-m4-slide-in.json' with { type: 'json' };
|
|
124
|
+
import s_slot_nut_6_bosch_m5_roll_in from '@rulecad/rules/slot-nut-6-bosch-m5-roll-in.json' with { type: 'json' };
|
|
125
|
+
import s_slot_nut_6_bosch_m5_slide_in from '@rulecad/rules/slot-nut-6-bosch-m5-slide-in.json' with { type: 'json' };
|
|
126
|
+
import s_slot_nut_6_misumi_m3_drop_in from '@rulecad/rules/slot-nut-6-misumi-m3-drop-in.json' with { type: 'json' };
|
|
127
|
+
import s_slot_nut_6_misumi_m3_roll_in from '@rulecad/rules/slot-nut-6-misumi-m3-roll-in.json' with { type: 'json' };
|
|
128
|
+
import s_slot_nut_6_misumi_m3_slide_in from '@rulecad/rules/slot-nut-6-misumi-m3-slide-in.json' with { type: 'json' };
|
|
129
|
+
import s_slot_nut_6_misumi_m3_square from '@rulecad/rules/slot-nut-6-misumi-m3-square.json' with { type: 'json' };
|
|
130
|
+
import s_slot_nut_6_misumi_m4_drop_in from '@rulecad/rules/slot-nut-6-misumi-m4-drop-in.json' with { type: 'json' };
|
|
131
|
+
import s_slot_nut_6_misumi_m4_roll_in from '@rulecad/rules/slot-nut-6-misumi-m4-roll-in.json' with { type: 'json' };
|
|
132
|
+
import s_slot_nut_6_misumi_m4_slide_in from '@rulecad/rules/slot-nut-6-misumi-m4-slide-in.json' with { type: 'json' };
|
|
133
|
+
import s_slot_nut_6_misumi_m4_square from '@rulecad/rules/slot-nut-6-misumi-m4-square.json' with { type: 'json' };
|
|
134
|
+
import s_slot_nut_6_misumi_m5_roll_in from '@rulecad/rules/slot-nut-6-misumi-m5-roll-in.json' with { type: 'json' };
|
|
135
|
+
import s_slot_nut_6_misumi_m5_slide_in from '@rulecad/rules/slot-nut-6-misumi-m5-slide-in.json' with { type: 'json' };
|
|
136
|
+
import s_slot_nut_6_misumi_m5_square from '@rulecad/rules/slot-nut-6-misumi-m5-square.json' with { type: 'json' };
|
|
137
|
+
import s_slot_nut_6_motedis_m4_hammer from '@rulecad/rules/slot-nut-6-motedis-m4-hammer.json' with { type: 'json' };
|
|
138
|
+
import s_slot_nut_6_motedis_m5_hammer from '@rulecad/rules/slot-nut-6-motedis-m5-hammer.json' with { type: 'json' };
|
|
139
|
+
import s_slot_nut_6_motedis_m5_slide_in from '@rulecad/rules/slot-nut-6-motedis-m5-slide-in.json' with { type: 'json' };
|
|
140
|
+
import s_slot_nut_6_motedis_m5_square from '@rulecad/rules/slot-nut-6-motedis-m5-square.json' with { type: 'json' };
|
|
141
|
+
import s_slot_nut_6_openbuilds_m5_drop_in from '@rulecad/rules/slot-nut-6-openbuilds-m5-drop-in.json' with { type: 'json' };
|
|
142
|
+
import s_slot_nut_8_bosch_m4_drop_in from '@rulecad/rules/slot-nut-8-bosch-m4-drop-in.json' with { type: 'json' };
|
|
143
|
+
import s_slot_nut_8_bosch_m4_roll_in from '@rulecad/rules/slot-nut-8-bosch-m4-roll-in.json' with { type: 'json' };
|
|
144
|
+
import s_slot_nut_8_bosch_m4_slide_in from '@rulecad/rules/slot-nut-8-bosch-m4-slide-in.json' with { type: 'json' };
|
|
145
|
+
import s_slot_nut_8_bosch_m5_drop_in from '@rulecad/rules/slot-nut-8-bosch-m5-drop-in.json' with { type: 'json' };
|
|
146
|
+
import s_slot_nut_8_bosch_m5_roll_in from '@rulecad/rules/slot-nut-8-bosch-m5-roll-in.json' with { type: 'json' };
|
|
147
|
+
import s_slot_nut_8_bosch_m5_slide_in from '@rulecad/rules/slot-nut-8-bosch-m5-slide-in.json' with { type: 'json' };
|
|
148
|
+
import s_slot_nut_8_bosch_m6_drop_in from '@rulecad/rules/slot-nut-8-bosch-m6-drop-in.json' with { type: 'json' };
|
|
149
|
+
import s_slot_nut_8_bosch_m6_roll_in from '@rulecad/rules/slot-nut-8-bosch-m6-roll-in.json' with { type: 'json' };
|
|
150
|
+
import s_slot_nut_8_bosch_m6_slide_in from '@rulecad/rules/slot-nut-8-bosch-m6-slide-in.json' with { type: 'json' };
|
|
151
|
+
import s_slot_nut_8_bosch_m6_t_bolt from '@rulecad/rules/slot-nut-8-bosch-m6-t-bolt.json' with { type: 'json' };
|
|
152
|
+
import s_slot_nut_8_bosch_m8_roll_in from '@rulecad/rules/slot-nut-8-bosch-m8-roll-in.json' with { type: 'json' };
|
|
153
|
+
import s_slot_nut_8_bosch_m8_slide_in from '@rulecad/rules/slot-nut-8-bosch-m8-slide-in.json' with { type: 'json' };
|
|
154
|
+
import s_slot_nut_8_i_motedis_m4_hammer from '@rulecad/rules/slot-nut-8-i-motedis-m4-hammer.json' with { type: 'json' };
|
|
155
|
+
import s_slot_nut_8_i_motedis_m4_roll_in from '@rulecad/rules/slot-nut-8-i-motedis-m4-roll-in.json' with { type: 'json' };
|
|
156
|
+
import s_slot_nut_8_i_motedis_m5_hammer from '@rulecad/rules/slot-nut-8-i-motedis-m5-hammer.json' with { type: 'json' };
|
|
157
|
+
import s_slot_nut_8_i_motedis_m5_roll_in from '@rulecad/rules/slot-nut-8-i-motedis-m5-roll-in.json' with { type: 'json' };
|
|
158
|
+
import s_slot_nut_8_i_motedis_m6_hammer from '@rulecad/rules/slot-nut-8-i-motedis-m6-hammer.json' with { type: 'json' };
|
|
159
|
+
import s_slot_nut_8_i_motedis_m6_roll_in from '@rulecad/rules/slot-nut-8-i-motedis-m6-roll-in.json' with { type: 'json' };
|
|
160
|
+
import s_slot_nut_8_i_motedis_m8_roll_in from '@rulecad/rules/slot-nut-8-i-motedis-m8-roll-in.json' with { type: 'json' };
|
|
161
|
+
import s_slot_nut_8_misumi_m3_drop_in from '@rulecad/rules/slot-nut-8-misumi-m3-drop-in.json' with { type: 'json' };
|
|
162
|
+
import s_slot_nut_8_misumi_m3_roll_in from '@rulecad/rules/slot-nut-8-misumi-m3-roll-in.json' with { type: 'json' };
|
|
163
|
+
import s_slot_nut_8_misumi_m3_slide_in from '@rulecad/rules/slot-nut-8-misumi-m3-slide-in.json' with { type: 'json' };
|
|
164
|
+
import s_slot_nut_8_misumi_m4_drop_in from '@rulecad/rules/slot-nut-8-misumi-m4-drop-in.json' with { type: 'json' };
|
|
165
|
+
import s_slot_nut_8_misumi_m4_roll_in from '@rulecad/rules/slot-nut-8-misumi-m4-roll-in.json' with { type: 'json' };
|
|
166
|
+
import s_slot_nut_8_misumi_m4_slide_in from '@rulecad/rules/slot-nut-8-misumi-m4-slide-in.json' with { type: 'json' };
|
|
167
|
+
import s_slot_nut_8_misumi_m4_square from '@rulecad/rules/slot-nut-8-misumi-m4-square.json' with { type: 'json' };
|
|
168
|
+
import s_slot_nut_8_misumi_m5_drop_in from '@rulecad/rules/slot-nut-8-misumi-m5-drop-in.json' with { type: 'json' };
|
|
169
|
+
import s_slot_nut_8_misumi_m5_roll_in from '@rulecad/rules/slot-nut-8-misumi-m5-roll-in.json' with { type: 'json' };
|
|
170
|
+
import s_slot_nut_8_misumi_m5_slide_in from '@rulecad/rules/slot-nut-8-misumi-m5-slide-in.json' with { type: 'json' };
|
|
171
|
+
import s_slot_nut_8_misumi_m5_square from '@rulecad/rules/slot-nut-8-misumi-m5-square.json' with { type: 'json' };
|
|
172
|
+
import s_slot_nut_8_misumi_m6_drop_in from '@rulecad/rules/slot-nut-8-misumi-m6-drop-in.json' with { type: 'json' };
|
|
173
|
+
import s_slot_nut_8_misumi_m6_roll_in from '@rulecad/rules/slot-nut-8-misumi-m6-roll-in.json' with { type: 'json' };
|
|
174
|
+
import s_slot_nut_8_misumi_m6_slide_in from '@rulecad/rules/slot-nut-8-misumi-m6-slide-in.json' with { type: 'json' };
|
|
175
|
+
import s_slot_nut_8_misumi_m6_square from '@rulecad/rules/slot-nut-8-misumi-m6-square.json' with { type: 'json' };
|
|
176
|
+
import s_slot_nut_8_motedis_m4_hammer from '@rulecad/rules/slot-nut-8-motedis-m4-hammer.json' with { type: 'json' };
|
|
177
|
+
import s_slot_nut_8_motedis_m4_roll_in from '@rulecad/rules/slot-nut-8-motedis-m4-roll-in.json' with { type: 'json' };
|
|
178
|
+
import s_slot_nut_8_motedis_m5_hammer from '@rulecad/rules/slot-nut-8-motedis-m5-hammer.json' with { type: 'json' };
|
|
179
|
+
import s_slot_nut_8_motedis_m5_roll_in from '@rulecad/rules/slot-nut-8-motedis-m5-roll-in.json' with { type: 'json' };
|
|
180
|
+
import s_slot_nut_8_motedis_m6_hammer from '@rulecad/rules/slot-nut-8-motedis-m6-hammer.json' with { type: 'json' };
|
|
181
|
+
import s_slot_nut_8_motedis_m6_roll_in from '@rulecad/rules/slot-nut-8-motedis-m6-roll-in.json' with { type: 'json' };
|
|
182
|
+
import s_slot_nut_8_motedis_m8_roll_in from '@rulecad/rules/slot-nut-8-motedis-m8-roll-in.json' with { type: 'json' };
|
|
183
|
+
import s_unc_10_24 from '@rulecad/rules/unc_10_24.json' with { type: 'json' };
|
|
184
|
+
import s_unc_1_4_20 from '@rulecad/rules/unc_1_4_20.json' with { type: 'json' };
|
|
185
|
+
import s_unc_3_8_16 from '@rulecad/rules/unc_3_8_16.json' with { type: 'json' };
|
|
186
|
+
import s_unc_4_40 from '@rulecad/rules/unc_4_40.json' with { type: 'json' };
|
|
187
|
+
import s_unc_5_16_18 from '@rulecad/rules/unc_5_16_18.json' with { type: 'json' };
|
|
188
|
+
import s_unc_6_32 from '@rulecad/rules/unc_6_32.json' with { type: 'json' };
|
|
189
|
+
import s_unc_8_32 from '@rulecad/rules/unc_8_32.json' with { type: 'json' };
|
|
190
|
+
import s_unf_10_32 from '@rulecad/rules/unf_10_32.json' with { type: 'json' };
|
|
191
|
+
import o_profile_custom from '@rulecad/rules/outlines/profile-custom.json' with { type: 'json' };
|
|
192
|
+
import vocabulary from '@rulecad/rules/vocabulary.json' with { type: 'json' };
|
|
193
|
+
|
|
194
|
+
/** The names a profile, a slot and a slot nut are written in: the fields of vocabulary.json. @type {Record<string, { unit?: string, choice?: string[], list?: boolean, says: string }>} */
|
|
195
|
+
export const FIELDS = vocabulary.fields;
|
|
196
|
+
/** Every rule set frames knows, by its name. @type {Record<string, { name: string, part?: string, rules: Record<string, any> }>} */
|
|
197
|
+
export const SETS = Object.fromEntries([
|
|
198
|
+
s_al6000_item, s_al6005a_8020, s_al6060_rexroth, s_al6063_t5, s_al6063_t66, s_al6n01_t5, s_m10, s_m12,
|
|
199
|
+
s_m1_6, s_m2, s_m2_5, s_m3, s_m4, s_m5, s_m6, s_m8, s_profile_1010_8020, s_profile_1010_makerbeam, s_profile_1020_8020,
|
|
200
|
+
s_profile_1515_8020, s_profile_1515_makerbeam_xl, s_profile_1515_openbeam, s_profile_1530_8020, s_profile_2020_bosch,
|
|
201
|
+
s_profile_2020_generic, s_profile_2020_item_5, s_profile_2020_misumi_hfs5, s_profile_2020_motedis_b6,
|
|
202
|
+
s_profile_2020_motedis_i5, s_profile_2020_openbuilds, s_profile_2040_bosch, s_profile_2040_generic, s_profile_2040_item_5,
|
|
203
|
+
s_profile_2040_misumi_hfs5, s_profile_2040_motedis_i5, s_profile_2040_openbuilds, s_profile_2060_misumi_hfs5,
|
|
204
|
+
s_profile_2060_openbuilds, s_profile_2080_misumi_hfs5, s_profile_2080_openbuilds, s_profile_3030_bosch,
|
|
205
|
+
s_profile_3030_generic, s_profile_3030_item_6, s_profile_3030_item_6l, s_profile_3030_misumi_hfs6, s_profile_3030_motedis_i6,
|
|
206
|
+
s_profile_3060_bosch, s_profile_3060_item_6, s_profile_3060_item_6l, s_profile_3060_misumi_hfs6, s_profile_4040_bosch_l,
|
|
207
|
+
s_profile_4040_generic, s_profile_4040_item_8, s_profile_4040_item_8l, s_profile_4040_misumi_hfs8, s_profile_4040_motedis_b10,
|
|
208
|
+
s_profile_4040_motedis_i8, s_profile_4080_bosch_l, s_profile_4080_item_8, s_profile_4080_item_8l, s_profile_4080_misumi_hfs8,
|
|
209
|
+
s_profile_4080_motedis_i8, s_profile_4080_openbuilds_cbeam, s_profile_4545_bosch_l, s_profile_4545_misumi_hfs8,
|
|
210
|
+
s_profile_4590_misumi_hfs8, s_profile_angle_al_25x25x3, s_profile_angle_steel_30x30x3, s_profile_angle,
|
|
211
|
+
s_profile_bar_al_25x5, s_profile_bar_steel_30x5, s_profile_bar, s_profile_channel_al_30x20x2, s_profile_channel,
|
|
212
|
+
s_profile_custom, s_profile_round_bar_al_10, s_profile_round_bar_steel_10, s_profile_round_bar, s_profile_round_tube_al_25x2,
|
|
213
|
+
s_profile_round_tube_steel_25x2, s_profile_round_tube, s_profile_tube_al_20x20x2, s_profile_tube_al_25x25x2,
|
|
214
|
+
s_profile_tube_al_40x20x2, s_profile_tube_steel_25x25x2, s_profile_tube_steel_40x40x2, s_profile_tube,
|
|
215
|
+
s_s275, s_slot_10_bosch_45l, s_slot_10_bosch, s_slot_10_misumi_45, s_slot_10_misumi, s_slot_10_motedis,
|
|
216
|
+
s_slot_10, s_slot_3_makerbeam_xl, s_slot_3_makerbeam, s_slot_3_openbeam, s_slot_5_item, s_slot_5_motedis,
|
|
217
|
+
s_slot_6_8020, s_slot_6_bosch, s_slot_6_item_light, s_slot_6_item, s_slot_6_misumi, s_slot_6_motedis_i,
|
|
218
|
+
s_slot_6_motedis, s_slot_6_openbuilds, s_slot_6, s_slot_8_8020, s_slot_8_bosch, s_slot_8_i, s_slot_8_item_light,
|
|
219
|
+
s_slot_8_item, s_slot_8_misumi, s_slot_8_motedis_i, s_slot_8, s_slot_nut_6_bosch_m3_roll_in, s_slot_nut_6_bosch_m4_drop_in,
|
|
220
|
+
s_slot_nut_6_bosch_m4_roll_in, s_slot_nut_6_bosch_m4_slide_in, s_slot_nut_6_bosch_m5_roll_in, s_slot_nut_6_bosch_m5_slide_in,
|
|
221
|
+
s_slot_nut_6_misumi_m3_drop_in, s_slot_nut_6_misumi_m3_roll_in, s_slot_nut_6_misumi_m3_slide_in, s_slot_nut_6_misumi_m3_square,
|
|
222
|
+
s_slot_nut_6_misumi_m4_drop_in, s_slot_nut_6_misumi_m4_roll_in, s_slot_nut_6_misumi_m4_slide_in, s_slot_nut_6_misumi_m4_square,
|
|
223
|
+
s_slot_nut_6_misumi_m5_roll_in, s_slot_nut_6_misumi_m5_slide_in, s_slot_nut_6_misumi_m5_square, s_slot_nut_6_motedis_m4_hammer,
|
|
224
|
+
s_slot_nut_6_motedis_m5_hammer, s_slot_nut_6_motedis_m5_slide_in, s_slot_nut_6_motedis_m5_square, s_slot_nut_6_openbuilds_m5_drop_in,
|
|
225
|
+
s_slot_nut_8_bosch_m4_drop_in, s_slot_nut_8_bosch_m4_roll_in, s_slot_nut_8_bosch_m4_slide_in, s_slot_nut_8_bosch_m5_drop_in,
|
|
226
|
+
s_slot_nut_8_bosch_m5_roll_in, s_slot_nut_8_bosch_m5_slide_in, s_slot_nut_8_bosch_m6_drop_in, s_slot_nut_8_bosch_m6_roll_in,
|
|
227
|
+
s_slot_nut_8_bosch_m6_slide_in, s_slot_nut_8_bosch_m6_t_bolt, s_slot_nut_8_bosch_m8_roll_in, s_slot_nut_8_bosch_m8_slide_in,
|
|
228
|
+
s_slot_nut_8_i_motedis_m4_hammer, s_slot_nut_8_i_motedis_m4_roll_in, s_slot_nut_8_i_motedis_m5_hammer,
|
|
229
|
+
s_slot_nut_8_i_motedis_m5_roll_in, s_slot_nut_8_i_motedis_m6_hammer, s_slot_nut_8_i_motedis_m6_roll_in,
|
|
230
|
+
s_slot_nut_8_i_motedis_m8_roll_in, s_slot_nut_8_misumi_m3_drop_in, s_slot_nut_8_misumi_m3_roll_in, s_slot_nut_8_misumi_m3_slide_in,
|
|
231
|
+
s_slot_nut_8_misumi_m4_drop_in, s_slot_nut_8_misumi_m4_roll_in, s_slot_nut_8_misumi_m4_slide_in, s_slot_nut_8_misumi_m4_square,
|
|
232
|
+
s_slot_nut_8_misumi_m5_drop_in, s_slot_nut_8_misumi_m5_roll_in, s_slot_nut_8_misumi_m5_slide_in, s_slot_nut_8_misumi_m5_square,
|
|
233
|
+
s_slot_nut_8_misumi_m6_drop_in, s_slot_nut_8_misumi_m6_roll_in, s_slot_nut_8_misumi_m6_slide_in, s_slot_nut_8_misumi_m6_square,
|
|
234
|
+
s_slot_nut_8_motedis_m4_hammer, s_slot_nut_8_motedis_m4_roll_in, s_slot_nut_8_motedis_m5_hammer, s_slot_nut_8_motedis_m5_roll_in,
|
|
235
|
+
s_slot_nut_8_motedis_m6_hammer, s_slot_nut_8_motedis_m6_roll_in, s_slot_nut_8_motedis_m8_roll_in, s_unc_10_24,
|
|
236
|
+
s_unc_1_4_20, s_unc_3_8_16, s_unc_4_40, s_unc_5_16_18, s_unc_6_32, s_unc_8_32, s_unf_10_32
|
|
237
|
+
].map((s) => [s.name, s]));
|
|
238
|
+
/** The kit's own outlines, by the name of the set each belongs to (rules/outlines/<name>.json). @type {Record<string, { name?: string, source: string, licence: string, loops: number[][][] }>} */
|
|
239
|
+
export const OUTLINES = { "profile-custom": o_profile_custom };
|