@rulecad/cad 0.7.56 → 0.7.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md CHANGED
@@ -93,6 +93,63 @@ variable says which rule it comes from. Follow these steps; they're what makes a
93
93
  drawn: one axis through the stack, a clearance hole in each part passed, a pilot, insert or nut at the far end, the
94
94
  length chosen from what is sold, thread engaged, the seat under the head and the key's way to it, and `cad list`
95
95
  counts the screws. Report what it finds with its numbers, and fix the part, never the relation, to make it pass.
96
+ - **Beams are held to each other by a join**, not a fasten: `{ "kind": "blind", "a": "y1.a", "b": "x1.back@120" }`
97
+ (`npx cad add join …`), `b` the place on the other beam where a's end meets it. A blind or end-tap join taps a's end,
98
+ drills b and adds its screw to the fasten checks and the list. A bracket, gusset or splice join with `"fitting":
99
+ "printed"` adds its printed fitting, sized from `"load"` (N, default 100) by finite elements, and its screws into both
100
+ beams' slots: report the fitting's grams, margin and stiffness from `cad check` with that load, and say the stiffness
101
+ leaves out the slot nuts. A bought fitting is a rule set named in `"fitting"` (`fitting-motedis-bracket-20-b6`;
102
+ bracket, gusset, splice, hidden and anchor joins): its screws and nuts are its set's, its price goes on `cad list`,
103
+ and its stiffness is its set's estimate, so report it as one. Choose printed or bought from what `cad list` costs
104
+ and what each stiffness rests on, and say both. A `fitting.fit` failure means the set is made for another profile
105
+ or slot: choose another set, never edit the set to pass. The other kinds are checked where they meet and say their
106
+ fitting comes later (`join.fitting`). Move the beam to fix `join.geometry`, never the address, unless the
107
+ address is what was wrong; `join.stiffness` says whether it rests on an estimate or on the joint rig's
108
+ measurement (and its date): report it as it says. A `join.drop` is a prediction for a beam held by one join, to
109
+ measure and write back with `cad measured`, never a figure to tune.
110
+ - **Beams are cut and drilled by hand from their sheets and jigs**: `npx cad beams <project>/<assembly>` writes a
111
+ cut-and-drill sheet per mark, and `--jigs` writes the jigs as a plate in `exports/` (a drill guide per distinct
112
+ hole across a beam, a tap guide per tapped end, a cut-length stop per length, a squaring corner of the hand each square join takes),
113
+ each marked with the marks it is for. Report each jig's grams and margin and that it prints clean; a hole too far
114
+ from both ends for one print is a `jig.drill` warning: say to mark it from the sheet. A `jig.tap` or `jig.square`
115
+ warning is a tapped end or a join with no jig that fits: tap it by eye, or square it with an engineer's square.
116
+ - **A bay closed by a sheet is a `panel` item**: `{ "id": "front", "panel": { "sheet": "acrylic", "thickness": 3,
117
+ "bay": ["x1", "z2", "x2", "z1"], "out": [0, -1, 0] } }`. It is cut to the bay with its clips at a pitch, each
118
+ fastened into its slot; report its size and grams from `cad check` (`panel.size`) and the clips from `cad list`.
119
+ `"door": { "hinge": "z1" }` makes it a door on two printed hinges, turning on a joint: run `cad check --sweep` and
120
+ report what it finds. A turn-button latch shown shut blocks the door in its first degree, which is right.
121
+ - **A board or supply on a frame is a bought item with `"mount"`**: `{ "id": "psu", "bought": "supply-24v",
122
+ "variant": "LRS-50-24", "mount": { "on": "rail.top@-90" } }`. Its holes come from its rule set (`mount_holes`, x then
123
+ y for each); add them from the maker's drawing, with their source, before mounting a device whose set has none. A
124
+ wire along a beam is a run in its `via`, `{ "along": "rail.front", "from": 300, "to": 60 }`: report its length and
125
+ its clips from `wire.length` and `wire.run`.
126
+ - **Linear motion on a beam is a guide**: `"guides": [{ "kind": "rail", "rail": "rail-mgn12", "carriage": "MGN12H",
127
+ "on": "x1.top", "from": 50, "length": 300 }]`. Never draw a rail or carriage yourself, nor type its screws: the
128
+ guide places the rail, its screws into the slot at its pitch and each carriage on a sliding joint with its true
129
+ travel. Fix a table on a carriage with a fixed joint at `g1-carriage-1.top`. Run `cad check --sweep`, and report
130
+ `guide.fit`, the travel and each carriage's `joint.moment` margin; a fail there means a longer carriage
131
+ (`MGN12H`), a larger rail or the load nearer the carriage, never a changed rating.
132
+ On a V-slot beam the same guide can be wheels: `{ "kind": "wheels", "wheel": "v-wheel-solid", "on": "x1.top",
133
+ "from": 50, "length": 400 }` (the plate over that face, its wheels in the tracks either side). A plain T-slot is
134
+ refused for wheels: use a rail or a `slider` there. Report the wheels' `guide.fit` seat, the travel and the
135
+ plate's `joint.moment` margin, and say the wheels' ratings are estimates.
136
+ Two smooth rods and a lead screw are two guides: `{ "kind": "rods", "on": "x1.top", "from": 60, "length": 101,
137
+ "endstop": { "at": "x1.front@82" } }` and `{ "kind": "screw", "guide": "g1", "motor": { "model": "28byj48" } }`.
138
+ Never draw the holders, motor plate, coupler or carriage yourself: the guides place them by addresses and give the
139
+ motor its lead screw. Report the travel, `motor.torque`'s margin, `guide.coupler`, the bearings' `joint.moment`, the
140
+ endstop's home, and each printed part's grams and margin; if the endstop is refused, use the address it names.
141
+ - **A part screwed onto a beam is a `fasten` into a slot**: `"into": "x1.top"` (or `x1.top.2`, or `x1.top@120`, the
142
+ middle of its screws), the
143
+ part's holes drawn with `v.fixings` at the slot's spacing, `"nut"` the slot nut's kind. `fasten.slot` fails a hole off
144
+ a slot's centre line, with the distance: move the hole. `frame.nut` fails slide-in nuts in a slot that joins close
145
+ at both ends: use the kind it names (`"nut": "drop-in"`). `frame.preload` lists nuts to load before a join; tell
146
+ the user, and `cad order` shows them on the step.
147
+ - **A frame's build is `cad order`**: from bars to a square frame in numbered steps (cut, drill and tap, sides built
148
+ flat and squared, nuts to load, joins with their torque, the diagonals, then the rest). Give the user its steps and
149
+ its diagonals (`frame.square`: each and the difference to accept). If it is refused for a slot's nuts, change the
150
+ nut to the kind it names; never reorder the joins to get round it. Where a side is built on the frame, not flat,
151
+ the build says why; pass that on. Its load and "Slide ... screw into ... head first" steps give each nut and head a
152
+ way into its slot: pass them on as written. `cad check` counts the same steps.
96
153
  - A fit with `"fastens": true` is for what holds parts without screws (pins, a press, a clip). An older assembly with
