@rulecad/cad 0.7.55 → 0.7.57

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.
@@ -0,0 +1,159 @@
1
+ // Slot nuts in a frame: what a fasten into a beam's slot (lib/fasten.mjs) asks of the joins round it. A slide-in nut
2
+ // (and a plain square nut) goes into a slot only from an open end of it; a drop-in, roll-in, hammer-head nut or T-bolt
3
+ // goes in through the opening anywhere along it. A slot's end is closed by a join that butts on it (the beam's end
4
+ // meets another beam), or, for the stretch of slot a nut is in, by a blind join's head sitting in that slot between
5
+ // the nut and the end; an item placed at the end (a cap, a foot) closes it too, though it comes off again.
6
+ // frame.nut: the nuts whose stretch of slot joins close at both ends. Once those joins are made a slide-in nut has
7
+ // no way in, so the check fails and names the nut of that thread that goes in through the opening.
8
+ // frame.preload: the nuts with a way in that a join closes and none that stays open (the other end capped): they
9
+ // go into the slot before that join is made. cad order and the build page list them at the step that makes it.
10
+ import { nutFor } from '@rulecad/frames';
11
+ import { framesContext } from './beams.mjs';
12
+ import { givenFor } from './frames.mjs';
13
+
14
+ const mm = (x) => String(+Number(x).toFixed(2)), r3 = (x) => +x.toFixed(3);
15
+ const EPS = 1e-3; // mm: a closure this near a nut is where the nut is, not beside it
16
+ const THROUGH = ['drop-in', 'roll-in', 'hammer', 't-bolt']; // (the kinds that go in through the opening, in the order a stand-in is offered)
17
+ const list = (xs) => (xs.length < 2 ? xs.join('') : `${xs.slice(0, -1).join(', ')} and ${xs.at(-1)}`);
18
+ const an = (t) => (/^(?:[aeiou8]|M\d)/i.test(String(t)) ? 'an' : 'a');
19
+
20
+ /**
21
+ * Each fasten's nuts in one slot: the relation, the beam and its slot (place: top.1, as joins name it; named: top, as
22
+ * said where the face has one slot), the nut, its kind and entry, the part it holds, and where along the beam each is.
23
+ * @param {object} s a built assembly
24
+ * @returns {{ rel: object, item: string, place: string, named: string, nut: string, kind: string, entry: string, thread: string, part: string, at: number[], screws: object[] }[]}
25
+ */
26
+ export function nutGroupsOf(s) {
27
+ const out = new Map();
28
+ for (const rel of s.fastened?.relations ?? []) for (const sc of rel.screws) {
29
+ if (!sc.slot) continue;
30
+ const key = `${rel.index}|${sc.slot.item}|${sc.slot.place}`; // (place: top.1, as joins name it; named: top, as said where the face has one slot)
31
+ if (!out.has(key)) out.set(key, { rel, ...sc.slot, at: [], screws: [] });
32
+ out.get(key).at.push(sc.slot.distance); out.get(key).screws.push(sc);
33
+ }
34
+ return [...out.values()];
35
+ }
36
+
37
+ /**
38
+ * What closes a beam's slot, and where along it: joins at its ends, blind joins' heads in that slot, items at its ends.
39
+ * @param {object} s a built assembly @param {string} item the beam @param {string} place its slot (top.1)
40
+ * @returns {{ at: number, end: string|null, join?: object, head?: boolean, item?: string }[]}
41
+ */
42
+ export function closuresOf(s, item, place) {
43
+ const L = s.objects.find((o) => o.id === item)?.beam?.length ?? 0, out = [], endAt = (e) => (e === 'a' ? 0 : L);
44
+ for (const j of s.joins ?? []) {
45
+ if (j.items[0] === item) out.push({ at: endAt(j.end[0]), end: j.end[0], join: j });
46
+ if (j.items[1] === item && j.model.b.end) out.push({ at: endAt(j.model.b.end[0]), end: j.model.b.end[0], join: j });
47
+ if (j.items[1] === item && j.kind === 'blind' && j.model.b.place === place) out.push({ at: j.model.b.distance, end: null, join: j, head: true });
48
+ }
49
+ for (const it of s.a.items || []) {
50
+ const m = typeof it.at === 'string' ? /^([\w-]+)\.([ab])(\.|$)/.exec(it.at.trim()) : null;
51
+ if (m && m[1] === item) out.push({ at: endAt(m[2]), end: m[2], item: it.id });
52
+ }
53
+ return out;
54
+ }
55
+
56
+ // The two ways out of a stretch of slot from lo to hi along the beam: every closure toward each end, nearest first (a
57
+ // join before an item where both stand at one place). A way is closed by a join where any closure on it is a join, not
58
+ // only the nearest: a head between the nuts and an end closed further along closes it as much as that end
59
+ function waysOf(s, item, place, lo, hi) {
60
+ const cs = closuresOf(s, item, place), near = (far) => (p, q) => (far ? q.at - p.at : p.at - q.at) || (q.join ? 1 : 0) - (p.join ? 1 : 0);
61
+ const all = { a: cs.filter((c) => c.at < lo - EPS).sort(near(true)), b: cs.filter((c) => c.at > hi + EPS).sort(near(false)) };
62
+ return { a: all.a[0] ?? null, b: all.b[0] ?? null, all, join: { a: all.a.find((c) => c.join) ?? null, b: all.b.find((c) => c.join) ?? null } };
63
+ }
64
+ const closerSays = (g, w) => (w.head ? `the head of the ${w.join.label} at ${mm(w.at)} mm` : w.join ? `${g.item}'s end ${w.end} (the ${w.join.label})` : `${g.item}'s end ${w.end} (${w.item} placed there)`);
65
+ const nutsSay = (g) => `${g.at.length} ${g.kind} nut${g.at.length > 1 ? 's' : ''} (${g.nut})`;
66
+
67
+ // The nut of that thread made for the slot that goes in through its opening: a drop-in first, then the other kinds
68
+ function throughNut(s, g) {
69
+ const b = s.objects.find((o) => o.id === g.item)?.beam;
70
+ for (const kind of THROUGH) { try { return nutFor(b.profile, g.place, g.thread, { kind, given: givenFor(framesContext(), b.profile.name) }); } catch {} }
71
+ return null;
72
+ }
73
+
74
+ /**
75
+ * The nuts that must be in a slot before a join closes it: slide-in and square nuts whose stretch of slot has no way
76
+ * that stays open, and a way a join closes. @param {object} s a built assembly
77
+ * @returns {{ fasten: number, label: string, item: string, place: string, named: string, part: string, nut: string, count: number, end: string|null, way: string, at: number, join: object, closers: object[], other: object|null, text: string }[]}
78
+ * join: the nearest join on the way the nuts go in; closers: every join on that way, nearest the nuts first (any of them
79
+ * made shuts the way, so the nuts go in before the first of them is made)
80
+ */
81
+ export function preloadOf(s) {
82
+ const out = [];
83
+ for (const g of nutGroupsOf(s)) {
84
+ if (g.entry !== 'end') continue;
85
+ const w = waysOf(s, g.item, g.place, Math.min(...g.at), Math.max(...g.at));
86
+ if (!w.a || !w.b || (w.join.a && w.join.b) || (!w.join.a && !w.join.b)) continue; // (a way stays open; or joins close both: frame.nut's; or only items placed at the ends do, which go on after the nuts)
87
+ // every join on that way closes it (a head nearer the end as much as the nearest), so the nuts go in before the first
88
+ // made; an item at that end (a foot, a cap) is off until then too
89
+ const way = w.join.a ? 'a' : 'b', other = way === 'a' ? 'b' : 'a', by = w.join[way], ends = w.all[other].filter((c) => c.item), caps = w.all[way].filter((c) => c.item);
90
+ const closers = [...new Map(w.all[way].filter((c) => c.join).map((c) => [c.join.index, c])).values()];
91
+ const end = closers.find((c) => c.end)?.end ?? null, heads = closers.filter((c) => c.head);
92
+ const from = closers.length > 1 || !end ? `from end ${way}${heads.length ? `, past ${list(heads.map((c) => `${mm(c.at)}`).reverse())} mm` : ''}` : `through its end ${end}`;
93
+ const capped = caps.length ? ` (${list(caps.map((c) => c.item))} off until then)` : '';
94
+ const before = closers.length > 1 ? `before the first made of ${list(closers.map((c) => `the ${c.join.label}`).reverse())}, each of which closes that way` : `before the ${by.join.label} closes it`;
95
+ const or = ends.length ? ` (or through end ${other} before ${list(ends.map((c) => c.item))} go${ends.length > 1 ? '' : 'es'} on)` : '';
96
+ const how = `${from}${capped}, ${before}${or}`;
97
+ out.push({ fasten: g.rel.index, label: g.rel.label, item: g.item, place: g.place, named: g.named, part: g.part, nut: g.nut, count: g.at.length, end: by.end, way, at: by.at, join: by.join, closers: closers.map((c) => c.join), other: ends[0] ?? null, how,
98
+ text: `load ${g.at.length} × ${g.nut} into ${g.item}'s ${g.named} slot ${from}${capped}, for ${g.part}, ${before}${or}` });
99
+ }
100
+ return out;
101
+ }
102
+
103
+ /**
104
+ * The slide-in and square nuts that joins shut in: their stretch of slot closed at both ends by joins (frame.nut's
105
+ * failures), each with the two joins and the nut that goes in through the opening, where there is one.
106
+ * @param {object} s a built assembly
107
+ * @returns {{ fasten: number, label: string, item: string, place: string, named: string, nut: string, kind: string, count: number, part: string, at: number[], joins: object[], alternative: object|null }[]}
108
+ */
109
+ export function trappedOf(s) {
110
+ const out = [];
111
+ for (const g of nutGroupsOf(s)) {
112
+ if (g.entry !== 'end') continue;
113
+ const w = waysOf(s, g.item, g.place, Math.min(...g.at), Math.max(...g.at));
114
+ if (w.join.a && w.join.b) out.push({ fasten: g.rel.index, label: g.rel.label, item: g.item, place: g.place, named: g.named, nut: g.nut, kind: g.kind, count: g.at.length, part: g.part, at: g.at, joins: [w.join.a.join, w.join.b.join], alternative: throughNut(s, g) });
115
+ }
116
+ return out;
117
+ }
118
+
119
+ /**
120
+ * frame.nut and frame.preload, in the assembly's findings shape. @param {object} s a built assembly @param {Function} f the findings' sink
121
+ */
122
+ export function slotNutChecks(s, f) {
123
+ const groups = nutGroupsOf(s);
124
+ if (!groups.length) return;
125
+ const pre = preloadOf(s);
126
+ for (const g of groups) {
127
+ const lo = Math.min(...g.at), hi = Math.max(...g.at), where = `${g.item}'s ${g.named} slot`, first = g.screws[0];
128
+ const refs = { fasten: g.rel.index, item: g.item, place: g.place, nut: g.nut, kind: g.kind, along: g.at };
129
+ if (g.entry !== 'end') { f('pass', `${g.rel.label}: ${nutsSay(g)} go${g.at.length > 1 ? '' : 'es'} into ${where} through its opening, anywhere along it`, null, { code: 'frame.nut', at: first.at.map(r3), refs }); continue; }
130
+ const w = waysOf(s, g.item, g.place, lo, hi);
131
+ if (w.join.a && w.join.b) {
132
+ const alt = throughNut(s, g), joins = [w.join.a.join.index, w.join.b.join.index];
133
+ f('fail', `${g.rel.label}: ${nutsSay(g)} go${g.at.length > 1 ? '' : 'es'} into ${where} at ${g.at.map(mm).join(' and ')} mm, between ${closerSays(g, w.join.a)} and ${closerSays(g, w.join.b)}, which close it at both ends: a ${g.kind} nut goes in only from an open end. ${alt ? `${alt.name} (${an(alt.thread)} ${alt.thread} ${alt.nutKind} nut) goes in through the opening anywhere: give "nut": "${alt.nutKind}"` : `No ${g.thread} nut made for ${g.slot} goes in through its opening: load these before the later of the two joins, or move them to a slot with an open end`}`,
134
+ `${g.rel.label}: nut`, { code: 'frame.nut', at: first.at.map(r3), values: { nuts: g.at.length }, refs: { ...refs, joins, ...(alt ? { alternative: alt.name, kind_needed: alt.nutKind } : {}) } });
135
+ continue;
136
+ }
137
+ const open = !w.a ? 'a' : !w.b ? 'b' : null, pl = open ? null : pre.find((p) => p.fasten === g.rel.index && p.item === g.item && p.place === g.place);
138
+ f('pass', `${g.rel.label}: ${nutsSay(g)} go${g.at.length > 1 ? '' : 'es'} into ${where} ${open ? `from its end ${open}, which nothing closes` : pl ? `before a join closes its way, ${pl.how} (frame.preload)` : `from an end before ${list(['a', 'b'].map((e) => w.all[e].filter((c) => c.item).map((c) => c.item)).flat())} go on`}`, null, { code: 'frame.nut', at: first.at.map(r3), refs });
139
+ }
140
+ for (const p of pre) f('info', `${p.label}: ${p.text}`, null, { code: 'frame.preload', values: { nuts: p.count }, refs: { fasten: p.fasten, item: p.item, place: p.place, nut: p.nut, join: p.join.index, joins: p.closers.map((j) => j.index), end: p.end, way: p.way } });
141
+ if (!pre.length) f('pass', 'no slot nut has to be in its slot before a join closes it', null, { code: 'frame.preload' });
142
+ }
143
+
144
+ /**
145
+ * The order of assembly with the nuts to load first: each preload at the step that makes the join that closes its slot
146
+ * (the step its later item goes on in), as that step's load. @param {object} s a built assembly @param {object} r orderOf's
147
+ * @returns {object} r, its steps copied with load: string[] where there are nuts to load before them
148
+ */
149
+ export function withPreload(s, r) {
150
+ if (!r?.steps?.length) return r;
151
+ const pre = preloadOf(s);
152
+ if (!pre.length) return r;
153
+ const steps = r.steps.map((st) => ({ ...st })), stepOf = (id) => steps.findIndex((st) => st.items.includes(id));
154
+ for (const p of pre) {
155
+ const i = Math.min(...p.closers.map((j) => Math.max(0, ...j.items.map(stepOf)))); // (the step that makes the first of the joins on the way)
156
+ (steps[i].load ||= []).push(p.text);
157
+ }
158
+ return { ...r, steps };
159
+ }
package/lib/task.mjs CHANGED
@@ -118,14 +118,16 @@ function speedCheck(s, f) {
118
118
  else f('pass', `${t.tool} moves ${say}`, null, { code, at, values });
119
119
  }
