@rulecad/cad 0.7.41 → 0.7.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +21 -0
- package/EXAMPLES.md +4252 -4
- package/README.md +13 -0
- package/bin/cad.mjs +120 -8
- package/lib/animate.mjs +41 -0
- package/lib/assembly.mjs +49 -8
- package/lib/bought.mjs +105 -0
- package/lib/buildpage.mjs +81 -0
- package/lib/gait.mjs +66 -0
- package/lib/grip.mjs +23 -0
- package/lib/links.mjs +11 -2
- package/lib/list.mjs +58 -0
- package/lib/loads.mjs +224 -0
- package/lib/machine.mjs +92 -0
- package/lib/measured.mjs +87 -0
- package/lib/motors.mjs +30 -14
- package/lib/order.mjs +242 -0
- package/lib/plates.mjs +108 -0
- package/lib/power.mjs +31 -0
- package/lib/rules.mjs +6 -0
- package/lib/seats.mjs +128 -0
- package/lib/sheet.mjs +146 -16
- package/lib/task.mjs +203 -0
- package/lib/wires.mjs +131 -0
- package/package.json +7 -6
- package/schemas/assembly.schema.json +14 -1
package/lib/wires.mjs
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// Wires in the assembly: anchors at each end, a route between them, and the longest the route gets through the machine's
|
|
2
|
+
// poses. A wire that won't reach the elbow at full stretch, or is too thin for what it carries, is found here rather than
|
|
3
|
+
// on the bench. "wires": [{ "from": "elbow.connector", "to": "board.Y", "via": ["upper.cable"], "gauge": "awg22" }]
|
|
4
|
+
import { peekRuleSet as loadRuleSet } from './rules.mjs';
|
|
5
|
+
|
|
6
|
+
const n3 = (x, d = 1) => String(Number(x.toFixed(d)));
|
|
7
|
+
const GAUGE = /^awg(\d{1,2})$/i;
|
|
8
|
+
const areaOf = (gauge, base) => { const d = base * Math.pow(92, (36 - gauge) / 39); return (Math.PI * d * d) / 4; };
|
|
9
|
+
|
|
10
|
+
// Anchors to world points at given joint values
|
|
11
|
+
function pointer(s, { placeItems, jointValues, mul, marksOf }) {
|
|
12
|
+
const motion = s.motion, ids = motion.items.map((x) => x[0]);
|
|
13
|
+
const marks = (id, name) => motion.marks.find((m) => m.id === id && m.name === name);
|
|
14
|
+
return (ref, what) => {
|
|
15
|
+
const bits = String(ref).split('.'), name = bits.pop(), id = bits.join('.'), m = marks(id, name);
|
|
16
|
+
if (!m) throw new Error(`${what}: no anchor "${ref}" (give <item>.<anchor>${ids.includes(id) ? `; ${id} has ${motion.marks.filter((x) => x.id === id).map((x) => x.name).join(', ') || 'none'}` : ''})`);
|
|
17
|
+
const k = ids.indexOf(id), F = m.frame;
|
|
18
|
+
return (worlds) => { const W = mul(worlds[k], F); return [W[3], W[7], W[11]]; };
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
// Joint values to try: each named pose, each moving joint at its ends and middle, all together when few enough
|
|
22
|
+
function samples(motion, jointValues) {
|
|
23
|
+
const base = jointValues(motion, motion.pose ?? undefined), free = motion.joints.filter((j) => !j.follow && j.type !== 'fixed' && j.dofs.length === 1), out = [base];
|
|
24
|
+
for (const p of Object.keys(motion.poses || {})) out.push(jointValues(motion, p));
|
|
25
|
+
const levels = (j) => { const [lo, hi] = j.dofs[0]; return [lo, (lo + hi) / 2, hi]; }, leads = Object.fromEntries(Object.entries(base).filter(([id]) => !motion.joints.find((x) => x.id === id)?.follow));
|
|
26
|
+
if (free.length && free.length <= 5) {
|
|
27
|
+
const go = (i, set) => { if (i === free.length) { out.push(jointValues(motion, set)); return; } for (const v of levels(free[i])) go(i + 1, { ...set, [free[i].id]: [v] }); };
|
|
28
|
+
go(0, leads);
|
|
29
|
+
} else for (const j of free) for (const v of levels(j)) out.push(jointValues(motion, { ...leads, [j.id]: [v] }));
|
|
30
|
+
return out;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Each wire as a route of point functions, checked by name when the assembly is built
|
|
34
|
+
export function wiresOf(a, placed, joints) {
|
|
35
|
+
return (a.wires || []).map((w, i) => {
|
|
36
|
+
const what = `wire ${w.id || i + 1}`;
|
|
37
|
+
if (!w.from || !w.to) throw new Error(`${what}: give "from" and "to", anchors as <item>.<anchor>`);
|
|
38
|
+
const g = GAUGE.exec(String(w.gauge ?? ''));
|
|
39
|
+
if (w.gauge != null && !g) throw new Error(`${what}: gauge is awg and a number (awg22), not ${JSON.stringify(w.gauge)}`);
|
|
40
|
+
for (const v of w.via ?? []) if (typeof v === 'string' && !v.includes('.') && !joints.some((j) => j.id === v && j.type === 'path')) throw new Error(`${what}: via "${v}" is neither an anchor (<item>.<anchor>) nor a path joint`);
|
|
41
|
+
return { ...w, id: w.id || `w${i + 1}` };
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// What a wire carries: what it's given, or a motor's current at either end, or a signal's
|
|
46
|
+
function currentOf(w, s, top, signal) {
|
|
47
|
+
if (w.current != null) return { current: Number(w.current), why: 'as given' };
|
|
48
|
+
const motors = s.motion.drives.filter((d) => [top(w.from), top(w.to)].includes(d.id));
|
|
49
|
+
for (const d of motors) { const I = d.spec.current ?? d.model.figures.rated_current?.value; if (I != null) return { current: I, why: `${d.id}'s rated current` }; }
|
|
50
|
+
return { current: signal, why: 'a signal' };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// A wire ending on a board's axis connector: the board's pins for that axis, from its rule set
|
|
54
|
+
function pinsAt(w, s) {
|
|
55
|
+
for (const end of [w.from, w.to]) {
|
|
56
|
+
const [id, anchor] = String(end).split('.'), o = s.objects.find((x) => x.id === id && x.bought?.part === 'board'), e = o?.built.entries;
|
|
57
|
+
if (!e || !/^[A-Z]$/.test(anchor ?? '')) continue;
|
|
58
|
+
const pin = (k) => e.find((x) => x.name === `${o.bought.set}.${k}_pin_${anchor.toLowerCase()}`)?.value;
|
|
59
|
+
if (pin('step')) return `step ${pin('step')}, dir ${pin('dir')}${pin('limit') ? `, limit ${pin('limit')}` : ''}`;
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function wireRows(s, helpers) {
|
|
65
|
+
const motion = s.motion, wires = s.wires; if (!wires?.length) return [];
|
|
66
|
+
const rules = loadRuleSet('wire').rules, density = rules.current_density.value, loop = rules.service_loop.value, base = rules.awg_base.value, signal = rules.signal_current.value;
|
|
67
|
+
const point = pointer(s, helpers), { placeItems, jointValues } = helpers, top = (n) => String(n).split('.')[0], poses = samples(motion, jointValues).map((v) => placeItems(motion, v));
|
|
68
|
+
return wires.map((w) => {
|
|
69
|
+
const what = `wire ${w.id}`, chain = [w.from, ...(w.via ?? []), w.to];
|
|
70
|
+
const fns = chain.flatMap((v) => (typeof v === 'string' && !v.includes('.') ? [] : [point(v, what)]));
|
|
71
|
+
const pathLen = (w.via ?? []).reduce((t, v) => { const j = typeof v === 'string' && !v.includes('.') && motion.joints.find((x) => x.id === v); if (!j) return t; let l = 0; for (let k = 1; k < j.path.length; k++) l += Math.hypot(...j.path[k].map((c, m) => c - j.path[k - 1][m])); return t + l; }, 0);
|
|
72
|
+
let longest = 0, shortest = Infinity, atLongest = null;
|
|
73
|
+
for (const W of poses) { const P = fns.map((fn) => fn(W)); let l = pathLen; for (let k = 1; k < P.length; k++) l += Math.hypot(P[k][0] - P[k - 1][0], P[k][1] - P[k - 1][1], P[k][2] - P[k - 1][2]); if (l > longest) { longest = l; atLongest = P; } shortest = Math.min(shortest, l); }
|
|
74
|
+
const { current, why } = currentOf(w, s, top, signal), gauge = w.gauge ? Number(GAUGE.exec(w.gauge)[1]) : null, area = gauge != null ? areaOf(gauge, base) : null, capacity = area != null ? area * density : null;
|
|
75
|
+
return { id: w.id, from: w.from, to: w.to, via: w.via ?? [], pins: pinsAt(w, s), gauge: w.gauge ?? null, colour: w.colour ?? null, conductors: w.conductors ?? (s.motion.drives.some((d) => [top(w.from), top(w.to)].includes(d.id)) ? 4 : 1), connectors: w.connectors ?? null,
|
|
76
|
+
longest, shortest, length: Math.ceil(longest + loop), loop, current, why, area, capacity, route: atLongest };
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function wireChecks(s, f, helpers) {
|
|
81
|
+
for (const w of wireRows(s, helpers)) {
|
|
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 });
|
|
84
|
+
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
|
+
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
|
+
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 });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// A route's stations: each anchor as [item, local point]; a path joint in the route is its whole polyline, on its parent
|
|
91
|
+
function stations(s, chain, mul) {
|
|
92
|
+
const motion = s.motion, out = [], ids = motion.items.map((x) => x[0]);
|
|
93
|
+
for (const v of chain) {
|
|
94
|
+
if (typeof v === 'string' && !v.includes('.')) { const j = motion.joints.find((x) => x.id === v); if (j) for (const p of j.path) { const W = mul(j.a, [1, 0, 0, p[0], 0, 1, 0, p[1], 0, 0, 1, p[2]]); out.push([j.parent, W[3], W[7], W[11]]); } continue; }
|
|
95
|
+
const bits = String(v).split('.'), name = bits.pop(), id = bits.join('.'), m = motion.marks.find((x) => x.id === id && x.name === name);
|
|
96
|
+
if (m) out.push([ids.indexOf(id), m.frame[3], m.frame[7], m.frame[11]]);
|
|
97
|
+
}
|
|
98
|
+
return out;
|
|
99
|
+
}
|
|
100
|
+
const worldOf = (W, [, x, y, z]) => [W[0] * x + W[1] * y + W[2] * z + W[3], W[4] * x + W[5] * y + W[6] * z + W[7], W[8] * x + W[9] * y + W[10] * z + W[11]];
|
|
101
|
+
const I = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0];
|
|
102
|
+
|
|
103
|
+
/** Each wire's route as stations a link carries: [[id, [[item, x, y, z], …]]], the item -1 (world) when nothing moves. */
|
|
104
|
+
export function wireRoutes(s, { placeItems, mul }) {
|
|
105
|
+
const hasJoints = s.motion.joints.length > 0, W = hasJoints ? null : placeItems(s.motion, s.jointValues);
|
|
106
|
+
return (s.wires || []).map((w) => [w.id, stations(s, [w.from, ...(w.via ?? []), w.to], mul).map((p) => (hasJoints ? p.map((v) => +v.toFixed(3)) : [-1, ...worldOf(p[0] < 0 ? I : W[p[0]], p).map((v) => +v.toFixed(3))]))]);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// A thin square tube along each wire at the assembly's pose, for previews: drawn faint, never a part, so no check sees it
|
|
110
|
+
export function wireTubes(s, { placeItems, mul }) {
|
|
111
|
+
const worlds = placeItems(s.motion, s.jointValues), r = 0.5, out = [];
|
|
112
|
+
for (const w of s.wires || []) {
|
|
113
|
+
const pts = stations(s, [w.from, ...(w.via ?? []), w.to], mul).map((p) => worldOf(p[0] < 0 ? I : worlds[p[0]], p)), tris = [];
|
|
114
|
+
for (let k = 1; k < pts.length; k++) {
|
|
115
|
+
const a = pts[k - 1], b = pts[k], d = b.map((c, i) => c - a[i]), l = Math.hypot(...d); if (l < 1e-6) continue;
|
|
116
|
+
const z = d.map((c) => c / l), side = Math.abs(z[0]) < 0.9 ? [1, 0, 0] : [0, 1, 0], x0 = [z[1] * side[2] - z[2] * side[1], z[2] * side[0] - z[0] * side[2], z[0] * side[1] - z[1] * side[0]], m = Math.hypot(...x0), x = x0.map((c) => c / m), y = [z[1] * x[2] - z[2] * x[1], z[2] * x[0] - z[0] * x[2], z[0] * x[1] - z[1] * x[0]];
|
|
117
|
+
const corner = (o, sx, sy) => o.map((c, i) => c + (sx * x[i] + sy * y[i]) * r), ring = (o) => [corner(o, 1, 1), corner(o, -1, 1), corner(o, -1, -1), corner(o, 1, -1)], A = ring(a), B = ring(b);
|
|
118
|
+
for (let q = 0; q < 4; q++) { const n = (q + 1) % 4; tris.push([A[q], A[n], B[n]], [A[q], B[n], B[q]]); }
|
|
119
|
+
tris.push([A[0], A[2], A[1]], [A[0], A[3], A[2]], [B[0], B[1], B[2]], [B[0], B[2], B[3]]);
|
|
120
|
+
}
|
|
121
|
+
if (tris.length) out.push({ name: `wire.${w.id}`, role: 'wire', label: `wire ${w.id}`, item: null, triangles: tris });
|
|
122
|
+
}
|
|
123
|
+
return out;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// The sheet: each wire, its length, gauge, colour and connectors, in Markdown
|
|
127
|
+
export function wiringSheet(rows) {
|
|
128
|
+
const line = (a) => `| ${a.join(' | ')} |`;
|
|
129
|
+
return [line(['Wire', 'From', 'To', 'Length (mm)', 'Gauge', 'Conductors', 'Colour', 'Connectors', 'Board pins', 'Carries']), line(['---', '---', '---', '---:', '---', '---:', '---', '---', '---', '---']),
|
|
130
|
+
...rows.map((w) => line([w.id, w.from, w.to, w.length, w.gauge ?? '', w.conductors, w.colour ?? '', Array.isArray(w.connectors) ? w.connectors.join(' to ') : w.connectors ?? '', w.pins ?? '', `${n3(w.current, 2)} A, ${w.why}`]))].join('\n');
|
|
131
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulecad/cad",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.43",
|
|
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": {
|
|
@@ -57,21 +57,22 @@
|
|
|
57
57
|
"url": "https://github.com/JoniBach/rulecad/issues"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@rulecad/variables": "^0.3.
|
|
60
|
+
"@rulecad/variables": "^0.3.3",
|
|
61
61
|
"@rulecad/keyboard-layout": "^0.1.2",
|
|
62
62
|
"@rulecad/printcheck": "^0.3.0",
|
|
63
63
|
"@rulecad/fit": "^0.4.0",
|
|
64
|
-
"@rulecad/model-link": "^0.3.
|
|
64
|
+
"@rulecad/model-link": "^0.3.1",
|
|
65
65
|
"@rulecad/versions": "^0.1.0",
|
|
66
|
-
"@rulecad/shapes": "^0.4.
|
|
67
|
-
"@rulecad/rules": "^0.3.
|
|
66
|
+
"@rulecad/shapes": "^0.4.4",
|
|
67
|
+
"@rulecad/rules": "^0.3.9",
|
|
68
68
|
"@jscad/modeling": "^2.12.0",
|
|
69
69
|
"three": "^0.186.1",
|
|
70
70
|
"@rulecad/fea": "^0.2.1",
|
|
71
71
|
"@rulecad/topopt": "^0.3.0",
|
|
72
72
|
"@rulecad/flexures": "^0.5.0",
|
|
73
73
|
"@rulecad/gears": "^0.3.2",
|
|
74
|
-
"@rulecad/motors": "^0.1.
|
|
74
|
+
"@rulecad/motors": "^0.1.4",
|
|
75
|
+
"@rulecad/robots": "^0.1.1"
|
|
75
76
|
},
|
|
76
77
|
"peerDependencies": {
|
|
77
78
|
"@rulecad/pcb": "^0.1.0 || ^0.2.0 || ^0.3.0 || ^0.4.0 || ^0.5.0"
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"description": { "type": "string" },
|
|
13
13
|
"note": { "type": "string" },
|
|
14
14
|
"kind": { "enum": ["fit", "plate"] },
|
|
15
|
+
"packed": { "type": "object", "description": "Written by cad plates: which assembly this plate is for, its filament and gap, and each part's build hash, so a changed part re-packs only its plate", "required": ["of", "filament", "gap", "parts"], "additionalProperties": false, "properties": { "of": { "type": "string" }, "filament": { "type": "string" }, "gap": { "type": "number" }, "parts": { "type": "object" } } },
|
|
15
16
|
"uses": { "type": "array", "items": { "type": "string" } },
|
|
16
17
|
"requires": { "type": "object", "additionalProperties": { "type": "string" }, "description": "object → semver range" },
|
|
17
18
|
"items": { "type": "array", "items": { "$ref": "#/$defs/item" } },
|
|
@@ -19,6 +20,10 @@
|
|
|
19
20
|
"joints": { "type": "array", "items": { "$ref": "#/$defs/joint" } },
|
|
20
21
|
"loops": { "type": "array", "items": { "$ref": "#/$defs/loop" } },
|
|
21
22
|
"planetary": { "type": "array", "items": { "$ref": "#/$defs/planetary" } },
|
|
23
|
+
"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 }" } } },
|
|
24
|
+
"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" } } },
|
|
25
|
+
"power": { "type": "object", "additionalProperties": false, "properties": { "margin": { "type": "number" } } },
|
|
26
|
+
"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" } } } },
|
|
22
27
|
"gravity": { "$ref": "#/$defs/vec3", "description": "Which way down is, for masses in loads (default [0, 0, -1])" },
|
|
23
28
|
"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" } } } },
|
|
24
29
|
"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" } } },
|
|
@@ -37,7 +42,8 @@
|
|
|
37
42
|
"id": { "type": "string" },
|
|
38
43
|
"object": { "type": "string" },
|
|
39
44
|
"assembly": { "type": "string" },
|
|
40
|
-
"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" } } },
|
|
45
|
+
"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" } } },
|
|
46
|
+
"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" },
|
|
41
47
|
"variant": { "type": "string" },
|
|
42
48
|
"set": { "type": "object" },
|
|
43
49
|
"at": { "$ref": "#/$defs/vec3" },
|
|
@@ -70,7 +76,11 @@
|
|
|
70
76
|
"engage": { "$ref": "#/$defs/expr", "description": "a goes at least this far (mm) onto b along the joint between them: a part slid onto a shaft or a pin, not resting on its end" },
|
|
71
77
|
"radius": { "$ref": "#/$defs/expr", "description": "With engage: how near the joint's axis to look (mm, default 10)" },
|
|
72
78
|
"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" },
|
|
79
|
+
"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)" },
|
|
73
80
|
"fastens": { "type": "boolean", "description": "a and b are fastened together (pins, screws, a press): what holds a part that has no joint" },
|
|
81
|
+
"fastener": { "type": "string", "description": "What does the fastening (an M3 × 12 screw): named on the shopping list and the assembly step" },
|
|
82
|
+
"count": { "$ref": "#/$defs/expr", "description": "With fastener: how many" },
|
|
83
|
+
"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" },
|
|
74
84
|
"min": { "$ref": "#/$defs/expr" },
|
|
75
85
|
"max": { "$ref": "#/$defs/expr" },
|
|
76
86
|
"note": { "type": "string" },
|
|
@@ -104,6 +114,9 @@
|
|
|
104
114
|
"min": { "$ref": "#/$defs/values" },
|
|
105
115
|
"max": { "$ref": "#/$defs/values" },
|
|
106
116
|
"value": { "$ref": "#/$defs/values" },
|
|
117
|
+
"support": { "type": "object", "additionalProperties": false, "description": "What takes this joint's tipping load: bought bearings, or printed clips (read by FE)", "properties": { "bearings": { "type": "array", "items": { "type": "string" } }, "clips": { "type": "array", "items": { "type": "string" } }, "pitch": { "$ref": "#/$defs/expr", "description": "Diameter the clips stand on, mm" }, "cell": { "$ref": "#/$defs/expr", "description": "FE cell, mm" } } },
|
|
118
|
+
"errors": { "type": "object", "description": "What this joint adds to the error at the tool, degrees, by name (play, twist, bearing): an expression reading a rule, so a measurement moves it", "additionalProperties": { "$ref": "#/$defs/expr" } },
|
|
119
|
+
"home": { "type": "object", "additionalProperties": false, "required": ["endstop"], "description": "How this joint finds zero", "properties": { "endstop": { "type": "string", "description": "An item.anchor at the switch" }, "direction": { "enum": [1, -1] } } },
|
|
107
120
|
"brake": { "type": "string", "description": "What holds this joint with the power off (a ratchet, a detent): counted by motor.holds" },
|
|
108
121
|
"follow": { "type": "string" },
|
|
109
122
|
"ratio": { "$ref": "#/$defs/expr" },
|