create-rulecad 0.3.15 → 0.3.17

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.
Files changed (54) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/README.md +5 -2
  3. package/index.mjs +3 -2
  4. package/machines/arm/projects/arm/assemblies/arm.json +18 -4
  5. package/machines/arm/projects/arm/objects/base.js +6 -4
  6. package/machines/arm/projects/arm/objects/base.json +5 -6
  7. package/machines/arm/projects/arm/objects/bridge.js +4 -2
  8. package/machines/arm/projects/arm/objects/bridge.json +5 -4
  9. package/machines/arm/projects/arm/objects/clip.js +3 -1
  10. package/machines/arm/projects/arm/objects/clip.json +1 -2
  11. package/machines/arm/projects/arm/objects/forearm.js +10 -5
  12. package/machines/arm/projects/arm/objects/forearm.json +8 -4
  13. package/machines/arm/projects/arm/objects/holder.js +5 -2
  14. package/machines/arm/projects/arm/objects/holder.json +2 -3
  15. package/machines/arm/projects/arm/objects/housing.js +6 -3
  16. package/machines/arm/projects/arm/objects/housing.json +6 -6
  17. package/machines/arm/projects/arm/objects/output.js +3 -1
  18. package/machines/arm/projects/arm/objects/output.json +1 -2
  19. package/machines/arm/projects/arm/objects/spindle.js +5 -2
  20. package/machines/arm/projects/arm/objects/spindle.json +8 -7
  21. package/machines/arm/projects/arm/objects/upper.js +6 -3
  22. package/machines/arm/projects/arm/objects/upper.json +5 -6
  23. package/machines/arm/rules/arm.json +3 -3
  24. package/machines/leg/projects/leg/assemblies/stand.json +12 -2
  25. package/machines/leg/projects/leg/objects/bridge.js +4 -2
  26. package/machines/leg/projects/leg/objects/bridge.json +5 -4
  27. package/machines/leg/projects/leg/objects/carriage.js +3 -1
  28. package/machines/leg/projects/leg/objects/carriage.json +2 -3
  29. package/machines/leg/projects/leg/objects/clip.js +3 -1
  30. package/machines/leg/projects/leg/objects/clip.json +1 -2
  31. package/machines/leg/projects/leg/objects/collar.js +3 -1
  32. package/machines/leg/projects/leg/objects/collar.json +1 -2
  33. package/machines/leg/projects/leg/objects/foot.js +3 -1
  34. package/machines/leg/projects/leg/objects/foot.json +1 -2
  35. package/machines/leg/projects/leg/objects/housing.js +6 -3
  36. package/machines/leg/projects/leg/objects/housing.json +6 -6
  37. package/machines/leg/projects/leg/objects/output.js +3 -1
  38. package/machines/leg/projects/leg/objects/output.json +1 -2
  39. package/machines/leg/projects/leg/objects/shin.js +4 -2
  40. package/machines/leg/projects/leg/objects/shin.json +6 -4
  41. package/machines/leg/projects/leg/objects/spindle.js +5 -2
  42. package/machines/leg/projects/leg/objects/spindle.json +8 -7
  43. package/machines/leg/projects/leg/objects/thigh.js +5 -2
  44. package/machines/leg/projects/leg/objects/thigh.json +2 -4
  45. package/machines/leg/rules/leg.json +2 -2
  46. package/package.json +2 -1
  47. package/template/AGENTS.md +73 -7
  48. package/template/README.md +14 -0
  49. package/template/projects/home/assemblies/lidded-box.json +18 -0
  50. package/template/projects/home/objects/box.js +20 -0
  51. package/template/projects/home/objects/box.json +61 -0
  52. package/template/projects/home/objects/lid.js +11 -0
  53. package/template/projects/home/objects/lid.json +21 -0
  54. package/template/projects/home/project.json +1 -1
@@ -1,5 +1,7 @@
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
2
  // upward. The elbow's NEMA 14 bolts on the bed side, its shaft up through the plate, as chapter 11's housing does.
3
+ // The screws' holes are v.fixings': an M3 clearance hole through the socket's floor for the screw into the spindle,
4
+ // an M3 pilot in each post for its clip, and the elbow switch's M2 pilots.
3
5
  import jscad from '@jscad/modeling'
4
6
  const { cylinder, cylinderElliptic, cuboid, circle } = jscad.primitives
5
7
  const { translate, rotateZ } = jscad.transforms
@@ -7,6 +9,7 @@ const { extrudeLinear } = jscad.extrusions
7
9
  const { hull } = jscad.hulls
8
10
 
9
11
  export function main (v) {
12
+ const screw = v.fixings.holeModel('M3').diameter, pilot = v.fixings.holeModel('M3', { kind: 'pilot' }).diameter, switchPilot = v.fixings.holeModel('M2', { kind: 'pilot' }).diameter
10
13
  const motor = v.motors.motorModel('nema14')
11
14
  const at = (r, a) => [v.long + r * Math.cos(a), r * Math.sin(a)]
12
15
  const posts = [v.p1, v.p2, v.p3].map((a) => a * v.rad)
@@ -18,14 +21,14 @@ export function main (v) {
18
21
  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
22
  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
23
  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 }))
24
+ const pilots = posts.map((a) => cylinder({ radius: pilot / 2, height: v.pilot_depth, center: [...at(v.post_r, a), v.clip_at - v.pilot_depth / 2], segments: v.segments }))
22
25
  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
26
  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 })
27
+ const through = cylinder({ radius: screw / 2, height: v.floor + 1, center: [0, 0, (v.floor - 1) / 2], segments: v.segments })
25
28
  const flag = cuboid({ size: [v.flag_wide, v.flag_thick, v.flag_h], center: [v.flag_r, 0, v.thick + v.flag_h / 2] })
26
29
  const a = v.switch_a * v.rad
27
30
  const switchPost = translate([v.switch_x, v.switch_y, 0], rotateZ(a, cuboid({ size: [v.post_w, v.post_d, v.thick + v.switch_high], center: [0, 0, (v.thick + v.switch_high) / 2] })))
28
- const switchPilots = [-1, 1].map((s) => cylinder({ radius: v.switch_pilot / 2, height: v.switch_depth, center: [v.switch_x + s * v.switch_pitch / 2 * Math.cos(a), v.switch_y + s * v.switch_pitch / 2 * Math.sin(a), v.thick + v.switch_high - v.switch_depth / 2], segments: v.segments }))
31
+ const switchPilots = [-1, 1].map((s) => cylinder({ radius: switchPilot / 2, height: v.switch_depth, center: [v.switch_x + s * v.switch_pitch / 2 * Math.cos(a), v.switch_y + s * v.switch_pitch / 2 * Math.sin(a), v.thick + v.switch_high - v.switch_depth / 2], segments: v.segments }))
29
32
  const bands = [v.bias_1, v.bias_2].map((x) => cylinder({ radius: v.bias_d / 2, height: v.thick + 1, center: [x, 0, v.thick / 2], segments: v.segments }))