120
120
 
121
- // Each joint's error terms: step resolution from its motor, and what the assembly says of its play, its twist and so on
122
- function terms(s, c) {
121
+ // Each joint's error terms: step resolution from its motor, what the assembly says of its play, its twist and so on, and a
122
+ // guide's rail's (its parallelism, its carriage's play, the beam's straightness and sag)
123
+ export function terms(s, c) {
123
124
  const motion = s.motion, specs = new Map((s.a.joints || []).map((j) => [j.id, j]));
124
125
  return c.names.map((id) => {
125
126
  const out = [], t = trainFrom(motion, id), d = motion.drives.find((x) => x.joint === t.root), spec = specs.get(id);
126
127
  if (d?.model.stepAngle) { const micro = d.spec.microsteps ?? 16; out.push({ term: 'step', value: t.slide != null ? (d.model.stepAngle / micro) * t.slide : d.model.stepAngle / micro / t.ratio, kind: 'spec', note: `${n3(d.model.stepAngle, 3)}° at 1/${micro} step, ${n3(t.ratio, 1)}:1` }); }
127
128
  const belt = motion.joints.find((x) => x.id === id)?.slide?.stretch; if (belt) out.push({ term: 'belt stretch', value: (belt.load * belt.length) / (belt.k * belt.width), kind: 'estimate', note: `${belt.load} N over ${belt.length} mm` });
128
129
  for (const [term, expr] of Object.entries(spec?.errors ?? {})) out.push({ term, value: s.num(expr), kind: kindOf(expr), expr });
130
+ for (const x of spec?._guide?.terms ?? []) out.push({ term: x.term, value: x.value, kind: x.kind, note: x.note }); // (a guide's rail: mm along its travel, from its rule sets and the beam's)
129
131
  return { joint: id, terms: out, geared: t.stages.length > 0 };
130
132
  });
131
133
  }
package/lib/wires.mjs CHANGED
@@ -80,7 +80,8 @@ export function wireRows(s, helpers) {
80
80
  export function wireChecks(s, f, helpers) {
81
81
  for (const w of wireRows(s, helpers)) {
82
82
  const refs = { wire: w.id, from: w.from, to: w.to }, at = w.route?.[0], values = { length: w.length, longest: w.longest, shortest: w.shortest, current: w.current, capacity: w.capacity };
83
- f('info', `${w.id}: ${w.from} to ${w.to}, ${n3(w.length, 0)} mm with its ${w.loop} mm loop (${n3(w.shortest, 0)} to ${n3(w.longest, 0)} mm as the joints move)`, null, { code: 'wire.length', at, refs, values });
83
+ const run = (s.runs ?? []).filter((r) => r.wire === w.id), clips = run.reduce((t, r) => t + r.count, 0);
84
+ f('info', `${w.id}: ${w.from} to ${w.to}, ${n3(w.length, 0)} mm with its ${w.loop} mm loop (${n3(w.shortest, 0)} to ${n3(w.longest, 0)} mm as the joints move)${run.length ? `; ${run.map((r) => `${n3(r.length, 0)} mm of it along ${r.along}`).join(', ')}, held by ${clips} cable clip${clips > 1 ? 's' : ''}` : ''}`, null, { code: 'wire.length', at, refs, values: { ...values, ...(run.length ? { along: run.reduce((t, r) => t + r.length, 0), clips } : {}) } });
84
85
  if (w.capacity == null) { f('warn', `${w.id}: no gauge given, so nothing checks it against ${n3(w.current, 2)} A (${w.why})`, `${w.id}: no gauge`, { code: 'wire.gauge', at, refs, values }); continue; }
85
86
  if (w.current > w.capacity) f('fail', `${w.id}: ${w.gauge} carries ${n3(w.capacity, 2)} A at most, and this carries ${n3(w.current, 2)} A (${w.why}): a thicker wire`, `${w.id}: too thin`, { code: 'wire.gauge', at, refs, values });
86
87
  else f('pass', `${w.id}: ${w.gauge} takes ${n3(w.current, 2)} A (${w.why}), up to ${n3(w.capacity, 2)} A`, null, { code: 'wire.gauge', at, refs, values });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulecad/cad",
3
- "version": "0.7.55",
3
+ "version": "0.7.57",
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": {
@@ -30,6 +30,7 @@
30
30
  "schemas",
31
31
  "templates",
32
32
  "README.md",
33
+ "CHANGELOG.md",
33
34
  "TUTORIAL.md",
34
35
  "EXAMPLES.md",
35
36
  "LICENSE",
@@ -57,24 +58,24 @@
57
58
  "url": "https://github.com/JoniBach/rulecad/issues"
58
59
  },
59
60
  "dependencies": {
60
- "@rulecad/variables": "^0.3.4",
61
+ "@rulecad/variables": "^0.3.5",
61
62
  "@rulecad/keyboard-layout": "^0.1.2",
62
63
  "@rulecad/printcheck": "^0.3.0",
63
64
  "@rulecad/fit": "^0.4.0",
64
65
  "@rulecad/model-link": "^0.3.2",
65
66
  "@rulecad/versions": "^0.1.6",
66
- "@rulecad/shapes": "^0.4.4",
67
- "@rulecad/rules": "^0.3.14",
67
+ "@rulecad/shapes": "^0.4.5",
68
+ "@rulecad/rules": "^0.3.16",
68
69
  "@jscad/modeling": "^2.12.0",
69
70
  "three": "^0.186.1",
70
71
  "@rulecad/fea": "^0.2.1",
71
72
  "@rulecad/topopt": "^0.3.0",
72
73
  "@rulecad/flexures": "^0.5.0",
73
74
  "@rulecad/gears": "^0.3.2",
74
- "@rulecad/motors": "^0.1.4",
75
- "@rulecad/fixings": "^0.1.3",
75
+ "@rulecad/motors": "^0.1.6",
76
+ "@rulecad/fixings": "^0.1.4",
76
77
  "@rulecad/robots": "^0.1.1",
77
- "@rulecad/frames": "^0.1.7"
78
+ "@rulecad/frames": "^0.1.8"
78
79
  },
79
80
  "peerDependencies": {
80
81
  "@rulecad/pcb": "^0.1.0 || ^0.2.0 || ^0.3.0 || ^0.4.0 || ^0.5.0"
@@ -17,14 +17,16 @@
17
17
  "requires": { "type": "object", "additionalProperties": { "type": "string" }, "description": "object → semver range" },
18
18
  "items": { "type": "array", "items": { "$ref": "#/$defs/item" } },
19
19
  "fits": { "type": "array", "items": { "$ref": "#/$defs/fit" } },
20
- "fasten": { "type": "array", "description": "Screwed joints: each names its screw, the parts it passes through in order, and the part it ends in. The holes are read from the parts as drawn and each screw followed along one axis; a fasten holds its parts as a fit that fastens does, and lines their holes up as a holes fit does", "items": { "$ref": "#/$defs/fasten" } },
20
+ "fasten": { "type": "array", "description": "Screwed joints: each names its screw, the parts it passes through in order, and the part it ends in. The holes are read from the parts as drawn and each screw followed along one axis; a fasten holds its parts as a fit that fastens does, lines their holes up as a holes fit does, and puts its screws on the shopping list. Draw the holes with v.fixings, and name the screw with no length: the check chooses one", "items": { "$ref": "#/$defs/fasten" }, "defaultSnippets": [{ "label": "fasten", "description": "A screwed joint", "body": [{ "screw": "${1:M3 cap}", "through": ["${2:bracket}"], "into": "${3:base}", "at": ["${4:bracket.h1}", "${5:bracket.h2}"] }] }] },
21
+ "joins": { "type": "array", "description": "How beams are joined: each names an end of one beam (a) and a place on another (b), and its kind. A join puts its operations on both beams (a tap in a's end, an access or clearance hole across b), its screws into fasten, and a spring for the frame's solve; join.geometry checks the end meets the face square and flush where b says", "items": { "$ref": "#/$defs/join" }, "defaultSnippets": [{ "label": "join", "description": "A blind join: a's end tapped, its screw's head in b's slot", "body": [{ "kind": "${1:blind}", "a": "${2:y1.a}", "b": "${3:x1.back@120}" }] }] },
22
+ "guides": {"type": "array", "description": "Linear motion on a beam. A rail: a miniature rail screwed down on a beam's slotted face into slot nuts at its hole pitch, its carriages each riding its own share of the rail on a sliding joint with its true travel (<id>-1, <id>-2 ..; poses <id>-a and <id>-b put them at either end), their loads held to their ratings as joint.moment. Wheels: a printed plate (<id>-carriage-1) over a beam's face on V-wheels (<id>-wheel-1 ..) in the V tracks of the faces either side, rolling on a sliding joint (<id>-1) through the stretch from..from + length; refused on a face with no V track. A slider: a printed slider (<id>-carriage-1) in or over a slot, on a sliding joint through its stretch. Rods: two smooth rods along a face in printed holders at the stretch's ends (<id>-holder-a, <id>-holder-b, saddles screwed into the slots either side), a printed carriage (<id>-carriage-1) on two linear bearings on a sliding joint; an endstop's printed mount at a side face's address and a flag on the carriage set the joint's home. A screw: a lead screw driving a rods guide's carriage from a printed motor plate (<id>-plate) at its end a, the motor (<id>-motor) a motor item whose lead screw comes from the screw's set, a coupler, the screw, its bearings in the holders and the lead nut on the carriage", "items": {"type": "object", "required": ["kind"], "additionalProperties": false, "properties": {"id": {"type": "string", "description": "Its name (default g1, g2 ..): the rail item takes it"}, "kind": {"enum": ["rail", "wheels", "slider", "rods", "screw"], "description": "rail (a miniature linear rail, which needs rail), wheels (a plate on V-wheels in a V-slot's tracks), slider (a printed slider in or over a slot), rods (two rods in printed holders and a printed carriage on linear bearings) or screw (a lead screw and its motor driving a rods guide, which needs guide and motor); every kind but screw needs on and length; a belt follows"}, "rail": {"type": "string", "description": "The rail's rule set: rail-mgn7, rail-mgn9, rail-mgn12, rail-mgn15"}, "carriage": {"type": "string", "description": "The carriage, a variant of the rail's set: MGN12C (standard, the default) or MGN12H (long)"}, "on": {"type": "string", "description": "A rail's or a slider's slotted face (x1.top, x1.top.2); for wheels, the face the plate lies over (x1.top), its wheels in the slots either side"}, "from": {"$ref": "#/$defs/expr", "description": "Where the rail or the stretch starts, mm from the beam's end a (default 0)"}, "length": {"$ref": "#/$defs/expr", "description": "The rail as it is cut, mm; for wheels and a slider, the stretch of the beam it runs along, mm"}, "carriages": {"type": "integer", "minimum": 1, "maximum": 8, "description": "How many carriages ride it (default 1)"}, "nut": {"type": "string", "description": "A rail or rods: the slot nuts' kind (slide-in, drop-in, roll-in, square, hammer, t-bolt), for the rail's screws, or the rods' holders, motor plate and endstop mount; between two joins that close a slot at both ends, a slide-in nut is shut in (frame.nut), so give drop-in. A screw: the lead nut's rule set (t8-nut, the default)"}, "note": {"type": "string"}, "wheel": {"type": "string", "description": "Wheels: the V-wheel's rule set, v-wheel-solid (the default) or v-wheel-mini"}, "wheels": {"enum": [3, 4], "description": "Wheels: 4 (two a side, the default) or 3 (one on an eccentric)"}, "pitch": {"$ref": "#/$defs/expr", "description": "Wheels: their spacing along the beam, mm (default a wheel's diameter and 15 mm, rounded up to 5)"}, "load": {"$ref": "#/$defs/expr", "description": "Wheels or a slider: the printed part's design load, N (default 50 for a plate, 20 for a slider)"}, "mode": {"enum": ["over", "in"], "description": "A slider: over the slot (a shoe on the face, keyed into the opening; the default) or in it (a block held under its lips)"}, "size": {"$ref": "#/$defs/expr", "description": "A slider: its own length along the beam, mm (default 30)"}, "rod": {"type": "string", "description": "Rods: the rods' rule set (rod-8, the default)"}, "bearing": {"type": "string", "description": "Rods: the linear bearings' rule set (lm8uu, the default, or lm8luu)"}, "spacing": {"$ref": "#/$defs/expr", "description": "Rods: their distance apart across the face, mm (default room for the bearings and a lead nut's flange between)"}, "height": {"$ref": "#/$defs/expr", "description": "Rods: the rods' and screw's height over the face, mm (default the least that clears the carriage, the nut, the screw's bearing, the coupler and the motor)"}, "endstop": {"type": "object", "required": ["at"], "additionalProperties": false, "description": "Rods: an endstop on a printed mount; its lever meets a flag on the carriage, and the joint homes there", "properties": {"at": {"type": "string", "description": "An address on a face beside the rods: x1.front@80"}, "switch": {"type": "string", "description": "The switch's rule set (endstop-10t85, the default)"}}}, "guide": {"type": "string", "description": "A screw: the id of the rods guide whose carriage it drives"}, "screw": {"type": "string", "description": "A screw: the lead screw's rule set (t8-screw, the default)"}, "support": {"type": ["string", "null"], "description": "A screw: the ball bearing each holder takes the screw in (bearing-608, the default), or null for none"}, "coupler": {"type": "string", "description": "A screw: the coupler from the motor's shaft to the screw (coupler-5-8, the default)"}, "motor": {"type": "object", "required": ["model"], "description": "A screw: the motor item's spec ({ \"model\": \"28byj48\", \"microsteps\": 1 }): its drives and leadscrew come from the guide"}, "friction": {"$ref": "#/$defs/expr", "description": "A screw: the nut's friction on the screw (default the screw's set's, an estimate)"}}}, "defaultSnippets": [{"label": "rail", "description": "An MGN12 rail on a beam's top face", "body": [{"kind": "rail", "rail": "${1:rail-mgn12}", "on": "${2:x1.top}", "from": 0, "length": "${3:300}"}]}, {"label": "wheels", "description": "A plate on four V-wheels over a V-slot beam's top face", "body": [{"kind": "wheels", "wheel": "${1:v-wheel-solid}", "on": "${2:x1.top}", "from": 0, "length": "${3:400}"}]}, {"label": "rods and a screw", "description": "Two 8 mm rods on a beam's top face, a carriage on LM8UUs, driven by a 28BYJ-48 through a T8 screw", "body": [{"kind": "rods", "on": "${1:x1.top}", "from": "${2:60}", "length": "${3:120}"}, {"kind": "screw", "guide": "g1", "screw": "t8-screw", "motor": {"model": "${4:28byj48}"}}]}]},
21
23
  "joints": { "type": "array", "items": { "$ref": "#/$defs/joint" } },
22
24
  "loops": { "type": "array", "items": { "$ref": "#/$defs/loop" } },
23
25
  "planetary": { "type": "array", "items": { "$ref": "#/$defs/planetary" } },
24
26
  "task": { "type": "object", "required": ["tool"], "additionalProperties": false, "description": "What the machine is for: the tool, where it works, how fast and how accurately", "properties": { "tool": { "type": "string", "description": "An anchor, <item>.<anchor>" }, "sheet": { "type": "object", "required": ["at"], "additionalProperties": false, "properties": { "size": {}, "width": { "type": "number" }, "height": { "type": "number" }, "landscape": { "type": "boolean" }, "at": { "$ref": "#/$defs/vec3" }, "normal": { "$ref": "#/$defs/vec3" }, "u": { "$ref": "#/$defs/vec3" } } }, "region": { "type": "object" }, "volume": { "type": "object" }, "speed": { "$ref": "#/$defs/expr", "description": "mm/s" }, "accuracy": { "$ref": "#/$defs/expr", "description": "mm" }, "accel": { "$ref": "#/$defs/expr", "description": "mm/s², for planning" }, "elbow": { "enum": ["left", "right"] }, "deflection": { "$ref": "#/$defs/expr", "description": "mm of link deflection at the tool, an estimate; else worked out from the parts when there is a payload" }, "payload": { "$ref": "#/$defs/expr", "description": "kg at the tool" }, "grip": { "type": "object", "description": "A compliant gripper on a servo: { servo, horn, leaf: { length, thickness, width }, travel, friction, lever, margin }" }, "pen": { "type": "object", "description": "Servo angles for the pen: { up, down }" } } },
25
27
  "gait": { "type": "object", "required": ["legs", "pattern", "stride", "lift", "period", "height", "mass"], "additionalProperties": false, "description": "Poses in time: the feet by anchor, a pattern, and the body", "properties": { "legs": { "type": "array", "items": { "type": "string" } }, "pattern": {}, "stride": { "$ref": "#/$defs/expr" }, "lift": { "$ref": "#/$defs/expr" }, "period": { "$ref": "#/$defs/expr" }, "height": { "$ref": "#/$defs/expr" }, "mass": { "$ref": "#/$defs/expr" }, "steps": { "$ref": "#/$defs/expr" }, "com": { "$ref": "#/$defs/vec3" }, "clearance": { "$ref": "#/$defs/expr" } } },
26
28
  "power": { "type": "object", "additionalProperties": false, "properties": { "margin": { "type": "number" } } },
27
- "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": { "type": "string" }, "description": "Anchors or path joints 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" } } } },
29
+ "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" } } } },
28
30
  "gravity": { "$ref": "#/$defs/vec3", "description": "Which way down is, for masses in loads (default [0, 0, -1])" },
