@rulecad/cad 0.8.0 → 0.9.0

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.
Files changed (83) hide show
  1. package/AGENTS.md +24 -10
  2. package/CHANGELOG.md +404 -0
  3. package/EXAMPLES.md +40 -38
  4. package/README.md +193 -67
  5. package/TUTORIAL.md +2 -2
  6. package/bin/cad.mjs +2250 -512
  7. package/lib/animate.mjs +173 -49
  8. package/lib/assembly.mjs +1847 -434
  9. package/lib/beams.mjs +256 -52
  10. package/lib/belts.mjs +66 -15
  11. package/lib/board-work.mjs +12 -0
  12. package/lib/bought.mjs +309 -53
  13. package/lib/buildpage.mjs +179 -29
  14. package/lib/carried.mjs +201 -0
  15. package/lib/clone.mjs +194 -42
  16. package/lib/design.mjs +649 -121
  17. package/lib/drive.mjs +187 -63
  18. package/lib/edit.mjs +899 -191
  19. package/lib/errors.mjs +16 -3
  20. package/lib/explain.mjs +62 -13
  21. package/lib/fasten.mjs +2702 -507
  22. package/lib/fittings.mjs +715 -121
  23. package/lib/fixings.mjs +21 -9
  24. package/lib/framebuild.mjs +790 -175
  25. package/lib/framecheck.mjs +1901 -368
  26. package/lib/framegen.mjs +100 -22
  27. package/lib/frameheat.mjs +225 -42
  28. package/lib/frameprint.mjs +513 -108
  29. package/lib/frames.mjs +81 -17
  30. package/lib/framesize.mjs +792 -120
  31. package/lib/frametip.mjs +235 -0
  32. package/lib/gait.mjs +135 -23
  33. package/lib/grip.mjs +62 -13
  34. package/lib/guides.mjs +1403 -230
  35. package/lib/host.mjs +123 -21
  36. package/lib/inplace.mjs +171 -36
  37. package/lib/jigs.mjs +360 -78
  38. package/lib/joins.mjs +697 -118
  39. package/lib/jsonedit.mjs +88 -26
  40. package/lib/kept.mjs +84 -0
  41. package/lib/kit.mjs +438 -68
  42. package/lib/layout.mjs +2 -1
  43. package/lib/links.mjs +149 -42
  44. package/lib/list.mjs +326 -64
  45. package/lib/live-guard.mjs +68 -0
  46. package/lib/live-shape.mjs +96 -24
  47. package/lib/live.mjs +189 -59
  48. package/lib/loads.mjs +579 -130
  49. package/lib/machine.mjs +372 -74
  50. package/lib/magnets.mjs +162 -44
  51. package/lib/measured.mjs +417 -94
  52. package/lib/mesh.mjs +526 -119
  53. package/lib/meshcmd.mjs +215 -60
  54. package/lib/motors.mjs +1021 -213
  55. package/lib/motorsvg.mjs +114 -32
  56. package/lib/names.mjs +3 -1
  57. package/lib/optimise.mjs +978 -283
  58. package/lib/order.mjs +519 -112
  59. package/lib/panels.mjs +482 -94
  60. package/lib/parts.mjs +78 -23
  61. package/lib/pins.mjs +163 -44
  62. package/lib/plates.mjs +223 -35
  63. package/lib/player.mjs +37 -9
  64. package/lib/power.mjs +64 -13
  65. package/lib/preview.mjs +83 -16
  66. package/lib/profilemeasure.mjs +572 -129
  67. package/lib/rules.mjs +15 -5
  68. package/lib/sandbox-hooks.mjs +77 -19
  69. package/lib/sandbox-run.mjs +117 -18
  70. package/lib/sandbox.mjs +509 -60
  71. package/lib/schema.mjs +42 -11
  72. package/lib/seats.mjs +227 -49
  73. package/lib/services.mjs +261 -52
  74. package/lib/sheet.mjs +851 -178
  75. package/lib/slotnuts.mjs +213 -34
  76. package/lib/targets/gist.mjs +4 -1
  77. package/lib/targets.mjs +22 -4
  78. package/lib/task.mjs +376 -79
  79. package/lib/versions.mjs +111 -28
  80. package/lib/wires.mjs +228 -45
  81. package/lib/workspace.mjs +197 -12
  82. package/package.json +19 -19
  83. package/schemas/assembly.schema.json +2 -2
package/lib/workspace.mjs CHANGED
@@ -6,9 +6,11 @@
6
6
  // printer the rule set a print is checked against (bed, overhang, bridges); a project.json's "printer" wins
7
7
  // viewUrl the model page that links open (the public one by default: it reads links as data, nothing is uploaded)
8
8
  // targets optional extras: show (put a model on display: a module of your own) and shorten (short links: "gist")
9
+ // designTimeout, designMemory how long a design may run in the sandbox (seconds) and the memory it may hold
10
+ // (megabytes): sandbox.mjs designLimits; above the defaults, only once the workspace is trusted
9
11
  import fs from 'node:fs';
10
12
  import path from 'node:path';
11
- import { host, readJson } from './host.mjs';
13
+ import { host, readJson, guardReads, readOwnText } from './host.mjs';
12
14
  import { fileURLToPath } from 'node:url';
13
15
  import { plainName } from './names.mjs';
14
16
 
@@ -23,18 +25,158 @@ function find() {
23
25
  }
24
26
 
25
27
  export const WS = find();