30
33
  const hole = v.motors.mountModel(motor, { plate: v.thick, counterbore: true }), rise = v.thick - hole.pocketDepth
31
34
  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 }))
@@ -3,11 +3,13 @@
3
3
  "name": "upper",
4
4
  "title": "Upper arm",
5
5
  "version": "0.1.0",
6
- "uses": ["x1c", "arm", "m2", "m3"],
6
+ "uses": ["x1c", "arm"],
7
7
  "engine": "manifold",
8
8
  "orientation": "The arm's top face on the bed: the hub, the elbow's fixed ring and its posts all rise from the one flat face, and go on hanging down",
9
9
  "description": "From the shoulder's hexagon to the elbow's motor. Printed as one part with the elbow's fixed ring, so the elbow's gearbox costs a sun, three planets and an output ring.",
10
10
  "anchors": {
11
+ "sw1": {"at": ["switch_x - switch_pitch / 2 * cosd(switch_a)", "switch_y - switch_pitch / 2 * sind(switch_a)", "thick + switch_high"], "axis": [0, 0, 1]},
12
+ "sw2": {"at": ["switch_x + switch_pitch / 2 * cosd(switch_a)", "switch_y + switch_pitch / 2 * sind(switch_a)", "thick + switch_high"], "axis": [0, 0, 1]},
11
13
  "hub": {"at": [0, 0, "thick + collar"], "axis": [0, 0, -1], "ref": [1, 0, 0]},
12
14
  "elbow": {"at": ["long", 0, "thick"], "axis": [0, 0, 1], "ref": [1, 0, 0]},
13
15
  "output": {"at": ["long", 0, "thick + gear + arm_gap"], "axis": [0, 0, 1], "ref": [1, 0, 0]},
@@ -29,7 +31,6 @@
29
31
  "hex_depth": {"value": "thick + collar - floor", "unit": "mm", "rule": "The socket's depth"},
30
32
  "floor": {"value": 3, "unit": "mm", "rule": "What the screw pulls against: a socket's floor"},
31
33
  "hex_fit": {"value": "x1c.fit + x1c.hole_comp", "unit": "mm", "rule": "Across the socket's flats, over the spindle's, printed"},
32
- "screw": {"value": "m3.clearance + x1c.hole_comp", "unit": "mm", "rule": "M3 clearance"},
33
34
  "gear": {"value": "arm.gear", "unit": "mm", "rule": "The fixed ring's face"},
34
35
  "arm_gap": {"value": "arm.ring_gap", "unit": "mm", "rule": "Between the fixed ring and the output ring"},
35
36
  "rim": {"value": 62, "unit": "mm", "rule": "Round the 54-tooth ring"},
@@ -44,8 +45,7 @@
44
45
  "rad": {"value": 0.017453293, "rule": "Radians in a degree"},
45
46
  "clip_at": {"value": "thick + gear + arm_gap + gear + arm.flange + clip_gap", "unit": "mm", "rule": "Each post's tip, where its clip goes on, just past the output's flange"},
46
47
  "clip_gap": {"value": 0.3, "unit": "mm", "rule": "The output turns under the clips with this to spare"},
47
- "pilot": {"value": 2.9, "unit": "mm", "rule": "An M3 screw self-tapped into a post", "kind": "community"},
48
- "pilot_depth": {"value": 8, "unit": "mm", "rule": "For an M3 × 10 through a clip"},
48
+ "pilot_depth": {"value": 8, "unit": "mm", "rule": "Each post's pilot, deep enough for its clip's screw"},
49
49
  "flag_r": {"value": 50, "unit": "mm", "rule": "The home flag, as far from the shoulder as its switch"},
50
50
  "flag_h": {"value": 5.5, "unit": "mm", "rule": "Down from the arm's underside far enough to reach the switch's lever"},
51
51
  "flag_wide": {"value": 14, "unit": "mm", "rule": "Along the radius"},
@@ -58,8 +58,7 @@
58
58
  "post_w": {"value": 14, "unit": "mm", "rule": "Elbow switch post, along the radius"},
59
59
  "post_d": {"value": 12, "unit": "mm", "rule": "Elbow switch post, tangential"},
60
60
  "switch_pitch": {"value": "arm.switch_pitch", "unit": "mm", "rule": "The switch's screw spacing"},
61
- "switch_pilot": {"value": "m2.clearance - 0.6", "unit": "mm", "rule": "An M2 self-tapped", "kind": "community"},
62
- "switch_depth": {"value": 9, "unit": "mm", "rule": "Pilot depth for M2 × 8"},
61
+ "switch_depth": {"value": 9, "unit": "mm", "rule": "Each switch screw's pilot depth"},
63
62
  "segments": {"value": 64, "rule": "Round enough"},
64
63
  "ring_segments": {"value": 96, "rule": "The rim's circle"},
65
64
  "hex_segments": {"value": 6, "rule": "A hexagon's sides"},
@@ -19,10 +19,10 @@
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"},
21
21
  "face": {"value": "foot + room + motor17", "unit": "mm", "rule": "The shoulder motor's mounting face above the bench: the base's height", "kind": "default", "source": "The stack", "checked": "2026-11-09"},
22
- "plate": {"value": 5, "unit": "mm", "rule": "The shoulder housing's plate: enough for M3 screws into a NEMA 17 (1.5 × their size)", "kind": "default", "source": "Chapter 11's housing", "checked": "2026-11-09"},
22
+ "plate": {"value": 5, "unit": "mm", "rule": "The shoulder housing's plate: deep enough for the motor's four screws to bite, 1.5 times their thread", "kind": "default", "source": "Chapter 11's housing", "checked": "2026-11-09"},
23
23
  "gear": {"value": 8, "unit": "mm", "rule": "Each gear stage's face", "kind": "default", "source": "Chapter 11's gearbox", "checked": "2026-11-09"},
24
24
  "ring_gap": {"value": 0.4, "unit": "mm", "rule": "Between the fixed ring and the output ring", "kind": "default", "source": "Chapter 11's gearbox", "checked": "2026-11-09"},
25
- "flange": {"value": 5, "unit": "mm", "rule": "The output ring's flange: thick enough for four M3 screws to bite", "kind": "default", "source": "Design", "checked": "2026-11-09"},
25
+ "flange": {"value": 5, "unit": "mm", "rule": "The output ring's flange: thick enough for the spindle's four screws to bite", "kind": "default", "source": "Design", "checked": "2026-11-09"},
26
26
  "output_top": {"value": "face + plate + gear + ring_gap + gear + flange", "unit": "mm", "rule": "Top of the shoulder's output flange above the bench", "kind": "default", "source": "The stack", "checked": "2026-11-09"},
27
27
  "disc": {"value": 3, "unit": "mm", "rule": "The spindle's disc, on the flange", "kind": "default", "source": "Design", "checked": "2026-11-09"},
28
28
  "bridge_gap": {"value": 0.6, "unit": "mm", "rule": "Between the spindle's disc and the bridge above it", "kind": "default", "source": "Design", "checked": "2026-11-09"},
@@ -30,7 +30,7 @@
30
30
  "bridge_low": {"value": "output_top + disc + bridge_gap", "unit": "mm", "rule": "The bridge's underside above the bench", "kind": "default", "source": "The stack", "checked": "2026-11-09"},
31
31
  "arm_gap": {"value": 0.5, "unit": "mm", "rule": "Between the bridge's top and the upper arm's underside", "kind": "default", "source": "Design", "checked": "2026-11-09"},
32
32
  "arm": {"value": 12, "unit": "mm", "rule": "The upper arm's thickness, a plate over the elbow too: about 1.7 mm of sag under its load at 8 mm thick, 0.5 mm at 12", "kind": "default", "source": "The cantilever formula in EXAMPLES.md chapter 12", "checked": "2026-11-09"},
33
- "switch_pitch": {"value": 9.5, "unit": "mm", "rule": "Between the endstop's two screw holes", "kind": "estimate", "source": "endstop-10t85 in @rulecad/rules: the set has words among its figures, so an object can't read it through uses", "checked": "2026-11-09"},
33
+ "switch_pitch": {"value": 9.5, "unit": "mm", "rule": "Between the endstop's two mounting screws", "kind": "estimate", "source": "endstop-10t85 in @rulecad/rules: the set has words among its figures, so an object can't read it through uses", "checked": "2026-11-09"},
34
34
  "bearing_bore": {"value": 10, "unit": "mm", "rule": "The 6800's bore", "kind": "spec", "source": "bearing-6800 in @rulecad/rules (NTN)", "checked": "2026-11-09"},
35
35
  "bearing_outer": {"value": 19, "unit": "mm", "rule": "The 6800's outside diameter", "kind": "spec", "source": "bearing-6800", "checked": "2026-11-09"},
36
36
  "bearing_width": {"value": 5, "unit": "mm", "rule": "The 6800's width", "kind": "spec", "source": "bearing-6800", "checked": "2026-11-09"},
@@ -67,13 +67,23 @@
67
67
  { "sun": "sun", "carrier": "carrier", "ring": "housing", "planets": ["p1", "p2", "p3"], "drive": "sun", "module": 1, "teeth": [18, 18, 54], "output": { "ring": "output", "planet": 21, "teeth": 57 } },
68
68
  { "sun": "esun", "carrier": "ecarrier", "ring": "ering", "planets": ["ep1", "ep2", "ep3"], "drive": "sun", "module": 1, "teeth": [18, 18, 54], "output": { "ring": "eoutput", "planet": 21, "teeth": 57 } }
69
69
  ],