29
31
  "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" } } } },
30
32
  "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" } } },
@@ -44,9 +46,12 @@
44
46
  "object": { "type": "string" },
45
47
  "assembly": { "type": "string" },
46
48
  "motor": { "type": "object", "required": ["model"], "additionalProperties": false, "description": "A motor from @rulecad/motors: bought, not printed; its shaft turns the joint it drives", "properties": { "model": { "type": "string" }, "drives": { "type": "string" }, "set": { "type": "object", "description": "Figures that differ from the catalogue's, by name" }, "speed": { "$ref": "#/$defs/expr", "description": "The motor's speed, rpm (default: what it does comfortably)" }, "margin": { "$ref": "#/$defs/expr", "description": "How many times over the torque must be (default 2)" }, "duty": { "$ref": "#/$defs/expr", "description": "The share of the time it runs, 0 to 1 (default 1), for its heat" }, "screw": { "type": "string", "description": "The screws through a motor's plain holes, if not the size they take: M3" }, "driver": { "type": "string", "description": "The bought driver item this motor plugs into" }, "leadscrew": { "type": "object", "additionalProperties": false, "required": ["lead"], "properties": { "lead": { "$ref": "#/$defs/expr" }, "diameter": { "$ref": "#/$defs/expr" }, "friction": { "$ref": "#/$defs/expr" } } }, "belt": { "type": "object", "additionalProperties": false, "required": ["teeth"], "properties": { "teeth": { "$ref": "#/$defs/expr" }, "pitch": { "$ref": "#/$defs/expr" }, "stiffness": { "$ref": "#/$defs/expr", "description": "N per mm of strain, per mm of belt width" }, "width": { "$ref": "#/$defs/expr" }, "length": { "$ref": "#/$defs/expr" }, "load": { "$ref": "#/$defs/expr" } } }, "current": { "type": "number", "description": "A per coil, as set on the driver (default its rated current)" }, "cooled": { "type": "boolean", "description": "The driver has a heat sink and moving air" }, "microsteps": { "type": "number", "description": "Steps to a full step (default 16): resolution, not accuracy" } } },