28
+
29
+ // Links out of the workspace. A workspace can come from anyone, and git carries symbolic links: a rules/x.json, a
30
+ // design's .json or a folder of a project that is a link to a file of the user's elsewhere (a key in their home folder)
31
+ // would be read as the workspace's own, and what is read can end up in a model link or an exported file. So the
32
+ // workspace's own files are read only where they really are inside it: by the file's real path (every link on its way
33
+ // followed) against the workspace's real path. node_modules is left alone: packages are linked in from elsewhere as a
34
+ // matter of course (npm link, a workspace of packages), and the sandbox holds what a design may load of them.
35
+ let realWs = null;
36
+ const wsReal = () => {
37
+ if (realWs == null)
38
+ try {
39
+ realWs = fs.realpathSync(WS);
40
+ } catch {
41
+ realWs = path.resolve(WS);
42
+ }
43
+ return realWs;
44
+ };
45
+ const within = (dir, f) => {
46
+ const rel = path.relative(dir, f);
47
+ return rel === '' || (rel !== '..' && !rel.startsWith(`..${path.sep}`) && !path.isAbsolute(rel));
48
+ };
49
+ /**
50
+ * The error for a link in the workspace that leads out of it: code workspace.outside, naming the link.
51
+ * @param {string} link the link, inside the workspace @param {string} to where it really leads
52
+ */
53
+ export function outsideError(link, to) {
54
+ const name = path.relative(WS, link) || link;
55
+ return Object.assign(
56
+ new Error(
57
+ `${name} is a link to ${to}, outside this workspace (${WS}), so it isn't read: a workspace may read only its own files, and a link could hand a file of yours elsewhere to a design or a model link. To share a file between workspaces, copy it into the workspace, or put it in a package and install that`,
58
+ ),
59
+ { code: 'workspace.outside', file: link },
60
+ );
61
+ }
62
+ /**
63
+ * `file`, when it is not the workspace's (one of the kit's rule sets, a package), or when it really is inside the
64
+ * workspace; else an error (code workspace.outside) naming the link on its way that leads out. A file not there yet is
65
+ * returned as it is: reading it finds nothing, and says so.
66
+ * @param {string} file
67
+ * @returns {string}
68
+ */
69
+ export function ownFile(file) {
70
+ if (host.name !== 'node') return file; // (a workspace in memory has no links)
71
+ const abs = path.resolve(file),
72
+ base = within(WS, abs) ? WS : within(wsReal(), abs) ? wsReal() : null;
73
+ if (!base) return file; // (not the workspace's)
74
+ // (the workspace's own node_modules only: a project, or any other folder, named node_modules is the workspace's)
75
+ if (path.relative(base, abs).split(path.sep)[0] === 'node_modules') return file;
76
+ let real;
77
+ try {
78
+ real = fs.realpathSync(abs);
79
+ } catch {
80
+ return file;
81
+ }
82
+ if (within(wsReal(), real)) return file;
83
+ // the link that leads out: the first on the way down from the workspace whose real path is outside it
84
+ const parts = path.relative(base, abs).split(path.sep);
85
+ for (let i = 1; i <= parts.length; i++) {
86
+ const p = path.join(base, ...parts.slice(0, i));
87
+ try {
88
+ if (fs.lstatSync(p).isSymbolicLink() && !within(wsReal(), fs.realpathSync(p)))
89
+ throw outsideError(path.join(WS, ...parts.slice(0, i)), fs.realpathSync(p));
90
+ } catch (e) {
91
+ if (e.code === 'workspace.outside') throw e;
92
+ }
93
+ }
94
+ throw outsideError(path.join(WS, ...parts), real);
95
+ }
96
+ // The folders already looked through this run (by real path): a run builds many designs of one project, and its
97
+ // links don't change under it, so each folder is walked once
98
+ const walked = new Set();
99
+ /**
100
+ * Throws (code workspace.outside, naming the link) if any of these folders of the workspace, or a folder in them,
101
+ * holds a link whose real path is outside the workspace. The sandbox may read the whole workspace, and Node's
102
+ * permission model follows a link even to a place it was not allowed to read: so before a design runs there, the
103
+ * folders it may read (its project, the rule sets) are looked through. A link that stays inside the workspace is
104
+ * followed and its folder looked through too; node_modules is left to the sandbox's import hook (sandbox-hooks.mjs),
105
+ * and a folder outside the workspace (a design named by a path elsewhere) is not the workspace's to look through.
106
+ * @param {string[]} dirs
107
+ */
108
+ export function noLinksOut(dirs) {
109
+ if (host.name !== 'node') return;
110
+ const look = (dir, shown) => {
111
+ let real;
112
+ try {
113
+ real = fs.realpathSync(dir);
114
+ } catch {
115
+ return; // (no such folder)
116
+ }
117
+ if (walked.has(real) || !within(wsReal(), real)) return;
118
+ walked.add(real);
119
+ let entries;
120
+ try {
121
+ entries = fs.readdirSync(dir, { withFileTypes: true });
122
+ } catch {
123
+ return;
124
+ }
125
+ for (const e of entries) {
126
+ if (e.name === 'node_modules') continue;
127
+ const p = path.join(dir, e.name),
128
+ named = path.join(shown, e.name);
129
+ if (e.isSymbolicLink()) {
130
+ let to;
131
+ try {
132
+ to = fs.realpathSync(p);
133
+ } catch {
134
+ continue; // (a link to nothing: reading it finds nothing)
135
+ }
136
+ if (!within(wsReal(), to)) throw outsideError(named, to);
137
+ if (fs.statSync(p).isDirectory()) look(p, named);
138
+ } else if (e.isDirectory()) look(p, named);
139
+ }
140
+ };
141
+ try {
142
+ for (const d of dirs) {
143
+ if (!d) continue;
144
+ const abs = path.resolve(d);
145
+ if (!within(WS, abs) && !within(wsReal(), abs)) continue;
146
+ ownFile(abs); // (the folder itself, or one on its way, a link out: projects/p or rules/ linked in from elsewhere)
147
+ look(abs, abs);
148
+ }
149
+ } catch (e) {
150
+ walked.clear(); // (looked through afresh next time: the link may be put right by then)
151
+ throw e;
152
+ }
153
+ }
154
+
155
+ // One of the workspace's text files, read only where it really is inside it (ownFile): host.mjs's, held to ownFile below
156
+ export { readOwnText };
157
+ // Every JSON file the tool reads (readJson) is held to this: the workspace's rule sets, projects, designs, assemblies
158
+ guardReads(ownFile);
159
+
26
160
  // A cad.config.json that doesn't parse is kept as configError for the command to report in its own words: this runs
27
161
  // as the tool is loaded, where an error would reach a person as a stack trace
28
162
  export let configError = null;
163
+ /** The kit's own model page, which links open unless a workspace names another (viewUrl in cad.config.json). */
164
+ export const DEFAULT_VIEW = 'https://jonibach.github.io/rulecad/';
29
165
  export const config = (() => {
30
166
  const f = path.join(WS, 'cad.config.json');
31
167
  let own = {};
32
- try { if (host.exists(f)) own = readJson(f); } catch (e) { configError = e; }
33
- return { printer: 'x1c', viewUrl: 'https://jonibach.github.io/rulecad/', targets: {}, ...own };
168
+ try {
169
+ if (host.exists(f)) own = readJson(f);
170
+ } catch (e) {
171
+ configError = e;
172
+ }
173
+ return { printer: 'x1c', viewUrl: DEFAULT_VIEW, targets: {}, ...own };
34
174
  })();
35
175
 
36
176
  // Rule sets: the workspace's own first (your copies, with your measurements), then the published ones (@rulecad/rules).
37
- export const RULE_DIRS = [...new Set([path.join(WS, 'rules'), path.dirname(fileURLToPath(import.meta.resolve('@rulecad/rules/x1c.json')))])];
177
+ export const RULE_DIRS = [
178
+ ...new Set([path.join(WS, 'rules'), path.dirname(fileURLToPath(import.meta.resolve('@rulecad/rules/x1c.json')))]),
179
+ ];
38
180
 