70
+ "fasten": [
71
+ {"screw": "M3 cap", "through": ["housing"], "into": "carriage", "at": ["housing.f1", "housing.f2", "housing.f3"], "note": "The housing on the carriage's face"},
72
+ {"screw": "M3 cap", "through": ["bridge"], "into": "housing", "at": ["bridge.s1", "bridge.s2", "bridge.s3"], "note": "The bridge on the housing's posts"},
73
+ {"screw": "M3 countersunk", "through": ["spindle"], "into": "output", "at": ["spindle.b1", "spindle.b2", "spindle.b3", "spindle.b4"], "note": "The spindle on the hip's output, its heads flush under the bridge"},
74
+ {"screw": "M3 cap", "through": ["thigh"], "into": "spindle", "at": ["thigh.hub"], "note": "The thigh clamped down on the spindle's hexagon"},
75
+ {"screw": "M3 cap", "through": ["clip1"], "into": "thigh", "at": ["clip1.post"], "note": "A clip on its post"},
76
+ {"screw": "M3 cap", "through": ["clip2"], "into": "thigh", "at": ["clip2.post"], "note": "A clip on its post"},
77
+ {"screw": "M3 cap", "through": ["clip3"], "into": "thigh", "at": ["clip3.post"], "note": "A clip on its post"},
78
+ {"screw": "M3 cap", "through": ["shin"], "into": "eoutput", "at": ["shin.b1", "shin.b2", "shin.b3", "shin.b4"], "note": "The shin on the knee's output"}
79
+ ],
70
80
  "fits": [
71
81
  { "a": "m1", "b": "housing", "fastens": true, "min": -0.1, "note": "The hip motor, on its four screws, its boss seated in the plate's pocket" },
72
82
  { "a": "m1", "b": "sun", "shaft": true, "note": "The shaft in the sun" },
73
83
  { "a": "m2", "b": "esun", "shaft": true, "note": "The knee motor's shaft in its sun" },
74
84
  { "a": "m2", "b": "thigh", "fastens": true, "min": -0.1, "note": "The knee motor, on its four screws" },
75
- { "a": "housing", "b": "carriage", "fastens": true, "min": 0, "note": "The housing, screwed to the carriage's face" },
76
- { "a": "bridge", "b": "housing", "fastens": true, "min": 0, "note": "The bridge, on the housing's posts" },
85
+ { "a": "housing", "b": "carriage", "min": 0, "note": "The housing, screwed to the carriage's face" },
86
+ { "a": "bridge", "b": "housing", "min": 0, "note": "The bridge, on the housing's posts" },
77
87
  { "a": "b1", "b": "bridge", "seat": "press", "note": "The 6800 in its seat" },
78
88
  { "a": "ecarrier", "b": "ering", "min": -1, "note": "Two specks: neither is printed" },
79
89
  { "a": "lm1", "b": "carriage", "fastens": true, "min": -0.5, "note": "The bushing, pressed in its pocket" },
@@ -1,15 +1,17 @@
1
1
  // A three-armed plate over the gearbox, the bearing's seat in the middle.
2
+ // Each post's screw: an M3 clearance hole and its cap head's counterbore, sunk a layer, both v.fixings'.
2
3
  import jscad from '@jscad/modeling'
3
4
  const { cylinder, cuboid } = jscad.primitives
4
5
  const { rotateZ } = jscad.transforms
5
6
 
6
7
  export function main (v) {
8
+ const screw = v.fixings.holeModel('M3').diameter, cb = v.fixings.counterboreModel('M3 cap'), head = cb.diameter, headDepth = cb.depth + v.sink
7
9
  const posts = [v.p1, v.p2, v.p3].map((a) => a * v.rad), at = (a) => [v.post_r * Math.cos(a), v.post_r * Math.sin(a)]
8
10
  const hub = cylinder({ radius: v.hub / 2, height: v.thick, center: [0, 0, v.thick / 2], segments: v.segments * 2 })
9
11
  const arms = posts.map((a) => rotateZ(a, cuboid({ size: [v.post_r, v.lobe, v.thick], center: [v.post_r / 2, 0, v.thick / 2] })))
10
12
  const lobes = posts.map((a) => cylinder({ radius: v.lobe / 2, height: v.thick, center: [...at(a), v.thick / 2], segments: v.segments }))
11
13
  const seat = v.shapes.bearingSeat({ bore: v.bore, outer_diameter: v.outer, width: v.width }, { fit: 'press', relief: v.relief, through: true, printer: v.x1c, at: [0, 0, v.thick], into: '-z', lead: 0 })
12
- const screws = posts.map((a) => cylinder({ radius: v.screw / 2, height: v.thick + 1, center: [...at(a), v.thick / 2], segments: v.segments }))
13
- const heads = posts.map((a) => cylinder({ radius: v.head / 2, height: v.head_depth + 1, center: [...at(a), v.thick - (v.head_depth - 1) / 2], segments: v.segments }))
14
+ const screws = posts.map((a) => cylinder({ radius: screw / 2, height: v.thick + 1, center: [...at(a), v.thick / 2], segments: v.segments }))
15
+ const heads = posts.map((a) => cylinder({ radius: head / 2, height: headDepth + 1, center: [...at(a), v.thick - (headDepth - 1) / 2], segments: v.segments }))
14
16
  return v.ops.subtract(v.ops.union(hub, arms, lobes), seat, screws, heads)
15
17
  }
@@ -3,11 +3,14 @@
3
3
  "name": "bridge",
4
4
  "title": "Bridge: the 6800's seat",
5
5
  "version": "0.1.0",
6
- "uses": ["x1c", "leg", "m3"],
6
+ "uses": ["x1c", "leg"],
7
7
  "engine": "manifold",
8
8
  "orientation": "Upside to the sky, as it goes on: the pocket opens upward and its ledge prints flat",
9
9
  "description": "Three arms across the housing's posts, holding the bearing that takes the output's tipping load.",
10
10
  "anchors": {
11
+ "s1": {"at": ["post_r * cosd(p1)", "post_r * sind(p1)", "thick"], "axis": [0, 0, 1]},
12
+ "s2": {"at": ["post_r * cosd(p2)", "post_r * sind(p2)", "thick"], "axis": [0, 0, 1]},
13
+ "s3": {"at": ["post_r * cosd(p3)", "post_r * sind(p3)", "thick"], "axis": [0, 0, 1]},
11
14
  "seat": {"at": [0, 0, "thick - width"], "axis": [0, 0, 1]},
12
15
  "under": {"at": [0, 0, 0], "axis": [0, 0, 1]}
13
16
  },
@@ -24,9 +27,7 @@
24
27
  "p2": {"value": 150, "unit": "°", "rule": "Second post"},
25
28
  "p3": {"value": 270, "unit": "°", "rule": "Third post"},
26
29
  "rad": {"value": 0.017453293, "rule": "Radians in a degree"},
27
- "screw": {"value": "m3.clearance + x1c.hole_comp", "unit": "mm", "rule": "M3 clearance"},
28
- "head": {"value": "m3.head + 2 * x1c.fit + x1c.hole_comp", "unit": "mm", "rule": "The screw head's counterbore"},
29
- "head_depth": {"value": "m3.head_height + x1c.layer", "unit": "mm", "rule": "A socket head's height, sunk, so the thigh passes over"},
30
+ "sink": {"value": "x1c.layer", "unit": "mm", "rule": "Each screw head sits a layer under the face, so the thigh passes over"},
30
31
  "segments": {"value": 64, "rule": "Round enough"}
31
32
  }
