@rulecad/cad 0.7.65 → 0.7.66
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/CHANGELOG.md +8 -0
- package/lib/machine.mjs +2 -2
- package/lib/task.mjs +1 -1
- package/package.json +2 -2
- package/schemas/assembly.schema.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,14 @@ print (a hole's diameter, a seat's depth, a part's outline). Each release lists
|
|
|
5
5
|
its reason. A **fasten** is an entry in an assembly's `"fasten"` list: one screwed joint, naming the screw by thread
|
|
6
6
|
and head, the parts it passes through and the part it ends in.
|
|
7
7
|
|
|
8
|
+
## 0.7.66: the Uno streamer keeps time (#181)
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- An assembly's `task` takes `blockTime`, seconds: `cad plot` plans no move shorter (robots' `minBlockTime`), for a
|
|
13
|
+
streamer that takes one line a block over serial. `cad machine` writes it into the machine's `task`. No printed size
|
|
14
|
+
moved.
|
|
15
|
+
|
|
8
16
|
## 0.7.65: the arm on the parts its builder has
|
|
9
17
|
|
|
10
18
|
### Changed
|
package/lib/machine.mjs
CHANGED
|
@@ -24,7 +24,7 @@ export function machineOf(s) {
|
|
|
24
24
|
});
|
|
25
25
|
const kinematics = c.names.length === 2 && motion.joints.filter((j) => c.names.includes(j.id)).every((j) => j.type === 'revolute') ? 'scara' : motion.joints.filter((j) => c.names.includes(j.id)).every((j) => j.type === 'prismatic') ? 'cartesian' : 'serial';
|
|
26
26
|
const pen = s.a.task.pen ?? null;
|
|
27
|
-
return { format: 'rulecad.machine/1', name: `${s.project}/${s.name}`, kinematics, tool: s.task.tool, elbow: sample(s).elbow, axes, task: { sheet: s.a.task.sheet ?? null, region: s.a.task.region ?? null, volume: s.a.task.volume ?? null, speed: s.task.speed, accuracy: s.task.accuracy, accel: s.task.accel ?? 500 }, ...(pen ? { pen } : {}) };
|
|
27
|
+
return { format: 'rulecad.machine/1', name: `${s.project}/${s.name}`, kinematics, tool: s.task.tool, elbow: sample(s).elbow, axes, task: { sheet: s.a.task.sheet ?? null, region: s.a.task.region ?? null, volume: s.a.task.volume ?? null, speed: s.task.speed, accuracy: s.task.accuracy, accel: s.task.accel ?? 500, ...(s.task.blockTime ? { blockTime: s.task.blockTime } : {}) }, ...(pen ? { pen } : {}) };
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
// A drawing's size against the sheet: the first stroke that leaves it, named
|
|
@@ -59,7 +59,7 @@ export function plot(s, svg, { tolerance, name } = {}) {
|
|
|
59
59
|
findings.push(...plan.findings);
|
|
60
60
|
if (!plan.ok) return { ok: false, findings, plan };
|
|
61
61
|
const speed = s.task.speed ?? 50, accel = m.task.accel, axes = m.axes.map((a) => ({ name: a.name, stepsPerUnit: a.stepsPerUnit, maxRate: a.maxRate }));
|
|
62
|
-
const steps = stepBlocks(plan, { axes, speed, accel, travelSpeed: speed * 2 });
|
|
62
|
+
const steps = stepBlocks(plan, { axes, speed, accel, travelSpeed: speed * 2, ...(m.task.blockTime ? { minBlockTime: m.task.blockTime } : {}) });
|
|
63
63
|
// The pen-down lines, with what the budget predicts along them
|
|
64
64
|
const { list } = s.task.accuracy != null ? accuracyOf(s) : { list: null }, drawn = plan.moves.filter((x) => x.kind === 'draw').map((x) => ({ stroke: x.stroke, name: x.name, points: x.points.map((p) => p.map(r6)), error: list ? x.q.map((q) => +jacobianError(c, q, list, s.task.deflection).toFixed(4)) : null }));
|
|
65
65
|
const time = estimate(steps), out = { ...steps, machine: m.name, drawing: name, drawn };
|
package/lib/task.mjs
CHANGED
|
@@ -23,7 +23,7 @@ export function taskOf(a, motion, num) {
|
|
|
23
23
|
const [id, name] = String(t.tool).split('.'), mark = motion.marks.find((m) => m.id === id && m.name === name);
|
|
24
24
|
if (!mark) throw new Error(`${what}: no anchor "${t.tool}" (anchors: ${motion.marks.filter((m) => m.id === id).map((m) => m.name).join(', ') || `no item ${id}`})`);
|
|
25
25
|
const vec = (v) => v.map(num), value = (k) => { if (t[k] == null) return null; const x = num(t[k]); if (!(x > 0)) throw new Error(`${what}: ${k} is above 0 (got ${x})`); return x; };
|
|
26
|
-
const out = { tool: t.tool, item: id, point: [mark.frame[3], mark.frame[7], mark.frame[11]], speed: value('speed'), accuracy: value('accuracy'), elbow: t.elbow ?? null, deflection: t.deflection != null ? num(t.deflection) : 0, payload: t.payload != null ? num(t.payload) : null, accel: t.accel != null ? num(t.accel) : null };
|
|
26
|
+
const out = { tool: t.tool, item: id, point: [mark.frame[3], mark.frame[7], mark.frame[11]], speed: value('speed'), accuracy: value('accuracy'), elbow: t.elbow ?? null, deflection: t.deflection != null ? num(t.deflection) : 0, payload: t.payload != null ? num(t.payload) : null, accel: t.accel != null ? num(t.accel) : null, blockTime: value('blockTime') };
|
|
27
27
|
if (t.elbow != null && !['left', 'right'].includes(t.elbow)) throw new Error(`${what}: elbow is left or right (got ${JSON.stringify(t.elbow)})`);
|
|
28
28
|
if (t.sheet) out.sheet = { ...t.sheet, at: vec(t.sheet.at), ...(t.sheet.normal ? { normal: vec(t.sheet.normal) } : {}), ...(t.sheet.u ? { u: vec(t.sheet.u) } : {}) };
|
|
29
29
|
const ranges = (o) => Object.fromEntries(Object.entries(o).map(([k, x]) => [k, Array.isArray(x) ? x.map(num) : typeof x === 'object' ? x : num(x)]));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulecad/cad",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.66",
|
|
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": {
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"@rulecad/gears": "^0.3.3",
|
|
75
75
|
"@rulecad/motors": "^0.1.6",
|
|
76
76
|
"@rulecad/fixings": "^0.1.5",
|
|
77
|
-
"@rulecad/robots": "^0.1.
|
|
77
|
+
"@rulecad/robots": "^0.1.3",
|
|
78
78
|
"@rulecad/frames": "^0.1.11"
|
|
79
79
|
},
|
|
80
80
|
"peerDependencies": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"joints": { "type": "array", "items": { "$ref": "#/$defs/joint" } },
|
|
25
25
|
"loops": { "type": "array", "items": { "$ref": "#/$defs/loop" } },
|
|
26
26
|
"planetary": { "type": "array", "items": { "$ref": "#/$defs/planetary" } },
|
|
27
|
-
"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 }" } } },
|
|
27
|
+
"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" }, "blockTime": { "$ref": "#/$defs/expr", "description": "s: the least time a planned move lasts, so a streamer taking a line a block over serial keeps up (the arm's: send.mjs leastBlockTime)" }, "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 }" } } },
|
|
28
28
|
"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" } } },
|
|
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" } } } },
|