create-rulecad 0.3.12 → 0.3.14
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/README.md +16 -0
- package/index.mjs +54 -3
- package/machines/arm/projects/arm/assemblies/arm.json +103 -0
- package/machines/arm/projects/arm/drawings/test.svg +1 -0
- package/machines/arm/projects/arm/firmware/arm/arm.ino +149 -0
- package/machines/arm/projects/arm/objects/base.js +18 -0
- package/machines/arm/projects/arm/objects/base.json +41 -0
- package/machines/arm/projects/arm/objects/bridge.js +15 -0
- package/machines/arm/projects/arm/objects/bridge.json +32 -0
- package/machines/arm/projects/arm/objects/clip.js +9 -0
- package/machines/arm/projects/arm/objects/clip.json +20 -0
- package/machines/arm/projects/arm/objects/forearm.js +20 -0
- package/machines/arm/projects/arm/objects/forearm.json +44 -0
- package/machines/arm/projects/arm/objects/holder.js +23 -0
- package/machines/arm/projects/arm/objects/holder.json +50 -0
- package/machines/arm/projects/arm/objects/horn.js +9 -0
- package/machines/arm/projects/arm/objects/horn.json +17 -0
- package/machines/arm/projects/arm/objects/housing.js +22 -0
- package/machines/arm/projects/arm/objects/housing.json +39 -0
- package/machines/arm/projects/arm/objects/output.js +12 -0
- package/machines/arm/projects/arm/objects/output.json +28 -0
- package/machines/arm/projects/arm/objects/pen.js +9 -0
- package/machines/arm/projects/arm/objects/pen.json +17 -0
- package/machines/arm/projects/arm/objects/planet.js +9 -0
- package/machines/arm/projects/arm/objects/planet.json +20 -0
- package/machines/arm/projects/arm/objects/speck.js +5 -0
- package/machines/arm/projects/arm/objects/speck.json +17 -0
- package/machines/arm/projects/arm/objects/spindle.js +17 -0
- package/machines/arm/projects/arm/objects/spindle.json +34 -0
- package/machines/arm/projects/arm/objects/sun.js +10 -0
- package/machines/arm/projects/arm/objects/sun.json +22 -0
- package/machines/arm/projects/arm/objects/upper.js +34 -0
- package/machines/arm/projects/arm/objects/upper.json +73 -0
- package/machines/arm/projects/arm/project.json +19 -0
- package/machines/arm/projects/arm/send.mjs +70 -0
- package/machines/arm/rules/arm.json +44 -0
- package/machines/leg/projects/leg/assemblies/stand.json +101 -0
- package/machines/leg/projects/leg/objects/bridge.js +15 -0
- package/machines/leg/projects/leg/objects/bridge.json +32 -0
- package/machines/leg/projects/leg/objects/carriage.js +14 -0
- package/machines/leg/projects/leg/objects/carriage.json +34 -0
- package/machines/leg/projects/leg/objects/clip.js +9 -0
- package/machines/leg/projects/leg/objects/clip.json +20 -0
- package/machines/leg/projects/leg/objects/collar.js +11 -0
- package/machines/leg/projects/leg/objects/collar.json +19 -0
- package/machines/leg/projects/leg/objects/foot.js +11 -0
- package/machines/leg/projects/leg/objects/foot.json +21 -0
- package/machines/leg/projects/leg/objects/housing.js +22 -0
- package/machines/leg/projects/leg/objects/housing.json +39 -0
- package/machines/leg/projects/leg/objects/output.js +12 -0
- package/machines/leg/projects/leg/objects/output.json +28 -0
- package/machines/leg/projects/leg/objects/pad.js +14 -0
- package/machines/leg/projects/leg/objects/pad.json +27 -0
- package/machines/leg/projects/leg/objects/planet.js +9 -0
- package/machines/leg/projects/leg/objects/planet.json +20 -0
- package/machines/leg/projects/leg/objects/scale.js +5 -0
- package/machines/leg/projects/leg/objects/scale.json +15 -0
- package/machines/leg/projects/leg/objects/shin.js +17 -0
- package/machines/leg/projects/leg/objects/shin.json +35 -0
- package/machines/leg/projects/leg/objects/speck.js +5 -0
- package/machines/leg/projects/leg/objects/speck.json +17 -0
- package/machines/leg/projects/leg/objects/spindle.js +17 -0
- package/machines/leg/projects/leg/objects/spindle.json +34 -0
- package/machines/leg/projects/leg/objects/sun.js +10 -0
- package/machines/leg/projects/leg/objects/sun.json +22 -0
- package/machines/leg/projects/leg/objects/thigh.js +29 -0
- package/machines/leg/projects/leg/objects/thigh.json +53 -0
- package/machines/leg/projects/leg/objects/tie.js +10 -0
- package/machines/leg/projects/leg/objects/tie.json +19 -0
- package/machines/leg/projects/leg/project.json +21 -0
- package/machines/leg/rules/leg.json +42 -0
- package/package.json +6 -1
- package/template/AGENTS.md +41 -6
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// A tapered bar from the knee's boss to a round foot, flat on the bed. The foot's rim has a V groove for the pad's ridge.
|
|
2
|
+
import jscad from '@jscad/modeling'
|
|
3
|
+
const { cylinder, circle, polygon } = jscad.primitives
|
|
4
|
+
const { translate } = jscad.transforms
|
|
5
|
+
const { extrudeLinear, extrudeRotate } = jscad.extrusions
|
|
6
|
+
const { hull } = jscad.hulls
|
|
7
|
+
|
|
8
|
+
export function main (v) {
|
|
9
|
+
const dot = (r, x) => translate([x, 0], circle({ radius: r, segments: v.segments }))
|
|
10
|
+
const bar = extrudeLinear({ height: v.bar }, hull(dot(v.wide / 2, 0), dot(v.toe / 2, v.long)))
|
|
11
|
+
const boss = cylinder({ radius: v.boss_d / 2, height: v.boss, center: [0, 0, v.boss / 2], segments: v.segments * 2 })
|
|
12
|
+
const r = v.foot_r, mid = v.foot_w / 2, g = v.groove
|
|
13
|
+
const foot = translate([v.long, 0, 0], extrudeRotate({ segments: v.segments }, polygon({ points: [[0, 0], [r, 0], [r, mid - g], [r - g, mid], [r, mid + g], [r, v.foot_w], [0, v.foot_w]] })))
|
|
14
|
+
const bolts = Array.from({ length: v.bolts }, (_, k) => cylinder({ radius: v.screw / 2, height: v.boss + 1, center: [v.bolt * Math.cos(k * v.quarter), v.bolt * Math.sin(k * v.quarter), v.boss / 2], segments: v.segments }))
|
|
15
|
+
const heads = Array.from({ length: v.bolts }, (_, k) => cylinder({ radius: v.head / 2, height: v.head_depth + 1, center: [v.bolt * Math.cos(k * v.quarter), v.bolt * Math.sin(k * v.quarter), (v.head_depth - 1) / 2], segments: v.segments }))
|
|
16
|
+
return v.ops.subtract(v.ops.union(bar, boss, foot), bolts, heads)
|
|
17
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
|
|
3
|
+
"name": "shin",
|
|
4
|
+
"title": "Shin and foot",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"uses": ["x1c", "leg", "m3"],
|
|
7
|
+
"engine": "manifold",
|
|
8
|
+
"orientation": "The bar and the foot flat on the bed, the boss up. The foot's V groove at 45° needs no support",
|
|
9
|
+
"description": "From the knee's output flange to a round foot: a bar in one piece with the disc the grip pad snaps round.",
|
|
10
|
+
"anchors": {
|
|
11
|
+
"hub": {"at": [0, 0, "boss"], "axis": [0, 0, -1], "ref": [1, 0, 0]},
|
|
12
|
+
"tip": {"at": ["long", 0, "foot_w / 2"], "axis": [0, 0, 1], "ref": [1, 0, 0]},
|
|
13
|
+
"pad": {"at": ["long", 0, 0], "axis": [0, 0, 1], "ref": [1, 0, 0]},
|
|
14
|
+
"cable": {"at": ["long / 2", 0, "bar"], "axis": [0, 0, 1]}
|
|
15
|
+
},
|
|
16
|
+
"variables": {
|
|
17
|
+
"long": {"value": "leg.shin", "unit": "mm", "rule": "Knee to the foot's centre", "label": "Shin", "show": true, "interface": true},
|
|
18
|
+
"bar": {"value": 8, "unit": "mm", "rule": "The bar's thickness, sized in the chapter: 2 MPa under the worst stance load"},
|
|
19
|
+
"wide": {"value": 20, "unit": "mm", "rule": "The bar's width at the knee"},
|
|
20
|
+
"toe": {"value": 16, "unit": "mm", "rule": "Its width at the foot: tapered, as the bending falls to nothing at the foot"},
|
|
21
|
+
"boss": {"value": "leg.boss", "unit": "mm", "rule": "The bar passes under the knee's clips, the boss above reaches the flange"},
|
|
22
|
+
"boss_d": {"value": 46, "unit": "mm", "rule": "Round the 40 mm bolt circle"},
|
|
23
|
+
"screw": {"value": "m3.clearance + x1c.hole_comp", "unit": "mm", "rule": "M3 clearance"},
|
|
24
|
+
"head": {"value": "m3.head + 2 * x1c.fit + x1c.hole_comp", "unit": "mm", "rule": "The screw's head, counterbored in the bed side"},
|
|
25
|
+
"head_depth": {"value": "m3.head_height + x1c.layer", "unit": "mm", "rule": "Sunk"},
|
|
26
|
+
"bolt": {"value": 20, "unit": "mm", "rule": "The output's bolt circle, radius"},
|
|
27
|
+
"bolts": {"value": 4, "rule": "On the bolt circle"},
|
|
28
|
+
"quarter": {"value": 1.57079633, "rule": "A quarter turn in radians"},
|
|
29
|
+
"foot_w": {"value": 14, "unit": "mm", "rule": "The foot's width across the leg: wide enough to stand on the pad's tread", "interface": true},
|
|
30
|
+
"foot_r": {"value": "leg.foot_r - pad_t", "unit": "mm", "rule": "The disc's radius, under the pad"},
|
|
31
|
+
"pad_t": {"value": 3, "unit": "mm", "rule": "The pad's thickness, its tread included", "interface": true},
|
|
32
|
+
"groove": {"value": 1, "unit": "mm", "rule": "The V groove the pad's ridge locks into, 1 mm deep: at 45° it prints without support", "interface": true},
|
|
33
|
+
"segments": {"value": 64, "rule": "Round enough"}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Nothing is printed here: the planets ride on the sun and the rings. A mark for the planets' joints to be on.
|
|
2
|
+
import jscad from '@jscad/modeling'
|
|
3
|
+
const { sphere } = jscad.primitives
|
|
4
|
+
|
|
5
|
+
export function main (v) { return sphere({ radius: v.r, center: [0, 0, v.far] }) }
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
|
|
3
|
+
"name": "speck",
|
|
4
|
+
"title": "Carrier (not printed)",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"role": "reference",
|
|
7
|
+
"anchors": {
|
|
8
|
+
"axis": {"at": [0, 0, 0], "axis": [0, 0, 1]},
|
|
9
|
+
"a": {"at": [18, 0, 0], "axis": [0, 0, 1]},
|
|
10
|
+
"b": {"at": ["0 - 9", "18 * sind(120)", 0], "axis": [0, 0, 1]},
|
|
11
|
+
"c": {"at": ["0 - 9", "0 - 18 * sind(120)", 0], "axis": [0, 0, 1]}
|
|
12
|
+
},
|
|
13
|
+
"variables": {
|
|
14
|
+
"r": {"value": 0.2, "unit": "mm", "rule": "A speck, so the planets' joints have something to hang from"},
|
|
15
|
+
"far": {"value": 110, "unit": "mm", "rule": "Out of the way, past the leg"}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// A disc on the output's flange and a shaft up through the bearing, a hexagon at its top for the arm.
|
|
2
|
+
import jscad from '@jscad/modeling'
|
|
3
|
+
const { cylinder } = jscad.primitives
|
|
4
|
+
|
|
5
|
+
export function main (v) {
|
|
6
|
+
const plate = cylinder({ radius: v.rim / 2, height: v.disc, center: [0, 0, v.disc / 2], segments: v.segments * 2 })
|
|
7
|
+
const top = v.collar_top + v.width
|
|
8
|
+
const shaft = cylinder({ radius: v.shaft / 2, height: top - 1, center: [0, 0, (top + 1) / 2], segments: v.segments * 2 })
|
|
9
|
+
const collar = v.shapes.shaftShoulder(v.shaft, { shoulder: v.shoulder, height: v.collar_top - v.disc, at: [0, 0, v.collar_top] })
|
|
10
|
+
const hex = cylinder({ radius: v.hex / 2 / v.cos30, height: v.hex_long, center: [0, 0, top + v.hex_long / 2], segments: v.hex_segments })
|
|
11
|
+
const screws = Array.from({ length: v.bolts }, (_, k) => {
|
|
12
|
+
const c = [v.bolt * Math.cos(k * v.quarter), v.bolt * Math.sin(k * v.quarter), v.disc]
|
|
13
|
+
return v.shapes.countersink({ hole: v.hole, head: v.head, length: v.disc + 1, at: c, into: '-z' })
|
|
14
|
+
})
|
|
15
|
+
const pilot = cylinder({ radius: v.pilot / 2, height: v.pilot_depth, center: [0, 0, top + v.hex_long - v.pilot_depth / 2], segments: v.segments })
|
|
16
|
+
return v.ops.subtract(v.ops.union(plate, shaft, collar, hex), screws, pilot)
|
|
17
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
|
|
3
|
+
"name": "spindle",
|
|
4
|
+
"title": "Spindle: disc and shaft",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"uses": ["x1c", "leg", "m3"],
|
|
7
|
+
"engine": "manifold",
|
|
8
|
+
"orientation": "The disc on the bed, the shaft up, as it goes on",
|
|
9
|
+
"description": "The output's flange turns the spindle; the spindle's shaft runs in the 6800 and carries the thigh on a hexagon at its top.",
|
|
10
|
+
"anchors": {
|
|
11
|
+
"down": {"at": [0, 0, 0], "axis": [0, 0, 1], "ref": [1, 0, 0]},
|
|
12
|
+
"seat": {"at": [0, 0, "collar_top + width"], "axis": [0, 0, 1], "ref": [1, 0, 0]}
|
|
13
|
+
},
|
|
14
|
+
"variables": {
|
|
15
|
+
"disc": {"value": "leg.disc", "unit": "mm", "rule": "Thick enough for a countersunk M3"},
|
|
16
|
+
"rim": {"value": 46, "unit": "mm", "rule": "Round the 40 mm bolt circle"},
|
|
17
|
+
"bolt": {"value": 20, "unit": "mm", "rule": "On the output's bolt circle"},
|
|
18
|
+
"hole": {"value": "m3.clearance + x1c.hole_comp", "unit": "mm", "rule": "M3 clearance"},
|
|
19
|
+
"head": {"value": "m3.head", "unit": "mm", "rule": "A countersunk head, flush with the disc so the bridge passes over"},
|
|
20
|
+
"shaft": {"value": "leg.bearing_bore - x1c.press", "unit": "mm", "rule": "A close slide into the bearing's bore, clamped end to end by the thigh's screw"},
|
|
21
|
+
"width": {"value": "leg.bearing_width", "unit": "mm", "rule": "The bearing"},
|
|
22
|
+
"collar_top": {"value": "leg.bridge_low + leg.bridge - width - leg.output_top", "unit": "mm", "rule": "Where the inner race rests, above the disc's underside"},
|
|
23
|
+
"shoulder": {"value": 13, "unit": "mm", "rule": "Stops the inner race; clears the outer race"},
|
|
24
|
+
"hex": {"value": 8, "unit": "mm", "rule": "Hexagon across its flats: inside the bore, drives the thigh"},
|
|
25
|
+
"hex_long": {"value": 5, "unit": "mm", "rule": "Into the thigh's socket"},
|
|
26
|
+
"pilot": {"value": 2.9, "unit": "mm", "rule": "An M3 screw self-tapped", "kind": "community"},
|
|
27
|
+
"pilot_depth": {"value": 12, "unit": "mm", "rule": "For the thigh's M3"},
|
|
28
|
+
"cos30": {"value": "cosd(30)", "rule": "A hexagon, across corners to across flats"},
|
|
29
|
+
"bolts": {"value": 4, "rule": "On the bolt circle"},
|
|
30
|
+
"quarter": {"value": 1.57079633, "rule": "A quarter turn in radians"},
|
|
31
|
+
"segments": {"value": 64, "rule": "Round enough"},
|
|
32
|
+
"hex_segments": {"value": 6, "rule": "A hexagon's sides"}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// The sun with a hub above it, up through both stages, for grip on the shaft's flat.
|
|
2
|
+
import jscad from '@jscad/modeling'
|
|
3
|
+
const { cylinder } = jscad.primitives
|
|
4
|
+
|
|
5
|
+
export function main (v) {
|
|
6
|
+
const motor = v.motors.motorModel('nema17')
|
|
7
|
+
const gear = v.gears.spur({ module: v.module, teeth: v.teeth, width: v.width })
|
|
8
|
+
const hub = cylinder({ radius: v.hub / 2, height: v.tall, center: [0, 0, v.tall / 2], segments: v.segments })
|
|
9
|
+
return v.ops.subtract(v.ops.union(gear, hub), v.motors.bore(motor, { depth: v.tall, tip: v.tip }, v.ops))
|
|
10
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
|
|
3
|
+
"name": "sun",
|
|
4
|
+
"title": "Sun gear on a motor's shaft",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"uses": ["x1c"],
|
|
7
|
+
"engine": "manifold",
|
|
8
|
+
"orientation": "Gear down, the hub up",
|
|
9
|
+
"anchors": {
|
|
10
|
+
"axis": {"at": [0, 0, "0 - gap"], "axis": [0, 0, 1]}
|
|
11
|
+
},
|
|
12
|
+
"variables": {
|
|
13
|
+
"gap": {"value": 0.3, "unit": "mm", "rule": "Clear of the motor plate"},
|
|
14
|
+
"module": {"value": 1, "unit": "mm", "rule": "The gears'"},
|
|
15
|
+
"teeth": {"value": 18, "rule": "As the planets' first step"},
|
|
16
|
+
"width": {"value": 8, "unit": "mm", "rule": "The first stage"},
|
|
17
|
+
"hub": {"value": 12, "unit": "mm", "rule": "A hub above the teeth, inside the planets' second step"},
|
|
18
|
+
"tall": {"value": 16, "unit": "mm", "rule": "Up through both stages, so 12 mm of the shaft's flat is gripped"},
|
|
19
|
+
"tip": {"value": 18.7, "unit": "mm", "rule": "Where the shaft's 24 mm tip is from the sun's underside, 5.3 mm above the mounting face (the elbow's plate is thicker: its sun sets this less)", "interface": true, "tweak": {"min": 10, "max": 24}},
|
|
20
|
+
"segments": {"value": 64, "rule": "Round enough"}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// The thigh, drawn as it prints: its outer face on the bed, the knee's ring standing on it, the hub's socket opening
|
|
2
|
+
// upward. The knee's NEMA 14 bolts on the bed side, its shaft up through the plate, as the arm's elbow does.
|
|
3
|
+
import jscad from '@jscad/modeling'
|
|
4
|
+
const { cylinder, cylinderElliptic, cuboid, circle } = jscad.primitives
|
|
5
|
+
const { translate, rotateZ } = jscad.transforms
|
|
6
|
+
const { extrudeLinear } = jscad.extrusions
|
|
7
|
+
const { hull } = jscad.hulls
|
|
8
|
+
|
|
9
|
+
export function main (v) {
|
|
10
|
+
const motor = v.motors.motorModel('nema14')
|
|
11
|
+
const at = (r, a) => [v.long + r * Math.cos(a), r * Math.sin(a)]
|
|
12
|
+
const posts = [v.p1, v.p2, v.p3].map((a) => a * v.rad)
|
|
13
|
+
const round = (r, c) => translate([c, 0], circle({ radius: r, segments: v.segments }))
|
|
14
|
+
const neck = extrudeLinear({ height: v.thick }, hull(round(v.hub / 2, 0), round(v.neck / 2, v.long)))
|
|
15
|
+
const hub = cylinder({ radius: v.hub / 2, height: v.thick, center: [0, 0, v.thick / 2], segments: v.ring_segments })
|
|
16
|
+
const plate = cylinder({ radius: v.rim / 2, height: v.thick, center: [v.long, 0, v.thick / 2], segments: v.ring_segments })
|
|
17
|
+
const ring = translate([v.long, 0, v.thick], v.gears.internal({ module: v.module, teeth: v.teeth, width: v.gear, rim: v.rim }))
|
|
18
|
+
const lobes = posts.map((a) => cylinder({ radius: v.lobe / 2, height: v.thick, center: [...at(v.post_r, a), v.thick / 2], segments: v.segments }))
|
|
19
|
+
const joins = posts.map((a) => translate([v.long, 0, 0], rotateZ(a, cuboid({ size: [v.post_r - v.rim / 2 + 2, v.lobe, v.thick], center: [(v.post_r + v.rim / 2 - 2) / 2, 0, v.thick / 2] }))))
|
|
20
|
+
const uprights = posts.map((a) => cylinder({ radius: v.post / 2, height: v.clip_at, center: [...at(v.post_r, a), v.clip_at / 2], segments: v.segments }))
|
|
21
|
+
const pilots = posts.map((a) => cylinder({ radius: v.pilot / 2, height: v.pilot_depth, center: [...at(v.post_r, a), v.clip_at - v.pilot_depth / 2], segments: v.segments }))
|
|
22
|
+
const collar = cylinder({ radius: v.collar_d / 2, height: v.collar + 1, center: [0, 0, v.thick + (v.collar - 1) / 2], segments: v.segments })
|
|
23
|
+
const socket = cylinder({ radius: (v.hex + v.hex_fit) / 2 / v.cos30, height: v.hex_depth + 1, center: [0, 0, v.floor + (v.hex_depth + 1) / 2], segments: v.hex_segments })
|
|
24
|
+
const through = cylinder({ radius: v.screw / 2, height: v.floor + 1, center: [0, 0, (v.floor - 1) / 2], segments: v.segments })
|
|
25
|
+
const hole = v.motors.mountModel(motor, { plate: v.thick, counterbore: true }), rise = v.thick - hole.pocketDepth
|
|
26
|
+
const roof = translate([v.long, 0, 0], cylinderElliptic({ height: rise + 1, startRadius: [hole.pocket / 2, hole.pocket / 2], endRadius: [hole.pocket / 2 - rise - 1, hole.pocket / 2 - rise - 1], center: [0, 0, hole.pocketDepth + (rise + 1) / 2], segments: v.segments }))
|
|
27
|
+
const mount = translate([v.long, 0, 0], v.motors.mount(motor, { plate: v.thick, counterbore: true }, v.ops))
|
|
28
|
+
return v.ops.subtract(v.ops.union(neck, hub, plate, ring, lobes, joins, uprights, collar), socket, through, pilots, mount, roof)
|
|
29
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
|
|
3
|
+
"name": "thigh",
|
|
4
|
+
"title": "Thigh",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"uses": ["x1c", "leg", "m3"],
|
|
7
|
+
"engine": "manifold",
|
|
8
|
+
"orientation": "The thigh's outer face on the bed: the hub, the knee's fixed ring and its posts all rise from the one flat face",
|
|
9
|
+
"description": "From the hip's hexagon to the knee's motor. The drawing arm's upper arm, shorter and without its home switch or bands: printed as one part with the knee's fixed ring, so the knee's gearbox costs a sun, three planets and an output ring.",
|
|
10
|
+
"anchors": {
|
|
11
|
+
"hub": {"at": [0, 0, "thick + collar"], "axis": [0, 0, -1], "ref": [1, 0, 0]},
|
|
12
|
+
"knee": {"at": ["long", 0, "thick"], "axis": [0, 0, 1], "ref": [1, 0, 0]},
|
|
13
|
+
"output": {"at": ["long", 0, "thick + gear + arm_gap"], "axis": [0, 0, 1], "ref": [1, 0, 0]},
|
|
14
|
+
"motor": {"at": ["long", 0, 0], "axis": [0, 0, 1], "ref": [1, 0, 0]},
|
|
15
|
+
"clip1": {"at": ["long + post_r * cosd(p1)", "post_r * sind(p1)", "clip_at"], "axis": [0, 0, 1], "ref": ["cosd(p1)", "sind(p1)", 0]},
|
|
16
|
+
"clip2": {"at": ["long + post_r * cosd(p2)", "post_r * sind(p2)", "clip_at"], "axis": [0, 0, 1], "ref": ["cosd(p2)", "sind(p2)", 0]},
|
|
17
|
+
"clip3": {"at": ["long + post_r * cosd(p3)", "post_r * sind(p3)", "clip_at"], "axis": [0, 0, 1], "ref": ["cosd(p3)", "sind(p3)", 0]},
|
|
18
|
+
"cable": {"at": ["long / 2", 0, 0], "axis": [0, 0, 1]}
|
|
19
|
+
},
|
|
20
|
+
"variables": {
|
|
21
|
+
"long": {"value": "leg.thigh", "unit": "mm", "rule": "Hip to knee", "label": "Thigh", "show": true, "interface": true},
|
|
22
|
+
"neck": {"value": 22, "unit": "mm", "rule": "The thigh's width at the knee: its bending under the stance load is in the chapter"},
|
|
23
|
+
"hub": {"value": 36, "unit": "mm", "rule": "Round the hexagon socket"},
|
|
24
|
+
"collar": {"value": "leg.arm_gap", "unit": "mm", "rule": "A collar on the thigh's underside, on the bearing's inner race, so the outer race doesn't drag"},
|
|
25
|
+
"collar_d": {"value": 13.5, "unit": "mm", "rule": "On the inner race, clear of the outer"},
|
|
26
|
+
"hex": {"value": 8, "unit": "mm", "rule": "The spindle's hexagon"},
|
|
27
|
+
"hex_depth": {"value": "thick + collar - floor", "unit": "mm", "rule": "The socket's depth"},
|
|
28
|
+
"floor": {"value": 3, "unit": "mm", "rule": "What the screw pulls against: a socket's floor"},
|
|
29
|
+
"hex_fit": {"value": "x1c.fit + x1c.hole_comp", "unit": "mm", "rule": "Across the socket's flats, over the spindle's, printed"},
|
|
30
|
+
"screw": {"value": "m3.clearance + x1c.hole_comp", "unit": "mm", "rule": "M3 clearance"},
|
|
31
|
+
"gear": {"value": "leg.gear", "unit": "mm", "rule": "The fixed ring's face"},
|
|
32
|
+
"arm_gap": {"value": "leg.ring_gap", "unit": "mm", "rule": "Between the fixed ring and the output ring"},
|
|
33
|
+
"rim": {"value": 62, "unit": "mm", "rule": "Round the 54-tooth ring"},
|
|
34
|
+
"module": {"value": 1, "unit": "mm", "rule": "The gears'"},
|
|
35
|
+
"teeth": {"value": 54, "rule": "The fixed ring"},
|
|
36
|
+
"post_r": {"value": 37, "unit": "mm", "rule": "Three posts outside the output ring"},
|
|
37
|
+
"post": {"value": 7, "unit": "mm", "rule": "Each post's diameter"},
|
|
38
|
+
"lobe": {"value": 12, "unit": "mm", "rule": "The plate reaches out to each post"},
|
|
39
|
+
"p1": {"value": 30, "unit": "°", "rule": "First post"},
|
|
40
|
+
"p2": {"value": 150, "unit": "°", "rule": "Second post"},
|
|
41
|
+
"p3": {"value": 270, "unit": "°", "rule": "Third post"},
|
|
42
|
+
"rad": {"value": 0.017453293, "rule": "Radians in a degree"},
|
|
43
|
+
"clip_at": {"value": "thick + gear + arm_gap + gear + leg.flange + clip_gap", "unit": "mm", "rule": "Each post's tip, where its clip goes on, just past the output's flange"},
|
|
44
|
+
"clip_gap": {"value": 0.3, "unit": "mm", "rule": "The output turns under the clips with this to spare"},
|
|
45
|
+
"pilot": {"value": 2.9, "unit": "mm", "rule": "An M3 screw self-tapped into a post", "kind": "community"},
|
|
46
|
+
"pilot_depth": {"value": 8, "unit": "mm", "rule": "For an M3 × 10 through a clip"},
|
|
47
|
+
"segments": {"value": 64, "rule": "Round enough"},
|
|
48
|
+
"ring_segments": {"value": 96, "rule": "The rim's circle"},
|
|
49
|
+
"hex_segments": {"value": 6, "rule": "A hexagon's sides"},
|
|
50
|
+
"cos30": {"value": "cosd(30)", "rule": "A hexagon, across corners to across flats"},
|
|
51
|
+
"thick": {"value": "leg.arm", "unit": "mm", "rule": "The thigh's thickness, and the knee motor's plate: 16 lines of 0.42 and 40 layers"}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// A flat bar with a hole at each end, pressed down over the tops of the rods.
|
|
2
|
+
import jscad from '@jscad/modeling'
|
|
3
|
+
const { cylinder, roundedRectangle } = jscad.primitives
|
|
4
|
+
const { extrudeLinear } = jscad.extrusions
|
|
5
|
+
|
|
6
|
+
export function main (v) {
|
|
7
|
+
const bar = extrudeLinear({ height: v.thick }, roundedRectangle({ size: [v.long, v.width], roundRadius: v.corner, segments: v.segments }))
|
|
8
|
+
const holes = [-1, 1].map((s) => cylinder({ radius: v.socket / 2, height: v.thick + 1, center: [s * v.rod_x, 0, v.thick / 2], segments: v.segments }))
|
|
9
|
+
return v.ops.subtract(bar, holes)
|
|
10
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
|
|
3
|
+
"name": "tie",
|
|
4
|
+
"title": "Stand top tie",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"uses": ["x1c", "leg"],
|
|
7
|
+
"engine": "manifold",
|
|
8
|
+
"orientation": "Flat on the bed, the rods up through it",
|
|
9
|
+
"description": "A bar across the tops of the two rods, so they cannot lean apart.",
|
|
10
|
+
"variables": {
|
|
11
|
+
"long": {"value": "leg.rod_x * 2 + width * 2", "unit": "mm", "rule": "From rod to rod, and a width past each"},
|
|
12
|
+
"width": {"value": 20, "unit": "mm", "rule": "Across the bar"},
|
|
13
|
+
"thick": {"value": 8, "unit": "mm", "rule": "Thick enough not to flex"},
|
|
14
|
+
"socket": {"value": "leg.rod_d + x1c.hole_comp", "unit": "mm", "rule": "The rod, pressed through"},
|
|
15
|
+
"rod_x": {"value": "leg.rod_x", "unit": "mm", "rule": "Each rod"},
|
|
16
|
+
"corner": {"value": 5, "unit": "mm", "rule": "The bar's corners"},
|
|
17
|
+
"segments": {"value": 48, "rule": "Round enough"}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "leg",
|
|
3
|
+
"description": "A leg from the arm's parts, on a stand that reads its stance on a scale. EXAMPLES chapter 14 explains it.",
|
|
4
|
+
"material": "PLA",
|
|
5
|
+
"objects": [
|
|
6
|
+
"carriage",
|
|
7
|
+
"foot",
|
|
8
|
+
"tie",
|
|
9
|
+
"collar",
|
|
10
|
+
"housing",
|
|
11
|
+
"sun",
|
|
12
|
+
"planet",
|
|
13
|
+
"output",
|
|
14
|
+
"bridge",
|
|
15
|
+
"spindle",
|
|
16
|
+
"thigh",
|
|
17
|
+
"clip",
|
|
18
|
+
"shin",
|
|
19
|
+
"pad"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_doc": "A leg made from the drawing arm's parts: the stack of the same gearbox, with the arm's motor face as this leg's zero, what the leg is asked to stand up, and the stand it does that on. Examples chapter 14 explains each.",
|
|
3
|
+
"name": "leg",
|
|
4
|
+
"rules": {
|
|
5
|
+
"plate": {"value": 5, "unit": "mm", "rule": "The hip housing's plate: enough for M3 screws into a NEMA 17 (1.5 × their size)", "kind": "default", "source": "EXAMPLES chapter 11's housing", "checked": "2026-11-09"},
|
|
6
|
+
"gear": {"value": 8, "unit": "mm", "rule": "Each gear stage's face", "kind": "default", "source": "EXAMPLES chapter 11's gearbox", "checked": "2026-11-09"},
|
|
7
|
+
"ring_gap": {"value": 0.4, "unit": "mm", "rule": "Between the fixed ring and the output ring", "kind": "default", "source": "EXAMPLES chapter 11's gearbox", "checked": "2026-11-09"},
|
|
8
|
+
"flange": {"value": 5, "unit": "mm", "rule": "The output ring's flange: thick enough for four M3 screws to bite", "kind": "default", "source": "EXAMPLES chapter 12", "checked": "2026-11-09"},
|
|
9
|
+
"output_top": {"value": "plate + gear + ring_gap + gear + flange", "unit": "mm", "rule": "The top of the hip's output flange, from the motor's face", "kind": "default", "source": "The stack", "checked": "2026-11-09"},
|
|
10
|
+
"disc": {"value": 3, "unit": "mm", "rule": "The spindle's disc, on the flange", "kind": "default", "source": "EXAMPLES chapter 12", "checked": "2026-11-09"},
|
|
11
|
+
"bridge_gap": {"value": 0.6, "unit": "mm", "rule": "Between the spindle's disc and the bridge above it", "kind": "default", "source": "EXAMPLES chapter 12", "checked": "2026-11-09"},
|
|
12
|
+
"bridge": {"value": 7, "unit": "mm", "rule": "The bridge's thickness: the 5 mm bearing and a 2 mm ledge", "kind": "default", "source": "EXAMPLES chapter 12", "checked": "2026-11-09"},
|
|
13
|
+
"bridge_low": {"value": "output_top + disc + bridge_gap", "unit": "mm", "rule": "The bridge's underside, from the motor's face", "kind": "default", "source": "The stack", "checked": "2026-11-09"},
|
|
14
|
+
"arm_gap": {"value": 0.5, "unit": "mm", "rule": "Between the bridge's top and the thigh", "kind": "default", "source": "EXAMPLES chapter 12", "checked": "2026-11-09"},
|
|
15
|
+
"arm": {"value": 12, "unit": "mm", "rule": "The thigh's thickness, a plate over the knee too", "kind": "default", "source": "EXAMPLES chapter 12's upper arm", "checked": "2026-11-09"},
|
|
16
|
+
"bearing_bore": {"value": 10, "unit": "mm", "rule": "The 6800's bore", "kind": "spec", "source": "bearing-6800 in @rulecad/rules (NTN)", "checked": "2026-11-09"},
|
|
17
|
+
"bearing_outer": {"value": 19, "unit": "mm", "rule": "The 6800's outside diameter", "kind": "spec", "source": "bearing-6800", "checked": "2026-11-09"},
|
|
18
|
+
"bearing_width": {"value": 5, "unit": "mm", "rule": "The 6800's width", "kind": "spec", "source": "bearing-6800", "checked": "2026-11-09"},
|
|
19
|
+
"knee_flange": {"value": "bridge_low + bridge + arm_gap - gear - ring_gap - gear - flange", "unit": "mm", "rule": "The knee output flange's underside, where the shin bolts on: the thigh's underside less the knee's stack", "kind": "default", "source": "The stack", "checked": "2026-11-09"},
|
|
20
|
+
"boss": {"value": 11.5, "unit": "mm", "rule": "The shin's boss, so its bar passes under the knee's clips", "kind": "default", "source": "EXAMPLES chapter 12's forearm", "checked": "2026-11-09"},
|
|
21
|
+
"thigh": {"value": 100, "unit": "mm", "rule": "Hip to knee: past the 43 mm radius of each gearbox's posts, plus room to swing past one another", "kind": "default", "source": "EXAMPLES chapter 14", "checked": "2026-11-09"},
|
|
22
|
+
"shin": {"value": 100, "unit": "mm", "rule": "Knee to the middle of the foot: as long as the thigh, the longest stride for the height", "kind": "default", "source": "EXAMPLES chapter 14", "checked": "2026-11-09"},
|
|
23
|
+
"foot_r": {"value": 15, "unit": "mm", "rule": "The foot's round end, with its pad: rolls on the ground as the shin leans, so the gait's point stays over the contact", "kind": "default", "source": "EXAMPLES chapter 14", "checked": "2026-11-09"},
|
|
24
|
+
"stance": {"value": 170, "unit": "mm", "rule": "Hip to the foot's centre, standing: the knee bent about 32° each way, its lever on the foot small", "kind": "default", "source": "EXAMPLES chapter 14", "checked": "2026-11-09"},
|
|
25
|
+
"stride": {"value": 40, "unit": "mm", "rule": "The foot's travel in stance", "kind": "default", "source": "EXAMPLES chapter 14", "checked": "2026-11-09"},
|
|
26
|
+
"lift": {"value": 15, "unit": "mm", "rule": "The foot's lift in swing", "kind": "default", "source": "EXAMPLES chapter 14", "checked": "2026-11-09"},
|
|
27
|
+
"robot": {"value": 1.5, "unit": "kg", "rule": "The small robot the leg is sized for first; the quadruped built from these parts weighs more, and the chapter says how much", "kind": "default", "source": "EXAMPLES chapter 14", "checked": "2026-11-09"},
|
|
28
|
+
"share": {"value": "robot / 2", "unit": "kg", "rule": "Each leg's share in a trot, the most: two feet down at once", "kind": "default", "source": "Statics: the weight split over the two feet in stance", "checked": "2026-11-09"},
|
|
29
|
+
"scale_h": {"value": 25, "unit": "mm", "rule": "A kitchen scale's height: the foot's ground is its top. Yours differs", "kind": "estimate", "source": "A guess at a common 5 kg scale: measure yours", "checked": "2026-11-09"},
|
|
30
|
+
"stop_drop": {"value": 3, "unit": "mm", "rule": "How far the carriage drops onto its stops when the foot lifts: the foot pushes it up this much standing, so the scale carries the leg", "kind": "default", "source": "EXAMPLES chapter 14", "checked": "2026-11-09"},
|
|
31
|
+
"rod_x": {"value": 90, "unit": "mm", "rule": "Each rod's distance from the middle: a 130 mm scale fits between the feet", "kind": "default", "source": "EXAMPLES chapter 14", "checked": "2026-11-09"},
|
|
32
|
+
"rod_y": {"value": 17, "unit": "mm", "rule": "The rods behind the carriage's face", "kind": "default", "source": "EXAMPLES chapter 14", "checked": "2026-11-09"},
|
|
33
|
+
"rod_d": {"value": 8, "unit": "mm", "rule": "The rods' diameter", "kind": "community", "source": "rod-8 in @rulecad/rules", "checked": "2026-11-09"},
|
|
34
|
+
"rod_long": {"value": 300, "unit": "mm", "rule": "The rods, cut to this: bench to above the carriage's travel", "kind": "default", "source": "EXAMPLES chapter 14", "checked": "2026-11-09"},
|
|
35
|
+
"foot_block": {"value": 16, "unit": "mm", "rule": "The foot blocks' thickness: 12 mm of socket and a floor", "kind": "default", "source": "EXAMPLES chapter 14", "checked": "2026-11-09"},
|
|
36
|
+
"body_half": {"value": 75, "unit": "mm", "rule": "Hip to hip along the body, halved: the side plate, 242 mm long, fits on a 256 mm bed, and the knees point outward so they stay apart", "kind": "default", "source": "EXAMPLES chapter 14", "checked": "2026-11-09"},
|
|
37
|
+
"body_w": {"value": 50, "unit": "mm", "rule": "The body's half-width, to the hips' plates: two hip motors back to back fit inside", "kind": "default", "source": "EXAMPLES chapter 14", "checked": "2026-11-09"},
|
|
38
|
+
"side_t": {"value": 6, "unit": "mm", "rule": "The side plate's thickness", "kind": "default", "source": "EXAMPLES chapter 14", "checked": "2026-11-09"},
|
|
39
|
+
"robot_mass": {"value": 3.8, "unit": "kg", "rule": "The quadruped as drawn: 3.37 kg of prints, motors and bearings from cad list, and about 0.4 kg for its drivers, an Uno and shield, a battery and the wires, an estimate until built", "kind": "estimate", "source": "cad list leg/quadruped and a guess at the electronics", "checked": "2026-11-09"},
|
|
40
|
+
"foot_socket": {"value": 12, "unit": "mm", "rule": "How far each rod goes into a foot block", "kind": "default", "source": "EXAMPLES chapter 14", "checked": "2026-11-09"}
|
|
41
|
+
}
|
|
42
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-rulecad",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.14",
|
|
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": {
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"index.mjs",
|
|
11
11
|
"template",
|
|
12
|
+
"machines",
|
|
12
13
|
"README.md",
|
|
13
14
|
"LICENSE"
|
|
14
15
|
],
|
|
@@ -27,5 +28,9 @@
|
|
|
27
28
|
"type": "git",
|
|
28
29
|
"url": "git+https://github.com/JoniBach/rulecad.git",
|
|
29
30
|
"directory": "packages/create-rulecad"
|
|
31
|
+
},
|
|
32
|
+
"homepage": "https://github.com/JoniBach/rulecad/tree/main/packages/create-rulecad#readme",
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/JoniBach/rulecad/issues"
|
|
30
35
|
}
|
|
31
36
|
}
|
package/template/AGENTS.md
CHANGED
|
@@ -30,7 +30,7 @@ variable says which rule it comes from. Follow these steps; they're what makes a
|
|
|
30
30
|
1. `npx cad history <project>/<object>` first: read the print log. A failed print is the reason for most changes:
|
|
31
31
|
fix the rule or variable it points at (a measured fit beats a community rule).
|
|
32
32
|
2. Change, then check, preview and look, as for a new part. Change values with `npx cad set <project>/<object>
|
|
33
|
-
name=value` and assemblies with `npx cad add fit|joint|item|pose …`: they keep the file's layout and refuse an edit
|
|
33
|
+
name=value` and assemblies with `npx cad add fit|joint|item|pose|fasten …`: they keep the file's layout and refuse an edit
|
|
34
34
|
that breaks it. `npx cad values` lists an object's numbers; `npx cad why <project>/<object>.<name>` shows what a
|
|
35
35
|
value depends on, down to the rules (estimates marked). `--json` on check, values and why gives data to act on:
|
|
36
36
|
each finding has a code, its numbers and where it is.
|
|
@@ -43,15 +43,23 @@ variable says which rule it comes from. Follow these steps; they're what makes a
|
|
|
43
43
|
- Walls are whole numbers of print lines (`x1c.line * 3`, or your printer's set), heights whole numbers of layers.
|
|
44
44
|
- Holes and slots get the printer's hole compensation; parts that slide together get its fit clearance. Chamfer
|
|
45
45
|
bottom edges.
|
|
46
|
+
- A hole or a seat for a screw, a nut or a heat-set insert comes from `v.fixings`, named by its thread, never from a
|
|
47
|
+
typed number: `v.fixings.hole('M3', { kind: 'pilot', at })` (kinds: `clearance`, `close`, `loose`, `pilot`, `tap`,
|
|
48
|
+
`insert`, `thread`), `counterbore`, `countersink`, `nutPocket`, `nutTrap`, `squareNutSlot`, `insertBoss`. Each reads
|
|
49
|
+
the workspace's thread set (`rules/m3.json` before the kit's), the project's printer and its material, so no
|
|
50
|
+
diameter is typed and none is passed in. `cad check` then says what each was drawn to and the rule it rests on:
|
|
51
|
+
report a figure it marks as an estimate or a community figure, and measure it. A thread's name is text
|
|
52
|
+
(`'M3x12 cap'`), so the check on numbers passes it.
|
|
46
53
|
- An overhang warning means supports: say so in `orientation`, or change the shape or orientation.
|
|
47
54
|
- A part that moves by bending (a spring, a snap, a hinge with no pin) is a flexure from `v.flexures`: drawn flat, so it
|
|
48
55
|
bends within its layers; give its thickness in whole lines (`x1c.line`), and check its strain at the travel against
|
|
49
56
|
the material's limit with `v.flexures.printable`. PLA creeps held bent and fatigues; PETG or nylon for springs.
|
|
50
|
-
- Use the print-aware features in `v.shapes` before drawing your own: `
|
|
51
|
-
`
|
|
57
|
+
- Use the print-aware features in `v.shapes` before drawing your own: `teardropHole`, `crushRibs`, `wallOpening`
|
|
58
|
+
print without supports as drawn (and `countersink` and `nutPocket` for a size that is no screw's). Use `v.ops.union/subtract/intersect` for booleans: the
|
|
52
59
|
workspace can switch them to Manifold (faster, watertight) without touching the design.
|
|
53
|
-
- Designs run sandboxed: they may import only `@jscad/modeling`, `@rulecad/shapes`, `@rulecad/flexures
|
|
54
|
-
their project, and can't write files or start
|
|
60
|
+
- Designs run sandboxed: they may import only `@jscad/modeling`, `@rulecad/shapes`, `@rulecad/flexures`,
|
|
61
|
+
`@rulecad/gears`, `@rulecad/motors`, `@rulecad/fixings` and files in their project, and can't write files or start
|
|
62
|
+
programs. To see a value while designing, `console.log` it: it comes
|
|
55
63
|
out with the command's output. A misspelt `v.name` stops the build and says which name was meant.
|
|
56
64
|
- Something printed under the part and removed afterwards is a named `support` part (`return { cap, pillar }`, both
|
|
57
65
|
described in the .json's `parts`), not part of the shape. Look at `cad preview --explode` too.
|
|
@@ -73,7 +81,13 @@ variable says which rule it comes from. Follow these steps; they're what makes a
|
|
|
73
81
|
them with joints, name the positions in `poses`, and run `cad check --sweep` to find where parts collide on the way.
|
|
74
82
|
See "Joints and poses" in the cad README.
|
|
75
83
|
- A part is named in fits as `<item>.<part>`; an object that returns one unnamed shape has one part, `body`.
|
|
76
|
-
-
|
|
84
|
+
- Where parts screw together, say so with `fasten`, which knows the screw:
|
|
85
|
+
`{ "screw": "M3 cap", "through": ["bracket"], "into": "base", "at": ["bracket.h1", "bracket.h2"] }` (anchors on the
|
|
86
|
+
holes' axes), or `"holes": "bracket.body"` to use the part's own holes; `npx cad add fasten …` writes it. The check
|
|
87
|
+
reads the holes from the parts as drawn: one axis through the stack, a clearance hole in each part passed, a pilot,
|
|
88
|
+
insert or nut at the far end, the length chosen from what is sold, thread engaged, and the seat under the head.
|
|
89
|
+
Report what it finds with its numbers, and fix the part, never the relation, to make it pass.
|
|
90
|
+
- A gap fit can't tell whether holes line up. Where a board only rests on its screws' bosses, a holes fit follows them
|
|
77
91
|
(`{ "holes": "pcb.board", "into": "case.body", "depth": "m2.insert_length" }`).
|
|
78
92
|
- A part built around another (a case around its board) reads it: `"uses": ["macropad/pcb"]`, then
|
|
79
93
|
`pcb.board_w` and `v.pcb.board_holes`. Never copy another object's numbers by hand.
|
|
@@ -107,6 +121,27 @@ variable says which rule it comes from. Follow these steps; they're what makes a
|
|
|
107
121
|
design aid and the material values are data-sheet figures: such a part needs testing, recorded under
|
|
108
122
|
`"verification"`, not just a check.
|
|
109
123
|
|
|
124
|
+
## Machines
|
|
125
|
+
A machine is an assembly with a `task` at the top: the tool, the sheet or volume it works in, how fast and how accurately.
|
|
126
|
+
EXAMPLES chapter 12 builds one from start to finish.
|
|
127
|
+
- **Task first.** Write the `task` before any part: what the tool must reach, at what speed, to what accuracy. The checks
|
|
128
|
+
(`task.reach`, `task.speed`, `task.accuracy`) report margins against it, in every pose and across the sheet.
|
|
129
|
+
- **Reach before shape.** Find the link lengths from the far and near corners of the work, keeping away from full stretch
|
|
130
|
+
(the speed check finds that) and from the fold (the hole near the base). Write down why; the parts come after.
|
|
131
|
+
- **Bench before trusting a budget.** The error budget stacks what each joint adds. A gearbox's play and twist are
|
|
132
|
+
guesses until bench tests 14, 15 and 17 have measured them: give them as rules of `"kind": "estimate"`, read the
|
|
133
|
+
sentence that says what the figure rests on, and use `npx cad measured` to replace them. A passing budget on estimates
|
|
134
|
+
is a target, not a prediction. Report it that way.
|
|
135
|
+
- **Never set a driver's current from memory.** Give the motor item a `driver` and a `current`, and take the trimmer's
|
|
136
|
+
voltage from what `cad check` says for that board and its sense resistors; read the resistors on your own board first.
|
|
137
|
+
State why the current is what it is: the torque it needs, the driver's rating without a heat sink, the motor's heat.
|
|
138
|
+
- **Everything bought is an item.** Motors, drivers, bearings, switches, the supply: `bought` items and `wires` make the
|
|
139
|
+
shopping list (`cad list`), the wiring sheet (`cad wires`) and the firmware's settings (`cad machine`) from one assembly.
|
|
140
|
+
- Before moving anything: `cad plot` the drawing and watch the preview. It refuses a stroke that leaves the sheet.
|
|
141
|
+
- **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.
|
|
142
|
+
- **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.
|
|
143
|
+
- Start a machine from a template rather than from an empty assembly: `npm create rulecad my-arm --machine arm --sheet a5 --accuracy 0.3`, or `--machine leg`.
|
|
144
|
+
|
|
110
145
|
## Talking to the person
|
|
111
146
|
- Give links as one labelled line (`npx cad link <project>/<object> --md`), never a raw URL. If it says
|
|
112
147
|
"(not a release)", say so. If it says the link is too long for chat, don't paste it: tell the person, and offer
|