32
33
  }
@@ -1,14 +1,16 @@
1
1
  // A round hub for the hip, arms out to two bushing bosses, the hip's face down on the bed.
2
+ // The housing's three screws cut their thread in v.fixings' M3 pilots, through the plate.
2
3
  import jscad from '@jscad/modeling'
3
4
  const { cylinder, cuboid, roundedRectangle } = jscad.primitives
4
5
  const { extrudeLinear } = jscad.extrusions
5
6
 
6
7
  export function main (v) {
8
+ const pilot = v.fixings.holeModel('M3', { kind: 'pilot' }).diameter
7
9
  const arms = cuboid({ size: [v.half_w * 2, v.arm_w, v.plate], center: [0, 0, v.plate / 2] })
8
10
  const hub = cylinder({ radius: v.hub, height: v.plate, center: [0, 0, v.plate / 2], segments: v.segments * 2 })
9
11
  const bosses = [-1, 1].map((s) => cuboid({ size: [v.boss_x * 2, v.boss_long, v.boss_h], center: [s * v.rod_x, 0, v.boss_h / 2] }))
10
12
  const window = extrudeLinear({ height: v.plate + 1 }, roundedRectangle({ size: [v.cut, v.cut], roundRadius: v.corner, segments: v.segments }))
11
- const feet = [v.a1, v.a2, v.a3].map((a) => a * v.rad).map((a) => cylinder({ radius: v.pilot / 2, height: v.plate + 1, center: [v.feet_r * Math.cos(a), 0 - v.feet_r * Math.sin(a), v.plate / 2], segments: v.segments }))
13
+ const feet = [v.a1, v.a2, v.a3].map((a) => a * v.rad).map((a) => cylinder({ radius: pilot / 2, height: v.plate + 1, center: [v.feet_r * Math.cos(a), 0 - v.feet_r * Math.sin(a), v.plate / 2], segments: v.segments }))
12
14
  const pockets = [-1, 1].map((s) => v.shapes.lm8uuPocket(v.lm8uu, { printer: v.x1c, at: [s * v.rod_x, 0 - v.boss_long / 2, v.rod_y], into: '+y', through: true }))
13
15
  return v.ops.subtract(v.ops.union(arms, hub, bosses), window, feet, pockets)
14
16
  }
@@ -3,7 +3,7 @@
3
3
  "name": "carriage",
4
4
  "title": "Stand carriage: the leg's mount on two rods",
5
5
  "version": "0.1.0",
6
- "uses": ["x1c", "leg", "m3", "lm8uu"],
6
+ "uses": ["x1c", "leg", "lm8uu"],
7
7
  "engine": "manifold",
8
8
  "orientation": "The hip's face on the bed, the bosses up; each bearing pocket is a teardrop across the layers",
9
9
  "description": "A plate on two LM8UU bushings. The hip housing screws to its face and the hip's motor goes through its middle. It rides up the rods as the foot pushes, so the scale reads the leg.",
@@ -12,7 +12,7 @@
12
12
  "cable": {"at": ["half_w", 0, 0], "axis": [0, 0, -1]}
13
13
  },