47
- "bought": { "type": "string", "description": "A part from a rule set (\"608\", \"drv8825\"): bought, not printed; drawn faint from its figures, with anchors from what it is" },
49
+ "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" },
48
50
  "variant": { "type": "string" },
49
51
  "set": { "type": "object" },
52
+ "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"] }, "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" }, "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" }, "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)" } } },
53
+ "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" } } } } },
54
+ "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" } } },
50
55
  "beam": { "type": "object", "required": ["profile"], "additionalProperties": false, "description": "A length of a profile from @rulecad/frames: bought and cut to length, faint in previews; 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": { "type": "boolean", "description": "A printed beam (a later release): a bought one is false, the default" }, "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" } } },
51
56
  "at": { "anyOf": [{ "$ref": "#/$defs/vec3" }, { "$ref": "#/$defs/address" }] },
52
57
  "rotate": { "$ref": "#/$defs/vec3" },
@@ -72,7 +77,7 @@
72
77
  },
73
78
  "fit": {
74
79
  "type": "object",
75
- "required": ["a", "b"],
80
+ "anyOf": [{ "required": ["a", "b"] }, { "required": ["holes", "into"] }],
76
81
  "additionalProperties": false,
77
82
  "properties": {
78
83
  "a": { "$ref": "#/$defs/names" },
@@ -81,8 +86,8 @@
81
86
  "radius": { "$ref": "#/$defs/expr", "description": "With engage: how near the joint's axis to look (mm, default 10)" },
82
87
  "shaft": { "anyOf": [{ "type": "boolean" }, { "enum": ["slide", "press"] }], "description": "a or b is a motor, and the other takes its shaft: reads the bore from the part as drawn" },
83
88
  "seat": { "anyOf": [{ "type": "boolean" }, { "enum": ["press", "slip"] }, { "type": "number" }], "description": "a or b is a bought bearing, and the other its printed seat: reads the pocket as drawn against the bearing's rules and the printer's fit (fit.seat)" },
84
- "fastens": { "type": "boolean", "description": "a and b are fastened together (pins, screws, a press): what holds a part that has no joint" },
85
- "fastener": { "type": "string", "description": "What does the fastening (an M3 × 12 screw): named on the shopping list and the assembly step" },
89
+ "fastens": { "type": "boolean", "description": "a and b are fastened together (pins, a press, a clip): what holds a part that has no joint. Where screws hold them, use a fasten instead: it knows the screw, checks its holes and lists it" },
90
+ "fastener": { "type": "string", "description": "What does the fastening, by hand (two push pins): named on the shopping list and the assembly step. A screw is a fasten's, which chooses its length and counts it" },
86
91
  "count": { "$ref": "#/$defs/expr", "description": "With fastener: how many" },
87
92
  "access": { "type": "string", "description": "<item>.<anchor>: where the screw's tool comes from, its z axis pointing out along the screw. Whatever stands on that line goes on after the screw; if nothing can, assembly.order says so" },
88
93
  "min": { "$ref": "#/$defs/expr" },
@@ -90,11 +95,11 @@
90
95
  "note": { "type": "string" },
91
96
  "label": { "type": "string" },
92
97
  "poses": { "type": "array", "items": { "type": "string" } },
93
- "holes": { "type": "boolean" },
94
- "depth": { "$ref": "#/$defs/expr" },
95
- "direction": { "enum": ["up", "down"] },
96
- "ring": { "$ref": "#/$defs/expr" },
97
- "into": { "type": "string" },
98
+ "holes": { "type": "string", "description": "A holes fit: a circuit board's part (pcb.board) whose mounting holes are followed down into the part named by into. Where the board is screwed there, a fasten with \"holes\" says it and knows the screw: cad check suggests it, cad add fasten --from-fits writes it" },
99
+ "depth": { "$ref": "#/$defs/expr", "description": "With holes: how far each screw's path must be clear (mm)" },
100
+ "direction": { "enum": ["up", "down"], "description": "With holes: up for screws from below" },
101
+ "ring": { "$ref": "#/$defs/expr", "description": "With holes: how far round each screw there must be material (mm, default the hole's diameter)" },
102
+ "into": { "type": "string", "description": "With holes: the part the screws go into" },
98
103
  "within": { "$ref": "#/$defs/expr", "description": "With an anchor name (item@anchor): only faces this close to it (mm, default 10)" }
99
104
  }
100
105
  },