97
154
  a holes fit (`{ "holes": "pcb.board", "into": "case.body", … }`) and a fit that fastens the same parts gets a
98
155
  `fasten.suggest` note from `cad check`: `npx cad add fasten <project>/<assembly> --from-fits` puts the fasten in
package/CHANGELOG.md CHANGED
@@ -5,6 +5,47 @@ print (a hole's diameter, a seat's depth, a part's outline). Each release lists
5
5
  its reason. A **fasten** is an entry in an assembly's `"fasten"` list: one screwed joint, naming the screw by thread
6
6
  and head, the parts it passes through and the part it ends in.
7
7
 
8
+ ## 0.7.57: frames in assemblies (Frames 2)
9
+
10
+ ### Added
11
+
12
+ - **Joins** (`"joins"`, `cad add join`): beam to beam by kind. A blind or end-tap join taps one beam's end, drills
13
+ the access hole across the other and adds its screw to the fasten checks and `cad list`; a bracket, gusset, splice,
14
+ cube, anchor or hinge join takes a printed fitting (`"fitting": "printed"`) or a bought one by its rule set's name.
15
+ `join.geometry` fails a beam that stands off or runs into the face, with the gap; `join.stiffness` is an estimate
16
+ until the joint rig measures it, and says so.
17
+ - **Screws into a slot:** a fasten `"into": "x1.top"` (or `x1.top.2`, `x1.top@120`) uses the slot nut `nutFor`
18
+ picks, and `fasten.slot` holds the holes to the slot's centre line; a distance places the screws as a group.
19
+ `frame.nut` fails slide-in nuts in a slot that joins close at both ends and names the nut that drops in;
20
+ `frame.preload` lists nuts to load before a join closes their way.
21
+ - **Fittings:** printed brackets, gussets and splice plates; panels cut to their bay with clips; doors on printed
22
+ hinges, swept, a latched door failing its sweep; end caps, feet and castors; mounts for boards and supplies read
23
+ from their own rule sets, fans, drag chains, DIN rail, cable clips and runs along a slot; bought fittings with their
24
+ price on `cad list`.
25
+ - **Guides:** linear rails with their screws and slot nuts at the rail's pitch, each carriage on a sliding joint and
26
+ held to its ratings (`joint.moment`); V-wheel carriages seated from the profile's rules, the eccentrics' range
27
+ checked; rods with their holders, a lead screw with its motor plate, coupler and endstop, placed by addresses.
28
+ - **Jigs** (`cad beams --jigs`): drill and tap guides, cut-length stops and squaring corners of both hands, from the
29
+ assembly, laid out as one plate.
30
+ - **A frame's build** (`cad order`, the build page): from bars to a square frame in numbered steps, every screw head
31
+ and slot nut given a way into its slot, joins left snug until squared; an order that would trap a nut is refused
32
+ with the slot and the join. `frame.square` per bay.
33
+ - **`motor.heat`** reads the driver current the motor item sets; its case temperature is an estimate and says so.
34
+ - **`cad measured`** takes the joint rig's readings, a join's measured stiffness and a slot nut's hold along its
35
+ slot, and checks every value before it writes any.
36
+ - EXAMPLES.md chapter 16, a frame with a moving axis.
37
+
38
+ ### Changed
39
+
40
+ - A part fastened by a fit only to a part a joint moves, but placed where it stands, is said by name
41
+ (`assembly.fastened`).
42
+ - A beam placed by its ends counts as held in the loose-part check.
43
+ - Printed fittings in a project of a plastic the kit has no set for are refused by name, where they were sized as PLA.
44
+
45
+ ### Printed sizes that moved
46
+
47
+ None in the examples and templates that existed before. CI's dimension table compares every one.
48
+
8
49
  ## 0.7.56: screws through fixings, end to end (Fixings 3)
9
50
 
10
51
  ### What reads fixings now
package/EXAMPLES.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [The tutorial](TUTORIAL.md) ends with a wall hook checked against its screw. These examples carry on from there, one
4
4
  for each thing the [README](README.md) describes after that: parts, variants and releases, joints and poses, a model
5
- from elsewhere, an optimised part, a board, a mechanism printed flat, gears, a gearbox, a motor, a robot joint, a machine sized from its task, and a bracket screwed on. Each is a few files and the commands to run
5
+ from elsewhere, an optimised part, a board, a mechanism printed flat, gears, a gearbox, a motor, a robot joint, a machine sized from its task, a bracket screwed on, and a frame of beams with a moving axis. Each is a few files and the commands to run
6
6
  them. The tests write every file here and run every command, so what you read is what works.
7
7
 
8
8
  They start from a workspace `npm create rulecad my-designs` makes, as the tutorial does, and run in order: later
@@ -6406,3 +6406,365 @@ the strength figures under `fasten.load` are not, and their findings say so. Pri
6406
6406
  nut pockets and slots at three fits, a counterbore and printed threads. Its results go back with `cad measured
6407
6407
  benchmarks/fixings-test <rule>=<figure>`, and every design drawn from `v.fixings` follows them the next time it is
6408
6408
  built.
6409
+
6410
+ ## 16. A frame: beams, joins and an axis
6411
+
6412
+ A small box of aluminium extrusion with a moving axis along its top: the kind of frame a camera slider, a plotter or a
6413
+ test rig starts from. Every beam is one profile, MISUMI's 2020 (`2020-misumi-hfs5`), placed by its two ends, so its
6414
+ length is where its ends are. The joins say how beams hold each other: a blind join hides a screw inside the corner, a
6415
+ printed bracket goes on the outside. Feet and end caps finish the posts. Two rods on the top front rail carry a printed
6416
+ carriage, driven by a lead screw from a NEMA 17. A printed plate for a board is screwed into a slot. Then the frame is
6417
+ cut, drilled and printed from what the check worked out: the cut list, a sheet for each beam, the jigs, one plate of
6418
+ printed parts and the order to build it in. Two mistakes follow, each caught by name.
6419
+
6420
+ ```json projects/frame/project.json
6421
+ {
6422
+ "name": "frame",
6423
+ "title": "A frame with a moving axis",
6424
+ "printer": "x1c",
6425
+ "material": "PLA",
6426
+ "objects": ["plate"]
6427
+ }
6428
+ ```
6429
+
6430
+ ### The plate
6431
+
6432
+ The board plate is the one part drawn by hand. It lies on a beam's slotted face, two M4 holes from `v.fixings` along
6433
+ its middle, so both screws go into one slot's nuts. Its thickness is chosen with its screws: 3 mm of plate and the
6434
+ slot's 2 mm lip leave an M4x8 a hex nut's height of thread in a slot nut without reaching the slot's floor.
6435
+
6436
+ ```json projects/frame/objects/plate.json
6437
+ {
6438
+ "$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
6439
+ "name": "plate",
6440
+ "title": "Board plate",
6441
+ "version": "0.1.0",
6442
+ "uses": ["x1c"],
6443
+ "material": "PLA",
6444
+ "orientation": "Flat, the face that lies on the beam down",
6445
+ "variables": {
6446
+ "thick": { "value": "x1c.layer * 15", "unit": "mm", "rule": "The plate: whole layers, and thin enough that an M4x8 screw reaches a nut's height of thread in the slot nut", "tweak": { "min": 2, "max": 4 } },
6447
+ "long": { "value": 70, "unit": "mm", "rule": "Along the beam: a small board and a screw beyond each end of it", "tweak": { "min": 40, "max": 120 } },
6448
+ "wide": { "value": 20, "unit": "mm", "rule": "Across the beam: as wide as its face", "tweak": { "min": 20, "max": 60 } },
6449
+ "pitch": { "value": 50, "unit": "mm", "rule": "Between the two screws", "tweak": { "min": 10, "max": 100 } },
6450
+ "round": { "value": 3, "unit": "mm", "rule": "The plate's corners, rounded" }
6451
+ }
6452
+ }
6453
+ ```
6454
+
6455
+ ```js projects/frame/objects/plate.js
6456
+ // A printed plate a board screws to, held on a beam's slotted face by two M4 screws into slot nuts.
6457
+ import jscad from '@jscad/modeling'
6458
+ const { roundedRectangle } = jscad.primitives
6459
+ const { extrudeLinear } = jscad.extrusions
6460
+
6461
+ export function main (v) {
6462
+ const plate = extrudeLinear({ height: v.thick }, roundedRectangle({ size: [v.long, v.wide], roundRadius: v.round }))
6463
+ return v.ops.subtract(plate, ...[-1, 1].map((s) => v.fixings.hole('M4', { depth: v.thick, at: [s * v.pitch / 2, 0, v.thick] })))
6464
+ }
6465
+ ```
6466
+
6467
+ ```sh
6468
+ npx cad check frame/plate
6469
+ ```
6470
+
6471
+ ### The box
6472
+
6473
+ Up is z, and the box stands on its feet at z = 0. Four posts, `p1` to `p4`, stand 200 mm tall at the corners of a
6474
+ 300 by 260 mm rectangle (their centres 280 by 240 mm apart). Four rails run along x between them, `x1` and `x2` at
6475
+ 30 mm up, `x3` and `x4` at 170 mm, and four along y, `y1` and `y2` at 10 mm up, `y3` and `y4` at 190 mm. Each beam is
6476
+ placed by `from` and `to`, the middles of its two ends, so a rail between two posts starts and stops at their faces.
6477
+ An address names a place on a beam: `p1.back@30` is the face of `p1` that looks back along x, 30 mm from its end `a`;
6478
+ `x1.top@50%` is half way along the top face of `x1`.
6479
+
6480
+ - **Blind joins.** Twelve of the sixteen corners are `blind`: the rail's end is tapped M5, a button-head screw sits
6481
+ inside the post's slot under its lips, and an access hole across the post lets a hex key reach it. Nothing shows
6482
+ from outside, and the rail stays as long as the gap.
6483
+ - **Printed brackets.** The two bottom rails along y, `y1` and `y2`, are held by `bracket` joins with `"fitting":
6484
+ "printed"`: a corner bracket from `@rulecad/frames`, drawn from the profile's slot, sized from a 100 N load, on two
6485
+ M4 screws into slot nuts. Their nuts are `drop-in`, since those slots are closed at both ends by the time the
6486
+ brackets go on.
6487
+ - **Feet and caps.** A printed `foot` on each post's end `a`, screwed into the end's bore, which the post's own `ops`
6488
+ tap M5 as the foot asks. A printed `end-cap` on each end `b`, pushed on: its pegs go 5 mm into the slots and the bore,
6489
+ a press fit (`"min": -5`).
6490
+ - **The axis.** A `rods` guide on the top face of `x3`, from 100 to 250 mm along it: two 8 mm rods in printed holders,
6491
+ a printed carriage on two LM8UU bearings. A `screw` guide drives it: a printed motor plate before the first holder,
6492
+ a NEMA 17 on it, a coupler and an 8 mm lead T8 screw, a 608 bearing for the screw in each holder and the lead nut on
6493
+ the carriage. Every part is placed by the guide from the beam's addresses. The holders' and the plate's screws go
6494
+ into `x3`'s side slots, closed at both ends by its joins, so the guide's `"nut"` is `drop-in` too. The driver is set
6495
+ to 1.2 A, where the motor's case stays under PLA's softening point.
6496
+ - **The board plate.** At `x1.top@50%`, fastened into `x1`'s top slot on drop-in nuts. No screw length is given: the
6497
+ check chooses the shortest sold that fits.
6498
+ - **Loads.** The carriage carries 0.5 kg, and the axis pushes 20 N along the rods (a cable chain's drag, or a tool
6499
+ pressed along the way: a figure to replace with the task's own).
6500
+
6501
+ ```json projects/frame/assemblies/box.json
6502
+ {
6503
+ "$schema": "https://jonibach.github.io/rulecad/schemas/assembly.schema.json",
6504
+ "title": "A box of 2020 with a moving axis",
6505
+ "kind": "fit",
6506
+ "description": "Four posts, four rails along x and four along y, all one profile placed by their ends. Blind joins at every corner but the two bottom rails along y, which are held by printed brackets. Printed feet and end caps on the posts. A carriage on two rods along the top front rail, driven by a lead screw from a NEMA 17, and a board plate on the bottom front rail.",
6507
+ "items": [
6508
+ { "id": "p1", "beam": { "profile": "2020-misumi-hfs5", "ops": [{ "op": "tap", "at": "a", "thread": "M5", "depth": 18.5 }] }, "from": [10, 10, 0], "to": [10, 10, 200] },
6509
+ { "id": "p2", "beam": { "profile": "2020-misumi-hfs5", "ops": [{ "op": "tap", "at": "a", "thread": "M5", "depth": 18.5 }] }, "from": [290, 10, 0], "to": [290, 10, 200] },
6510
+ { "id": "p3", "beam": { "profile": "2020-misumi-hfs5", "ops": [{ "op": "tap", "at": "a", "thread": "M5", "depth": 18.5 }] }, "from": [290, 250, 0], "to": [290, 250, 200] },
6511
+ { "id": "p4", "beam": { "profile": "2020-misumi-hfs5", "ops": [{ "op": "tap", "at": "a", "thread": "M5", "depth": 18.5 }] }, "from": [10, 250, 0], "to": [10, 250, 200] },
6512
+ { "id": "x1", "beam": { "profile": "2020-misumi-hfs5" }, "from": [20, 10, 30], "to": [280, 10, 30] },
6513
+ { "id": "x2", "beam": { "profile": "2020-misumi-hfs5" }, "from": [20, 250, 30], "to": [280, 250, 30] },
6514
+ { "id": "x3", "beam": { "profile": "2020-misumi-hfs5" }, "from": [20, 10, 170], "to": [280, 10, 170] },
6515
+ { "id": "x4", "beam": { "profile": "2020-misumi-hfs5" }, "from": [20, 250, 170], "to": [280, 250, 170] },
6516
+ { "id": "y1", "beam": { "profile": "2020-misumi-hfs5" }, "from": [10, 20, 10], "to": [10, 240, 10] },
6517
+ { "id": "y2", "beam": { "profile": "2020-misumi-hfs5" }, "from": [290, 20, 10], "to": [290, 240, 10] },
6518
+ { "id": "y3", "beam": { "profile": "2020-misumi-hfs5" }, "from": [10, 20, 190], "to": [10, 240, 190] },
6519
+ { "id": "y4", "beam": { "profile": "2020-misumi-hfs5" }, "from": [290, 20, 190], "to": [290, 240, 190] },
6520
+ { "id": "foot1", "fitting": { "kind": "foot", "profile": "2020-misumi-hfs5" }, "at": "p1.a" },
6521
+ { "id": "foot2", "fitting": { "kind": "foot", "profile": "2020-misumi-hfs5" }, "at": "p2.a" },
6522
+ { "id": "foot3", "fitting": { "kind": "foot", "profile": "2020-misumi-hfs5" }, "at": "p3.a" },
6523
+ { "id": "foot4", "fitting": { "kind": "foot", "profile": "2020-misumi-hfs5" }, "at": "p4.a" },
6524
+ { "id": "cap1", "fitting": { "kind": "end-cap", "profile": "2020-misumi-hfs5" }, "at": "p1.b" },
6525
+ { "id": "cap2", "fitting": { "kind": "end-cap", "profile": "2020-misumi-hfs5" }, "at": "p2.b" },
6526
+ { "id": "cap3", "fitting": { "kind": "end-cap", "profile": "2020-misumi-hfs5" }, "at": "p3.b" },
6527
+ { "id": "cap4", "fitting": { "kind": "end-cap", "profile": "2020-misumi-hfs5" }, "at": "p4.b" },
6528
+ { "id": "plate", "object": "plate", "at": "x1.top@50%" }
6529
+ ],
6530
+ "joins": [
6531
+ { "kind": "blind", "a": "x1.a", "b": "p1.back@30" }, { "kind": "blind", "a": "x1.b", "b": "p2.front@30" },
6532
+ { "kind": "blind", "a": "x2.a", "b": "p4.back@30" }, { "kind": "blind", "a": "x2.b", "b": "p3.front@30" },
6533
+ { "kind": "blind", "a": "x3.a", "b": "p1.back@170" }, { "kind": "blind", "a": "x3.b", "b": "p2.front@170" },
6534
+ { "kind": "blind", "a": "x4.a", "b": "p4.back@170" }, { "kind": "blind", "a": "x4.b", "b": "p3.front@170" },
6535
+ { "kind": "bracket", "a": "y1.a", "b": "p1.top@10", "fitting": "printed", "nut": "drop-in" },
6536
+ { "kind": "bracket", "a": "y1.b", "b": "p4.bottom@10", "fitting": "printed", "nut": "drop-in" },
6537
+ { "kind": "bracket", "a": "y2.a", "b": "p2.top@10", "fitting": "printed", "nut": "drop-in" },
6538
+ { "kind": "bracket", "a": "y2.b", "b": "p3.bottom@10", "fitting": "printed", "nut": "drop-in" },
6539
+ { "kind": "blind", "a": "y3.a", "b": "p1.top@190" }, { "kind": "blind", "a": "y3.b", "b": "p4.bottom@190" },
6540
+ { "kind": "blind", "a": "y4.a", "b": "p2.top@190" }, { "kind": "blind", "a": "y4.b", "b": "p3.bottom@190" }
6541
+ ],
6542
+ "fits": [
6543
+ { "a": "cap1", "b": "p1", "fastens": true, "min": -5, "note": "An end cap, its pegs pushed 5 mm into the slots and the bore" },
6544
+ { "a": "cap2", "b": "p2", "fastens": true, "min": -5, "note": "An end cap, its pegs pushed 5 mm into the slots and the bore" },
6545
+ { "a": "cap3", "b": "p3", "fastens": true, "min": -5, "note": "An end cap, its pegs pushed 5 mm into the slots and the bore" },
6546
+ { "a": "cap4", "b": "p4", "fastens": true, "min": -5, "note": "An end cap, its pegs pushed 5 mm into the slots and the bore" }
6547
+ ],
6548
+ "guides": [
6549
+ { "kind": "rods", "on": "x3.top", "from": 100, "length": 150, "nut": "drop-in" },
6550
+ { "kind": "screw", "guide": "g1", "screw": "t8-screw", "motor": { "model": "nema17", "current": 1.2 } }
6551
+ ],
6552
+ "fasten": [
6553
+ { "screw": "M5 cap", "through": ["foot1"], "into": "p1", "at": ["foot1.b1"], "note": "Foot 1" },
6554
+ { "screw": "M5 cap", "through": ["foot2"], "into": "p2", "at": ["foot2.b1"], "note": "Foot 2" },
6555
+ { "screw": "M5 cap", "through": ["foot3"], "into": "p3", "at": ["foot3.b1"], "note": "Foot 3" },
6556
+ { "screw": "M5 cap", "through": ["foot4"], "into": "p4", "at": ["foot4.b1"], "note": "Foot 4" },
6557
+ { "screw": "M4 button", "through": ["plate"], "into": "x1.top", "holes": "plate.body", "nut": "drop-in", "note": "The board plate" }
6558
+ ],
6559
+ "loads": [
6560
+ { "mass": 0.5, "at": "g1-carriage-1.top", "note": "What the carriage carries" },
6561
+ { "joint": "g1-1", "force": 20, "note": "A push along the rods: a cable chain's drag, or a tool pressed along the way" }
6562
+ ]
6563
+ }
6564
+ ```
6565
+
6566
+ ```sh
6567
+ npx cad check frame/box
6568
+ npx cad check frame/box --sweep --steps 12
6569
+ ```
6570
+
6571
+ What the check says, piece by piece:
6572
+
6573
+ - `join.geometry`: each of the sixteen ends meets its face square and flush, where `b` says, on the slot's centre line.
6574
+ `join.end`: all 24 beam ends are joined or capped.
6575
+ - A blind join's screw, followed as any `fasten` is: an M5x12 button, 10 mm into the rail's own tapped thread (two
6576
+ diameters in aluminium, `engagement.aluminium`), its head bearing on the post's lips from inside: 17.9 mm² of
6577
+ aluminium either side of the opening takes 3677 N, so it is tightened to 3.68 N m at most.
6578
+ - A bracket: 4.8 mm thick and 4.07 g, 2.86 times under PLA's strength at its 100 N by finite elements, two M4x10 cap
6579
+ screws, each into a drop-in nut with 4 mm of thread.
6580
+ - The feet: an M5x16 cap through each foot's 5 mm floor and 11 mm into the post's tapped end.
6581
+ - The board plate: each screw over the centre line of `x1`'s top slot (`fasten.slot`), at 105 and 155 mm from its end
6582
+ a; M4x8 button chosen, 3.8 mm into its nut and 1 mm short of the slot's floor. `frame.nut`: the drop-in nuts go in
6583
+ through the slot's opening, anywhere along it.
6584
+ - The axis: the carriage slides 99.5 mm (`guide.travel`); the motor's shaft goes 12.5 mm into the coupler, half of
6585
+ it, so it stops short of the screw coming in from the other end (`guide.coupler`). `motor.torque`: 127.2 N at the
6586
+ carriage against the 20 N asked, 6.36 times over; it moves at 80 mm/s, and holds with the power off on the motor's
6587
+ detent (0.012 against 0.025 N m). `motor.heat`: the case reaches 53.8 °C at 1.2 A, under PLA's 57 °C.
6588
+ `joint.moment`: 556 g carried, the worse bearing takes 2.7 N against an LM8UU's 400 N.
6589
+ - `frame.square`: each bay's two diagonals, to measure when building it. The two sides along x have a 260 by 120 mm
6590
+ opening: each diagonal 286.36 mm, and a difference of up to 0.91 mm to accept from beams cut to ±0.5 mm.
6591
+ - `join.stiffness`: what each join puts at the rail's end when the frame is solved. A blind join is 1.5 N·m/mrad in
6592
+ bending and 0.3 in twist, an estimate; a bracket's bending, 0.095 N·m/mrad, is its own by finite elements, and the
6593
+ slot nuts and lips are in neither. Both stay estimates until the joint rig (issue 264) measures one.
6594
+
6595
+ The sweep moves the carriage from one end of its travel to the other, 0 to 99.5 mm in 12 steps: nothing collides.
6596
+
6597
+ ### Strong enough, and small
6598
+
6599
+ Each printed part is sized from a named load to about twice the margin, where its load sizes it at all:
6600
+
6601
+ | Part | Grams | Load it is sized for | Margin |
6602
+ |---|---|---|---|
6603
+ | Corner bracket (× 4) | 4.1 | 100 N across the rail at its screw | 2.86, by finite elements |
6604
+ | Carriage | 23.6 | 50 N on its middle, between its bearings | 6.04 |
6605
+ | Motor plate | 10.5 | 50 N along the beam at the shaft's height | 4.95 |
6606
+ | Rod holder (× 2) | 17.6 | 50 N along the beam at the rods' height | 24.3 |
6607
+ | Foot (× 4) | 7.0 | 250 N down the post | 78.8 |
6608
+ | End cap (× 4) | 1.3 | none: pushed on | |
6609
+ | Board plate | 5.1 | its screws' seat: 1124 N under each head | |
6610
+
6611
+ The bracket is the part its load sizes: thinner, it would bend past its margin. The others are sized by what they hold
6612
+ rather than what they carry: the carriage by its two bearings' pockets and the nut's bore, the holder by the 608
6613
+ bearing pressed into it, the plate by the motor's boss and its four screws, the foot by the counterbore its screw's
6614
+ head sinks into. Each is as small as those allow. The margins under 2.86 come from beam formulas or coarse finite
6615
+ elements on PLA's 39 MPa (`pla.strength`, a community figure), so each is an estimate, and the finding says so.
6616
+
6617
+ ### Cut, drilled and tapped
6618
+
6619
+ ```sh
6620
+ npx cad list frame/box
6621
+ npx cad beams frame/box
6622
+ npx cad beams frame/box --jigs
6623
+ ```
6624
+
6625
+ `cad list` gives the cut list. The beams come in seven marks, beams cut and drilled alike sharing one: `A`, the four
6626
+ rails along x at 260 mm, each tapped M5 18.5 mm deep at both ends; `B`, the two bracket-held rails at 220 mm, cut
6627
+ square and nothing more; `C`, the two top rails along y, tapped; and `D` to `G`, the four posts at 200 mm, each tapped
6628
+ at its foot, with three access holes on the faces its rails meet. All twelve come out of one 4000 mm bar, with a
6629
+ 3 mm kerf and 10 mm trimmed off its first end, leaving a 1234 mm offcut. Then the bought parts (the rods, bearings,
6630
+ coupler, screw, nut and motor), the fasteners by size with the packs to buy, and 124 g printed in 17 parts, about
6631
+ 134 minutes of printing. The fasteners, as `cad list` gives them:
6632
+
6633
+ - 12 × M5x12 button, for the blind joins.
6634
+ - 16 × M4x10 cap, with 16 of the 18 drop-in nuts, for the brackets, the rod holders and the motor plate.
6635
+ - 2 × M4x8 button, with the other 2 drop-in nuts, for the board plate.
6636
+ - 4 × M5x16 cap, for the feet.
6637
+ - 4 × M3x8 cap, for the motor on its plate.
6638
+ - 4 × M3x12 button, for the lead nut's flange on the carriage.
6639
+
6640
+ `cad beams` writes a cut-and-drill sheet for each mark, `exports/frame/box.beam-A.svg` and on: its length, each
6641
+ operation dimensioned from end `a`, and which face is up. `--jigs` makes the jigs the beams take, as one plate,
6642
+ `exports/frame/box.jigs.3mf`: a tap guide for the M5 ends, a cut-length stop for each length (260, 220 and 200 mm),
6643
+ two drill guides for the posts' access holes (one 30 mm from an end, one 10 mm), and a squaring corner of each hand
6644
+ for the blind joins, 8 jigs in 12 parts. Each is marked with what it is for, and prints without supports.
6645
+
6646
+ ### Printed on one plate
6647
+
6648
+ ```sh
6649
+ npx cad plates frame/box
6650
+ ```
6651
+
6652
+ Every printed part of the frame goes on one plate of the X1C's bed, laid as each prints: the four brackets, the four
6653
+ feet and caps, the two rod holders, the carriage, the motor plate and the board plate, 17 parts and 124 g, spaced by
6654
+ the first layer's rule (0.84 mm). The plate is written as an assembly, `box-base-1`, and checked as one print: no
6655
+ overhang past 45°, nothing in mid-air, nothing too near its neighbour on the first layer.
6656
+
6657
+ ### Built in order
6658
+
6659
+ ```sh
6660
+ npx cad order frame/box
6661
+ ```
6662
+
6663
+ `cad order` takes the frame from bars to square in 37 numbered steps, and `cad check` counts the same 37
6664
+ (`assembly.order`):
6665
+
6666
+ 1. Cut the beams, mark by mark, from the one bar.
6667
+ 2. Drill and tap each mark as its sheet shows, and write the item on each beam.
6668
+ 3. Side 1, the front (`p1`, `p2`, `x1` and `x3`), built flat on the bench, a join at a time, each with its screw, its
6669
+ 3 mm hex key and its torque (steps 3 to 6). Each join is left snug, then the side is squared by its diagonals and
6670
+ its joins tightened to their torque (step 7).
6671
+ 4. Side 2, the back, the same (steps 8 to 12).
6672
+ 5. The rails along y go on side 1 (steps 13 to 16), and side 2 goes on as one (step 17): the heads of its blind joins
6673
+ slide into the posts' slots from their ends.
6674
+ 6. The two bays along y are squared (step 18).
6675
+ 7. The rest is mounted: the feet and caps, the board plate, the holders, the carriage, the motor plate, the rods,
6676
+ the bearings, the motor, the coupler, the screw and its nut (steps 19 to 37).
6677
+
6678
+ Every head and every nut has a way into its slot at the step that puts it there: an end of the slot that nothing has
6679
+ closed yet, and nothing already in the slot between it and that end. Here each blind join's head slides in from the
6680
+ nearer end of its post as its rail goes on, and every slot nut is a drop-in, which goes in through the opening. Where a
6681
+ slide-in nut or a head has no such way as its beam goes on, the build loads it at a step where it has one (`Load 2 ×
6682
+ ... through its end b, before cap1 goes on`, or `Slide an M5x12 button screw into x3's back slot head first ...`),
6683
+ and where no step has one, it is refused with the slot and what is in the way.
6684
+
6685
+ It ends with each kind of join's tightening: the twelve blind joins to 3.68 N m (what the lips take), the four bracket
6686
+ joins to 0.68 N m (what the PLA under each head takes).
6687
+
6688
+ ### Two mistakes, caught
6689
+
6690
+ A trapped nut. The board plate on its rail between two posts, its nuts `slide-in`, which go into a slot only from an
6691
+ open end:
6692
+
6693
+ ```json projects/frame/assemblies/trapped.json
6694
+ {
6695
+ "$schema": "https://jonibach.github.io/rulecad/schemas/assembly.schema.json",
6696
+ "title": "The board plate on slide-in nuts",
6697
+ "kind": "fit",
6698
+ "items": [
6699
+ { "id": "p1", "beam": { "profile": "2020-misumi-hfs5" }, "from": [10, 10, 0], "to": [10, 10, 200] },
6700
+ { "id": "p2", "beam": { "profile": "2020-misumi-hfs5" }, "from": [290, 10, 0], "to": [290, 10, 200] },
6701
+ { "id": "x1", "beam": { "profile": "2020-misumi-hfs5" }, "from": [20, 10, 30], "to": [280, 10, 30] },
6702
+ { "id": "plate", "object": "plate", "at": "x1.top@50%" }
6703
+ ],
6704
+ "joins": [
6705
+ { "kind": "blind", "a": "x1.a", "b": "p1.back@30" }, { "kind": "blind", "a": "x1.b", "b": "p2.front@30" }
6706
+ ],
6707
+ "fasten": [
6708
+ { "screw": "M4 button", "through": ["plate"], "into": "x1.top", "holes": "plate.body", "nut": "slide-in", "note": "The board plate" }
6709
+ ]
6710
+ }
6711
+ ```
6712
+
6713
+ `npx cad check frame/trapped` fails on `frame.nut`, and names the nut that would do:
6714
+
6715
+ ```text
6716
+ ✗ The board plate: 2 slide-in nuts (slot-nut-6-misumi-m4-slide-in) go into x1's top slot at 105 and 155 mm, between x1's end a (the blind join of x1.a to p1.back@30) and x1's end b (the blind join of x1.b to p2.front@30), which close it at both ends: a slide-in nut goes in only from an open end. slot-nut-6-misumi-m4-drop-in (an M4 drop-in nut) goes in through the opening anywhere: give "nut": "drop-in"
6717
+ ```
6718
+
6719
+ and `npx cad order frame/trapped` refuses to give an order:
6720
+
6721
+ ```text
6722
+ frame/trapped: x1's top slot: 2 slide-in nuts (slot-nut-6-misumi-m4-slide-in) for plate would be shut in between the blind join of x1.a to p1.back@30 and the blind join of x1.b to p2.front@30: whichever of the two is made second shuts them in, and a nut loaded before it can never be taken out or replaced: give "nut": "drop-in" (slot-nut-6-misumi-m4-drop-in), which goes in through the opening anywhere
6723
+ ```
6724
+
6725
+ A plate drawn for the wrong slot spacing. The same plate turned across a wider rail, a 2040 whose top face has two
6726
+ slots 20 mm apart, with its holes drawn 30 mm apart, as a 30 series beam's slots are:
6727
+
6728
+ ```json projects/frame/assemblies/spacing.json
6729
+ {
6730
+ "$schema": "https://jonibach.github.io/rulecad/schemas/assembly.schema.json",
6731
+ "title": "A plate drawn for 30 mm slots on a 2040",
6732
+ "kind": "fit",
6733
+ "items": [
6734
+ { "id": "x1", "beam": { "profile": "2040-misumi-hfs5" }, "from": [0, 0, 10], "to": [260, 0, 10] },
6735
+ { "id": "plate", "object": "plate", "at": [130, 0, 20], "rotate": [0, 0, 90], "set": { "pitch": 30, "long": 44 } }
6736
+ ],
6737
+ "fasten": [
6738
+ { "screw": "M4 button", "through": ["plate"], "into": "x1.top", "holes": "plate.body", "nut": "drop-in", "note": "The board plate" }
6739
+ ]
6740
+ }
6741
+ ```
6742
+
6743
+ `npx cad check frame/spacing` fails on `fasten.slot`, for each screw:
6744
+
6745
+ ```text
6746
+ ✗ The board plate, screw 1 (hole at -15, 0, 1.5): plate's hole is 5 mm off the centre line of x1's top.1 slot, where its 4.6 mm hole lets an M4 screw move 0.3 mm: the screw meets the face beside the slot, not its nut. x1's top slots are 20 mm apart. Move the hole 5 mm, or plate is drawn for another profile
6747
+ ✗ The board plate, screw 2 (hole at 15, 0, 1.5): plate's hole is 5 mm off the centre line of x1's top.2 slot, where its 4.6 mm hole lets an M4 screw move 0.3 mm: the screw meets the face beside the slot, not its nut. x1's top slots are 20 mm apart. Move the hole 5 mm, or plate is drawn for another profile
6748
+ ```
6749
+
6750
+ ### The build page
6751
+
6752
+ `npx cad link frame/box --md` gives a link to the model page. Its Build button opens the shopping list, the cut list
6753
+ and each beam's sheet, the plate drawn on its bed, and "Building the frame": the 37 steps, each a button that shows the
6754
+ frame at that step, with the torques and the diagonals as tables. The carriage is a slider on the page, so the axis
6755
+ can be run along its travel.
6756
+
6757
+ ### What rests on estimates
6758
+
6759
+ The beams' sections, the slot nuts, the rods, the bearings, the screw and the motor come from their makers' figures.
6760
+ Five things do not, and their findings say so:
6761
+
6762
+ - Each join's stiffness, until the joint rig (issue 264) measures one.
6763
+ - The torque a blind join's head puts on the lips, which counts their bearing and not their bending.
6764
+ - The printed parts' margins, which rest on PLA's strength and on beam formulas or coarse finite elements.
6765
+ - The motor's case temperature (`motor.heat`): the maker's rise at its rated current, scaled by the square of the
6766
+ current the driver is set to (1.2 A here), since the heat goes as the current squared.
6767
+ - The lead nut's friction on the screw, 0.15, an estimate that goes to the motor's checks with the lead.
6768
+
6769
+ The frame's own sag and sway under the carriage's load, and its lowest frequency, come with the frame checks (issues
6770
+ 265 to 267).