14
14
  "variables": {
15
- "plate": {"value": 8, "unit": "mm", "rule": "The plate's thickness: three M3 screws bite here and carry the leg into the bushings"},
15
+ "plate": {"value": 8, "unit": "mm", "rule": "The plate's thickness: the housing's three screws bite here and carry the leg into the bushings"},
16
16
  "feet_r": {"value": 37, "unit": "mm", "rule": "The housing's three feet", "interface": true},
17
17
  "hub": {"value": 46, "unit": "mm", "rule": "The plate's round middle: past the feet, for the screws"},
18
18
  "arm_w": {"value": 24, "unit": "mm", "rule": "The arms' width, out to the bosses"},
@@ -24,7 +24,6 @@
24
24
  "rod_y": {"value": "leg.rod_y", "unit": "mm", "rule": "The rods' distance behind the face"},
25
25
  "cut": {"value": 44.5, "unit": "mm", "rule": "The motor's way through: a NEMA 17 and 1.1 mm each side"},
26
26
  "corner": {"value": 3, "unit": "mm", "rule": "Round the corners of the motor's window"},
27
- "pilot": {"value": 2.9, "unit": "mm", "rule": "M3 self-tapped into the plate, from the housing", "kind": "community"},
28
27
  "a1": {"value": 90, "unit": "°", "rule": "The housing's first foot"},
29
28
  "a2": {"value": 210, "unit": "°", "rule": "Second"},
30
29
  "a3": {"value": 330, "unit": "°", "rule": "Third"},
@@ -1,9 +1,11 @@
1
1
  // A flat tab screwed to a post, its nose over the flange.
2
+ // Its screw's hole is v.fixings' M3 clearance hole.
2
3
  import jscad from '@jscad/modeling'
3
4
  const { cuboid, cylinder } = jscad.primitives
4
5
  const { subtract } = jscad.booleans
5
6
 
6
7
  export function main (v) {
8
+ const hole = v.fixings.holeModel('M3').diameter
7
9
  const tab = cuboid({ size: [v.reach + v.back, v.wide, v.thick], center: [(v.back - v.reach) / 2, 0, v.thick / 2] })
8
- return subtract(tab, cylinder({ radius: v.hole / 2, height: v.thick + 1, center: [0, 0, v.thick / 2], segments: v.segments }))
10
+ return subtract(tab, cylinder({ radius: hole / 2, height: v.thick + 1, center: [0, 0, v.thick / 2], segments: v.segments }))
9
11
  }
@@ -3,7 +3,7 @@
3
3
  "name": "clip",
4
4
  "title": "Retaining clip",
5
5
  "version": "0.1.0",
6
- "uses": ["x1c", "m3"],
6
+ "uses": ["x1c"],
7
7
  "orientation": "Flat on the bed",
8
8
  "description": "Holds the knee's output ring from dropping off its posts.",
9
9
  "anchors": {
@@ -14,7 +14,6 @@
14
14
  "back": {"value": 4, "unit": "mm", "rule": "Round the post"},
15
15
  "wide": {"value": 8, "unit": "mm", "rule": "As wide as the post and a little"},
16
16
  "thick": {"value": 3, "unit": "mm", "rule": "Fifteen layers"},
17
- "hole": {"value": "m3.clearance + x1c.hole_comp", "unit": "mm", "rule": "M3 clearance"},
18
17
  "segments": {"value": 24, "rule": "Small round hole"}
19
18
  }
20
19
  }
@@ -1,11 +1,13 @@
1
1
  // A ring with a slot and a screw across it, closing round the rod. The screw's hole is a teardrop across the layers.
2
+ // The clamp screw's hole is v.fixings' M3 clearance hole.
2
3
  import jscad from '@jscad/modeling'
3
4
  const { cylinder, cuboid } = jscad.primitives
4
5
 
5
6
  export function main (v) {
7
+ const screwD = v.fixings.holeModel('M3').diameter
6
8
  const ring = cylinder({ radius: v.outer / 2, height: v.high, center: [0, 0, v.high / 2], segments: v.segments * 2 })
7
9
  const hole = cylinder({ radius: v.bore / 2, height: v.high + 1, center: [0, 0, v.high / 2], segments: v.segments })
8
10
  const slot = cuboid({ size: [v.outer / 2 + 1, v.slot, v.high + 1], center: [(v.outer / 2 + 1) / 2, 0, v.high / 2] })
9
- const screw = v.shapes.teardropHole({ d: v.screw, length: v.outer, at: [v.screw_out, 0 - v.outer / 2, v.high / 2], into: '+y', through: true })
11
+ const screw = v.shapes.teardropHole({ d: screwD, length: v.outer, at: [v.screw_out, 0 - v.outer / 2, v.high / 2], into: '+y', through: true })
10
12
  return v.ops.subtract(ring, hole, slot, screw)
11
13
  }
@@ -3,7 +3,7 @@
3
3
  "name": "collar",
4
4
  "title": "Rod collar: the carriage's stop",
5
5
  "version": "0.1.0",
6
- "uses": ["x1c", "leg", "m3"],
6
+ "uses": ["x1c", "leg"],
7
7
  "engine": "manifold",
8
8
  "orientation": "Flat on the bed, the rod's hole upright, the clamp's slot through one side",
9
9
  "description": "Set on a rod under the carriage: the carriage drops onto it when the foot lifts, so the foot really leaves the scale.",
@@ -12,7 +12,6 @@
12
12
  "outer": {"value": 22, "unit": "mm", "rule": "Round the rod, wall enough to take the screw"},
13
13
  "high": {"value": 10, "unit": "mm", "rule": "Along the rod"},
14
14
  "slot": {"value": 1.5, "unit": "mm", "rule": "The slot the clamp screw closes"},
15
- "screw": {"value": "m3.clearance + x1c.hole_comp", "unit": "mm", "rule": "The clamp's M3, across the slot: its hole a teardrop"},
16
15
  "screw_out": {"value": 8, "unit": "mm", "rule": "The screw, clear of the rod"},
17
16
  "segments": {"value": 48, "rule": "Round enough"}
18
17
  }
@@ -1,11 +1,13 @@
1
1
  // A block with a rod's socket in the top and a bolt through each end.
2
+ // The bolts' holes are v.fixings' M5 clearance holes.
2
3
  import jscad from '@jscad/modeling'
3
4
  const { cylinder, roundedRectangle } = jscad.primitives
4
5
  const { extrudeLinear } = jscad.extrusions
5
6
 
6
7
  export function main (v) {
8
+ const bolt = v.fixings.holeModel('M5').diameter
7
9
  const block = extrudeLinear({ height: v.thick }, roundedRectangle({ size: [v.long, v.wide], roundRadius: v.corner, segments: v.segments }))
8
10
  const socket = cylinder({ radius: v.socket / 2, height: v.depth + 1, center: [0, 0, v.thick - v.depth + (v.depth + 1) / 2], segments: v.segments })
9
- const bolts = [-1, 1].map((s) => cylinder({ radius: v.bolt / 2, height: v.thick + 1, center: [s * v.bolt_x, 0, v.thick / 2], segments: v.segments }))
11
+ const bolts = [-1, 1].map((s) => cylinder({ radius: bolt / 2, height: v.thick + 1, center: [s * v.bolt_x, 0, v.thick / 2], segments: v.segments }))
10
12
  return v.ops.subtract(block, socket, bolts)
11
13
  }