@@ -104,7 +109,7 @@
104
109
  "at": { "$ref": "#/$defs/beamAddress" },
105
110
  "thread": { "type": "string", "description": "A thread by name (M5): sizes the hole, the tap or the seat through @rulecad/fixings" },
106
111
  "kind": { "enum": ["clearance", "close", "loose", "tap"], "description": "A drilled hole's kind" },
107
- "head": { "type": "string", "description": "A counterbore's head: cap, button, hex or pan" },
112
+ "head": { "type": "string", "description": "A counterbore's head: cap, button, hex or pan; an access hole's, the head its hex key turns: cap (the default), button or countersunk" },
108
113
  "diameter": { "$ref": "#/$defs/expr", "description": "mm, in place of a thread's figure" },
109
114
  "depth": { "$ref": "#/$defs/expr", "description": "mm from the face or the end" },
110
115
  "through": { "enum": ["wall", "beam"], "description": "A drilled hole through one wall (the default) or right through the beam" },
@@ -116,17 +121,39 @@
116
121
  "radius": { "$ref": "#/$defs/expr", "description": "A pocket's corner radius, mm" },
117
122
  "length": { "$ref": "#/$defs/expr", "description": "A notch's length along the beam, mm" } } },
118
123
  "address": { "type": "string", "pattern": "^[a-z][\\w-]*(\\.[\\w-]+)+(@-?\\d+(\\.\\d+)?%?)?$", "description": "An anchor by name, <item>.<anchor>; on a beam an end (x1.a, x1.b), an end bore (x1.a.1), or a face with a distance from end a (x1.top@120), from end b (x1.top@-20) or a share of the length (x1.top@50%), the second slot of a face x1.top.2@120" },