39
181
  export const paths = {
40
182
  projects: path.join(WS, 'projects'),
@@ -64,24 +206,67 @@ const TRUSTED = () => process.env.CAD_TRUSTED || path.join(os.homedir(), '.confi
64
206
  // The kit's own targets, by exact name. A target is the kit's own only if its name is a key here, never because of
65
207
  // what its name looks like or because a file of that name happens to be in the kit: anything else in "targets" (a bare
66
208
  // name, a path with / or \, a ../ name that reaches one of the kit's modules) is the workspace's code, and asked about.
67
- export const OWN_TARGETS = Object.freeze(Object.assign(Object.create(null), { gist: new URL('./targets/gist.mjs', import.meta.url).href }));
209
+ export const OWN_TARGETS = Object.freeze(
210
+ Object.assign(Object.create(null), { gist: new URL('./targets/gist.mjs', import.meta.url).href }),
211
+ );
68
212
  /** Whether a target name in cad.config.json is one of the kit's own (exactly a key of OWN_TARGETS). */
69
213
  export const isOwnTarget = (name) => typeof name === 'string' && Object.hasOwn(OWN_TARGETS, name);
70
- /** What this workspace asks to run outside the sandbox: [] when nothing. */
214
+ /** The time a design may run in the sandbox unless the workspace says otherwise, in seconds (sandbox.mjs designLimits). */
215
+ export const DESIGN_TIMEOUT = 3600;
216
+ /** The memory a design's JavaScript may hold in the sandbox unless the workspace says otherwise, in megabytes. */
217
+ export const DESIGN_MEMORY = 4096;
218
+ // A design's limits raised above these by cad.config.json are asked about too: a workspace cloned from elsewhere could
219
+ // otherwise take the limits away (a month, a million megabytes) and have a design fill the machine on its first command
220
+ const above = (v, limit) => {
221
+ const n = typeof v === 'number' ? v : typeof v === 'string' && v.trim() ? Number(v) : NaN;
222
+ return Number.isFinite(n) && n > limit ? n : null;
223
+ };
224
+ /** What this workspace asks to run outside the sandbox, or past the sandbox's limits: [] when nothing. */
71
225
  export function asks(cfg = config) {
72
- const own = Object.entries(cfg.targets || {}).filter(([, v]) => v && !isOwnTarget(v)).map(([k, v]) => `the ${k} target ${typeof v === 'string' ? v : JSON.stringify(v)}`);
73
- return [...(cfg.sandbox === false ? ['designs run outside the sandbox'] : []), ...own].sort();
226
+ const own = Object.entries(cfg.targets || {})
227
+ .filter(([, v]) => v && !isOwnTarget(v))
228
+ .map(([k, v]) => `the ${k} target ${typeof v === 'string' ? v : JSON.stringify(v)}`);
229
+ const time = above(cfg.designTimeout, DESIGN_TIMEOUT),
230
+ memory = above(cfg.designMemory, DESIGN_MEMORY);
231
+ return [
232
+ ...(cfg.sandbox === false ? ['designs run outside the sandbox'] : []),
233
+ ...(time != null ? [`designs run for up to ${time} s`] : []),
234
+ ...(memory != null ? [`designs use up to ${memory} MB`] : []),
235
+ ...own,
236
+ ].sort();
74
237
  }
75
- const trustList = () => { try { return JSON.parse(fs.readFileSync(TRUSTED(), 'utf8')); } catch { return {}; } };
238
+ const trustList = () => {
239
+ try {
240
+ return JSON.parse(fs.readFileSync(TRUSTED(), 'utf8'));
241
+ } catch {
242
+ return {};
243
+ }
244
+ };
76
245
  /** Whether the user has trusted this workspace for all it asks. */
77
- export const trusted = (cfg = config) => { const a = asks(cfg); if (!a.length || process.env.CAD_TRUST === '1') return true; const t = trustList()[WS]; return !!t && a.every((x) => t.includes(x)); };
246
+ export const trusted = (cfg = config) => {
247
+ const a = asks(cfg);
248
+ if (!a.length || process.env.CAD_TRUST === '1') return true;
249
+ const t = trustList()[WS];
250
+ return !!t && a.every((x) => t.includes(x));
251
+ };
78
252
  /** Trust this workspace for what it asks now. */
79
- export function trust(cfg = config) { const list = trustList(); list[WS] = asks(cfg); fs.mkdirSync(path.dirname(TRUSTED()), { recursive: true }); fs.writeFileSync(TRUSTED(), JSON.stringify(list, null, 2) + '\n'); return list[WS]; }
253
+ export function trust(cfg = config) {
254
+ const list = trustList();
255
+ list[WS] = asks(cfg);
256
+ fs.mkdirSync(path.dirname(TRUSTED()), { recursive: true });
257
+ fs.writeFileSync(TRUSTED(), JSON.stringify(list, null, 2) + '\n');
258
+ return list[WS];
259
+ }
80
260
  /**
81
261
  * Throws, saying what it asks, where it asks it and how to allow it, when this workspace isn't trusted for what it asks.
82
262
  * @param {object} [cfg]
83
263
  */
84
264
  export function needTrust(cfg = config) {
85
265
  if (trusted(cfg)) return;
86
- throw Object.assign(new Error(`this workspace asks for ${asks(cfg).join(' and ')} (cad.config.json). If you trust it, run cad trust once; until then, it isn't done`), { code: 'workspace.untrusted' });
266
+ throw Object.assign(
267
+ new Error(
268
+ `this workspace asks for ${asks(cfg).join(' and ')} (cad.config.json). If you trust it, run cad trust once; until then, it isn't done`,
269
+ ),
270
+ { code: 'workspace.untrusted' },
271
+ );
87
272
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulecad/cad",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "The cad command: JSCAD designs from traceable rules, checked for printing and fit, versioned by what fits, shared as links and exported as Bambu 3MF.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -46,7 +46,7 @@
46
46
  "cli"
47
47
  ],
48
48
  "engines": {
49
- "node": ">=20.6"
49
+ "node": ">=22.13"
50
50
  },
51
51
  "repository": {
52
52
  "type": "git",
@@ -58,27 +58,27 @@
58
58
  "url": "https://github.com/JoniBach/rulecad/issues"
59
59
  },
60
60
  "dependencies": {
61
- "@rulecad/variables": "^0.3.7",
62
- "@rulecad/keyboard-layout": "^0.1.2",
63
- "@rulecad/printcheck": "^0.3.3",
64
- "@rulecad/fit": "^0.4.1",
65
- "@rulecad/model-link": "^0.3.3",
66
- "@rulecad/versions": "^0.1.6",
67
- "@rulecad/shapes": "^0.4.9",
68
- "@rulecad/rules": "^0.3.31",
61
+ "@rulecad/variables": "^0.4.0",
62
+ "@rulecad/keyboard-layout": "^0.2.0",
63
+ "@rulecad/printcheck": "^0.4.0",
64
+ "@rulecad/fit": "^0.5.0",
65
+ "@rulecad/model-link": "^0.4.0",
66
+ "@rulecad/versions": "^0.2.0",
67
+ "@rulecad/shapes": "^0.5.0",
68
+ "@rulecad/rules": "^0.4.0",
69
69
  "@jscad/modeling": "^2.12.0",
70
70
  "three": "^0.186.1",
71
- "@rulecad/fea": "^0.3.0",
72
- "@rulecad/topopt": "^0.3.9",
73
- "@rulecad/flexures": "^0.5.18",
74
- "@rulecad/gears": "^0.3.5",
75
- "@rulecad/motors": "^0.1.6",
76
- "@rulecad/fixings": "^0.1.9",
77
- "@rulecad/robots": "^0.1.4",
78
- "@rulecad/frames": "^0.1.14"
71
+ "@rulecad/fea": "^0.4.0",
72
+ "@rulecad/topopt": "^0.4.0",
73
+ "@rulecad/flexures": "^0.6.0",
74
+ "@rulecad/gears": "^0.4.0",
75
+ "@rulecad/motors": "^0.2.0",
76
+ "@rulecad/fixings": "^0.2.0",
77
+ "@rulecad/robots": "^0.2.0",
78
+ "@rulecad/frames": "^0.2.0"
79
79
  },
80
80
  "peerDependencies": {
81
- "@rulecad/pcb": "^0.6.0"
81
+ "@rulecad/pcb": "^0.7.0"
82
82
  },
83
83
  "peerDependenciesMeta": {
84
84
  "@rulecad/pcb": {
@@ -29,7 +29,7 @@
29
29
  "power": { "type": "object", "additionalProperties": false, "properties": { "margin": { "type": "number" } } },
30
30
  "wires": { "type": "array", "description": "Wires between anchors, their length measured through every pose", "items": { "type": "object", "required": ["from", "to"], "additionalProperties": false, "properties": { "id": { "type": "string" }, "from": { "type": "string" }, "to": { "type": "string" }, "via": { "type": "array", "items": { "anyOf": [{ "type": "string" }, { "type": "object", "required": ["along", "from", "to"], "additionalProperties": false, "description": "A run along a beam's slot: the wire follows the slot from one distance to another, held by printed cable clips at a pitch", "properties": { "along": { "type": "string", "description": "A beam's slotted face: rail.top" }, "from": { "$ref": "#/$defs/expr", "description": "mm from the beam's end a" }, "to": { "$ref": "#/$defs/expr" }, "pitch": { "$ref": "#/$defs/expr", "description": "The most between clips, mm (default 100)" }, "cable": { "$ref": "#/$defs/expr", "description": "The bundle the clips hold, mm (default 6)" } } }] }, "description": "Anchors, path joints or runs along a slot that the wire is routed by" }, "gauge": { "type": "string", "description": "awg22" }, "colour": { "type": "string" }, "conductors": { "type": "number" }, "connectors": { "type": "array", "items": { "type": "string" } }, "current": { "type": "number", "description": "A: else a motor's rated current at either end, or a signal's" }, "note": { "type": "string" } } } },
31
31
  "gravity": { "$ref": "#/$defs/vec3", "description": "Which way down is, for masses in loads (default [0, 0, -1])" },
32
- "frame": { "type": "object", "additionalProperties": false, "description": "The frame: what it is (a generator, kind with inside or outside, which expands into beams, joins and their ends before anything is built, as cad frame --expand writes out), and how its beams and joins are solved for frame.deflection, frame.stress, frame.buckling, frame.rack and frame.frequency, which beams could be printed (beam.printable), and how it is cut and heated for frame.square and frame.heat. Left out, it stands on its feet: the beam ends that carry a foot, a levelling foot, a castor plate or a stacking foot, or else the lowest beam ends, each held from moving (pinned)", "properties": {"kind": {"enum": ["box", "portal", "table", "gantry", "shelf"], "description": "A frame generated from a size: box (four posts and a ring of beams at the bottom and top), portal (two legs and a beam across: inside and outside are [width, height]; it lies in one plane and tips over on its feet alone, so it is refused until supports says its feet are held down, as z1.a and z2.a fixed), table (four legs and a ring at the top), gantry (a box without its top beams across, and a beam riding along the two top side beams on a sliding joint) or shelf (a box with rings between, shelves of them). Its beams are z1 .. (upright), x1 .. and y1 .. (along x and y, by ring from the bottom), g (a gantry's moving beam); its corner arrangement follows the join"}, "inside": {"type": "array", "minItems": 2, "maxItems": 3, "items": {"$ref": "#/$defs/expr"}, "description": "The clear volume the frame encloses, [width (x), depth (y), height (z)] in mm (a portal: [width, height]); the beams go round it. Give inside or outside"}, "outside": {"type": "array", "minItems": 2, "maxItems": 3, "items": {"$ref": "#/$defs/expr"}, "description": "The volume the whole frame must fit in, [width, depth, height] in mm (a portal: [width, height]); the beams go within it"}, "profile": {"type": "string", "description": "Every beam's profile, a square one (2020-misumi-hfs5, 3030-generic, 4040-item-8)"}, "join": {"description": "How the beams meet at each corner: a kind (blind, end-tap, bracket, gusset, hidden, anchor: the upright beams run through and the others butt against their faces, each shorter by the profile's width at each end; cube: every beam butts into a corner node, each as long as the inside), or { kind, fitting, screw } as a join takes them", "oneOf": [{"type": "string"},{"type": "object", "additionalProperties": false, "required": ["kind"], "properties": {"kind": {"type": "string"}, "fitting": {"type": "string"}, "screw": {"type": "string"}}}]}, "feet": {"type": ["string", "null"], "description": "What stands under the upright beams' lower ends: foot, levelling, castor or stacking (printed), or a bought foot's set by name (fitting-motedis-foot-m6-d19); left out, an end cap"}, "caps": {"type": ["string", "boolean"], "description": "The ends no join covers: printed end caps (true, the default), a bought end cap's set by name, or false for none (join.end then names them)"}, "braces": {"type": "array", "items": {"enum": ["front", "back", "left", "right"]}, "description": "The upright sides whose corners are stiffened against racking: each join in that side becomes a bracket join with a printed corner bracket in the corner, on drop-in nuts"}, "panels": {"type": "object", "additionalProperties": false, "required": ["sheet", "thickness"], "description": "Panels closing the upright sides, each cut to its bay with its clips (a box, a shelf, a gantry's two sides)", "properties": {"sheet": {"type": "string", "description": "The sheet's material: acrylic, polycarbonate, aluminium, plywood, mdf"}, "thickness": {"$ref": "#/$defs/expr", "description": "mm"}, "sides": {"type": "array", "items": {"enum": ["front", "back", "left", "right"]}, "description": "Which sides (default every side that has a bay)"}}}, "shelves": {"type": "integer", "minimum": 1, "maximum": 20, "description": "A shelf: how many rings stand between the bottom and the top, spacing its height into equal clear bays (default 1)"}, "supports": {"type": "object", "description": "Where the frame is held, by beam end (\"z1.a\") or a place on a beam (\"x1.bottom@50%\"): pinned holds it from moving and lets it turn, fixed holds it from turning too, resting holds it from moving and from twisting about the beam's own length (a beam lying across a round bar, as the beam coupon does; for a beam along x, y or z). Given, these are the only supports, and at least one is named", "minProperties": 1, "additionalProperties": {"enum": ["pinned", "fixed", "resting"]}}, "limit": {"$ref": "#/$defs/expr", "description": "The sag allowed in every frame.deflection finding, in mm: at each load's point, each named point and along each guide whose rail gives no parallelism of its own (default: the task's accuracy, else the span of the beam it is on over 360)"}, "points": {"type": "array", "description": "Places on beams to report the sag at, beside each load's point and every guide (\"x1.top@50%\")", "items": {"type": "string"}}, "cut": {"type": "object", "additionalProperties": false, "description": "How the beams are cut in this workshop, where it differs from the profile's set and the kit's defaults: frame.square, frame.cut and the cut list read it", "properties": {"tolerance": {"$ref": "#/$defs/expr", "description": "How far a cut length may be from the length asked, either way, in mm (default: the profile's cut_tolerance, else 0.5)"}}}, "heat": {"type": "object", "additionalProperties": false, "description": "frame.heat: the temperatures the frame works at. The beams grow with the air in the enclosure; each printed fitting is held to its plastic's softening point", "properties": {"air": {"$ref": "#/$defs/expr", "description": "The air round the frame when it runs, in degrees C (inside its enclosure)"}, "built": {"$ref": "#/$defs/expr", "description": "The air it was built and squared in, in degrees C (default 20)"}, "heaters": {"type": "array", "description": "Hot things near the frame: what is within reach of one is taken at its temperature", "items": {"type": "object", "required": ["at", "temperature", "reach"], "additionalProperties": false, "properties": {"name": {"type": "string"}, "at": {"$ref": "#/$defs/vec3", "description": "Its middle, in the assembly's frame, mm"}, "temperature": {"$ref": "#/$defs/expr", "description": "Degrees C at its surface"}, "reach": {"$ref": "#/$defs/expr", "description": "How far from its middle a part is taken at that temperature, mm"}}}}}}, "printed": {"description": "beam.printable: each beam tried printed in this plastic (the kit's printable profile of its size, lying down or standing up), the frame solved again and held to its own limits: its sags, stress, buckling, creep and lowest mode; the beams that can be printed are listed, and printed together solved once more. A plastic's set by name (\"petg\"), or how it prints", "oneOf": [{"type": "string"},{"type": "object", "additionalProperties": false, "required": ["material"], "properties": {"material": {"type": "string", "description": "The plastic's set: pla, petg"}, "walls": {"type": "integer", "minimum": 1, "description": "Walls round every outline, in lines (3)"}, "infill": {"type": "number", "minimum": 0, "maximum": 1, "description": "The share of the inside the infill fills (0.4)"}, "pose": {"enum": ["lying", "standing"], "description": "Only this way up (both are tried where left out)"}}}]}, "size": {"type": "object", "additionalProperties": false, "description": "frame.size: each group of beams that must match given the lightest profile from a list that meets the frame's own limits (the sag at each load, point and guide, each beam's stress and buckling with frame.margin to spare, and the lowest mode against the task's moves), solved in every pose; a table of each group's profile, the limit that set it and its margin, and cad frame --size --write writes the profiles in", "properties": {"profiles": {"type": "array", "minItems": 1, "items": {"type": "string"}, "description": "The profiles to choose from, by set (default MISUMI's HFS5, HFS6 and HFS8 series from 2020 to 4080). One that is not square is tried lying as drawn and turned a quarter. A design is only tried where every join of a grouped beam still goes together (a blind join's screw and button head in the other beam's slot, an end-tap's cap head on its far face, a bought fitting on both profiles); the join checks of the written frame hold the rest"}, "groups": {"type": "object", "description": "Beams that must take one profile, by group name (\"rails\": [\"x1\", \"x2\"]); the rest are grouped by themselves: one profile, one direction, lengths within 0.5 mm", "additionalProperties": {"type": "array", "minItems": 1, "items": {"type": "string"}}}, "limits": {"type": "object", "additionalProperties": false, "description": "Limits in place of the frame checks' own", "properties": {"deflection": {"$ref": "#/$defs/expr", "description": "The sag allowed at every load, named point and guide, mm"}, "stress": {"$ref": "#/$defs/expr", "description": "How many times under its alloy's strength each beam stays (default frame.margin, 2)"}, "buckling": {"$ref": "#/$defs/expr", "description": "How many times its load the frame, and each grouped beam by Euler's load, must carry before it buckles (default frame.margin, 2)"}, "frequency": {"$ref": "#/$defs/expr", "description": "The lowest mode's floor, Hz (default twice what the task's moves shake it at; none without a task)"}, "rack": {"$ref": "#/$defs/expr", "description": "The sway allowed at the frame's top under frame.rack's side push alone, each way across, mm: racking as a limit (default frame.rack's own limit where the assembly gives frame.rack; none otherwise)"}}}, "by": {"enum": ["mass", "cost"], "description": "What is made least (mass: no profile set in the kit gives a price per metre yet)"}}}, "rack": {"type": "object", "additionalProperties": false, "description": "frame.rack: the side push at the frame's top and the sway allowed", "properties": {"load": {"$ref": "#/$defs/expr", "description": "The side push in N, shared among the top corners (default 20, an estimate)"}, "limit": {"$ref": "#/$defs/expr", "description": "The sway allowed at the top, in mm (default: the task's accuracy, else the height over 400)"}}}} },
32
+ "frame": { "type": "object", "additionalProperties": false, "description": "The frame: what it is (a generator, kind with inside or outside, which expands into beams, joins and their ends before anything is built, as cad frame --expand writes out), and how its beams and joins are solved for frame.deflection, frame.stress, frame.buckling, frame.rack and frame.frequency, which beams could be printed (beam.printable), and how it is cut and heated for frame.square and frame.heat. Left out, it stands on its feet: the beam ends that carry a foot, a levelling foot, a castor plate or a stacking foot, or else the lowest beam ends, each held from moving (pinned)", "properties": {"kind": {"enum": ["box", "portal", "table", "gantry", "shelf"], "description": "A frame generated from a size: box (four posts and a ring of beams at the bottom and top), portal (two legs and a beam across: inside and outside are [width, height]; it lies in one plane and tips over on its feet alone, so it is refused until supports says its feet are held down, as z1.a and z2.a fixed), table (four legs and a ring at the top), gantry (a box without its top beams across, and a beam riding along the two top side beams on a sliding joint) or shelf (a box with rings between, shelves of them). Its beams are z1 .. (upright), x1 .. and y1 .. (along x and y, by ring from the bottom), g (a gantry's moving beam); its corner arrangement follows the join"}, "inside": {"type": "array", "minItems": 2, "maxItems": 3, "items": {"$ref": "#/$defs/expr"}, "description": "The clear volume the frame encloses, [width (x), depth (y), height (z)] in mm (a portal: [width, height]); the beams go round it. Give inside or outside"}, "outside": {"type": "array", "minItems": 2, "maxItems": 3, "items": {"$ref": "#/$defs/expr"}, "description": "The volume the whole frame must fit in, [width, depth, height] in mm (a portal: [width, height]); the beams go within it"}, "profile": {"type": "string", "description": "Every beam's profile, a square one (2020-misumi-hfs5, 3030-generic, 4040-item-8)"}, "join": {"description": "How the beams meet at each corner: a kind (blind, end-tap, bracket, gusset, hidden, anchor: the upright beams run through and the others butt against their faces, each shorter by the profile's width at each end; cube: every beam butts into a corner node, each as long as the inside), or { kind, fitting, screw } as a join takes them", "oneOf": [{"type": "string"},{"type": "object", "additionalProperties": false, "required": ["kind"], "properties": {"kind": {"type": "string"}, "fitting": {"type": "string"}, "screw": {"type": "string"}}}]}, "feet": {"description": "What stands under the upright beams' lower ends: foot, levelling or stacking (printed), a bought foot's set by name (fitting-motedis-foot-m6-d19), or a printed castor plate as { kind: castor, holes: [x, y], thread: M6, top } from the castor's drawing; left out, an end cap", "oneOf": [{"type": ["string", "null"]},{"type": "object", "additionalProperties": false, "required": ["kind", "holes", "thread"], "properties": {"kind": {"enum": ["castor"]}, "holes": {"type": "array", "minItems": 2, "maxItems": 2, "items": {"type": "number"}, "description": "The castor's bolt holes' spacing [x, y] in mm, from its maker's drawing"}, "thread": {"type": "string", "description": "Its bolts' thread, as M6"}, "top": {"type": "number", "description": "Its top plate's thickness in mm, for the bolts' length (3, an estimate, where left out)"}}}]}, "caps": {"type": ["string", "boolean"], "description": "The ends no join covers: printed end caps (true, the default), a bought end cap's set by name, or false for none (join.end then names them)"}, "braces": {"type": "array", "items": {"enum": ["front", "back", "left", "right"]}, "description": "The upright sides whose corners are stiffened against racking: each corner of that side keeps the join asked for and gains a printed corner bracket beside it, on drop-in nuts (where the join is a printed bracket already, that bracket is drawn braced instead; a bracket join not printed is refused with braces)"}, "panels": {"type": "object", "additionalProperties": false, "required": ["sheet", "thickness"], "description": "Panels closing the upright sides, each cut to its bay with its clips (a box, a shelf, a gantry's two sides)", "properties": {"sheet": {"type": "string", "description": "The sheet's material: acrylic, polycarbonate, aluminium, plywood, mdf"}, "thickness": {"$ref": "#/$defs/expr", "description": "mm"}, "sides": {"type": "array", "items": {"enum": ["front", "back", "left", "right"]}, "description": "Which sides (default every side that has a bay)"}}}, "shelves": {"type": "integer", "minimum": 1, "maximum": 20, "description": "A shelf: how many rings stand between the bottom and the top, spacing its height into equal clear bays (default 1)"}, "supports": {"type": "object", "description": "Where the frame is held, by beam end (\"z1.a\") or a place on a beam (\"x1.bottom@50%\"): pinned holds it from moving and lets it turn, fixed holds it from turning too, resting holds it from moving and from twisting about the beam's own length (a beam lying across a round bar, as the beam coupon does; for a beam along x, y or z). Given, these are the only supports, and at least one is named", "minProperties": 1, "additionalProperties": {"enum": ["pinned", "fixed", "resting"]}}, "limit": {"$ref": "#/$defs/expr", "description": "The sag allowed in every frame.deflection finding, in mm: at each load's point, each named point and along each guide whose rail gives no parallelism of its own (default: the task's accuracy, else the span of the beam it is on over 360)"}, "points": {"type": "array", "description": "Places on beams to report the sag at, beside each load's point and every guide (\"x1.top@50%\")", "items": {"type": "string"}}, "cut": {"type": "object", "additionalProperties": false, "description": "How the beams are cut in this workshop, where it differs from the profile's set and the kit's defaults: frame.square, frame.cut and the cut list read it", "properties": {"tolerance": {"$ref": "#/$defs/expr", "description": "How far a cut length may be from the length asked, either way, in mm (default: the profile's cut_tolerance, else 0.5)"}}}, "heat": {"type": "object", "additionalProperties": false, "description": "frame.heat: the temperatures the frame works at. The beams grow with the air in the enclosure; each printed fitting is held to its plastic's softening point", "properties": {"air": {"$ref": "#/$defs/expr", "description": "The air round the frame when it runs, in degrees C (inside its enclosure)"}, "built": {"$ref": "#/$defs/expr", "description": "The air it was built and squared in, in degrees C (default 20)"}, "heaters": {"type": "array", "description": "Hot things near the frame: what is within reach of one is taken at its temperature", "items": {"type": "object", "required": ["at", "temperature", "reach"], "additionalProperties": false, "properties": {"name": {"type": "string"}, "at": {"$ref": "#/$defs/vec3", "description": "Its middle, in the assembly's frame, mm"}, "temperature": {"$ref": "#/$defs/expr", "description": "Degrees C at its surface"}, "reach": {"$ref": "#/$defs/expr", "description": "How far from its middle a part is taken at that temperature, mm"}}}}}}, "printed": {"description": "beam.printable: each beam tried printed in this plastic (the kit's printable profile of its size, lying down or standing up), the frame solved again and held to its own limits: its sags, stress, buckling, creep and lowest mode; the beams that can be printed are listed, and printed together solved once more. A plastic's set by name (\"petg\"), or how it prints", "oneOf": [{"type": "string"},{"type": "object", "additionalProperties": false, "required": ["material"], "properties": {"material": {"type": "string", "description": "The plastic's set: pla, petg"}, "walls": {"type": "integer", "minimum": 1, "description": "Walls round every outline, in lines (3)"}, "infill": {"type": "number", "minimum": 0, "maximum": 1, "description": "The share of the inside the infill fills (0.4)"}, "pose": {"enum": ["lying", "standing"], "description": "Only this way up (both are tried where left out)"}}}]}, "size": {"type": "object", "additionalProperties": false, "description": "frame.size: each group of beams that must match given the lightest profile from a list that meets the frame's own limits (the sag at each load, point and guide, each beam's stress and buckling with frame.margin to spare, and the lowest mode against the task's moves), solved in every pose; a table of each group's profile, the limit that set it and its margin, and cad frame --size --write writes the profiles in", "properties": {"profiles": {"type": "array", "minItems": 1, "items": {"type": "string"}, "description": "The profiles to choose from, by set (default MISUMI's HFS5, HFS6 and HFS8 series from 2020 to 4080). One that is not square is tried lying as drawn and turned a quarter. A design is only tried where every join of a grouped beam still goes together (a blind join's screw and button head in the other beam's slot, an end-tap's cap head on its far face, a bought fitting on both profiles); the join checks of the written frame hold the rest"}, "groups": {"type": "object", "description": "Beams that must take one profile, by group name (\"rails\": [\"x1\", \"x2\"]); the rest are grouped by themselves: one profile, one direction, lengths within 0.5 mm", "additionalProperties": {"type": "array", "minItems": 1, "items": {"type": "string"}}}, "limits": {"type": "object", "additionalProperties": false, "description": "Limits in place of the frame checks' own", "properties": {"deflection": {"$ref": "#/$defs/expr", "description": "The sag allowed at every load, named point and guide, mm"}, "stress": {"$ref": "#/$defs/expr", "description": "How many times under its alloy's strength each beam stays (default frame.margin, 2)"}, "buckling": {"$ref": "#/$defs/expr", "description": "How many times its load the frame, and each grouped beam by Euler's load, must carry before it buckles (default frame.margin, 2)"}, "frequency": {"$ref": "#/$defs/expr", "description": "The lowest mode's floor, Hz (default twice what the task's moves shake it at; none without a task)"}, "rack": {"$ref": "#/$defs/expr", "description": "The sway allowed at the frame's top under frame.rack's side push alone, each way across, mm: racking as a limit (default frame.rack's own limit where the assembly gives frame.rack; none otherwise)"}}}, "by": {"enum": ["mass", "cost"], "description": "What is made least (mass: no profile set in the kit gives a price per metre yet)"}}}, "rack": {"type": "object", "additionalProperties": false, "description": "frame.rack: the side push at the frame's top and the sway allowed", "properties": {"load": {"$ref": "#/$defs/expr", "description": "The side push in N, shared among the top corners (default 20, an estimate)"}, "limit": {"$ref": "#/$defs/expr", "description": "The sway allowed at the top, in mm (default: the task's accuracy, else the height over 400)"}}}} },
33
33
  "loads": { "type": "array", "description": "What the assembly has to do: a torque (N m) or force (N) on a joint, or a mass (kg) carried at an anchor", "items": { "type": "object", "additionalProperties": false, "properties": { "joint": { "type": "string" }, "torque": { "$ref": "#/$defs/expr" }, "force": { "$ref": "#/$defs/expr" }, "mass": { "$ref": "#/$defs/expr" }, "at": { "$ref": "#/$defs/anchorRef" }, "note": { "type": "string" } } } },
34
34
  "poses": { "type": "object", "description": "Named sets of joint values ({ \"hinge\": 90 }), and of items' variables (\"action.travel\": 25: a flexure drawn bent in that pose, printed as drawn)", "additionalProperties": { "type": "object", "additionalProperties": { "$ref": "#/$defs/values" } } },
35
35
  "printInPlace": { "type": "array", "minItems": 2, "items": { "type": "string" }, "description": "Items printed together as one object printed in place (\"printInPlace\": true on it): they come off the bed together, so the assembly order never takes them apart from each other" },
@@ -52,7 +52,7 @@
52
52
  "bought": { "type": "string", "description": "A part from a rule set (\"608\", \"drv8825\", \"fitting-motedis-end-cap-20-b6\"): bought, not printed; drawn faint from its figures, with anchors from what it is. A frame's bought fitting (an end cap, a levelling foot, a hinge) placed at a beam's address is checked against that beam's profile, and its price goes on cad list" },
53
53
  "variant": { "type": "string" },
54
54
  "set": { "type": "object" },
55
- "fitting": { "type": "object", "required": ["kind"], "additionalProperties": false, "description": "A printed fitting from @rulecad/frames, drawn from a profile's and its slot nuts' rules and sized from a named load (a join with \"fitting\": \"printed\" adds one for itself; a panel adds its clips, a door its hinges, handle and catch). A bracket, gusset or splice is sized by finite elements; the others by beam formulas, each reporting its grams and margin. In its fitted frame: a bracket's x along b's face away from a, y up a, z across; a plate's x along b, y along a, its contact face at z = 0", "properties": { "kind": { "enum": ["bracket", "gusset", "splice", "panel-clip", "panel-corner", "slot-cover", "panel-edge", "gasket-strip", "hinge", "handle", "latch", "magnet-catch", "end-cap", "foot", "levelling-foot", "castor-plate", "stacking-foot", "device-mount", "fan-mount", "drag-chain-end", "din-rail", "cable-clip", "tie-anchor", "spool-holder", "rail-jig", "wheel-plate", "slider", "rod-holder", "rod-carriage", "motor-plate", "endstop-mount", "nut-carrier", "belt-plate", "belt-clamp", "belt-idler"], "description": "A nut-carrier is a printed block that slides in a slot holding a hex nut or a heat-set insert (face, thread, holds, length, count, pitch, load)" }, "profile": { "type": "string", "description": "The profile the base leg or the plate lies on" }, "other": { "type": "string", "description": "A bracket's: the profile its upright leg lies on, where not the same" }, "face": { "type": "string", "description": "The face of the profile it lies on (top, top.2): its slot sizes the tongue and the nut" }, "otherFace": { "type": "string" }, "shape": { "enum": ["L", "T", "cross", "splice"], "description": "A gusset's shape" }, "brace": { "type": "boolean", "description": "A bracket's brace across its inside corner" }, "load": { "type": "number", "description": "The design load in N, across beam a at the fitting's screw (default 100)" }, "count": { "type": "number", "description": "A plate's screws on each arm (default 2)" }, "thread": { "type": "string" }, "head": { "enum": ["cap", "button"] }, "part": { "type": "string", "description": "A hinge's leaf (frame, door) or a levelling foot's part (body, pad): an item each" }, "sheet": { "type": "number", "description": "The panel's or door's thickness, in mm" }, "length": { "type": "number", "description": "A strip's length, in mm" }, "standoff": { "type": "number", "description": "A latch's or catch's: the door's inner face over the beam's face (a hinge's standoff)" }, "edge": { "type": "number" }, "magnet": { "type": "array", "items": { "type": "number" } }, "stud": { "type": "string" }, "holds": { "enum": ["nut", "insert"], "description": "A nut-carrier's: a hex nut slid in from the side (the default) or a heat-set insert pressed in from below" }, "range": { "type": "number" }, "holes": { "type": "array", "items": { "type": "number" } }, "end": { "enum": ["a", "b"] }, "depth": { "type": "number" }, "grip": { "type": "number" }, "span": { "type": "number" }, "gap": { "type": "number" }, "squeeze": { "type": "number" }, "pin": { "type": "string" }, "screw": { "type": "string" }, "thickness": { "type": "number" }, "nut": { "type": "string" }, "material": { "type": "string" }, "device": { "type": "string", "description": "A device mount's: the rule set its holes are read from (supply-24v, cnc-shield-v3)" }, "variant": { "type": "string", "description": "A device mount's: the device's variant" }, "turn": { "enum": [0, 90, 180, 270], "description": "A device mount's: the device's x from the slot's line, degrees" }, "offset": { "type": "number", "description": "A device mount's: the device's middle across the slot, mm" }, "deviceHead": { "enum": ["cap", "button"] }, "size": { "type": "number", "description": "A fan mount's fan, mm: 40, 60, 80, 92 or 120" }, "side": { "enum": [1, -1] }, "flange": { "type": "number" }, "cable": { "type": "number", "description": "A cable clip's bundle, mm" }, "width": { "type": "number" }, "tie": { "type": "array", "items": { "type": "number" } }, "spool": { "type": "object" }, "rod": { "type": "string", "description": "A rod holder's or carriage's: the rods' rule set" }, "bearing": { "type": "string", "description": "A carriage's linear bearings' rule set" }, "spacing": { "type": "number" }, "height": { "type": "number" }, "leadNut": { "type": "string", "description": "A rod holder's or carriage's: the lead nut's rule set" }, "support": { "type": ["string", "null"], "description": "A rod holder's: the screw's ball bearing's rule set" }, "flag": { "type": "object", "description": "A carriage's endstop flag: where its tip reaches, { y, z }" }, "motor": { "type": "string", "description": "A motor plate's: the motor's rule set (28byj48, nema14, nema17)" }, "coupler": { "type": "object", "description": "A motor plate's: the coupler's { length, D }" }, "switch": { "type": "string", "description": "An endstop mount's: the switch's rule set" }, "pulley": { "type": "string", "description": "A belt plate's: the pulley's rule set" }, "idler": { "type": "string", "description": "A belt idler block's: the idler's rule set" }, "belt": { "type": "string", "description": "A belt part's: the belt's rule set" }, "across": { "type": "number", "description": "A belt plate's or idler block's: the pulley's or idler's middle off the slot's line, mm" }, "least": { "type": "number", "description": "A belt plate's: the least height of the belt's middle over the face, mm" }, "lift": { "type": "number", "minimum": 0, "description": "A belt plate's: how much further up its shaft the pulley stands, mm (default 0), to raise the belt without a thicker plate" }, "tension": { "type": "number", "description": "A belt part's: each span's tension, N" }, "rise": { "type": "number", "description": "A belt clamp's or idler block's: the belt's middle over the carriage's top, or over the face" }, "stretch": { "type": "number", "description": "A belt idler block's: the belt's stretch at its tension, mm" }, "carriageHoles": { "type": "array", "description": "A belt clamp's: the carriage's tapped holes, [[x, y], ...] from its top's middle" }, "toward": { "enum": [1, -1], "description": "An endstop mount's: which way across the face its lever reaches" }, "pose": { "enum": ["fit", "print"], "description": "fit (the default): in its place, as the item's at and rotate put it; print: laid as it prints, for a plate (cad plates writes it so)" } } },
55
+ "fitting": { "type": "object", "required": ["kind"], "additionalProperties": false, "description": "A printed fitting from @rulecad/frames, drawn from a profile's and its slot nuts' rules and sized from a named load (a join with \"fitting\": \"printed\" adds one for itself; a panel adds its clips, a door its hinges, handle and catch). A bracket, gusset or splice is sized by finite elements; the others by beam formulas, each reporting its grams and margin. In its fitted frame: a bracket's x along b's face away from a, y up a, z across; a plate's x along b, y along a, its contact face at z = 0", "properties": { "kind": { "enum": ["bracket", "gusset", "splice", "panel-clip", "panel-corner", "slot-cover", "panel-edge", "gasket-strip", "hinge", "handle", "latch", "magnet-catch", "end-cap", "foot", "levelling-foot", "castor-plate", "stacking-foot", "device-mount", "fan-mount", "drag-chain-end", "din-rail", "cable-clip", "tie-anchor", "spool-holder", "rail-jig", "wheel-plate", "slider", "rod-holder", "rod-carriage", "motor-plate", "endstop-mount", "nut-carrier", "belt-plate", "belt-clamp", "belt-idler"], "description": "A nut-carrier is a printed block that slides in a slot holding a hex nut or a heat-set insert (face, thread, holds, length, count, pitch, load)" }, "profile": { "type": "string", "description": "The profile the base leg or the plate lies on" }, "other": { "type": "string", "description": "A bracket's: the profile its upright leg lies on, where not the same" }, "face": { "type": "string", "description": "The face of the profile it lies on (top, top.2): its slot sizes the tongue and the nut" }, "otherFace": { "type": "string" }, "shape": { "enum": ["L", "T", "cross", "splice"], "description": "A gusset's shape" }, "brace": { "type": "boolean", "description": "A bracket's brace across its inside corner" }, "load": { "type": "number", "description": "The design load in N, across beam a at the fitting's screw (default 100)" }, "count": { "type": "number", "description": "A plate's screws on each arm (default 2)" }, "thread": { "type": "string" }, "head": { "enum": ["cap", "button"] }, "part": { "type": "string", "description": "A hinge's leaf (frame, door) or a levelling foot's part (body, pad): an item each" }, "sheet": { "type": "number", "description": "The panel's or door's thickness, in mm" }, "length": { "type": "number", "description": "A strip's length, in mm" }, "standoff": { "type": "number", "description": "A latch's or catch's: the door's inner face over the beam's face (a hinge's standoff)" }, "edge": { "type": "number" }, "magnet": { "type": "array", "items": { "type": "number" } }, "stud": { "type": "string" }, "holds": { "enum": ["nut", "insert"], "description": "A nut-carrier's: a hex nut slid in from the side (the default) or a heat-set insert pressed in from below" }, "range": { "type": "number" }, "holes": { "type": "array", "items": { "type": "number" } }, "top": { "type": "number", "exclusiveMinimum": 0, "maximum": 20, "description": "A castor plate's: its castor's top plate's thickness in mm, for its bolts' length (3, an estimate, where left out)" }, "end": { "enum": ["a", "b"] }, "depth": { "type": "number" }, "grip": { "type": "number" }, "span": { "type": "number" }, "gap": { "type": "number" }, "squeeze": { "type": "number" }, "pin": { "type": "string" }, "screw": { "type": "string" }, "thickness": { "type": "number" }, "nut": { "type": "string" }, "material": { "type": "string" }, "device": { "type": "string", "description": "A device mount's: the rule set its holes are read from (supply-24v, cnc-shield-v3)" }, "variant": { "type": "string", "description": "A device mount's: the device's variant" }, "turn": { "enum": [0, 90, 180, 270], "description": "A device mount's: the device's x from the slot's line, degrees" }, "offset": { "type": "number", "description": "A device mount's: the device's middle across the slot, mm" }, "deviceHead": { "enum": ["cap", "button"] }, "size": { "type": "number", "description": "A fan mount's fan, mm: 40, 60, 80, 92 or 120" }, "side": { "enum": [1, -1] }, "flange": { "type": "number" }, "cable": { "type": "number", "description": "A cable clip's bundle, mm" }, "width": { "type": "number" }, "tie": { "type": "array", "items": { "type": "number" } }, "spool": { "type": "object" }, "rod": { "type": "string", "description": "A rod holder's or carriage's: the rods' rule set" }, "bearing": { "type": "string", "description": "A carriage's linear bearings' rule set" }, "spacing": { "type": "number" }, "height": { "type": "number" }, "leadNut": { "type": "string", "description": "A rod holder's or carriage's: the lead nut's rule set" }, "support": { "type": ["string", "null"], "description": "A rod holder's: the screw's ball bearing's rule set" }, "flag": { "type": "object", "description": "A carriage's endstop flag: where its tip reaches, { y, z }" }, "motor": { "type": "string", "description": "A motor plate's: the motor's rule set (28byj48, nema14, nema17)" }, "coupler": { "type": "object", "description": "A motor plate's: the coupler's { length, D }" }, "switch": { "type": "string", "description": "An endstop mount's: the switch's rule set" }, "pulley": { "type": "string", "description": "A belt plate's: the pulley's rule set" }, "idler": { "type": "string", "description": "A belt idler block's: the idler's rule set" }, "belt": { "type": "string", "description": "A belt part's: the belt's rule set" }, "across": { "type": "number", "description": "A belt plate's or idler block's: the pulley's or idler's middle off the slot's line, mm" }, "least": { "type": "number", "description": "A belt plate's: the least height of the belt's middle over the face, mm" }, "lift": { "type": "number", "minimum": 0, "description": "A belt plate's: how much further up its shaft the pulley stands, mm (default 0), to raise the belt without a thicker plate" }, "tension": { "type": "number", "description": "A belt part's: each span's tension, N" }, "rise": { "type": "number", "description": "A belt clamp's or idler block's: the belt's middle over the carriage's top, or over the face" }, "stretch": { "type": "number", "description": "A belt idler block's: the belt's stretch at its tension, mm" }, "carriageHoles": { "type": "array", "description": "A belt clamp's: the carriage's tapped holes, [[x, y], ...] from its top's middle" }, "toward": { "enum": [1, -1], "description": "An endstop mount's: which way across the face its lever reaches" }, "pose": { "enum": ["fit", "print"], "description": "fit (the default): in its place, as the item's at and rotate put it; print: laid as it prints, for a plate (cad plates writes it so)" } } },
56
56
  "panel": { "type": "object", "required": ["sheet", "thickness", "bay", "out"], "additionalProperties": false, "description": "A panel from @rulecad/frames: a sheet cut to the bay of four beams it closes, on their faces that look along out, held by printed clips at a pitch; with door, a door on printed hinges that turns on a joint", "properties": { "sheet": { "enum": ["acrylic", "polycarbonate", "aluminium"] }, "thickness": { "$ref": "#/$defs/expr" }, "bay": { "type": "array", "items": { "type": "string" }, "minItems": 4, "maxItems": 4, "description": "The four beam items round it, in order" }, "out": { "type": "array", "items": { "$ref": "#/$defs/expr" }, "minItems": 3, "maxItems": 3, "description": "The way its face looks, square to the bay" }, "pitch": { "$ref": "#/$defs/expr" }, "nut": { "type": "string" }, "load": { "$ref": "#/$defs/expr" }, "door": { "type": "object", "required": ["hinge"], "additionalProperties": false, "properties": { "hinge": { "type": "string", "description": "The beam of the bay its hinges go on" }, "open": { "$ref": "#/$defs/expr" }, "handle": { "type": "boolean" }, "catch": { "type": "boolean" }, "latch": { "type": "boolean" }, "load": { "$ref": "#/$defs/expr" } } } } },
57
57
  "mount": { "type": "object", "required": ["on"], "additionalProperties": false, "description": "A bought board's or supply's printed mount on a beam (@rulecad/frames' deviceMountModel), its holes read from the item's rule set: the mount goes at a slotted face's address, the item on it, and the screws into the slot and into the device are fastens", "properties": { "on": { "type": "string", "description": "An address on a beam's slotted face: rail.top@200" }, "turn": { "enum": [0, 90, 180, 270], "description": "The device's x from the beam's line, degrees" }, "offset": { "$ref": "#/$defs/expr", "description": "The device's middle across the slot, mm" }, "standoff": { "$ref": "#/$defs/expr", "description": "A board's least standoff, mm" }, "load": { "$ref": "#/$defs/expr", "description": "N on the device at its farthest hole (default 50)" }, "nut": { "type": "string" }, "head": { "enum": ["cap", "button"] }, "screw": { "type": "string", "description": "A board's screws, where not the largest its holes pass" } } },
58
58
  "beam": { "type": "object", "required": ["profile"], "additionalProperties": false, "description": "A length of a profile from @rulecad/frames: bought and cut to length, faint in previews, or printed; placed by its ends (from, to, roll) or by at and rotate", "properties": { "profile": { "type": "string", "description": "A profile's name: 2020-misumi-hfs5, profile-4040-item-8, or a set in this workspace's rules/" }, "length": { "$ref": "#/$defs/expr", "description": "mm from end a to end b; may be left out when from and to are both given" }, "printed": { "description": "A printed beam (@rulecad/frames printed beams): true, or how it prints. A printed beam is a printed part, weighed by the plastic laid, on a plate, off the cut list; a bought one is false, the default", "oneOf": [{ "type": "boolean" }, { "type": "object", "additionalProperties": false, "properties": { "pose": { "enum": ["lying", "standing"], "description": "lying (the default): on its bottom face, its layers along it; standing: on end a, its section the layer" }, "walls": { "type": "integer", "minimum": 1, "description": "Walls round every outline, in lines (3)" }, "infill": { "type": "number", "minimum": 0, "maximum": 1, "description": "The share of the inside the infill fills (0.4)" }, "end": { "enum": ["insert", "nut"], "description": "What a tapped end becomes in print: a heat-set insert (the default) or a captive nut" }, "pull": { "type": "number", "exclusiveMinimum": 0, "description": "A slot nut's design pull in N (100)" } } }] }, "laid": { "type": "boolean", "description": "A printed beam drawn as it prints, for a plate (cad plates writes it so)" }, "material": { "type": "string", "description": "A material set in place of the profile's alloy: al6063-t5, or a plastic" }, "ops": { "type": "array", "items": { "$ref": "#/$defs/beamOp" }, "description": "Operations on the beam, each a line on its sheet and a cut in its solid, placed by an address on the beam and dimensioned from end a" } } },