@@ -3,7 +3,7 @@
3
3
  "name": "foot",
4
4
  "title": "Stand foot block",
5
5
  "version": "0.1.0",
6
- "uses": ["x1c", "leg", "m5"],
6
+ "uses": ["x1c", "leg"],
7
7
  "engine": "manifold",
8
8
  "orientation": "Flat on the bed, the rod's socket opening up",
9
9
  "description": "Holds a rod upright, and bolts to the bench through two holes.",
@@ -13,7 +13,6 @@
13
13
  "thick": {"value": "leg.foot_block", "unit": "mm", "rule": "The socket's depth and a floor"},
14
14
  "socket": {"value": "leg.rod_d + x1c.hole_comp", "unit": "mm", "rule": "The rod, a press into the printed bore"},
15
15
  "depth": {"value": "leg.foot_socket", "unit": "mm", "rule": "How far the rod goes in"},
16
- "bolt": {"value": "m5.clearance", "unit": "mm", "rule": "To the bench"},
17
16
  "bolt_x": {"value": 12, "unit": "mm", "rule": "The bolts, either side of the rod"},
18
17
  "corner": {"value": 4, "unit": "mm", "rule": "The block's corners, rounded"},
19
18
  "segments": {"value": 48, "rule": "Round enough"}
@@ -1,9 +1,12 @@
1
1
  // The motor plate with the fixed ring and posts standing on it. The motor bolts underneath, its shaft up through the middle.
2
+ // The screws' holes are v.fixings': an M3 pilot in each post for the bridge, and an M3 clearance hole with its cap
3
+ // head's counterbore in each foot, sunk a layer, for the screw down into the plate under it.
2
4
  import jscad from '@jscad/modeling'
3
5
  const { cylinder, cylinderElliptic } = jscad.primitives
4
6
  const { translate } = jscad.transforms
5
7
 
6
8
  export function main (v) {
9
+ const pilot = v.fixings.holeModel('M3', { kind: 'pilot' }).diameter, screw = v.fixings.holeModel('M3').diameter, cb = v.fixings.counterboreModel('M3 cap'), head = cb.diameter, headDepth = cb.depth + v.sink
7
10
  const motor = v.motors.motorModel('17HS4401')
8
11
  const at = (r, a) => [r * Math.cos(a), r * Math.sin(a)]
9
12
  const posts = [v.p1, v.p2, v.p3].map((a) => a * v.rad), feet = [v.f1, v.f2, v.f3].map((a) => a * v.rad)
@@ -12,9 +15,9 @@ export function main (v) {
12
15
  const lobes = [...posts, ...feet].map((a) => cylinder({ radius: v.lobe / 2, height: v.plate, center: [...at(v.post_r, a), v.plate / 2], segments: v.segments }))
13
16
  const joins = [...posts, ...feet].map((a) => jscad.transforms.rotateZ(a, jscad.primitives.cuboid({ size: [v.post_r - v.rim / 2 + 2, v.lobe, v.plate], center: [(v.post_r + v.rim / 2 - 2) / 2, 0, v.plate / 2] })))
14
17
  const uprights = posts.map((a) => cylinder({ radius: v.post / 2, height: v.post_high + v.plate, center: [...at(v.post_r, a), (v.post_high + v.plate) / 2], segments: v.segments }))
15
- const pilots = posts.map((a) => cylinder({ radius: v.pilot / 2, height: v.pilot_depth, center: [...at(v.post_r, a), v.plate + v.post_high - v.pilot_depth / 2], segments: v.segments }))
16
- const screws = feet.map((a) => cylinder({ radius: v.screw / 2, height: v.plate + 1, center: [...at(v.column_r, a), v.plate / 2], segments: v.segments }))
17
- const heads = feet.map((a) => cylinder({ radius: v.head / 2, height: v.head_depth, center: [...at(v.column_r, a), v.plate - v.head_depth / 2], segments: v.segments }))
18
+ const pilots = posts.map((a) => cylinder({ radius: pilot / 2, height: v.pilot_depth, center: [...at(v.post_r, a), v.plate + v.post_high - v.pilot_depth / 2], segments: v.segments }))
19
+ const screws = feet.map((a) => cylinder({ radius: screw / 2, height: v.plate + 1, center: [...at(v.column_r, a), v.plate / 2], segments: v.segments }))
20
+ const heads = feet.map((a) => cylinder({ radius: head / 2, height: headDepth, center: [...at(v.column_r, a), v.plate - headDepth / 2], segments: v.segments }))
18
21
  // the pocket for the motor's boss would be bridged across: a 45° cone from its roof up through the plate needs no bridge
19
22
  const hole = v.motors.mountModel(motor, { plate: v.plate, counterbore: true }), rise = v.plate - hole.pocketDepth
20
23
  const roof = 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 })
@@ -3,10 +3,13 @@
3
3
  "name": "housing",
4
4
  "title": "Shoulder housing and fixed ring",
5
5
  "version": "0.1.0",
6
- "uses": ["x1c", "leg", "m3"],
6
+ "uses": ["x1c", "leg"],
7
7
  "engine": "manifold",
8
8
  "orientation": "The motor plate on the bed, the ring and posts up",
9
9
  "anchors": {
10
+ "f1": {"at": ["column_r * cosd(f1)", "column_r * sind(f1)", "plate"], "axis": [0, 0, 1]},
11
+ "f2": {"at": ["column_r * cosd(f2)", "column_r * sind(f2)", "plate"], "axis": [0, 0, 1]},
12
+ "f3": {"at": ["column_r * cosd(f3)", "column_r * sind(f3)", "plate"], "axis": [0, 0, 1]},
10
13
  "axis": {"at": [0, 0, "plate"], "axis": [0, 0, 1]},
11
14
  "motor": {"at": [0, 0, 0], "axis": [0, 0, 1], "ref": [1, 0, 0]}
12
15
  },
@@ -19,13 +22,10 @@
19
22
  "post_r": {"value": 37, "unit": "mm", "rule": "Three posts outside the output ring", "interface": true},
20
23
  "post": {"value": 7, "unit": "mm", "rule": "Each post's diameter"},
21
24
  "post_high": {"value": "leg.bridge_low - 0 - plate", "unit": "mm", "rule": "From the plate to under the bridge", "interface": true},
