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
package/CHANGELOG.md ADDED
@@ -0,0 +1,63 @@
1
+ # Changelog: create-rulecad
2
+
3
+ What changed in each release, for someone upgrading a workspace. A **printed size** is a dimension of a part you
4
+ print (a hole's diameter, a seat's depth, a part's outline). Each release lists every printed size that moved in what
5
+ it makes, with its reason. A **fasten** is an entry in an assembly's `"fasten"` list: one screwed joint, naming the
6
+ screw by thread and head, the parts it passes through and the part it ends in.
7
+
8
+ ## 0.3.17: frames in the agents' notes (Frames 2)
9
+
10
+ ### Changed
11
+
12
+ - The template's AGENTS.md follows cad's: joins between beams, screws into a slot, fittings, guides, jigs and a
13
+ frame's build.
14
+
15
+ ## 0.3.16: screws through fixings in every template (Fixings 3)
16
+
17
+ ### What reads fixings now
18
+
19
+ - **The starter workspace** (`npm create rulecad my-project`) gains a second example in `projects/home`: a box with
20
+ its lid screwed on. `box.js` and `lid.js` draw the screws' holes with `v.fixings`, named by the thread (`'M3'`):
21
+ a pilot in each corner post and a clearance hole in the lid, sized from the thread's rule set and the printer's.
22
+ `assemblies/lidded-box.json` holds them together with a fasten. `npx cad list home/lidded-box` buys 4 M3x8 cap
23
+ screws, the length the check chose. The soap tray is unchanged.
24
+ - **The arm and leg machines** (`--machine arm`, `--machine leg`) are rebuilt from the repository's migrated bench
25
+ arm and leg: every screw hole from `v.fixings`, an anchor on every screw's axis, and every screwed joint a fasten.
26
+ `cad list arm/arm` now counts the screws: 4 M2x10 cap, 1 M3x3 set, 4 M3x6 cap, 3 M3x8 cap, 4 M3x8 countersunk,
27
+ 6 M3x10 cap, 8 M3x12 cap, 1 M3x16 cap, 2 M3x30 cap and 2 M3 hex nuts, 30.4 g in all.
28
+ - The template's AGENTS.md says a screwed joint is a fasten, with its holes from `v.fixings`, and a board's mounting
29
+ holes are named by thread (`v.pcb.mount('M2', x, y)`).
30
+ - The machines' rules (`rules/arm.json`, `rules/leg.json`) no longer name a thread in a plate's or a flange's
31
+ thickness ("deep enough for the motor's four screws to bite"). No value changed.
32
+
33
+ ### Printed sizes that moved
34
+
35
+ The starter's soap tray moves nothing; the box and lid are new. In the machines (volumes in mm3):
36
+
37
+ | Machine | Part | What moved | Volume | Reason |
38
+ |---|---|---|---|---|
39
+ | arm | base | M5 bolt holes 5.5 to 5.6 mm; home switch M2 pilots 1.8 to 2.1 mm | 76200.62 to 76161.41 | The printer's hole compensation (0.1 mm) is now added to the M5 clearance hole, as to every other. The 1.8 mm pilot was the M2 clearance less 0.6 mm, which is no thread's figure; it is now the M2 pilot (a community figure) |
40
+ | arm | upper | home switch M2 pilots 1.8 to 2.1 mm | 100104.83 to 100088.32 | As the base |
41
+ | arm | holder | pen clamp pilot 2.8 to 2.9 mm | 25547.38 to 25546.69 | The M3 clearance less 0.6 mm, replaced by the M3 pilot |
42
+ | arm, leg | spindle | countersinks 5.5 to 6.82 mm across; disc 46 to 48 mm across | 5729.69 to 6119.54 | 5.5 mm was a cap head's diameter. An ISO 10642 M3 countersunk head needs 6.72 mm, so the heads stood about 0.6 mm proud under the bridge. The disc grew to keep 0.6 mm of edge |
43
+ | arm | forearm | boss counterbores sunk 1.5 mm (was 0.2); yoke cheeks made parallel; yoke heads counterbored 3 mm | 25738.92 to 25907.74 | An M3x16 ran 2.7 mm past the elbow output's flange into the planet gears: sunk, an M3x12 engages the whole flange and stops at its face. Tapered cheeks left no flat seat for the heads and nuts. The 28 mm yoke needs an M3x30, which reaches the nut only with the counterbore |
44
+ | leg | foot | M5 bolt holes 5.5 to 5.6 mm | 13379.21 to 13351.41 | As the arm's base |
45
+ | leg | shin | boss counterbores sunk 1.5 mm (was 0.2) | 34176.92 to 34080.07 | As the forearm: the screws stop short of the knee's planet gears |
46
+
47
+ Every other part of the machines keeps its sizes. The arm prints 439.4 g (was 438.7 g).
48
+
49
+ ### Findings that changed
50
+
51
+ - The leg's stand gets two `fasten.access` warnings: the shin's screws 1 and 3 are reached only by a ball-end key in
52
+ the stand's pose. Put the shin on before the leg goes on the stand.
53
+ - The stand's two collar clamp screws are not yet a fasten: their heads and nuts sit on the collar's round outside.
54
+ The collar needs flats first.
55
+
56
+ ### What a workspace should change
57
+
58
+ - A workspace already made from an earlier template keeps its files: nothing here changes them. To take the new
59
+ arm or leg, make a new workspace with `--machine arm` or `--machine leg` and compare, or copy the parts above across.
60
+ Parts already printed from the old files fit the old screws: the arm's spindle and forearm, and the leg's shin, are
61
+ the ones whose new screws need the new holes.
62
+ - See `@rulecad/cad`'s changelog for the fasten relation and `cad add fasten --from-fits`, which moves an older
63
+ assembly's screwed joints onto fasten.
package/README.md CHANGED
@@ -6,8 +6,11 @@ cd my-designs
6
6
  npx cad check home/soap-tray
7
7
  ```
8
8
 
9
- Makes a [rulecad](https://github.com/JoniBach/rulecad) workspace with one design to start from: a soap tray with
10
- ribs and drain slots, every measurement a variable that names its rule. `--no-install` makes the files without
9
+ Makes a [rulecad](https://github.com/JoniBach/rulecad) workspace with two designs to start from, every measurement a
10
+ variable that names its rule: a soap tray with ribs and drain slots, and a box with its lid screwed on. The box's
11
+ assembly (`npx cad check home/lidded-box`) says how the parts screw together with a `fasten`: the holes are drawn from
12
+ `v.fixings` by the thread's name, so no screw size is typed anywhere, and the check chooses each screw's length and
13
+ lists the screws (`npx cad list home/lidded-box`: 4 × M3x8 cap). `--no-install` makes the files without
11
14
  running `npm install`. It asks how you'll share models: short links keep each shared model in a secret GitHub Gist
12
15
  (needs the `gh` command, signed in); long links carry the model and upload nothing. `--share gist` or `--share long`
13
16
  answers in advance (without either, and with no one to ask, links stay long).
package/index.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
- // npm create rulecad [folder]: a new rulecad workspace with a design to start from (a soap tray), then npm install.
2
+ // npm create rulecad [folder]: a new rulecad workspace with designs to start from (a soap tray, and a box whose lid is
3
+ // screwed on: a fasten, its holes from v.fixings), then npm install.
3
4
  // --machine arm | leg start from a whole machine instead: the arm drawn on a sheet (EXAMPLES chapter 12) or a leg on a stand
4
5
  // (chapter 14), sized when it is made, with its task, bought parts, wires and firmware
5
6
  // --sheet a5 --accuracy 0.3 (for --machine arm), --robot 1.5 (for --machine leg): the sizes it is made to
@@ -39,7 +40,7 @@ fs.writeFileSync(path.join(dir, 'package.json'), `${JSON.stringify({
39
40
  dependencies: { '@rulecad/cad': from('cad'), '@jscad/modeling': '^2.12.0' },
40
41
  }, null, 2)}\n`);
41
42
 
42
- console.log(`made ${path.relative(process.cwd(), dir) || '.'}: a soap tray to start from, in projects/home`);
43
+ console.log(`made ${path.relative(process.cwd(), dir) || '.'}: a soap tray and a box with a screwed lid to start from, in projects/home`);
43
44
 
44
45
  // A machine: copy it in, and size it to what was asked
45
46
  const SHEETS = { a6: [148, 105], a5: [210, 148], a4: [297, 210] };
@@ -74,11 +74,11 @@
74
74
  { "a": "m1", "b": "sun", "shaft": true, "note": "The shaft in the sun" },
75
75
  { "a": "m2", "b": "esun", "shaft": true, "note": "The elbow motor's shaft in its sun" },
76
76
  { "a": "m2", "b": "upper", "fastens": true, "min": -0.1, "note": "The elbow motor, on its four screws, its boss seated in the plate's pocket" },
77
- { "a": "housing", "b": "base", "fastens": true, "min": 0, "note": "The housing, on the base's three columns" },
78
- { "a": "bridge", "b": "housing", "fastens": true, "min": 0, "note": "The bridge, on the housing's posts" },
77
+ { "a": "housing", "b": "base", "min": 0, "note": "The housing, on the base's three columns" },
78
+ { "a": "bridge", "b": "housing", "min": 0, "note": "The bridge, on the housing's posts" },
79
79
  { "a": "b1", "b": "bridge", "seat": "press", "note": "The 6800 in its seat" },
80
- { "a": "es1", "b": "base", "fastens": true, "min": -0.1, "note": "The home switch on its post, 0.1 mm of resting contact allowed" },
81
- { "a": "es2", "b": "upper", "fastens": true, "min": -0.1, "note": "The elbow's home switch on its post" },
80
+ { "a": "es1", "b": "base", "min": -0.1, "note": "The home switch on its post, 0.1 mm of resting contact allowed" },
81
+ { "a": "es2", "b": "upper", "min": -0.1, "note": "The elbow's home switch on its post" },
82
82
  { "a": "es1", "b": "upper", "min": -30, "note": "The arm's flag on the home switch's lever at the end of the range" },
83
83
  { "a": "es2", "b": "forearm", "min": -30, "note": "The forearm's flag on the elbow switch's lever" },
84
84
  { "a": "horn", "b": "holder", "min": -30, "note": "The horn lifts the shuttle's lug: drawn at rest, the lug doesn't rise here" },
@@ -86,6 +86,20 @@
86
86
  { "a": "d1", "b": "shield", "fastens": true, "min": -20, "note": "Plugged in" },
87
87
  { "a": "d2", "b": "shield", "fastens": true, "min": -20, "note": "Plugged in" }
88
88
  ],
89
+ "fasten": [
90
+ { "screw": "M3 cap", "through": ["housing"], "into": "base", "at": ["housing.f1", "housing.f2", "housing.f3"], "note": "The housing on the base's three columns" },
91
+ { "screw": "M3 cap", "through": ["bridge"], "into": "housing", "at": ["bridge.s1", "bridge.s2", "bridge.s3"], "note": "The bridge on the housing's posts" },
92
+ { "screw": "M3 countersunk", "through": ["spindle"], "into": "output", "at": ["spindle.b1", "spindle.b2", "spindle.b3", "spindle.b4"], "note": "The spindle on the output's flange, its heads flush under the bridge" },
93
+ { "screw": "M3 cap", "through": ["upper"], "into": "spindle", "at": ["upper.hub"], "note": "The upper arm clamped down on the spindle's hexagon" },
94
+ { "screw": "M3 cap", "through": ["clip1"], "into": "upper", "at": ["clip1.post"], "note": "A clip on its post" },
95
+ { "screw": "M3 cap", "through": ["clip2"], "into": "upper", "at": ["clip2.post"], "note": "A clip on its post" },
96
+ { "screw": "M3 cap", "through": ["clip3"], "into": "upper", "at": ["clip3.post"], "note": "A clip on its post" },
97
+ { "screw": "M3 cap", "through": ["forearm"], "into": "eoutput", "at": ["forearm.b1", "forearm.b2", "forearm.b3", "forearm.b4"], "note": "The forearm on the elbow's output" },
98
+ { "screw": "M3 cap", "through": ["forearm", "holder"], "into": "forearm", "at": ["forearm.h1", "forearm.h2"], "nut": true, "note": "The pen holder in the forearm's yoke" },
99
+ { "screw": "M3 set", "through": [], "into": "holder", "at": ["holder.clamp"], "length": 3, "note": "The pen's clamp screw, down through the shuttle's wall" },
100
+ { "screw": "M2 cap", "through": ["es1"], "into": "base", "at": ["base.sw1", "base.sw2"], "note": "The home switch on its post" },
101
+ { "screw": "M2 cap", "through": ["es2"], "into": "upper", "at": ["upper.sw1", "upper.sw2"], "note": "The elbow's home switch on its post" }
102
+ ],
89
103
  "wires": [
90
104
  { "id": "shoulder", "from": "m1.connector", "to": "shield.X", "via": ["base.cable"], "gauge": "awg24", "colour": "black, red, green, blue", "connectors": ["JST-XH 4 pin", "screw terminal"], "note": "From the motor's own lead, down through the base" },
91
105
  { "id": "elbow", "from": "m2.connector", "to": "shield.Y", "via": ["upper.cable", "base.cable"], "gauge": "awg24", "colour": "black, red, green, blue", "connectors": ["JST-XH 4 pin", "screw terminal"] },
@@ -1,18 +1,20 @@
1
- // A plate with three columns and a post: first layer one square with four holes.
1
+ // A plate with three columns and a post: first layer one square with four holes. Every screw's hole is v.fixings':
2
+ // the M5 bolts' clearance, the M3 pilots the housing's screws cut their thread in, and the switch's M2 pilots.
2
3
  import jscad from '@jscad/modeling'
3
4
  const { cylinder, cuboid, roundedRectangle } = jscad.primitives
4
5
  const { extrudeLinear } = jscad.extrusions
5
6
  const { translate, rotateZ } = jscad.transforms
6
7
 
7
8
  export function main (v) {
9
+ const bolt = v.fixings.holeModel('M5').diameter, pilot = v.fixings.holeModel('M3', { kind: 'pilot' }).diameter, switchPilot = v.fixings.holeModel('M2', { kind: 'pilot' }).diameter
8
10
  const plate = extrudeLinear({ height: v.foot }, roundedRectangle({ size: [v.side, v.side], roundRadius: v.corner, segments: v.segments }))
9
11
  const angles = [v.c1, v.c2, v.c3].map((a) => a * v.rad)
10
12
  const at = (r, a) => [r * Math.cos(a), r * Math.sin(a)]
11
13
  const columns = angles.map((a) => cylinder({ radius: v.column / 2, height: v.column_top, center: [...at(v.column_r, a), v.column_top / 2], segments: v.segments }))
12
- const pilots = angles.map((a) => cylinder({ radius: v.pilot / 2, height: v.pilot_depth, center: [...at(v.column_r, a), v.column_top - v.pilot_depth / 2], segments: v.segments }))
14
+ const pilots = angles.map((a) => cylinder({ radius: pilot / 2, height: v.pilot_depth, center: [...at(v.column_r, a), v.column_top - v.pilot_depth / 2], segments: v.segments }))
13
15
  const a = v.post_a * v.rad
14
16
  const post = translate([...at(v.post_r, a), 0], rotateZ(a, cuboid({ size: [v.post_w, v.post_d, v.post_top], center: [0, 0, v.post_top / 2] })))
15
- const pads = [-1, 1].map((s) => cylinder({ radius: v.switch_pilot / 2, height: v.switch_depth, center: [...at(v.post_r + s * v.switch_pitch / 2, a), v.post_top - v.switch_depth / 2], segments: v.segments }))
16
- const holes = [[1, 1], [-1, 1], [1, -1], [-1, -1]].map(([x, y]) => cylinder({ radius: v.bolt / 2, height: v.foot + 1, center: [x * v.bolt_at, y * v.bolt_at, v.foot / 2], segments: v.segments }))
17
+ const pads = [-1, 1].map((s) => cylinder({ radius: switchPilot / 2, height: v.switch_depth, center: [...at(v.post_r + s * v.switch_pitch / 2, a), v.post_top - v.switch_depth / 2], segments: v.segments }))
18
+ const holes = [[1, 1], [-1, 1], [1, -1], [-1, -1]].map(([x, y]) => cylinder({ radius: bolt / 2, height: v.foot + 1, center: [x * v.bolt_at, y * v.bolt_at, v.foot / 2], segments: v.segments }))
17
19
  return v.ops.subtract(v.ops.union(plate, columns, post), pilots, pads, holes)
18
20
  }
@@ -3,11 +3,13 @@
3
3
  "name": "base",
4
4
  "title": "Base: plate and motor stand",
5
5
  "version": "0.1.0",
6
- "uses": ["x1c", "arm", "m2", "m3", "m5"],
6
+ "uses": ["x1c", "arm"],
7
7
  "engine": "manifold",
8
8
  "orientation": "The plate on the bed, columns up",
9
9
  "description": "A square plate that bolts down through four corner holes, flat on the bench or upright on a stand, with three columns round the motor carrying the shoulder housing and a post for the home switch.",
10
10
  "anchors": {
11
+ "sw1": {"at": ["(post_r + switch_pitch / 2) * cosd(post_a)", "(post_r + switch_pitch / 2) * sind(post_a)", "post_top"], "axis": [0, 0, 1]},
12
+ "sw2": {"at": ["(post_r - switch_pitch / 2) * cosd(post_a)", "(post_r - switch_pitch / 2) * sind(post_a)", "post_top"], "axis": [0, 0, 1]},
11
13
  "top": {"at": [0, 0, "column_top"], "axis": [0, 0, 1]},
12
14
  "cable": {"at": ["0 - side / 2", 0, "foot"], "axis": [0, 0, 1]},
13
15
  "switch": {"at": ["(post_r + switch_pitch / 2) * cosd(post_a)", "(post_r + switch_pitch / 2) * sind(post_a)", "post_top + switch_half"], "axis": [0, 0, 1], "ref": ["0 - cosd(post_a)", "0 - sind(post_a)", 0]}
@@ -16,21 +18,18 @@
16
18
  "side": {"value": 96, "unit": "mm", "rule": "The plate's side: round the columns, with room for the bolts", "label": "Plate", "show": true},
17
19
  "foot": {"value": "arm.foot", "unit": "mm", "rule": "The plate's thickness"},
18
20
  "corner": {"value": 8, "unit": "mm", "rule": "The plate's corners, rounded"},
19
- "bolt": {"value": "m5.clearance", "unit": "mm", "rule": "Bolts through to the bench, or an upright stand"},
20
21
  "bolt_at": {"value": 38, "unit": "mm", "rule": "Half the bolts' square: the same pattern on a bench and on a stand"},
21
22
  "column_top": {"value": "arm.face", "unit": "mm", "rule": "Up to the shoulder motor's mounting face"},
22
23
  "column_r": {"value": 37, "unit": "mm", "rule": "Round the motor's corners"},
23
24
  "column": {"value": 10, "unit": "mm", "rule": "Solid, stiff enough for the arm's tipping load: section against 2 x the arm's weight in the chapter"},
24
- "pilot": {"value": 2.9, "unit": "mm", "rule": "An M3 screw self-tapped into the column's top", "kind": "community"},
25
- "pilot_depth": {"value": 16, "unit": "mm", "rule": "For an M3 × 20 through the housing's plate"},
25
+ "pilot_depth": {"value": 16, "unit": "mm", "rule": "Each column's pilot, deep enough for the housing's screw"},
26
26
  "post_r": {"value": 50, "unit": "mm", "rule": "The switch post, outside the housing's posts", "interface": true},
27
27
  "post_a": {"value": 235, "unit": "°", "rule": "Round from the front: where the upper arm's flag meets the switch's lever at the shoulder's home, -116°", "interface": true},
28
28
  "post_w": {"value": 14, "unit": "mm", "rule": "The post's width along the radius, for the switch's two screws"},
29
29
  "post_d": {"value": 12, "unit": "mm", "rule": "The post's depth, tangential"},
30
30
  "post_top": {"value": "arm.bridge_low + arm.bridge - 6", "unit": "mm", "rule": "The switch lies on the post, its lever under the arm's flag"},
31
- "switch_pilot": {"value": "m2.clearance - 0.6", "unit": "mm", "rule": "An M2 screw self-tapped into the post", "kind": "community"},
32
31
  "switch_pitch": {"value": "arm.switch_pitch", "unit": "mm", "rule": "The switch's screw spacing"},
33
- "switch_depth": {"value": 10, "unit": "mm", "rule": "Pilot depth for M2 × 8"},
32
+ "switch_depth": {"value": 10, "unit": "mm", "rule": "Each switch screw's pilot depth"},
34
33
  "segments": {"value": 64, "rule": "Round enough"},
35
34
  "rad": {"value": 0.017453293, "rule": "Radians in a degree"},
36
35
  "c1": {"value": 90, "unit": "°", "rule": "First column, between the motor's corners"},
@@ -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", "arm", "m3"],
6
+ "uses": ["x1c", "arm"],
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 arm passes over"},
30
+ "sink": {"value": "x1c.layer", "unit": "mm", "rule": "Each screw head sits a layer under the face, so the arm passes over"},
30
31
  "segments": {"value": 64, "rule": "Round enough"}
31
32
  }
32
33
  }
@@ -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 elbow'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,4 +1,8 @@
1
- // A short bar from the elbow's output to a yoke round the pen holder's block.
1
+ // A short bar from the elbow's output to a yoke round the pen holder's block. The yoke's cheeks run parallel along the
2
+ // slot, so the heads and nuts of the screws across it sit square.
3
+ // The screws' holes are v.fixings': two M3 clearance holes across the yoke for the holder's screws, each head
4
+ // counterbored into the near cheek (on its side, so a teardrop) so an M3x30 reaches its nut on the far one, and four
5
+ // in the boss with their cap heads' counterbores for the screws into the elbow's output.
2
6
  import jscad from '@jscad/modeling'
3
7
  const { cylinder, cuboid, circle, rectangle } = jscad.primitives
4
8
  const { translate } = jscad.transforms
@@ -6,14 +10,15 @@ const { extrudeLinear } = jscad.extrusions
6
10
  const { hull } = jscad.hulls
7
11
 
8
12
  export function main (v) {
13
+ const screw = v.fixings.holeModel('M3').diameter, cb = v.fixings.counterboreModel('M3 cap'), head = cb.diameter, headDepth = cb.depth + v.sink
9
14
  const endWide = v.block + v.cheek * 2, tip = v.long + v.reach
10
15
  const dot = (r, x) => translate([x, 0], circle({ radius: r, segments: v.segments }))
11
- const bar = extrudeLinear({ height: v.bar }, hull(dot(v.wide / 2, 0), rectangle({ size: [1, endWide], center: [tip - 1 / 2, 0] })))
16
+ const bar = extrudeLinear({ height: v.bar }, hull(dot(v.wide / 2, 0), rectangle({ size: [tip - v.long + v.slot_from, endWide], center: [(tip + v.long - v.slot_from) / 2, 0] })))
12
17
  const boss = cylinder({ radius: v.boss_d / 2, height: v.boss, center: [0, 0, v.boss / 2], segments: v.segments * 2 })
13
18
  const slot = cuboid({ size: [tip + 1 - (v.long - v.slot_from), v.block + v.slot_fit, v.bar + 1], center: [(tip + 1 + v.long - v.slot_from) / 2, 0, v.bar / 2] })
14
- const holes = [-1, 1].map((s) => v.shapes.teardropHole({ d: v.screw, length: endWide + 1, at: [v.long + s * v.pitch, 0 - endWide / 2 - 1 / 2, v.mid], into: '+y', through: true }))
15
- 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 }))
16
- 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 }))
19
+ const holes = [-1, 1].map((s) => v.fixings.counterbore('M3 cap', { length: endWide, at: [v.long + s * v.pitch, 0 - endWide / 2, v.mid], into: '+y' }))
20
+ 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 }))
21
+ 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 }))
17
22
  const flag = cuboid({ size: [v.flag_wide, v.flag_thick, v.flag_h], center: [v.flag_x, v.flag_y, v.bar + v.flag_h / 2] })
18
23
  const band = cylinder({ radius: v.bias_d / 2, height: v.bar + 1, center: [v.bias_at, 0, v.bar / 2], segments: v.segments })
19
24
  return v.ops.subtract(v.ops.union(bar, boss, flag), slot, holes, bolts, heads, band)
@@ -3,10 +3,16 @@
3
3
  "name": "forearm",
4
4
  "title": "Forearm",
5
5
  "version": "0.1.0",
6
- "uses": ["x1c", "arm", "m3"],
6
+ "uses": ["x1c", "arm"],
7
7
  "engine": "manifold",
8
8
  "orientation": "The bar flat on the bed, the boss and flag up",
9
9
  "anchors": {
10
+ "b1": {"at": ["bolt", 0, 0], "axis": [0, 0, 1]},
11
+ "b2": {"at": [0, "bolt", 0], "axis": [0, 0, 1]},
12
+ "b3": {"at": ["0 - bolt", 0, 0], "axis": [0, 0, 1]},
13
+ "b4": {"at": [0, "0 - bolt", 0], "axis": [0, 0, 1]},
14
+ "h1": {"at": ["long - pitch", 0, "mid"], "axis": [0, 1, 0]},
15
+ "h2": {"at": ["long + pitch", 0, "mid"], "axis": [0, 1, 0]},
10
16
  "hub": {"at": [0, 0, "boss"], "axis": [0, 0, -1], "ref": [1, 0, 0]},
11
17
  "holder": {"at": ["long", 0, "mid"], "axis": [0, 1, 0], "ref": [1, 0, 0]},
12
18
  "flag": {"at": ["flag_x", "flag_y", "bar + flag_h"], "axis": [0, 0, 1]},
@@ -20,9 +26,7 @@
20
26
  "mid": {"value": "arm.arm_mid", "unit": "mm", "rule": "Half the thickness"},
21
27
  "boss": {"value": "arm.boss", "unit": "mm", "rule": "The bar passes under the elbow's clips, the boss above reaches the flange"},
22
28
  "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"},
29
+ "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
30
  "bolt": {"value": 20, "unit": "mm", "rule": "The output's bolt circle, radius"},
27
31
  "bolts": {"value": 4, "rule": "On the bolt circle"},
28
32
  "quarter": {"value": 1.57079633, "rule": "A quarter turn in radians"},
@@ -1,9 +1,12 @@
1
1
  // All in one flat print: a fixed frame with the servo, two tapered leaves, the shuttle with the pen's bore and a lug for the horn.
2
+ // The screws' holes are v.fixings': M3 clearance through the block for the forearm's two screws, and an M3 pilot down
3
+ // through the shuttle's wall for the screw that clamps the pen.
2
4
  import jscad from '@jscad/modeling'
3
5
  const { cuboid, cylinder } = jscad.primitives
4
6
  const { translate } = jscad.transforms
5
7
 
6
8
  export function main (v) {
9
+ const bolt = v.fixings.holeModel('M3').diameter, clampPilot = v.fixings.holeModel('M3', { kind: 'pilot' }).diameter
7
10
  const f = v.flexures, material = f.flexureMaterial({ modulus: v.petg.modulus, strength: v.petg.strength, name: 'PETG' })
8
11
  const leaf = { length: v.leaf_l, thickness: v.leaf_t, width: v.thick, gap: v.gap, taper: v.taper, fillet: v.fillet, shuttle: v.pen_x - v.block_x - v.leaf_l + v.pen_wall, base: v.block_x * 2 }
9
12
  const model = f.parallelGuideModel(leaf, { E: v.petg.modulus })
@@ -16,8 +19,8 @@ export function main (v) {
16
19
  const tabBody = cuboid({ size: [v.lug_x1 - v.lug_x0, (0 - v.shuttle) - v.lug_y + 1, v.thick], center: [(v.lug_x0 + v.lug_x1) / 2, (v.lug_y + (0 - v.shuttle) + 1) / 2, v.half] })
17
20
  const lug = cuboid({ size: [v.lug_x1 - v.lug_x0, v.lug_wide, v.lug_top - v.thick + 1], center: [(v.lug_x0 + v.lug_x1) / 2, v.lug_y + v.lug_wide / 2, v.thick + (v.lug_top - v.thick - 1) / 2] })
18
21
  const bore = v.shapes.teardropHole({ d: v.pen_d, length: v.shuttle * 2 + 1, at: [v.pen_x, 0 - v.shuttle - 1 / 2, v.half], into: '+y', through: true })
19
- const clamp = cylinder({ radius: v.clamp / 2, height: v.thick, center: [v.pen_x, 0, v.thick - v.half / 2], segments: v.segments })
22
+ const clamp = cylinder({ radius: clampPilot / 2, height: v.thick, center: [v.pen_x, 0, v.thick - v.half / 2], segments: v.segments })
20
23
  const servo = translate([v.xh, v.yh, v.thick], v.motors.mount(v.motors.motorModel('sg90'), { plate: v.thick }, v.ops))
21
- const holes = [-1, 1].map((s) => cylinder({ radius: v.bolt / 2, height: v.thick + 1, center: [s * v.bolt_y, 0, v.half], segments: v.segments }))
24
+ const holes = [-1, 1].map((s) => cylinder({ radius: bolt / 2, height: v.thick + 1, center: [s * v.bolt_y, 0, v.half], segments: v.segments }))
22
25
  return v.ops.subtract(v.ops.union(guide, block, frameBody, tail, shuttleBlock, tabBody, lug), bore, clamp, servo, holes)
23
26
  }
@@ -3,12 +3,13 @@
3
3
  "name": "holder",
4
4
  "title": "Pen holder with lift",
5
5
  "version": "0.1.0",
6
- "uses": ["x1c", "arm", "petg", "m2", "m3"],
6
+ "uses": ["x1c", "arm", "petg"],
7
7
  "engine": "manifold",
8
8
  "material": "PETG",
9
9
  "orientation": "Flat on the bed: the drawing's x and y are the bed's, the pen's axis along y. The leaves bend within their layers. PETG: it creeps less than PLA held bent",
10
10
  "description": "A shuttle holding the pen on two tapered leaves: a parallel guide. Its spring is the pen's pressure; an SG90 on a stock horn lifts it. Drawn at rest, the leaves straight.",
11
11
  "anchors": {
12
+ "clamp": {"at": ["pen_x", 0, "thick"], "axis": [0, 0, 1]},
12
13
  "mount": {"at": [0, 0, "half"], "axis": [0, 0, -1], "ref": [1, 0, 0]},
13
14
  "tool": {"at": ["pen_x", "paper", "half"], "axis": [0, 1, 0], "ref": [1, 0, 0]},
14
15
  "pen": {"at": ["pen_x", "paper - arm.press", "half"], "axis": [0, 1, 0], "ref": [1, 0, 0]},
@@ -32,8 +33,6 @@
32
33
  "block_x": {"value": 8, "unit": "mm", "rule": "Half the bolt block's length along x"},
33
34
  "shuttle": {"value": 14, "unit": "mm", "rule": "Half the shuttle's height along y"},
34
35
  "bolt_y": {"value": 4, "unit": "mm", "rule": "Half the bolts' spacing along x"},
35
- "bolt": {"value": "m3.clearance + x1c.hole_comp", "unit": "mm", "rule": "M3 clearance, through the block"},
36
- "clamp": {"value": "m3.clearance - 0.6", "unit": "mm", "rule": "The pen's clamp screw, self-tapped through the shuttle's wall", "kind": "community"},
37
36
  "lug_x0": {"value": 43, "unit": "mm", "rule": "The lug the horn lifts, its left edge"},
38
37
  "lug_x1": {"value": 47.5, "unit": "mm", "rule": "Its right edge, clear of the pen"},
39
38
  "lug_y": {"value": -22.2, "unit": "mm", "rule": "Its underside, a hair above the horn at rest"},
@@ -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 base's column.
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", "arm", "m3"],
6
+ "uses": ["x1c", "arm"],
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": "arm.bridge_low - arm.face - 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", "arm", "m3"],
6
+ "uses": ["x1c", "arm"],
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,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 upper arm'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", "arm", "m3"],
6
+ "uses": ["x1c", "arm"],
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 upper arm 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": "arm.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": "arm.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": "arm.bearing_bore - x1c.press", "unit": "mm", "rule": "A close slide into the bearing's bore, clamped end to end by the upper arm's screw"},
21
23
  "width": {"value": "arm.bearing_width", "unit": "mm", "rule": "The bearing"},
22
24
  "collar_top": {"value": "arm.bridge_low + arm.bridge - width - arm.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 upper arm"},
25
27
  "hex_long": {"value": 5, "unit": "mm", "rule": "Into the arm'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 arm's M3"},
28
+ "pilot_depth": {"value": 12, "unit": "mm", "rule": "The pilot in the hexagon's top, for the upper arm'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"},