124
+ "join": {
125
+ "type": "object",
126
+ "description": "Two beams joined: an end of one (a), a place on the other (b), and how (kind)",
127
+ "required": ["kind", "a", "b"],
128
+ "additionalProperties": false,
129
+ "properties": {
130
+ "kind": { "enum": ["blind", "end-tap", "bracket", "gusset", "cube", "hidden", "anchor", "mitre", "pivot", "splice", "printed"], "description": "blind: a's end tapped, a button-head screw's head in b's slot, an access hole across b. end-tap: a's end tapped, a cap screw through a hole drilled across b. bracket, gusset and splice with \"fitting\": \"printed\" add a printed fitting and its screws; bracket, gusset, splice, hidden and anchor with a bought fitting's set by name add that fitting, its screws and the holes it needs. The rest (cube, mitre's key, pivot, printed) are checked where they meet and stiffen the frame by an estimate; their fittings come in later releases" },
131
+ "a": { "type": "string", "description": "A beam's end: y1.a, or one bore of it where the end has several (y1.a.2)" },
132
+ "b": { "type": "string", "description": "A place on the other beam where a's end (its bore's axis) meets it: a face with a distance from its end a (x1.back@120, x1.top@-20, x1.top@50%), or an end (x1.b) for a splice, mitre or corner" },
133
+ "fitting": { "type": "string", "minLength": 1, "description": "For a kind with a fitting: printed, or a bought fitting's rule set by name (fitting-motedis-bracket-20-b6), or bought to be told which sets there are. Printed, a bracket, gusset or splice join adds the fitting as an item, placed from where the beams are, its screws into slot nuts in both beams as fastens, and its own stiffness by finite elements. A bought set on a bracket, gusset, splice, hidden or anchor join adds its item (a reference, listed with its price), its screws into the set's nuts as fastens, the hole a beam needs for it, and its set's stiffness, an estimate until the joint rig measures it" },
134
+ "brace": { "type": "boolean", "description": "A printed bracket's brace across its inside corner" },
135
+ "load": { "type": "number", "description": "A printed fitting's design load in N, across beam a at its screw (default 100): it is sized to about twice the margin at it" },
136
+ "nut": { "enum": ["slide-in", "drop-in", "roll-in", "hammer", "square", "t-bolt"], "description": "A printed fitting's slot nuts' kind (default: the strongest made for the slot)" },
137
+ "screw": { "type": "string", "description": "For blind and end-tap: the screw by thread and head (M5 button), where not the end bore's thread with the kind's head" },
138
+ "note": { "type": "string" }
139
+ }
140
+ },
119
141
  "fasten": {
120
142
  "type": "object",
143
+ "description": "A screwed joint: the screw by thread and head, the parts it passes in order, the part it ends in, and where the screws go (at, an anchor each, or holes, a part's own holes)",
121
144
  "required": ["screw", "through", "into"],
122
145
  "additionalProperties": false,
146
+ "defaultSnippets": [
147
+ { "label": "screws at anchors", "body": { "screw": "${1:M3 cap}", "through": ["${2:bracket}"], "into": "${3:base}", "at": ["${4:bracket.h1}", "${5:bracket.h2}"] } },
148
+ { "label": "screws in a part's own holes", "body": { "screw": "${1:M3 cap}", "through": ["${2:lid}"], "into": "${3:box}", "holes": "${4:lid.body}" } }
149
+ ],
123
150
  "properties": {
124
151
  "screw": { "type": "string", "description": "The screw, by its thread and head: M3 cap, M4 button, M3x12 countersunk, 6-32 UNC cap (the names @rulecad/fixings reads). With no length in the name, the shortest sold length that fits is chosen" },
125
152
  "through": { "type": "array", "items": { "type": "string" }, "description": "The parts the screw passes through, in order from under its head: items (bracket) or item.part (bracket.body). Each needs a clearance hole for the thread" },
126
- "into": { "type": "string", "description": "The part the screw ends in: a pilot, a tapped or printed thread, an insert's hole or a nut's seat there, or a clearance hole with nut" },
153
+ "into": { "type": "string", "description": "The part the screw ends in: a pilot, a tapped or printed thread, an insert's hole or a nut's seat there, or a clearance hole with nut. Or a slot on a beam (x1.top, x1.top.2, x1.top@120): the screw ends in a slot nut under the slot's lips, the one made for that slot and thread (nut chooses its kind), and each screw lies over a slot's centre line (fasten.slot)" },
127
154
  "at": { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/anchorRef" }, "description": "One screw at each anchor: a point on its axis (bracket.h1), the anchor's axis along the screw" },
128
155
  "holes": { "type": "string", "description": "In place of at: a part whose holes are the screws' places, found in the part as drawn (a circuit board: its mounting holes)" },
129
- "nut": { "anyOf": [{ "type": "boolean" }, { "type": "string" }], "description": "What holds the screw where the part it ends in does not: true or hex, square, lock. It sits on that part's far face, or in a nut's seat drawn there" },
156
+ "nut": { "anyOf": [{ "type": "boolean" }, { "type": "string" }], "description": "What holds the screw where the part it ends in does not: true or hex, square, lock. It sits on that part's far face, or in a nut's seat drawn there. Into a beam's slot, the slot nut's kind: slide-in, drop-in, roll-in, hammer, square or t-bolt (left out, the strongest made for the slot). A slide-in or square nut enters only from an open end of the slot (frame.nut, frame.preload)" },
130
157
  "washer": { "type": "boolean", "description": "A plain washer under the head" },
131
158
  "length": { "$ref": "#/$defs/expr", "description": "The screw's length in mm, where the name gives none: checked for reaching, bottoming out and standing proud" },
132
159
  "torque": { "$ref": "#/$defs/expr", "description": "The tightening torque, N m: the pressure under the head is then held against the material it sits on (fasten.seat)" },
@@ -13,7 +13,7 @@
13
13
  "version": { "type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+" },
14
14
  "description": { "type": "string" },
15
15
  "note": { "type": "string" },
16
- "uses": { "type": "array", "items": { "type": "string" }, "description": "Rule sets (x1c, m3) and other objects (project/object, optionally @version)" },
16
+ "uses": { "type": "array", "items": { "type": "string" }, "description": "Rule sets (x1c, m3) and other objects (project/object, optionally @version). A screw's holes need none listed: v.fixings reads the thread's set, the printer and the material itself" },
17
17
  "material": { "type": "string" },
18
18
  "orientation": { "type": "string", "description": "How it sits on the bed, and anything the printer or the person assembling it should know" },
19
19
  "role": { "enum": ["part", "reference", "board"], "description": "reference: drawn faint and never printed (a switch, a tablet); board: a circuit board" },
@@ -48,7 +48,7 @@
48
48
  "required": ["value"],
49
49
  "additionalProperties": false,
50
50
  "properties": {
51
- "value": { "description": "A number, an expression (x1c.line * 3), or for typed variables a name or text", "type": ["number", "string", "boolean", "array", "object"] },
51
+ "value": { "description": "A number, an expression (x1c.line * 3), or for typed variables a name or text. A hole for a screw, a nut or an insert is no typed number: draw it with v.fixings in the .js (v.fixings.hole('M3', { kind: 'pilot' })), and say how parts screw together with a fasten in the assembly", "type": ["number", "string", "boolean", "array", "object"] },
52
52
  "unit": { "type": "string" },
53
53
  "rule": { "type": "string", "description": "Why the value is what it is" },
54
54
  "label": { "type": "string" },