22
- "pilot": {"value": 2.9, "unit": "mm", "rule": "An M3 screw self-tapped", "kind": "community"},
23
- "pilot_depth": {"value": 8, "unit": "mm", "rule": "For an M3 × 16 through the bridge"},
25
+ "pilot_depth": {"value": 8, "unit": "mm", "rule": "Each post's pilot, deep enough for the bridge's screw"},
24
26
  "column_r": {"value": 37, "unit": "mm", "rule": "Over the base's columns"},
25
27
  "lobe": {"value": 12, "unit": "mm", "rule": "The plate reaches out over each column"},
26
- "screw": {"value": "m3.clearance + x1c.hole_comp", "unit": "mm", "rule": "M3 clearance, down into the column"},
27
- "head": {"value": "m3.head + 2 * x1c.fit + x1c.hole_comp", "unit": "mm", "rule": "The screw head's counterbore"},
28
- "head_depth": {"value": "m3.head_height + x1c.layer", "unit": "mm", "rule": "A socket head's height, sunk"},
28
+ "sink": {"value": "x1c.layer", "unit": "mm", "rule": "Each foot's screw head sits a layer under the plate's face"},
29
29
  "segments": {"value": 64, "rule": "Round enough"},
30
30
  "ring_segments": {"value": 96, "rule": "Smooth to the eye and to the gear"},
31
31
  "rad": {"value": 0.017453293, "rule": "Radians in a degree"},
@@ -1,12 +1,14 @@
1
1
  // The output ring, drawn as it prints: its flange on the bed, the teeth standing on it; it goes on upside down.
2
+ // Its four holes are v.fixings' M3 pilots, through the flange: the spindle's screws cut their thread in them.
2
3
  import jscad from '@jscad/modeling'
3
4
  const { cylinder } = jscad.primitives
4
5
  const { translate } = jscad.transforms
5
6
 
6
7
  export function main (v) {
8
+ const pilot = v.fixings.holeModel('M3', { kind: 'pilot' }).diameter
7
9
  const flange = cylinder({ radius: v.rim / 2, height: v.top, center: [0, 0, v.top / 2], segments: v.ring_segments })
8
10
  const ring = translate([0, 0, v.top], v.gears.internal({ module: v.module, teeth: v.teeth, width: v.width, rim: v.rim }))
9
- const holes = Array.from({ length: v.bolts }, (_, k) => cylinder({ radius: v.pilot / 2, height: v.top + 1, center: [v.bolt * Math.cos(k * v.quarter), v.bolt * Math.sin(k * v.quarter), v.top / 2], segments: v.segments }))
11
+ const holes = Array.from({ length: v.bolts }, (_, k) => cylinder({ radius: pilot / 2, height: v.top + 1, center: [v.bolt * Math.cos(k * v.quarter), v.bolt * Math.sin(k * v.quarter), v.top / 2], segments: v.segments }))
10
12
  const middle = cylinder({ radius: v.middle / 2, height: v.top + 1, center: [0, 0, v.top / 2], segments: v.ring_segments })
11
13
  return v.ops.subtract(v.ops.union(flange, ring), holes, middle)
12
14
  }
@@ -3,7 +3,7 @@
3
3
  "name": "output",
4
4
  "title": "Output ring and flange",
5
5
  "version": "0.1.0",
6
- "uses": ["x1c", "leg", "m3"],
6
+ "uses": ["x1c", "leg"],
7
7
  "engine": "manifold",
8
8
  "orientation": "The flange on the bed, the teeth standing on it",
9
9
  "description": "Printed flange down and fitted upside down: the same part on the shoulder and the elbow.",
@@ -17,7 +17,6 @@
17
17
  "rim": {"value": 66, "unit": "mm", "rule": "Round the 57-tooth ring"},
18
18
  "module": {"value": 1, "unit": "mm", "rule": "The gears'"},
19
19
  "teeth": {"value": 57, "rule": "The output ring"},
20
- "pilot": {"value": 2.9, "unit": "mm", "rule": "An M3 screw self-tapped into the flange", "kind": "community"},
21
20
  "middle": {"value": 15, "unit": "mm", "rule": "A hole in the middle for the motor's shaft to come up in"},
22
21
  "bolt": {"value": 20, "unit": "mm", "rule": "Radius of the bolt circle", "interface": true},
23
22
  "segments": {"value": 24, "rule": "Small holes"},
@@ -1,4 +1,5 @@
1
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
+ // The four screws into the knee's output are v.fixings': M3 clearance holes with their cap heads' counterbores.
2
3
  import jscad from '@jscad/modeling'
3
4
  const { cylinder, circle, polygon } = jscad.primitives
4
5
  const { translate } = jscad.transforms
@@ -6,12 +7,13 @@ const { extrudeLinear, extrudeRotate } = jscad.extrusions
6
7
  const { hull } = jscad.hulls
7
8
 
8
9
  export function main (v) {
10
+ const screw = v.fixings.holeModel('M3').diameter, cb = v.fixings.counterboreModel('M3 cap'), head = cb.diameter, headDepth = cb.depth + v.sink
9
11
  const dot = (r, x) => translate([x, 0], circle({ radius: r, segments: v.segments }))
10
12
  const bar = extrudeLinear({ height: v.bar }, hull(dot(v.wide / 2, 0), dot(v.toe / 2, v.long)))
11
13
  const boss = cylinder({ radius: v.boss_d / 2, height: v.boss, center: [0, 0, v.boss / 2], segments: v.segments * 2 })
12
14
  const r = v.foot_r, mid = v.foot_w / 2, g = v.groove
13
15
  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
+ const bolts = Array.from({ length: v.bolts }, (_, k) => cylinder({ radius: 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 }))
17
+ const heads = Array.from({ length: v.bolts }, (_, k) => cylinder({ radius: head / 2, height: headDepth + 1, center: [v.bolt * Math.cos(k * v.quarter), v.bolt * Math.sin(k * v.quarter), (headDepth - 1) / 2], segments: v.segments }))
16
18
  return v.ops.subtract(v.ops.union(bar, boss, foot), bolts, heads)
17
19
  }
@@ -3,11 +3,15 @@
3
3
  "name": "shin",
4
4
  "title": "Shin and foot",
5
5
  "version": "0.1.0",
6
- "uses": ["x1c", "leg", "m3"],
6
+ "uses": ["x1c", "leg"],
7
7
  "engine": "manifold",
8
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
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
10
  "anchors": {
11
+ "b1": {"at": ["bolt", 0, 0], "axis": [0, 0, 1]},
12
+ "b2": {"at": [0, "bolt", 0], "axis": [0, 0, 1]},
13
+ "b3": {"at": ["0 - bolt", 0, 0], "axis": [0, 0, 1]},
14
+ "b4": {"at": [0, "0 - bolt", 0], "axis": [0, 0, 1]},
11
15
  "hub": {"at": [0, 0, "boss"], "axis": [0, 0, -1], "ref": [1, 0, 0]},
12
16
  "tip": {"at": ["long", 0, "foot_w / 2"], "axis": [0, 0, 1], "ref": [1, 0, 0]},
13
17
  "pad": {"at": ["long", 0, 0], "axis": [0, 0, 1], "ref": [1, 0, 0]},
@@ -20,9 +24,7 @@
20
24
  "toe": {"value": 16, "unit": "mm", "rule": "Its width at the foot: tapered, as the bending falls to nothing at the foot"},
21
25
  "boss": {"value": "leg.boss", "unit": "mm", "rule": "The bar passes under the knee's clips, the boss above reaches the flange"},
22
26
  "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"},
