create-rulecad 0.3.19 → 0.3.21
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
CHANGED
|
@@ -5,6 +5,25 @@ print (a hole's diameter, a seat's depth, a part's outline). Each release lists
|
|
|
5
5
|
it makes, with its reason. A **fasten** is an entry in an assembly's `"fasten"` list: one screwed joint, naming the
|
|
6
6
|
screw by thread and head, the parts it passes through and the part it ends in.
|
|
7
7
|
|
|
8
|
+
## 0.3.21: the arm on a 17HS4401 elbow and 12 V
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- `--machine arm` makes the arm with a 17HS4401 at the elbow as at the shoulder, on a 12 V supply (an LRS-50-12), so
|
|
13
|
+
one motor and one driver setting cover both joints. Printed sizes moved in `upper`: the elbow motor's four M3 holes
|
|
14
|
+
and their counterbores from the NEMA 14's 26 mm square to the 17HS4401's 31 mm square. `arm.shoulder_torque` goes
|
|
15
|
+
from 0.2 to 0.22 N m for the heavier elbow motor.
|
|
16
|
+
- The template's `AGENTS.md` tells an agent to mark what the person has `"have": true` and to give the supply they
|
|
17
|
+
will use, since a stepper's torque at speed follows its volts.
|
|
18
|
+
|
|
19
|
+
## 0.3.20: the edit commands and belt guides in the agent notes (Frames 4)
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- The template's `AGENTS.md`, copied from `@rulecad/cad`, tells an agent to make and change projects and assemblies
|
|
24
|
+
with `cad new`, `cad set`, `cad add`, `cad move` and `cad remove` rather than writing their JSON by hand, and how to
|
|
25
|
+
put a belt drive on a beam.
|
|
26
|
+
|
|
8
27
|
## 0.3.19: pins, magnets and printed bolts in the agent notes (Fixings 4)
|
|
9
28
|
|
|
10
29
|
### Changed
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
{ "id": "bridge", "object": "bridge", "at": [0, 0, "arm.bridge_low"] },
|
|
17
17
|
{ "id": "b1", "bought": "bearing-6800", "at": [0, 0, "arm.bridge_low + arm.bridge - arm.bearing_width"] },
|
|
18
18
|
{ "id": "upper", "object": "upper" },
|
|
19
|
-
{ "id": "m2", "motor": { "model": "
|
|
19
|
+
{ "id": "m2", "motor": { "model": "17HS4401", "drives": "edrive", "speed": 300, "duty": 0.3, "driver": "d2", "current": 0.5, "microsteps": 8 } },
|
|
20
20
|
{ "id": "esun", "object": "sun", "set": { "tip": 11.7 } },
|
|
21
21
|
{ "id": "ecarrier", "object": "speck" }, { "id": "ering", "object": "speck" },
|
|
22
22
|
{ "id": "ep1", "object": "planet" }, { "id": "ep2", "object": "planet" }, { "id": "ep3", "object": "planet" },
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
{ "id": "d1", "bought": "drv8825", "at": [-300, -30, 8] },
|
|
33
33
|
{ "id": "d2", "bought": "drv8825", "at": [-300, 0, 8] },
|
|
34
34
|
{ "id": "shield", "bought": "cnc-shield-v3", "at": [-300, 0, 0] },
|
|
35
|
-
{ "id": "psu", "bought": "supply-
|
|
35
|
+
{ "id": "psu", "bought": "supply-12v", "variant": "LRS-50-12", "at": [-330, 150, 0] }
|
|
36
36
|
],
|
|
37
37
|
"joints": [
|
|
38
38
|
{ "id": "m1_on", "type": "fixed", "parent": "housing.motor", "child": "m1.face" },
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
{ "id": "pen", "from": "servo.connector", "to": "shield.Z", "via": ["forearm.cable", "upper.cable", "base.cable"], "gauge": "awg26", "colour": "brown, red, orange", "conductors": 3, "current": 0.7, "connectors": ["Servo JR 3 pin", "D11, 5 V, GND"], "note": "D11 is the Z limit pin on a V3.00 shield: arm.ino uses it for the servo" },
|
|
107
107
|
{ "id": "home1", "from": "es1.left", "to": "shield.X", "via": ["base.cable"], "gauge": "awg26", "colour": "white, black", "conductors": 2, "connectors": ["Crimped spade", "X limit and GND"] },
|
|
108
108
|
{ "id": "home2", "from": "es2.left", "to": "shield.Y", "via": ["upper.cable", "base.cable"], "gauge": "awg26", "colour": "white, black", "conductors": 2, "connectors": ["Crimped spade", "Y limit and GND"] },
|
|
109
|
-
{ "id": "power", "from": "psu.terminals", "to": "shield.top", "gauge": "awg22", "colour": "red, black", "conductors": 2, "current": 2, "connectors": ["Ring terminal", "Screw terminal"], "note": "
|
|
109
|
+
{ "id": "power", "from": "psu.terminals", "to": "shield.top", "gauge": "awg22", "colour": "red, black", "conductors": 2, "current": 2, "connectors": ["Ring terminal", "Screw terminal"], "note": "12 V into the shield's motor terminals" }
|
|
110
110
|
],
|
|
111
111
|
"loads": [
|
|
112
112
|
{ "joint": "out", "torque": "arm.shoulder_torque", "note": "The pen's drag at its reach, the arm's inertia at 500 mm/s², the bias" },
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// The upper arm, drawn as it prints: its top face on the bed, the elbow's ring standing on it, the hub's socket opening
|
|
2
|
-
// upward. The elbow's
|
|
2
|
+
// upward. The elbow's 17HS4401, the shoulder's motor, bolts on the bed side, its shaft up through the plate, on the same
|
|
3
|
+
// v.motors mount as the shoulder's housing.
|
|
3
4
|
// The screws' holes are v.fixings': an M3 clearance hole through the socket's floor for the screw into the spindle,
|
|
4
5
|
// an M3 pilot in each post for its clip, and the elbow switch's M2 pilots.
|
|
5
6
|
import jscad from '@jscad/modeling'
|
|
@@ -10,7 +11,7 @@ const { hull } = jscad.hulls
|
|
|
10
11
|
|
|
11
12
|
export function main (v) {
|
|
12
13
|
const screw = v.fixings.holeModel('M3').diameter, pilot = v.fixings.holeModel('M3', { kind: 'pilot' }).diameter, switchPilot = v.fixings.holeModel('M2', { kind: 'pilot' }).diameter
|
|
13
|
-
const motor = v.motors.motorModel('
|
|
14
|
+
const motor = v.motors.motorModel('17HS4401')
|
|
14
15
|
const at = (r, a) => [v.long + r * Math.cos(a), r * Math.sin(a)]
|
|
15
16
|
const posts = [v.p1, v.p2, v.p3].map((a) => a * v.rad)
|
|
16
17
|
const round = (r, c) => translate([c, 0], circle({ radius: r, segments: v.segments }))
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"twist_elbow": {"value": 0.01, "unit": "°", "rule": "The elbow's gear train twisting, the same", "kind": "estimate", "source": "A guess: bench test 15", "checked": "2026-11-09"},
|
|
14
14
|
"deflection": {"value": 0.02, "unit": "mm", "rule": "The links bending sideways at the pen under its drag, from beam formulas", "kind": "estimate", "source": "0.3 N of drag on the forearm and holder as cantilevers: bench test 17 measures the whole budget at once", "checked": "2026-11-09"},
|
|
15
15
|
"drag": {"value": 0.3, "unit": "N", "rule": "A pen's drag on paper, about, pulled sideways at the tip", "kind": "estimate", "source": "A hand guess from a pen on a spring scale: measure yours", "checked": "2026-11-09"},
|
|
16
|
-
"shoulder_torque": {"value": 0.
|
|
17
|
-
"elbow_torque": {"value": 0.08, "unit": "N m", "rule": "What the elbow must do: the pen's drag at
|
|
16
|
+
"shoulder_torque": {"value": 0.22, "unit": "N m", "rule": "What the shoulder must do at the task's speed and accel: the pen's drag at 242 mm, the arm's inertia and the bias", "kind": "estimate", "source": "Drag 0.3 N x 0.242 m = 0.073 N m + inertia 0.024 kg m2 (motor.accel's, with the 17HS4401 at the elbow) x 2.07 rad/s2 (500 mm/s2 at 242 mm) = 0.05 N m + the rubber band's bias 0.1 N m", "checked": "2026-11-22"},
|
|
17
|
+
"elbow_torque": {"value": 0.08, "unit": "N m", "rule": "What the elbow must do: the pen's drag at 115 mm, the forearm's inertia and the bias", "kind": "estimate", "source": "Drag 0.3 N x 0.115 m = 0.035 N m + inertia 0.0006 kg m2 (motor.accel's forearm) x 4.35 rad/s2 (500 mm/s2 at 115 mm) = 0.003 N m + the rubber band's bias 0.04 N m, 0.077 N m: the elbow's motor rides on the upper arm, so the change of motor leaves it", "checked": "2026-11-22"},
|
|
18
18
|
"foot": {"value": 6, "unit": "mm", "rule": "The base plate's thickness", "kind": "default", "source": "Stiff enough for four M5 screws", "checked": "2026-11-09"},
|
|
19
19
|
"room": {"value": 2, "unit": "mm", "rule": "Air between the shoulder motor's back and the base plate", "kind": "default", "source": "Design", "checked": "2026-11-09"},
|
|
20
20
|
"motor17": {"value": 40, "unit": "mm", "rule": "The 17HS4401's body length", "kind": "community", "source": "nema17 variant 17HS4401 (https://market.samm.com/17hs4401-nema17-step-motor-en)", "checked": "2026-11-09"},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-rulecad",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.21",
|
|
4
4
|
"description": "Start a rulecad project: npm create rulecad my-designs. A workspace with a soap tray to start from, ready to check, preview, export and share.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/template/AGENTS.md
CHANGED
|
@@ -40,8 +40,14 @@ variable says which rule it comes from. Follow these steps; they're what makes a
|
|
|
40
40
|
1. `npx cad history <project>/<object>` first: read the print log. A failed print is the reason for most changes:
|
|
41
41
|
fix the rule or variable it points at (a measured fit beats a community rule).
|
|
42
42
|
2. Change, then check, preview and look, as for a new part. Change values with `npx cad set <project>/<object>
|
|
43
|
-
name=value` and assemblies with `npx cad add fit|joint|item|pose|fasten
|
|
44
|
-
|
|
43
|
+
name=value` and assemblies with `npx cad add fit|joint|item|beam|pose|fasten|join|guide|load …`, `npx cad set
|
|
44
|
+
<project>/<assembly> x1.at=… joins.0.kind=…`, `npx cad move` and `npx cad remove`: they keep the file's layout and
|
|
45
|
+
refuse an edit that breaks it, naming why and writing nothing. Make a project with `npx cad new <project>` and an
|
|
46
|
+
assembly with `npx cad new <project>/<assembly> --assembly` (`--frame box --inside … --profile …` for a frame), and
|
|
47
|
+
change a project's own fields with `npx cad set <project> material=PETG`. Write project and assembly files with
|
|
48
|
+
these commands, not by hand: each checks its edit first, `--dry-run` shows it, and `--json` gives what changed and
|
|
49
|
+
the checks. `cad remove` refuses to take out what other entries name and lists them; add `--with-refs` only once
|
|
50
|
+
the person agrees those go too. `npx cad values` lists an object's numbers; `npx cad why <project>/<object>.<name>` shows what a
|
|
45
51
|
value depends on, down to the rules (estimates marked). `--json` on check, values and why gives data to act on:
|
|
46
52
|
each finding has a code, its numbers and where it is.
|
|
47
53
|
3. `npx cad release <project>/<object> -m "what changed, for the person" --dry-run` shows the bump and why. If it's
|
|
@@ -142,8 +148,10 @@ variable says which rule it comes from. Follow these steps; they're what makes a
|
|
|
142
148
|
- **A frame for a size starts from a generator**: `"frame": { "kind": "box", "inside": [w, d, h], "profile",
|
|
143
149
|
"join": "blind" }` (also portal, table, gantry, shelf) expands into beams, joins, feet and caps before anything is
|
|
144
150
|
checked. Ask by `inside` for what it must enclose, `outside` for what it must fit in; never work the lengths out by
|
|
145
|
-
hand.
|
|
146
|
-
|
|
151
|
+
hand. Make it with `npx cad new <project>/<assembly> --assembly --frame box --inside 300,300,350 --profile …
|
|
152
|
+
--join blind`, which says what it expands into before it writes. Read `frame.generated` for what it made, and
|
|
153
|
+
`npx cad frame <project>/<assembly> --expand` to write it out when it needs changes a generator cannot make, then
|
|
154
|
+
change the beams and joins with `cad set`, `cad move`, `cad add` and `cad remove` as a hand-drawn frame's.
|
|
147
155
|
- **Beams are cut and drilled by hand from their sheets and jigs**: `npx cad beams <project>/<assembly>` writes a
|
|
148
156
|
cut-and-drill sheet per mark, and `--jigs` writes the jigs as a plate in `exports/` (a drill guide per distinct
|
|
149
157
|
hole across a beam, a tap guide per tapped end, a cut-length stop per length, a squaring corner of the hand each square join takes),
|
|
@@ -161,7 +169,8 @@ variable says which rule it comes from. Follow these steps; they're what makes a
|
|
|
161
169
|
wire along a beam is a run in its `via`, `{ "along": "rail.front", "from": 300, "to": 60 }`: report its length and
|
|
162
170
|
its clips from `wire.length` and `wire.run`.
|
|
163
171
|
- **Linear motion on a beam is a guide**: `"guides": [{ "kind": "rail", "rail": "rail-mgn12", "carriage": "MGN12H",
|
|
164
|
-
"on": "x1.top", "from": 50, "length": 300 }]
|
|
172
|
+
"on": "x1.top", "from": 50, "length": 300 }]`, written by `npx cad add guide <project>/<assembly> --kind rail
|
|
173
|
+
rail=rail-mgn12 carriage=MGN12H on=x1.top from=50 length=300`. Never draw a rail or carriage yourself, nor type its screws: the
|
|
165
174
|
guide places the rail, its screws into the slot at its pitch and each carriage on a sliding joint with its true
|
|
166
175
|
travel. Fix a table on a carriage with a fixed joint at `g1-carriage-1.top`. Run `cad check --sweep`, and report
|
|
167
176
|
`guide.fit`, the travel and each carriage's `joint.moment` margin; a fail there means a longer carriage
|
|
@@ -175,6 +184,14 @@ variable says which rule it comes from. Follow these steps; they're what makes a
|
|
|
175
184
|
Never draw the holders, motor plate, coupler or carriage yourself: the guides place them by addresses and give the
|
|
176
185
|
motor its lead screw. Report the travel, `motor.torque`'s margin, `guide.coupler`, the bearings' `joint.moment`, the
|
|
177
186
|
endstop's home, and each printed part's grams and margin; if the endstop is refused, use the address it names.
|
|
187
|
+
A belt drives a rail's carriage: `{ "kind": "belt", "guide": "g1", "motor": { "model": "nema17" }, "accel": 3000 }`
|
|
188
|
+
(`npx cad add guide <project>/<assembly> --kind belt guide=g1 motor.model=nema17 accel=3000`). Never draw the
|
|
189
|
+
pulley, idler, belt, plate or clamp yourself: the guide places them by addresses. Report `belt.length` (cut and
|
|
190
|
+
buy), `belt.tension`, `motor.torque`'s margin and the travel a turn, `belt.tensioner`'s room, and each printed part's
|
|
191
|
+
grams and margin; say the tension and the belt's thickness are estimates. A `belt.rub` or `belt.line` fail means the
|
|
192
|
+
idler or the part it names moves, never the belt's figures; where the part is on the carriage, raise the belt with
|
|
193
|
+
the `"height"` it names instead or move the part; a `belt.tensioner` fail means cutting the belt to the length it
|
|
194
|
+
names.
|
|
178
195
|
- **A part screwed onto a beam is a `fasten` into a slot**: `"into": "x1.top"` (or `x1.top.2`, or `x1.top@120`, the
|
|
179
196
|
middle of its screws), the
|
|
180
197
|
part's holes drawn with `v.fixings` at the slot's spacing, `"nut"` the slot nut's kind. `fasten.slot` fails a hole off
|
|
@@ -258,6 +275,10 @@ EXAMPLES chapter 12 builds one from start to finish.
|
|
|
258
275
|
State why the current is what it is: the torque it needs, the driver's rating without a heat sink, the motor's heat.
|
|
259
276
|
- **Everything bought is an item.** Motors, drivers, bearings, switches, the supply: `bought` items and `wires` make the
|
|
260
277
|
shopping list (`cad list`), the wiring sheet (`cad wires`) and the firmware's settings (`cad machine`) from one assembly.
|
|
278
|
+
Ask the person what they already have, and mark those items `"have": true`: `cad list` and the kit then list them as
|
|
279
|
+
in hand, apart from what is to buy. Design for the parts they have before asking them to buy others.
|
|
280
|
+
- **The supply sets the speed.** A stepper's torque at speed is worked out at the volts of the assembly's bought supply
|
|
281
|
+
(24 V where it has none): give the supply they will really use, and report `motor.torque` at that voltage.
|
|
261
282
|
- Before moving anything: `cad plot` the drawing and watch the preview. It refuses a stroke that leaves the sheet.
|
|
262
283
|
- **A gait is the same idea for a body.** Give an assembly a `gait` (`legs`, `pattern`, `stride`, `lift`, `period`, `height`, `mass`): the body at the world origin, the hips at z = 0, the feet as anchors. One leg on a stand is a gait of one leg (`"pattern": { "duty": 0.6, "phase": [0] }`). Anchor a round foot at its centre, so the contact rolls with the shin and the height stays true. Report a gait's numbers as they are: quasi-static, the torque from the weight alone, no dynamics.
|
|
263
284
|
- **Say what the machine weighs.** A robot built from these parts is heavier than the first sizing said it was: list `cad list`'s grams and set the gait's `mass` to that, and report the torque margin at the real mass.
|