27
+ "sink": {"value": 1.5, "unit": "mm", "rule": "Each screw head sits this far into the boss, so an M3x12 engages the whole flange and its tip stops at the flange's far face, clear of the planets"},
26
28
  "bolt": {"value": 20, "unit": "mm", "rule": "The output's bolt circle, radius"},
27
29
  "bolts": {"value": 4, "rule": "On the bolt circle"},
28
30
  "quarter": {"value": 1.57079633, "rule": "A quarter turn in radians"},
@@ -1,8 +1,11 @@
1
1
  // A disc on the output's flange and a shaft up through the bearing, a hexagon at its top for the arm.
2
+ // The screws are v.fixings': four M3 countersunk screws down through the disc into the output's flange, each hole's
3
+ // countersink as wide as an ISO 10642 head so it sits flush, and an M3 pilot in the hexagon's top for the thigh's screw.
2
4
  import jscad from '@jscad/modeling'
3
5
  const { cylinder } = jscad.primitives
4
6
 
5
7
  export function main (v) {
8
+ const pilotD = v.fixings.holeModel('M3', { kind: 'pilot' }).diameter
6
9
  const plate = cylinder({ radius: v.rim / 2, height: v.disc, center: [0, 0, v.disc / 2], segments: v.segments * 2 })
7
10
  const top = v.collar_top + v.width
8
11
  const shaft = cylinder({ radius: v.shaft / 2, height: top - 1, center: [0, 0, (top + 1) / 2], segments: v.segments * 2 })
@@ -10,8 +13,8 @@ export function main (v) {
10
13
  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
14
  const screws = Array.from({ length: v.bolts }, (_, k) => {
12
15
  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' })
16
+ return v.fixings.countersink('M3', { length: v.disc + 1, at: c, into: '-z' })
14
17
  })
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 })
18
+ const pilot = cylinder({ radius: pilotD / 2, height: v.pilot_depth, center: [0, 0, top + v.hex_long - v.pilot_depth / 2], segments: v.segments })
16
19
  return v.ops.subtract(v.ops.union(plate, shaft, collar, hex), screws, pilot)
17
20
  }
@@ -3,28 +3,29 @@
3
3
  "name": "spindle",
4
4
  "title": "Spindle: disc and shaft",
5
5
  "version": "0.1.0",
6
- "uses": ["x1c", "leg", "m3"],
6
+ "uses": ["x1c", "leg"],
7
7
  "engine": "manifold",
8
8
  "orientation": "The disc on the bed, the shaft up, as it goes on",
9
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
10
  "anchors": {
11
+ "b1": {"at": ["bolt", 0, "disc"], "axis": [0, 0, 1]},
12
+ "b2": {"at": [0, "bolt", "disc"], "axis": [0, 0, 1]},
13
+ "b3": {"at": ["0 - bolt", 0, "disc"], "axis": [0, 0, 1]},
14
+ "b4": {"at": [0, "0 - bolt", "disc"], "axis": [0, 0, 1]},
11
15
  "down": {"at": [0, 0, 0], "axis": [0, 0, 1], "ref": [1, 0, 0]},
12
16
  "seat": {"at": [0, 0, "collar_top + width"], "axis": [0, 0, 1], "ref": [1, 0, 0]}
13
17
  },
14
18
  "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"},
19
+ "disc": {"value": "leg.disc", "unit": "mm", "rule": "Thick enough for the countersinks, with a wall of screw hole under each"},
20
+ "rim": {"value": 48, "unit": "mm", "rule": "Round the 40 mm bolt circle and its countersinks, 6.82 mm across, with a 0.6 mm edge outside them"},
17
21
  "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
22
  "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
23
  "width": {"value": "leg.bearing_width", "unit": "mm", "rule": "The bearing"},
22
24
  "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
25
  "shoulder": {"value": 13, "unit": "mm", "rule": "Stops the inner race; clears the outer race"},
24
26
  "hex": {"value": 8, "unit": "mm", "rule": "Hexagon across its flats: inside the bore, drives the thigh"},
25
27
  "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
+ "pilot_depth": {"value": 12, "unit": "mm", "rule": "The pilot in the hexagon's top, for the thigh's screw"},
28
29
  "cos30": {"value": "cosd(30)", "rule": "A hexagon, across corners to across flats"},
29
30
  "bolts": {"value": 4, "rule": "On the bolt circle"},
30
31
  "quarter": {"value": 1.57079633, "rule": "A quarter turn in radians"},
@@ -1,5 +1,7 @@
1
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
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
+ // The screws' holes are v.fixings': an M3 clearance hole through the socket's floor for the screw into the spindle,
4
+ // and an M3 pilot in each post for its clip.
3
5
  import jscad from '@jscad/modeling'
4
6
  const { cylinder, cylinderElliptic, cuboid, circle } = jscad.primitives
5
7
  const { translate, rotateZ } = jscad.transforms
@@ -7,6 +9,7 @@ const { extrudeLinear } = jscad.extrusions
7
9
  const { hull } = jscad.hulls
8
10
 
9
11
  export function main (v) {
12
+ const screw = v.fixings.holeModel('M3').diameter, pilot = v.fixings.holeModel('M3', { kind: 'pilot' }).diameter
10
13
  const motor = v.motors.motorModel('nema14')
11
14
  const at = (r, a) => [v.long + r * Math.cos(a), r * Math.sin(a)]
12
15
  const posts = [v.p1, v.p2, v.p3].map((a) => a * v.rad)
@@ -18,10 +21,10 @@ export function main (v) {
18
21
  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
22
  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
23
  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 }))
24
+ const pilots = posts.map((a) => cylinder({ radius: pilot / 2, height: v.pilot_depth, center: [...at(v.post_r, a), v.clip_at - v.pilot_depth / 2], segments: v.segments }))
22
25
  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
26
  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 })
27
+ const through = cylinder({ radius: screw / 2, height: v.floor + 1, center: [0, 0, (v.floor - 1) / 2], segments: v.segments })
25
28
  const hole = v.motors.mountModel(motor, { plate: v.thick, counterbore: true }), rise = v.thick - hole.pocketDepth
26
29
  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
30
  const mount = translate([v.long, 0, 0], v.motors.mount(motor, { plate: v.thick, counterbore: true }, v.ops))