@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 +57 -0
- package/CHANGELOG.md +41 -0
- package/EXAMPLES.md +363 -1
- package/README.md +336 -5
- package/TUTORIAL.md +2 -0
- package/bin/cad.mjs +35 -11
- package/lib/assembly.mjs +69 -16
- package/lib/beams.mjs +2 -2
- package/lib/bought.mjs +41 -5
- package/lib/buildpage.mjs +8 -3
- package/lib/edit.mjs +10 -4
- package/lib/fasten.mjs +255 -45
- package/lib/fittings.mjs +271 -0
- package/lib/framebuild.mjs +407 -0
- package/lib/frames.mjs +4 -3
- package/lib/guides.mjs +354 -0
- package/lib/jigs.mjs +237 -0
- package/lib/joins.mjs +259 -0
- package/lib/list.mjs +22 -6
- package/lib/loads.mjs +9 -2
- package/lib/measured.mjs +64 -17
- package/lib/motors.mjs +7 -3
- package/lib/order.mjs +19 -11
- package/lib/panels.mjs +220 -0
- package/lib/plates.mjs +11 -4
- package/lib/services.mjs +132 -0
- package/lib/slotnuts.mjs +159 -0
- package/lib/task.mjs +4 -2
- package/lib/wires.mjs +2 -1
- package/package.json +4 -4
- package/schemas/assembly.schema.json +27 -5
package/README.md
CHANGED
|
@@ -391,6 +391,7 @@ starts and stops. From that the check says:
|
|
|
391
391
|
| Finding | What it checks |
|
|
392
392
|
|---|---|
|
|
393
393
|
| `fasten.holes` | One axis runs from under the head through every part: a hole 0.05 mm or more off it fails, with the distance |
|
|
394
|
+
| `fasten.slot` | Into a beam's slot: each screw over a slot's centre line within its hole's play, square to the face and along the beam (see Fastening into a slot, under Beams) |
|
|
394
395
|
| `fasten.clearance` | Each part passed through has a clearance hole for the thread as drawn on this printer, between the close and the loose figure; it says what the hole measures and what it should be |
|
|
395
396
|
| `fasten.end` | The far end is a pilot, a hole to tap, a thread drawn to print, an insert's hole or a nut's seat of this thread (a pocket on the far face, or a slot across the screw partway along it, as `v.fixings.nutTrap` cuts), or a clearance hole with `nut`; into a motor, one of its own threaded mounting holes |
|
|
396
397
|
| `fasten.length` | The length chosen where none is given: the shortest sold length that fits the stack as measured (into a motor, the longest that stops short of the end of its thread). A given length is checked for reaching the far end, bottoming out in a blind hole (1 mm is kept at the tip) and standing more than a diameter proud |
|
|
@@ -490,7 +491,10 @@ then y, then z, as `rotate` does.
|
|
|
490
491
|
- **What holds each part:** in an assembly that moves, every part but the first turns or slides on a joint, or is
|
|
491
492
|
fastened to the first: by a `fasten` where screws do it, or by a fit with `"fastens": true` where pins, a press or a
|
|
492
493
|
clip do (named in the fit's note): `{ "a": "ring", "b": "case", "fastens": true, "note": "Two push pins" }`. A part only placed somewhere is
|
|
493
|
-
said (`assembly.loose`): a ring gear resting on its case would turn with its planets.
|
|
494
|
+
said (`assembly.loose`): a ring gear resting on its case would turn with its planets. A fit that fastens does not
|
|
495
|
+
move a part: one fastened only to a part a joint moves (a table to a carriage), but placed where it stands, stays
|
|
496
|
+
there in every pose and its mass is not carried, so it is said by name (`assembly.fastened`). Place it on the moving
|
|
497
|
+
part by an anchor or an address (`"at": "g1-carriage-1.top"`).
|
|
494
498
|
- **Onto a shaft:** `{ "a": "arm", "b": "crank", "engage": "arm.thick" }` checks that a part slid onto a shaft, a pin or a
|
|
495
499
|
peg goes that far onto it along the joint between them (`fit.engage`), not just against its end: an arm resting on
|
|
496
500
|
a shaft's end touches it face to face, as a seated one does, and nothing overlaps either way, so only this tells
|
|
@@ -520,7 +524,7 @@ An item can be a motor instead of a printed object: `{ "id": "drive", "motor": {
|
|
|
520
524
|
- `motor.torque`: what reaches the joint through the gears, against the load: a fail under 1 times, a warning under the margin. It says what its figures rest on. `motor.speed`: how fast it moves and how long its range takes. Stages pass on `stageEfficiency` of the power (0.95 a mesh, an estimate).
|
|
521
525
|
- `motor.holds`: with the power on (holding torque, or stall torque) and off (detent torque, a built-in gearbox's friction, a worm that locks, gears under 50% efficient, or `"brake": "a ratchet and pawl"` on the joint). Dropping with the power off is a warning: it may be what you want.
|
|
522
526
|
- `motor.mount`: the part a motor is fastened to (a `fasten` into the motor, or a fit that `fastens`), read as drawn: how thick it is at the screw holes against the screws' size, the screws' engagement in the motor's tapped holes (the screws as bought: their length past the plate, held to the motor's `mount_hole_depth`, at least one diameter, `engagement.steel`, or it fails; a motor item's `"screw"` may name a whole screw, `"M3x8 cap"`, to check that one), and the screws' bearing on the plastic under the motor's full torque. Its screws are counted in `cad list` and `cad order` (at the length sold that stays in the motor's thread, with the key that turns them). Then the whole part bent, by FE on the part as drawn (cubes, two across the plate at the screws): the motor's weight at its centre, along `gravity` in the pose it's checked in, and its full torque (the larger of its working and holding torque), both carried into the plate where the screws clamp it. The part is held at the joint that carries it, if one does; else where it meets the printed parts it's fastened to that sit below it; failing both, on its lowest face. It reports how far the shaft's tip moves (against the driven joint's seat, where that is on the same part, since the two move together), against the printer's `fit` clearance (or the motor's `"deflection"` in mm), and the peak stress against the material's `strength`; under 2 times either fails, and says what fixes it: the plate thickness that would do (bending goes with its cube), ribs, or how much stiffer a material would have to be. Cells this coarse read a plate 10 to 20% stiff, and a cell's stress is read at its centre, so the peak is scaled up to the surface; it's an estimate, said as one. Kept in `.cache/mount`.
|
|
523
|
-
- `motor.heat`: the motor's case against the softening point of the material the project prints in. Too hot says the current to set the driver to.
|
|
527
|
+
- `motor.heat`: the motor's case against the softening point of the material the project prints in. Too hot says the current to set the driver to; the motor item's `current` set to it is read (the maker's rise at rated current, scaled by the current squared, as the heat is), so the check then passes.
|
|
524
528
|
- A `"shaft": true` fit (or `"press"`) between a motor and what it drives reads the bore from the part as drawn: that it's on the shaft (`shaft.seat`), that its flat is there (`shaft.flat`; the shaft turns to meet it, so where the flat faces doesn't matter), how much of the flat it grips (`shaft.grip`), and, pressed on, the hoop stress in the hub (`shaft.hoop`).
|
|
525
529
|
- `cad preview --check` of an assembly with a motor writes `<assembly>-check.png`: the same six views, with a label at each joint the motor's torque passes through (what reaches it, and at the loaded joint the margin and whether it holds unpowered). The rest view never carries them.
|
|
526
530
|
- `cad preview` of an assembly with a motor draws each one at work beside the picture, as SVG: `<assembly>-<motor>-curve.svg`, its torque against speed at the output with the load and the working speed marked, and `<assembly>-<motor>-train.svg`, the torque from its shaft through each stage to the joint with the load, against what the load needs there, and whether it holds with the power on and off. The numbers are the check's.
|
|
@@ -544,7 +548,7 @@ An item can be a beam, a length of an aluminium extrusion, a tube or a bar from
|
|
|
544
548
|
`@rulecad/frames` README ("Face names in an assembly").
|
|
545
549
|
- A beam is bought: drawn faint, never on a plate, on `cad list` by profile and length (`2 × profile-2020-misumi-hfs5
|
|
546
550
|
x 300 mm a beam 150 g each`, weighed by the maker's mass per metre where the sheet gives one), and in the overlap
|
|
547
|
-
check by its envelope, a plain box. `cad check` says each beam's mass beside the sheet's, and warns of a length
|
|
551
|
+
check by its envelope, a plain box less any V tracks along it. `cad check` says each beam's mass beside the sheet's, and warns of a length
|
|
548
552
|
longer than the profile is sold in. Its numbers are values: `x1.length`, `x1.width`, `x1.height`, `x1.mass`.
|
|
549
553
|
- `"ops"` lists the operations on it, each placed by an address on the beam and dimensioned from end `a`: `cut`,
|
|
550
554
|
`mitre`, `tap`, `access`, `drill`, `counterbore`, `pocket`, `notch` and `deburr`. `{ "op": "tap", "at": "a", "thread":
|
|
@@ -573,19 +577,346 @@ x along the beam, turned by its `rotate` in that frame; it moves with the beam.
|
|
|
573
577
|
with the beam's length: `"top@320" is past the end of profile-2020-misumi-hfs5 x 300: it is 300 mm long`. In a fit, an
|
|
574
578
|
address stands for the faces near it, as `item@anchor` does (`"within"`, 10 mm by default).
|
|
575
579
|
|
|
580
|
+
**Joins.** `"joins"` says how beams are held to each other. Each names an end of one beam (`a`), a place on another
|
|
581
|
+
(`b`: a face with a distance where a's end meets it, or an end for a splice, a mitre or a corner) and its kind:
|
|
582
|
+
|
|
583
|
+
```json
|
|
584
|
+
"joins": [{ "kind": "blind", "a": "y1.a", "b": "x1.back@120" }]
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
- A join puts its operations on both beams before they are built, so they are on the cut list and the sheets: a
|
|
588
|
+
`blind` join taps the end of `a` (`tap M5 x 18.5 at a`) and drills an access hole across `b` from the opposite
|
|
589
|
+
face (`access Ø5.3 at front.1@120`), sized for the key of the join's own head (an M5 button head's 3 mm key), and
|
|
590
|
+
an `end-tap` join drills a clearance hole right across `b` instead. A beam's own operation at the same place, written
|
|
591
|
+
either way (`front@120` or `front.1@120`), is the same hole, not a second one.
|
|
592
|
+
- Its screws join `"fasten"`, so they are followed, checked and counted as any fasten's are (`1 × M5x12 button` on
|
|
593
|
+
`cad list`). A blind join's button head sits inside b's slot under its lips; an end-tap's cap head sits on the lips
|
|
594
|
+
of the slot across b. `fasten.seat` holds the head to the slot (wider than the opening, and inside the slot, no
|
|
595
|
+
wider than the cavity and no taller than the room under the lips), `fasten.end` takes the thread tapped in a's end
|
|
596
|
+
bore, and `fasten.access` follows the key through the access hole. `"screw"` names another screw (`"M5x12 button"`).
|
|
597
|
+
- A `mitre` join (`"b": "y1.a"`, an end) cuts both ends at the angle that halves the corner, about the face the corner
|
|
598
|
+
lies in, each beam's length on the outside of the corner, worked out from where the two beams are (both placed by
|
|
599
|
+
their ends). Its corner key or plate comes later.
|
|
600
|
+
- Printed fittings are sized from the project's plastic (`material` in project.json): `pla` and `petg` by name.
|
|
601
|
+
Another plastic is read from its own rule set (`rules/abs.json`), which must give `strength`, `modulus` and
|
|
602
|
+
`density`; where there is none, the build is refused by name.
|
|
603
|
+
- A `bracket`, `gusset` or `splice` join with `"fitting": "printed"` adds its printed fitting from `@rulecad/frames`
|
|
604
|
+
(its README, Printed fittings) as an item of its own (`y1-x1-bracket`), placed from where the two beams are (both
|
|
605
|
+
placed by their ends), and a `fasten` for each leg or arm into its beam's slot, with the slot nut the fitting was
|
|
606
|
+
drawn for. So the screws are chosen, checked and counted like any fasten's (`2 × M5x12 cap` and their slot nuts),
|
|
607
|
+
the fitting's grams are on `cad list` under Printed, and `join.stiffness` takes the fitting's own bending stiffness
|
|
608
|
+
by finite elements in place of the estimate (its twist stays an estimate). `cad check` says the fitting's own
|
|
609
|
+
findings of it: `fitting.margin` at its named load, `fitting.screw` (the length sold it was thickened for),
|
|
610
|
+
`fitting.stiffness`, `fitting.mass` and the rest (@rulecad/frames' README lists them).
|
|
611
|
+
- A bracket goes on the side of a with more of b, its base leg on b's face and its upright on a's face that looks
|
|
612
|
+
along b; refused by name where its leg would run past b's end there.
|
|
613
|
+
- A gusset lies on a face of each beam that looks the same way, in one plane: an L at a corner, a T where b runs
|
|
614
|
+
on both sides of a; refused where its arm has no room.
|
|
615
|
+
- A splice plate lies across two ends on a face they share.
|
|
616
|
+
- `"brace": true` braces a bracket; `"load"` (N) is the design load it is sized to about twice the margin at
|
|
617
|
+
(default 100); `"nut"` chooses the slot nuts' kind.
|
|
618
|
+
- An item may also be a printed fitting by itself: `{ "id": "br", "fitting": { "kind": "bracket", "profile":
|
|
619
|
+
"2020-misumi-hfs5" }, "at": "x1.top@130", "rotate": [90, 0, 0] }`. It is a printed part, joined and cut by Manifold
|
|
620
|
+
where the workspace has it; its anchors `b1`, `a1` (and `b2`, ... on a plate) lie on its screws' axes for a fasten's
|
|
621
|
+
`at`. The overlap check measures its body without its tongues, which stand in the slots.
|
|
622
|
+
- The printed parts for panels, doors, beams' ends and services are fitting items too (@rulecad/frames' README,
|
|
623
|
+
Panels and doors, Ends and feet, Services): `"kind"` is `panel-clip`, `panel-corner`, `slot-cover`, `panel-edge`, `gasket-strip`,
|
|
624
|
+
`hinge`, `handle`, `latch`, `magnet-catch`, `end-cap`, `foot`, `levelling-foot`, `castor-plate`,
|
|
625
|
+
`stacking-foot` or `rail-jig` (`"rail": "rail-mgn12"`), with the model's own options (`"sheet": 3`, `"length": 200`). A hinge is two items, `"part":
|
|
626
|
+
"frame"` and `"part": "door"`, and a levelling foot's pad is `"part": "pad"`. An end part goes at the end's address
|
|
627
|
+
(`"at": "x1.a"`); its anchor `b1` is its screw's, and its `ops` say the tap the end needs. In a mechanism, hold it
|
|
628
|
+
as anything else is held: a foot by a `fasten` of its screw into the beam (`{ "screw": "M5 cap", "through": ["foot1"],
|
|
629
|
+
"into": "p1", "at": ["foot1.b1"] }`, the beam's end tapped as its `ops` say), and an end cap by a fit that fastens,
|
|
630
|
+
its pegs a press fit (`"min": -5`). The overlap check measures an end cap without its pegs, which stand in the beam,
|
|
631
|
+
and an in-slot panel edge or a slot cover by what stands above the face alone: the rest lies in the slot by design.
|
|
632
|
+
A panel item (below) holds its sheet with clips; a panel corner or an in-slot edge is placed by hand as an item.
|
|
633
|
+
- A `bracket`, `gusset`, `splice`, `hidden` or `anchor` join with a bought fitting's set by name (`"fitting":
|
|
634
|
+
"fitting-motedis-bracket-20-b6"`, @rulecad/frames' README, Bought fittings) adds that fitting as an item placed
|
|
635
|
+
where the printed one would go: a reference drawn from its set, listed under Bought with its price. Its screws join
|
|
636
|
+
`"fasten"` into the set's nuts (`2 × M4x8 cap`, `2 × slot-nut-6-motedis-m4-hammer`), so the fasten checks hold them
|
|
637
|
+
as any fasten's; an inner connector's grub screws are part of it, and an anchor connector adds the hole its guide
|
|
638
|
+
needs, drilled across a (on the cut list). `join.stiffness` takes the set's own figures and says what they rest on
|
|
639
|
+
(an estimate in the set, until the joint rig measures it). A set made for another profile size or slot family
|
|
640
|
+
fails `fitting.fit` and places nothing; a set of the wrong kind for the join is refused by name. `"fitting":
|
|
641
|
+
"bought"` alone names the sets there are.
|
|
642
|
+
- The other kinds (`cube`, `pivot`, `printed`, and a mitre's key) are checked where they meet and carry their
|
|
643
|
+
stiffness; their fittings come in later releases, and each says so (`join.fitting`).
|
|
644
|
+
- A frame's bought fitting is an item too: `{ "id": "cap", "bought": "fitting-motedis-end-cap-20-b6", "at": "x1.b" }`
|
|
645
|
+
(an end cap, a levelling foot, a hinge). At a beam's address it caps the end for `join.end`, and `fitting.fit`
|
|
646
|
+
checks it against that beam's profile: a foot whose stem is not the end bore's thread fails.
|
|
647
|
+
- `cad list` prints each bought line's price where its set gives one, and a cost line: the bought items' total (and
|
|
648
|
+
the sets with no price), and the printed parts' plastic at the material's price a kilogram (`pla` and `petg` carry
|
|
649
|
+
one). Fixings and bars are not priced. Swap `"fitting": "printed"` for a bought set and list again to compare.
|
|
650
|
+
- `cad check` adds `join.geometry` (the end meets the face square and flush, where `b` says, on the slot's centre line
|
|
651
|
+
where the kind needs a slot: a beam 2 mm off the face fails with `a gap of 2 mm`, and one 5 mm along names the
|
|
652
|
+
address it does meet at), `join.end` (every beam end is joined or capped: an item placed at the end, such as a foot,
|
|
653
|
+
caps it), and `join.stiffness` (the spring each join puts at a's end when the frame is solved, from
|
|
654
|
+
`@rulecad/frames`' `JOIN_STIFFNESS`: every figure an estimate until the joint rig measures it, and the finding says
|
|
655
|
+
which, measured with its date or an estimate).
|
|
656
|
+
- `join.drop` predicts a beam held by one join and nothing else, with a `mass` load on it (on the beam or on an item
|
|
657
|
+
at one of its addresses), as a cantilever from that join: its drop is the beam's own bending, F L³ / 3 E I, and the
|
|
658
|
+
join turning on its spring k, F L² / k. It is a prediction `cad measured` takes as `<beam>.drop=<mm>`: the measured
|
|
659
|
+
drop less the beam's own bending gives the join's spring, k = F L² / (drop less F L³ / 3 E I), written as measured
|
|
660
|
+
to the rule the spring came from. That is the kind's figure in the workspace's `rules/joins.json` (part `joins`,
|
|
661
|
+
made from `@rulecad/frames`' estimates the first time: `blind_bending`, `end_tap_twist` and the rest, for a 20 mm
|
|
662
|
+
profile), a printed fitting's share of its own stiffness by finite elements (`bracket_printed_share`), or a bought
|
|
663
|
+
fitting's `bending_stiffness`. Its sentence becomes what was measured, and the drop goes in its source. A drop no
|
|
664
|
+
more than the beam bends by itself is refused, and a refusal of any value writes nothing, not even the joins set's
|
|
665
|
+
first copy. The joint rig in
|
|
666
|
+
`examples/bench/projects/benchmarks` (MEASURE.md, rows 34 to 37) is built for it, and also measures a slot nut's
|
|
667
|
+
hold along its slot, written to the nut's own set as `hold_along`.
|
|
668
|
+
- `cad add join <project>/<assembly> --kind blind --a y1.a --b x1.back@120 [--screw "M5 button"] [--fitting printed]`
|
|
669
|
+
adds one.
|
|
670
|
+
|
|
671
|
+
**Fastening into a slot.** A `fasten` whose `into` is a slot on a beam ends in a slot nut under the slot's lips:
|
|
672
|
+
|
|
673
|
+
```json
|
|
674
|
+
"fasten": [{ "screw": "M4 button", "through": ["plate"], "into": "x1.top", "holes": "plate.body", "nut": "drop-in" }]
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
- `into` is a face with a slot (`x1.top`), one slot of a face with several (`x1.top.2`), or a place on it
|
|
678
|
+
(`x1.top@120`, which places the fasten's screws as a group: the middle of their spread along the slot is held to it,
|
|
679
|
+
within the play their holes give, so two screws at 110 and 130 mm pass `x1.top@120`). The nut is the one made for that slot's nut family and the thread
|
|
680
|
+
(`nutFor` of `@rulecad/frames`): `"nut"` chooses its kind (`slide-in`, `drop-in`, `roll-in`, `hammer`, `square`,
|
|
681
|
+
`t-bolt`), and left out, the strongest made for the slot. It is placed under the lips as a reference part and
|
|
682
|
+
counted by its rule set's name on `cad list` (`2 × slot-nut-6-misumi-m4-drop-in`).
|
|
683
|
+
- `fasten.slot`: each screw lies over a slot's centre line, within the play its hole in the part gives it (half the
|
|
684
|
+
hole less the thread), square to the face, along the beam. A plate drawn for slots 30 mm apart on a face whose slots
|
|
685
|
+
are 20 mm apart fails with the distance, `5 mm off the centre line of x1's top.1 slot`.
|
|
686
|
+
- `fasten.length` chooses the shortest sold screw that puts a hexagon nut's height of thread in the slot nut
|
|
687
|
+
(`<thread>.nut_height`, ISO 4032) and stops `FASTEN.floor` (0.3 mm, a working figure) short of the slot's floor.
|
|
688
|
+
The stack is the part, a washer, and the slot's lip. With 3 mm of plate on a 2020 slot an M4 screw has 1.3 mm to
|
|
689
|
+
land in, so `M4x8` fits it and nothing sold fits a 4 mm plate; the finding names the lengths either side.
|
|
690
|
+
- `frame.nut`: a slide-in or square nut goes in only from an open end of its slot (every fasten's, a guide's too, in
|
|
691
|
+
every pose). A slot is closed by a join that
|
|
692
|
+
butts on its end, and the stretch a nut is in by a blind join's head in that slot too. Every closure on a way counts,
|
|
693
|
+
not only the nearest: a head between the nuts and an end closed further along closes that way as much as the end,
|
|
694
|
+
and the finding names each, with an item placed at that end (`foot1 off until then`). Where joins close both ways,
|
|
695
|
+
the check fails and names the nut of that thread that goes in through the opening (`give "nut": "drop-in"`).
|
|
696
|
+
- `frame.preload`: nuts with a way in that a join closes and no way that stays open (the other end capped by an item
|
|
697
|
+
placed there, such as a foot) go in before that join is made. The finding names the beam, the slot, the end, the
|
|
698
|
+
nuts and the join, and `cad order` and the build page list them as the step before the one that makes it
|
|
699
|
+
(`5. Load 2 × slot-nut-6-misumi-m4-slide-in into y1's top slot through its end a, for plate2, before the blind join
|
|
700
|
+
of y1.a to p1.top@170 closes it`).
|
|
701
|
+
- `frame.square`: each bay of the frame (four beams joined in a rectangle in one plane), with its two diagonals,
|
|
702
|
+
inside corner to inside corner, and the difference between them to accept: twice the cut tolerance times the longer
|
|
703
|
+
side over the diagonal, what the beams' lengths allow with every corner square (`squareness` in `@rulecad/frames`).
|
|
704
|
+
A 260 × 200 mm opening of beams cut to ±0.5 mm: each diagonal 328.02 mm, accept up to 0.79 mm. Joint play is not in
|
|
705
|
+
it yet (issue 268).
|
|
706
|
+
- A blind or end-tap join's head on a slot's lips: `fasten.seat` gives what the lips take, the head's circle less the
|
|
707
|
+
strip of the opening across it (A = π D² / 4 - 2 (c √(R² - c²) + R² asin(c / R)), R half the head, c half the opening), at the beam alloy's strength, and the torque for that force (T = K d F, the nut
|
|
708
|
+
factor an estimate), or the screw tightened fully where that is less. An M5 button head on a MISUMI 6 mm slot:
|
|
709
|
+
17.9 mm² of al6n01-t5 at 205 MPa takes 3677 N, 3.68 N m. The lips' bending is not counted: an estimate, until the
|
|
710
|
+
joint rig (issue 264) measures one.
|
|
711
|
+
|
|
576
712
|
### Building it
|
|
577
713
|
|
|
578
714
|
Once an assembly is checked, these say how to make it. They all read the assembly itself, so they can't disagree with it.
|
|
579
715
|
|
|
580
716
|
- `cad order <project>/<assembly>`: the order it goes together in, each step with the part and what fastens it. A `fasten` names its screws on the step where its parts are both there, with the key that turns them and how tight: its `torque`, or the most the seat under the head takes (`2. bracket goes on: bracket fastened to base (2 × M3x10 cap) with a 2.5 mm hex key, to 0.33 N m at most (what the seat takes)`); `--json` gives each as `{ fit, fastener, count, key, tighten: { torque, given } }`, and the build page shows the same. What is not a screw (pins, a clip) is named on a fit that fastens: `"fastener": "push pin", "count": 2` puts it on the shopping list and the step. `--preview` writes a picture of each step to `.preview/`: what's there, and the new part held off along the way it goes on. The order is found by taking the assembly apart, so a part goes in after what it's fastened into, a bearing before its shaft, and a nut trapped by a wall before the neighbour that traps it. A part goes on along a straight line that clears everything already there; which line comes from the part as drawn.
|
|
581
|
-
- `
|
|
582
|
-
|
|
717
|
+
- `cad order` on a **frame** (an assembly with `joins`) gives its build from bars to a square frame, in numbered steps:
|
|
718
|
+
1. **Cut** the beams: each mark's count and length, the bars to buy and the cuts on each (the cut list).
|
|
719
|
+
2. **Drill and tap** each mark as its cut-and-drill sheet shows (each mark's work and its sheet's file).
|
|
720
|
+
3. **Sides built flat**: each bay that shares no beam with a side already chosen is built on the bench, beam by beam,
|
|
721
|
+
each beam's joins with their screws, key and torque, left snug (`Snug for now: tightened to its torque at step 8,
|
|
722
|
+
once square`), then squared by its diagonals and its joins tightened. Of
|
|
723
|
+
two bays that share a post, the first found is a side and the other is squared once the frame is joined.
|
|
724
|
+
4. **Nuts to load, heads slid in**: every blind join's head and every slot nut needs a way into its slot at the
|
|
725
|
+
step that puts it there: an end of the slot that nothing has closed yet (a join on that end, or an item placed
|
|
726
|
+
there) and nothing already in the slot between it and that end (a head, a nut). A beam going on slides along the
|
|
727
|
+
slots its heads go into, all one way, from whichever end leaves each head its way. A slide-in nut that a join
|
|
728
|
+
would close in is loaded on a step of its own just before the first join made of those on its way
|
|
729
|
+
(`frame.preload`), where that leaves every head its way; else at the first later step where it has a way
|
|
730
|
+
(`7. Load 2 × slot-nut-6-misumi-m4-slide-in into p1's back slot through its end b, for bracket, before cap1 goes
|
|
731
|
+
on`), else earlier. A head with no way as its beam goes on (its slot closed at both ends by then, or running
|
|
732
|
+
across the way the beam goes on) is slid into its slot on its own beforehand, and its join made with it in place
|
|
733
|
+
(`Slide an M5x12 button screw into x3's back slot head first, through its end a, to 130 mm, for the blind join of
|
|
734
|
+
m.a to x3.back@130, ...`). Where no step gives one a way, the build is refused with the slot and what is in the
|
|
735
|
+
way.
|
|
736
|
+
5. **Joins**: the beams in no side go on one at a time in the assembly's order, each joined to what is there. A
|
|
737
|
+
side goes on as one only where it can: the heads of its blind joins to the frame slide along slots that all run
|
|
738
|
+
one way, each with a way in from the end that leads. Where it can't, its beams go on one at a time on the frame
|
|
739
|
+
instead, and the build says why (`The bay of p3, p4, x2 and x4 is built on the frame, not flat: the heads of its
|
|
740
|
+
joins to the frame go into slots that run different ways (...)`).
|
|
741
|
+
6. **Square the frame**: the diagonals of each bay no side squared, then the joins tightened.
|
|
742
|
+
7. **Mount** the rest in the assembly's order, with their fastenings; copies of one thing in a row are one step. A
|
|
743
|
+
part that a beam would stand over the screws of goes on before that beam, once the beams it fastens to are
|
|
744
|
+
there, even in the middle of a side's build.
|
|
745
|
+
|
|
746
|
+
Every screw is reached in this order: what stands over a screw (`fasten.access`, or a fit's `access`) goes on
|
|
747
|
+
after the step that drives it. Where a side built flat would break that, the side is built on the frame instead;
|
|
748
|
+
where no build does, it is refused with the screw and what stands over it. It ends with the tightening of each
|
|
749
|
+
kind of join (`blind (16 joins, M5x12 button with a 3 mm hex key): 3.68 N m`). A slide-in nut in a stretch of slot
|
|
750
|
+
that joins close at both ends (`frame.nut`) is shut in by whichever of the two joins is made second, in any order:
|
|
751
|
+
the build is refused, naming the slot, the nuts, the two joins, and the nut that goes in through the opening
|
|
752
|
+
(`frame/box: x1's top slot: 2 slide-in nuts (...) for plate would be shut in between the blind join of x1.a to
|
|
753
|
+
p1.back@30 and the blind join of x1.b to p2.front@30: ...: give "nut": "drop-in"`), and `cad order` exits 1.
|
|
754
|
+
`--json` adds `frame`: `{ steps: [{ n, kind, text, lines, items, joins, shown, now, dir }], sides, notFlat, bays,
|
|
755
|
+
torques, stuck }`, kind one of `cut`, `drill`, `side`, `join`, `load`, `square`, `mount`; `shown` is what is in
|
|
756
|
+
view at that step (the side on the bench, or the frame so far) and `now` what goes on in it. `--preview` draws each
|
|
757
|
+
step that shows something, numbered as the build is. The build page shows the same as "Building the frame", its
|
|
758
|
+
one sequence of steps (each a button that shows that step in the viewer), with the torques and the diagonals as
|
|
759
|
+
tables.
|
|
760
|
+
- `assembly.order` is `cad check`'s finding on it, with the count of `cad order`'s steps (a frame's build from bars to
|
|
761
|
+
square where the assembly has joins, failing where that build is refused; `fasten.access` names the same steps, and
|
|
762
|
+
none of a build that is refused): a part no order can reach fails by name, and a part sealed inside another too. A fit can say where a screw is driven from with `"access": "<item>.<anchor>"`, the anchor's z pointing out along the screw: whatever stands on that line goes on after the screw, and if it has to go on first the screw can't be reached at all. Works on an assembly's own items; a component (an assembly used as an item) goes on as one step.
|
|
763
|
+
- `cad plates <project>/<assembly>`: every printed part laid out on beds, in its print orientation (as it's drawn), grouped by filament so each plate is one colour change, spaced by the first layer's rule (the printer's `print_gap` plus twice its `foot`, up to whole lines; `--gap` for your own). They're written as `kind: "plate"` assemblies called `<assembly>-<filament>-<n>` and checked as prints; `cad export` makes each one's 3MF. Each plate remembers what's on it by its build's hash (`"packed"` in its file): a changed part re-packs only its plate, so the other plates keep their files untouched, and a part too big for the bed is said by name (`plate.bed`). A frame's printed fittings (a join's bracket, a guide's holders and plate, a foot or an end cap) go on as their item's `fitting` with `"pose": "print"`, laid as each prints.
|
|
583
764
|
- `cad list <project>/<assembly>` lists the beams' **cut list** after the bought parts: each mark (beams that are the same, one profile, length and set of operations, share a mark, A, B, C), its count, grams each and work, then each profile's lengths to cut, the bars to buy in the lengths it is sold in, and the cuts on each bar in order with its offcut. Every cut takes the saw's 3 mm kerf and each bar's first end is trimmed 10 mm (`CUT_DEFAULTS` in `@rulecad/frames`, each with its source); the packing is first-fit decreasing. `cad check` adds the cut list's findings (`frame.cut`): a beam longer than any length sold fails, two lengths nearer than the cut tolerance can hold apart warn, and beams of one mark are reminded to be cut against one stop. Each beam's mark is in its label in the preview and the link (`x1: mark A, profile-2020-misumi-hfs5 x 300 mm`).
|
|
584
765
|
- `cad beams <project>/<assembly>`: a cut-and-drill sheet for each mark, written to `exports/<project>/<assembly>.beam-<mark>.svg`, in mm so it prints to scale at 100%: the section at end a with each face named and the taps marked, a view of each face with work on it (that face up, end a on the left), every operation dimensioned from end a to 0.1 mm, and the operations in order, each tap with its thread and depth. The build page lists the sheets with the cut list.
|
|
766
|
+
- `cad beams <project>/<assembly> --jigs`: the jigs its beams take, made from the assembly and written as a plate, `exports/<project>/<assembly>.jigs.3mf` (`.jigs-2.3mf` and on where one bed is not enough). A **drill guide** for each distinct hole across a beam (an access hole, a drilled hole, a counterbore's hole): it stops on the nearer end, keys into the face's slot and holds a bush for the drill where the sheet dimensions the hole. A **tap guide** for each tapped end, a **cut-length stop** for each length (a block for the saw's fence and a printed gauge as long as the cut), and a **squaring corner** for each pair of profiles and hand a blind or end-tap join takes. A corner is an L whose arm b runs along beam b one way only, so where a beam meets a post near the post's end, only one hand lies on the post: each join gets the corner laid on a pair of faces the two beams share (the outer pair first) and of the hand whose tongues lie whole on both beams, its plate clear of every other beam. A box with beams near both ends of its posts takes both hands. Where no corner fits, a `jig.square` warning says why (how much of a tongue lies past a beam's end, which beam the plate meets): square that join with an engineer's square. Distinct means drawn the same: one guide serves every hole of its size at its distance from an end. Each is marked with the marks it is for (`ABCD`, `E 260`), cut into a face that faces up as it prints, printchecked, and listed with its grams, its margin and what it is for: each hole by mark and sheet number (`A3`), with its bush's distance from end a beside the sheet's figure. A hole too far from both ends for one print gives a `jig.drill` warning in place of a guide; mark it from the sheet. A tapped end no guide can be drawn for gives a `jig.tap` warning in place of its guide. `--json` gives the same, `--preview` a picture of the plate. The jigs are `@rulecad/frames`' (`drillGuideModel`, `tapGuideModel`, `lengthStopModel`, `squareCornerModel`).
|
|
585
767
|
- `cad wires <project>/<assembly>`: the wiring sheet, printed and written to `exports/<project>/<assembly>.wiring.md` (`cad machine` writes it too): each wire's length through every pose with its service loop, gauge, colour, connectors and board pins. Wires also show faint along their routes in `cad preview` and in the link, moving with the joints, and are never parts: no overlap check sees them.
|
|
586
768
|
- `cad link` for such an assembly (or one with a `fasten`) carries the rest of the project with the model. A **Build** button on the page opens, beside it, the shopping list, the beams' cut list and their sheets, the plates drawn on their beds, the wiring sheet, the assembly steps (each shows the model at that step) and the machine's settings. The Rules panel lists **predicted against measured**: the ledger `cad measured` writes, each with its ratio, and what the checks predict that nobody has measured yet.
|
|
587
769
|
- A link for an assembly with a `task` lets the page move the machine: see "Things that move" in the viewer's README. It carries the newest step file `cad plot` wrote for this assembly (`--steps <file>` for another, `--no-steps` for none). A step file for other joints is refused by name.
|
|
588
770
|
|
|
771
|
+
**Panels and doors.** An item with `"panel"` is a sheet cut to the bay of four beams it closes:
|
|
772
|
+
|
|
773
|
+
```json
|
|
774
|
+
{ "id": "front", "panel": { "sheet": "acrylic", "thickness": 3, "bay": ["x1", "z2", "x2", "z1"], "out": [0, -1, 0] } }
|
|
775
|
+
```
|
|
776
|
+
|
|
777
|
+
- The bay is four beams placed by their ends, two each way round a rectangle, in order. Each has a slotted face that
|
|
778
|
+
looks along `out`; the four faces lie in one plane. Refused by name: a beam that runs across the plane, faces out
|
|
779
|
+
of one plane, a beam with no such face (turn it with `roll`), a bay that is not two beams each way.
|
|
780
|
+
- The panel lies on those faces, its edges 6.5 mm in from each slot's line for an M5 clip on a 2020, and is cut to
|
|
781
|
+
what is left: a 400 x 300 mm bay of 2020 (slot lines 380 x 300 mm apart) takes 367 x 287 mm. `cad list` counts it
|
|
782
|
+
under Bought by its sheet and size (`acrylic sheet, 3 mm cut 367 x 287 mm`) with its mass from the sheet's density.
|
|
783
|
+
- Its printed clips go along each edge at no more than `"pitch"` apart (150 mm by default, `PANEL_DEFAULTS.pitch`),
|
|
784
|
+
clear of the beams across the edge's ends and of their clips: each is an item (`front-clip`, `front-clip-2`, ...)
|
|
785
|
+
with a fasten into its beam's slot, so its screw is chosen, checked and counted (14 × M5x10 button and 14 slot
|
|
786
|
+
nuts round a 400 x 300 mm bay). `"nut"` chooses their slot nuts' kind; `"load"` (N) the load each clip is sized for.
|
|
787
|
+
- `cad check` says `panel.size` (its sheet, size, mass and how many clips hold it) and `panel.thickness` (a warning
|
|
788
|
+
where the sheet is not commonly stocked in that thickness), with each clip's own findings.
|
|
789
|
+
- With `"door": { "hinge": "z1" }` the panel is a door. It stands off the faces by the hinge's frame leaf, a head
|
|
790
|
+
and 1 mm (10.2 mm on a 2020), on two printed hinges along the beam named, each a frame leaf screwed into its slot
|
|
791
|
+
and a door leaf screwed through the door into nuts, an M4 cap screw and lock nut for each pin (on `cad list`). It
|
|
792
|
+
turns on a revolute joint `<id>-hinge` from 0 to `"open"` (120° by default), with poses `<id>-shut` and
|
|
793
|
+
`<id>-open`. A handle (`"handle": false` leaves it off) is screwed from inside into its feet, and a magnet catch
|
|
794
|
+
(`"catch"`) sits on the opposite beam under the door's edge; `"latch": true` adds a turn-button latch, shown shut.
|
|
795
|
+
The holes the screws pass are cut in the door. `cad check --sweep` turns the door through its range: on its own,
|
|
796
|
+
nothing collides. With its latch shut, the door hits the latch within its first degree, so the sweep also tries the
|
|
797
|
+
door 0.5° off shut (`latch_probe`), finer than its steps, and fails there by name.
|
|
798
|
+
- In a mechanism, a beam placed by its ends is the frame: what is screwed to it is held (`assembly.loose`).
|
|
799
|
+
|
|
800
|
+
**Services on a frame.** A bought board or supply with `"mount"` sits on a printed mount at an address on a beam's
|
|
801
|
+
slotted face, its holes read from its own rule set (@rulecad/frames' README, Services):
|
|
802
|
+
|
|
803
|
+
```json
|
|
804
|
+
{ "id": "psu", "bought": "supply-24v", "variant": "LRS-50-24", "mount": { "on": "rail.top@-90" } }
|
|
805
|
+
```
|
|
806
|
+
|
|
807
|
+
- The mount is an item `<id>-mount` (a `device-mount` fitting), listed just before the device, and the device goes on
|
|
808
|
+
its anchor `device`: leave out the device's `at` and `rotate`. `"turn"` (0, 90, 180, 270) and `"offset"` (mm across
|
|
809
|
+
the slot) move the device on it; `"standoff"`, `"load"`, `"nut"`, `"head"` and `"screw"` are the model's own.
|
|
810
|
+
- Its screws are fastens, so each is chosen, checked and counted: two into the slot past the device's body, and the
|
|
811
|
+
device's own. A supply's go up from under the mount into its tapped holes: `fasten.length` chooses the longest sold
|
|
812
|
+
that goes no further than its maker allows (`mount_hole_reach`, Mean Well's 3 mm), and `fasten.engagement` holds it
|
|
813
|
+
to that. A board's go down through its drilled holes (held to the drilled clearances) into pilots on the mount.
|
|
814
|
+
Refused by name: a mount on what is not a bought board or supply, a set with no `mount_holes`, an address that is
|
|
815
|
+
not on a slotted face, an item with both `at` and `mount`.
|
|
816
|
+
- `cad check` says `service.mount` for each, with the mount's own findings (`fitting.device`, `fitting.head`, its
|
|
817
|
+
grams and margin).
|
|
818
|
+
- A wire's `via` may hold a run along a slot: `{ "along": "rail.front", "from": 300, "to": 60, "pitch": 100,
|
|
819
|
+
"cable": 6 }`, its ends in mm from the beam's end a. Printed cable clips snap into the slot at each end and no more
|
|
820
|
+
than `pitch` apart (`<wire>-clip`, `<wire>-clip-2`, ...), each held by a fit that fastens, and the wire is routed
|
|
821
|
+
through them, so its length follows the beam. `wire.run` says the run's length and its clips, and `wire.length`
|
|
822
|
+
the part of the wire along the slot and how many clips hold it. A run past the beam's end is refused by name.
|
|
823
|
+
- A run along the slot a mount sits on keeps its clips off the mount's plate: one goes each side of it, and
|
|
824
|
+
`wire.run` warns by name that the wire must go round the mount there. A run that lies wholly under a plate is
|
|
825
|
+
refused by name.
|
|
826
|
+
- The other service parts are fitting items by kind: `fan-mount` (`"size": 80`), `drag-chain-end` (`"holes"`,
|
|
827
|
+
`"screw"`), `din-rail`, `cable-clip`, `tie-anchor` and `spool-holder`.
|
|
828
|
+
|
|
829
|
+
**Guides.** `"guides"` puts linear motion on a beam: a miniature rail screwed down on a slotted face and its carriages
|
|
830
|
+
(@rulecad/frames' README, Guides):
|
|
831
|
+
|
|
832
|
+
```json
|
|
833
|
+
"guides": [{ "kind": "rail", "rail": "rail-mgn12", "carriage": "MGN12H", "on": "x1.top", "from": 50, "length": 300 }]
|
|
834
|
+
```
|
|
835
|
+
|
|
836
|
+
- The rail is a bought item named by the guide's `id` (`g1`, `g2`, ... by default), placed at `from` mm along the
|
|
837
|
+
face from the beam's end a. Its screws are a fasten into the slot, one in each hole at the rail's pitch, so
|
|
838
|
+
`fasten.length` chooses them, the slot nuts are placed with them (`"nut"` chooses their kind), and `cad list`
|
|
839
|
+
counts both: an MGN12 cut to 300 mm takes twelve M3 cap screws 25 mm apart and twelve M3 slot nuts.
|
|
840
|
+
- Each carriage (`"carriages"`, 1 by default) is a bought item `<id>-carriage-1`, ... on its own sliding joint
|
|
841
|
+
`<id>-1`, ... along the beam, from 0 to its travel: its share of the rail less its length with its seals. The
|
|
842
|
+
poses `<id>-a` and `<id>-b` put every carriage at the start and the end of its share; `cad check --sweep` slides
|
|
843
|
+
each through its travel. A carriage's anchors are `top` and `t1` to `t4` (its tapped holes, from its top), for a
|
|
844
|
+
table fixed on it.
|
|
845
|
+
- `cad check` says `guide.holes` (the holes, their pitch and the end distance; `guide.end` where an end is past half
|
|
846
|
+
the pitch), `guide.travel`, `guide.fit` (the rail on the face, a slot nut for its screws, its ends on the beam and
|
|
847
|
+
clear of a beam joined across its face), `guide.budget` (what it adds to an error budget) and `guide.jig` (a
|
|
848
|
+
printed jig that centres the rail while it is screwed down, as a `rail-jig` fitting item).
|
|
849
|
+
- Each carriage's loads are held to its ratings at every pose (`joint.moment`): the weight of all it carries and the
|
|
850
|
+
masses of `"loads"` hung on it, as a force and a moment about its middle on the rail's top, in its own frame.
|
|
851
|
+
Each load over its rating (C0, MR, MP, MY), summed, is how much of the carriage it uses: past 1 it fails and names
|
|
852
|
+
the rating, under 2 times over it warns. How they combine is an estimate, said as one.
|
|
853
|
+
- A task whose chain runs through a carriage's joint counts the rail's terms in its error budget (`task.accuracy`):
|
|
854
|
+
its running parallelism and its carriage's play from its rule set (`spec`), the beam's straightness over the rail
|
|
855
|
+
from the profile's, and the beam's sag (an estimate).
|
|
856
|
+
- Refused by name: a kind not built yet (a belt), a face that is not a beam's slotted face, `on` with a distance (that
|
|
857
|
+
is `from`), a rail past the beam's end, a carriage its set has not got, and a rail too short for its carriages.
|
|
858
|
+
|
|
859
|
+
A carriage on V-wheels runs on a V-slot beam's own tracks, and a printed slider in or over a slot:
|
|
860
|
+
|
|
861
|
+
```json
|
|
862
|
+
"guides": [{ "kind": "wheels", "wheel": "v-wheel-solid", "wheels": 4, "on": "x1.top", "from": 50, "length": 400 },
|
|
863
|
+
{ "kind": "slider", "mode": "over", "size": 40, "on": "x2.top.1", "from": 100, "length": 200 }]
|
|
864
|
+
```
|
|
865
|
+
|
|
866
|
+
- For wheels, `on` is the face the plate lies over; its wheels run in the V tracks of the two faces either side, and
|
|
867
|
+
`from` and `length` are the stretch of the beam it rolls along. The plate is a printed fitting (`wheel-plate`)
|
|
868
|
+
`<id>-carriage-1` on the sliding joint `<id>-1`, from 0 to the stretch less its length over its wheels; the wheels
|
|
869
|
+
are bought items `<id>-wheel-1`, ... held to the plate at its anchors `w1`, `w2`, ..., the ones on the second side
|
|
870
|
+
on eccentric spacers. `cad list` counts the wheels, the plate's grams, and its screws, lock nuts, washers and
|
|
871
|
+
spacers. The plate's anchor `top` takes what it carries.
|
|
872
|
+
- Where each wheel seats comes from the slot's track and the wheel's rim (`guide.fit`, with the axle's distance from
|
|
873
|
+
the face). On a face with no V track (a plain T-slot) the guide is refused, saying why and what guides there
|
|
874
|
+
instead. `guide.seat` compares the seat with the maker's own plate and warns when the eccentrics, on one side only, cannot take up the whole difference, `guide.preload` gives the eccentrics' range,
|
|
875
|
+
and `guide.rating` each wheel's ratings, which rest on its plastic's contact pressure (an estimate).
|
|
876
|
+
- Each plate's loads are shared among its wheels at every pose (`joint.moment`), each wheel's radial and axial load
|
|
877
|
+
over its ratings: past 1 it fails and names the most loaded wheel. The sharing is an estimate, said as one.
|
|
878
|
+
- A slider is a printed fitting (`slider`) on its sliding joint along the slot `on` names, over it (a shoe and a key,
|
|
879
|
+
the default) or in it (`"mode": "in"`, a block under the lips, put in from the beam's end); `size` is its own
|
|
880
|
+
length. Its clearance a side is the printer's fit, and `guide.friction` says its friction and wear rest on working
|
|
881
|
+
figures until they are measured.
|
|
882
|
+
- The overlap check measures a beam by its envelope less its V tracks. A wheel is checked whole: its rim in the track
|
|
883
|
+
is clear, and a rim out of the track, or a part or beam across the track's line (an end cap, a crossing beam), is
|
|
884
|
+
found. A slider's key, which stands in the slot's opening, is left out of the check. `guide.fit` checks the rim's
|
|
885
|
+
seat in the track.
|
|
886
|
+
|
|
887
|
+
Two smooth rods carry a printed carriage on linear bearings, and a lead screw drives it from a motor; an endstop homes
|
|
888
|
+
it. Each is placed by an address: the rods' holders at the ends of the stretch on the face, the motor plate before
|
|
889
|
+
it, the switch's mount where its address says:
|
|
890
|
+
|
|
891
|
+
```json
|
|
892
|
+
"guides": [{ "kind": "rods", "on": "x1.top", "from": 60, "length": 101, "endstop": { "at": "x1.front@82" } },
|
|
893
|
+
{ "kind": "screw", "guide": "g1", "screw": "t8-screw", "motor": { "model": "28byj48", "microsteps": 1 } }]
|
|
894
|
+
```
|
|
895
|
+
|
|
896
|
+
- A rods guide puts printed holders (`rod-holder`) at `<beam>.<face>@from` and `@from + length` (`<id>-holder-a` and
|
|
897
|
+
`-b`), saddles screwed into the slots of the faces either side, one fasten a leg. The rods (`rod`, default `rod-8`)
|
|
898
|
+
are bought items cut to the stretch, at holder a's anchors `r1` and `r2`; the carriage (`rod-carriage`,
|
|
899
|
+
`<id>-carriage-1`) slides on the joint `<id>-1` with its bearings (`bearing`, default `lm8uu`) at its anchors `lm1`
|
|
900
|
+
and `lm2`. Its travel is the stretch less the two holders, a millimetre's gap at each and the carriage with the
|
|
901
|
+
nut's flange. `spacing` and `height` set the rods' place; their defaults leave room for what goes between and under.
|
|
902
|
+
`"nut"` chooses the kind of slot nut the holders', the motor plate's and the endstop mount's screws go into: on a
|
|
903
|
+
beam whose ends are both joined, a slide-in nut is shut in (`frame.nut` fails), so give `"nut": "drop-in"`.
|
|
904
|
+
The carriage's anchor `top` takes what it carries.
|
|
905
|
+
- A screw guide names the rods guide it drives (`guide`). It adds a printed motor plate (`motor-plate`, `<id>-plate`)
|
|
906
|
+
before holder a, the motor (`<id>-motor`, a motor item: give its `model` and any of `microsteps`, `duty`, `speed`,
|
|
907
|
+
`current`, `driver`) at the plate's anchor `motor`, the coupler and the screw at its anchor `coupler`, a ball bearing
|
|
908
|
+
for the screw in each holder (`support`, default `bearing-608`, or null) and the lead nut on the carriage's anchor
|
|
909
|
+
`nut`. The motor drives the carriage's joint with `leadscrew` from the screw's set (its lead and diameter) and
|
|
910
|
+
`friction` (default the set's, an estimate), so `motor.torque`, `motor.speed` and `motor.holds` read the drive's
|
|
911
|
+
ratio as they do any lead screw. `guide.drive` and `guide.coupler` (how far the shaft reaches into the coupler) say
|
|
912
|
+
what was placed. A belt is not built yet; a screw on a rail or wheels is refused.
|
|
913
|
+
- An endstop's printed mount (`endstop-mount`) goes at a side face's address (`endstop.at`), the switch (`switch`,
|
|
914
|
+
default `endstop-10t85`) on it; a flag on the carriage's far end meets its lever. Where that happens is the joint's
|
|
915
|
+
lower end and its `home` (`guide.endstop`). A switch the flag cannot reach, or a mount over a holder's leg, is
|
|
916
|
+
refused, naming the address where it trips at the travel's start.
|
|
917
|
+
- Each carriage's loads are shared between its bearings at every pose (`joint.moment`) against their static rating;
|
|
918
|
+
a moment on one bush is taken as a couple along it, an estimate, said as one.
|
|
919
|
+
|
|
589
920
|
## Optimised parts
|
|
590
921
|
|
|
591
922
|
`cad optimise` finds the stiffest layout of a flat part: where to put a fixed amount of material so the part bends
|
package/TUTORIAL.md
CHANGED
|
@@ -234,3 +234,5 @@ commands to run, tested the same way as this page. Each is also a section of [th
|
|
|
234
234
|
- **Optimised parts**: the stiffest layout for a load, and an analysis of what you drew.
|
|
235
235
|
- **Boards**: circuit boards from the same rules as the case around them.
|
|
236
236
|
- **Mechanisms printed flat**: springs, catches and triggers in one print, checked through their whole cycle.
|
|
237
|
+
- **Frames**: beams of an aluminium profile placed by their ends, joined, with feet and a motor-driven axis, cut,
|
|
238
|
+
drilled and printed on one plate (chapter 16).
|
package/bin/cad.mjs
CHANGED
|
@@ -60,6 +60,8 @@ const HELP = `cad: JSCAD designs you can trace, check, share and print (rulecad)
|
|
|
60
60
|
[--washer] [--length 12] [--torque 0.5] [--note …]
|
|
61
61
|
cad add fasten <project>/<assembly> --from-fits a fasten in place of a holes fit and a fit that fastens the same parts
|
|
62
62
|
(the screw read from them, or --screw "M2 cap")
|
|
63
|
+
cad add join <project>/<assembly> --kind blind --a y1.a --b x1.back@120 two beams joined: the end of a against b's face
|
|
64
|
+
[--screw "M5 button"] [--fitting printed|<bought set>] [--note …]
|
|
63
65
|
cad why <project>/<object>.<name> what a value reads, down to the rules and their sources [--json] [--depth N]
|
|
64
66
|
cad check <project>/<object> raw numbers in the design, then printability (exit 1 on a failure) [--json: findings as data]
|
|
65
67
|
cad preview <project>/<object> six views as a PNG in .preview/ (prints the path); an assembly with a motor also gets
|
|
@@ -93,10 +95,12 @@ const HELP = `cad: JSCAD designs you can trace, check, share and print (rulecad)
|
|
|
93
95
|
cad machine <project>/<assembly> the machine as plain data: axes, steps, limits, homing, the task, in exports/
|
|
94
96
|
cad plot <project>/<assembly> <drawing.svg> plans a drawing on the machine: a step file in exports/, an animation in
|
|
95
97
|
.preview/, and any stroke refused [--calibrate: the calibration drawing] [--tol 0.1] [--json]
|
|
96
|
-
cad order <project>/<assembly> the order it goes together in, each step with its fasteners [--preview: an exploded picture of each step in .preview/]
|
|
98
|
+
cad order <project>/<assembly> the order it goes together in, each step with its fasteners; a frame from bars to square: cut, drill, sides built flat, nuts to load, joins with their torque, diagonals [--preview: an exploded picture of each step in .preview/]
|
|
97
99
|
cad plates <project>/<assembly> every printed part on beds, by filament, spaced by the first-layer rule: written as plate assemblies and checked; a changed part re-packs only its plate [--gap mm] [--json]
|
|
98
100
|
cad list <project>/<assembly> what it takes to build: bought parts by set, the beams' cut list and bars to buy, every screw, nut and insert in packs, wire, printed parts in grams
|
|
99
101
|
cad beams <project>/<assembly> a cut-and-drill sheet for each mark of beam (beams that are the same share one), to scale, written to exports/ [--json]
|
|
102
|
+
--jigs: the jigs its beams take, as a plate in exports/ (a drill guide per distinct hole across a beam, a tap
|
|
103
|
+
guide per tapped end, a cut-length stop per length, a squaring corner per square join), each marked with its beam [--preview]
|
|
100
104
|
cad wires <project>/<assembly> the wiring sheet: each wire's length, gauge and ends, written to exports/ [--out wiring.md]
|
|
101
105
|
cad measured <project>/<assembly> <name>=<value> … a measurement, where the estimate was: a rule (x1c.press=0.08) or a
|
|
102
106
|
check's prediction (task.accuracy=0.8): says what moved, and keeps a ledger of predicted
|
|
@@ -139,18 +143,19 @@ const COMMANDS = ['new', 'import-kle', 'clone', 'agents', 'trust', 'rules', 'val
|
|
|
139
143
|
const OPTIONS = ['table', 'calibrate', 'check', 'turns', 'preview', 'gap', 'no-steps', 'all', 'along', 'at', 'bump', 'depth', 'dry-run', 'explode', 'force', 'fresh', 'json', 'licence', 'license', 'long', 'm', 'material', 'md', 'name', 'new',
|
|
140
144
|
'no-models', 'no-pictures', 'no-rules', 'note', 'open', 'part', 'place', 'pose', 'profile', 'progress', 'push', 'result', 'rules', 'samples', 'set', 'short', 'source', 'steps',
|
|
141
145
|
'sweep', 'tol', 'trailer', 'ttl', 'version', 'watch', 'line',
|
|
142
|
-
'unit', 'rule', 'label', 'from', 'out', // cad set, cad rules
|
|
146
|
+
'unit', 'rule', 'label', 'from', 'out', 'jigs', // cad set, cad rules, cad beams
|
|
143
147
|
'a', 'b', 'min', 'max', 'poses', 'id', 'type', 'parent', 'child', 'follow', 'value', 'ratio', 'object', 'assembly', 'variant', 'rotate', 'to', 'roll', // cad add
|
|
144
|
-
'screw', 'through', 'into', 'holes', 'nut', 'washer', 'length', 'torque', 'from-fits'
|
|
148
|
+
'screw', 'through', 'into', 'holes', 'nut', 'washer', 'length', 'torque', 'from-fits', // cad add fasten
|
|
149
|
+
'kind', 'fitting']; // cad add join
|
|
145
150
|
// What a command takes, where that isn't <project>/<object>
|
|
146
|
-
const USAGE = { add: 'fit|joint|item|beam|loop|pose|fasten <project>/<assembly> --key value …', why: '<project>/<object>.<variable>', set: '<project>/<object> name=value …',
|
|
151
|
+
const USAGE = { add: 'fit|joint|item|beam|loop|pose|fasten|join <project>/<assembly> --key value …', why: '<project>/<object>.<variable>', set: '<project>/<object> name=value …',
|
|
147
152
|
optimise: '<project>/<problem>', optimize: '<project>/<problem>', history: '<project>[/<object>]', release: '<project>[/<object>] -m "what changed"',
|
|
148
153
|
diff: '<project>/<object> <from> [<to>]', compare: '<project>/<object> <a> <b>', match: '<project>/<object> <model.stl|model.3mf>', clone: '<board.kicad_pcb | GitHub link> <name>' };
|
|
149
154
|
|
|
150
155
|
const args = process.argv.slice(2);
|
|
151
156
|
// Options that stand alone. Every other takes the value after it: --name value, or -m for one-letter names
|
|
152
157
|
// (--sweep, --watch and --nut take one or not).
|
|
153
|
-
const FLAGS = ['table', 'calibrate', 'check', 'preview', 'no-steps', 'all', 'dry-run', 'explode', 'force', 'fresh', 'json', 'long', 'md', 'new', 'no-models', 'no-pictures', 'no-rules', 'open', 'progress', 'push', 'short', 'washer', 'from-fits'];
|
|
158
|
+
const FLAGS = ['table', 'calibrate', 'check', 'preview', 'no-steps', 'all', 'dry-run', 'explode', 'force', 'fresh', 'json', 'long', 'md', 'new', 'no-models', 'no-pictures', 'no-rules', 'open', 'progress', 'push', 'short', 'washer', 'from-fits', 'jigs'];
|
|
154
159
|
const opt = (k) => {
|
|
155
160
|
const i = args.findIndex((a) => a === `--${k}` || (k.length === 1 && a === `-${k}`));
|
|
156
161
|
if (i < 0) return undefined;
|
|
@@ -602,7 +607,7 @@ async function editVariables(ref) {
|
|
|
602
607
|
console.log(`set ${r.changed.join(', ')} in ${path.relative(WS, r.file)}`);
|
|
603
608
|
}
|
|
604
609
|
|
|
605
|
-
// cad add fit|joint|item|loop|pose|fasten <project>/<assembly> --key value …: add to an assembly, keeping its layout
|
|
610
|
+
// cad add fit|joint|item|loop|pose|fasten|join <project>/<assembly> --key value …: add to an assembly, keeping its layout
|
|
606
611
|
async function editAssembly(what, ref) {
|
|
607
612
|
const list = (k) => (typeof opt(k) === 'string' ? opt(k).split(',').map((x) => parseValue(x.trim())) : undefined);
|
|
608
613
|
const pick = (keys) => Object.fromEntries(keys.map((k) => [k, typeof opt(k) === 'string' ? parseValue(opt(k)) : undefined]).filter(([, v]) => v !== undefined));
|
|
@@ -629,11 +634,12 @@ async function editAssembly(what, ref) {
|
|
|
629
634
|
const names = (k) => (typeof opt(k) === 'string' ? opt(k).split(',').map((x) => x.trim()).filter(Boolean) : undefined);
|
|
630
635
|
entry = { ...text(['screw']), through: names('through') ?? [], ...text(['into']), ...(names('at') ? { at: names('at') } : {}), ...text(['holes']), ...(opt('nut') ? { nut: opt('nut') === true ? true : String(opt('nut')) } : {}), ...(opt('washer') ? { washer: true } : {}), ...pick(['length', 'torque']), ...text(['note']) };
|
|
631
636
|
}
|
|
637
|
+
else if (what === 'join') entry = text(['kind', 'a', 'b', 'fitting', 'screw', 'note']);
|
|
632
638
|
else if (what === 'pose') {
|
|
633
639
|
const pairs = positional().slice(3);
|
|
634
640
|
if (typeof opt('name') !== 'string' || !pairs.length) throw new Error('usage: cad add pose <project>/<assembly> --name open hinge=90 [joint=value …]');
|
|
635
641
|
entry = { name: opt('name'), values: Object.fromEntries(pairs.map((p) => { const [k, v] = p.split('='); return [k.trim(), v.includes(',') ? v.split(',').map(parseValue) : parseValue(v)]; })) };
|
|
636
|
-
} else throw new Error('usage: cad add fit|joint|item|beam|loop|pose|fasten <project>/<assembly> --key value …');
|
|
642
|
+
} else throw new Error('usage: cad add fit|joint|item|beam|loop|pose|fasten|join <project>/<assembly> --key value …');
|
|
637
643
|
const r = addToAssembly(ref, what === 'beam' ? 'item' : what, entry);
|
|
638
644
|
if (opt('json')) return console.log(JSON.stringify({ ...r, added: entry }));
|
|
639
645
|
console.log(`added ${/^[aeiou]/.test(what) ? "an" : "a"} ${what} to ${path.relative(WS, r.file)}`);
|
|
@@ -1022,10 +1028,13 @@ async function platesCommand(what, ref) {
|
|
|
1022
1028
|
if (!isAssembly(ref)) throw new Error(`cad ${what} works on an assembly (<project>/<assembly>), and there is no "${ref}"`);
|
|
1023
1029
|
const s = await buildAssembly(ref);
|
|
1024
1030
|
if (what === 'order') {
|
|
1025
|
-
const { orderOf, orderText, stepPictures } = await import('../lib/order.mjs'), r = orderOf(s);
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
if (r.stuck)
|
|
1031
|
+
const { orderOf, orderText, stepPictures } = await import('../lib/order.mjs'), { withPreload } = await import('../lib/slotnuts.mjs'), r = withPreload(s, orderOf(s));
|
|
1032
|
+
// a frame (beams with joins): from bars to a square frame, its sides built flat, nuts loaded before the join that would shut them in
|
|
1033
|
+
const frame = s.joins?.length ? (await import('../lib/framebuild.mjs')) : null, fb = frame ? frame.frameBuild(s) : null;
|
|
1034
|
+
if (opt('json')) { console.log(JSON.stringify(fb ? { ...r, frame: fb } : r, null, 2)); if (r.stuck || fb?.stuck) process.exitCode = 1; return; }
|
|
1035
|
+
console.log(fb ? frame.frameBuildText(ref, fb) : orderText(ref, r));
|
|
1036
|
+
if (r.stuck || fb?.stuck) { process.exitCode = 1; return; }
|
|
1037
|
+
if (opt('preview') && fb) { for (const { n, parts } of frame.frameStepPictures(s, fb)) { const st = fb.steps[n - 1], out = paths.preview(s.project, `${s.name}-step-${String(n).padStart(2, '0')}.png`); await preview(parts, { title: `${s.a.title || s.name}: step ${n} of ${fb.steps.length}`, meta: st.text, out }); console.log(path.relative(WS, out)); } return; } // (numbered as the frame's build is)
|
|
1029
1038
|
if (opt('preview')) { const pics = stepPictures(s, r); for (const [i, parts] of pics.entries()) { const st = r.steps[i], out = paths.preview(s.project, `${s.name}-step-${String(st.n).padStart(2, '0')}.png`); await preview(parts, { title: `${s.a.title || s.name}: step ${st.n} of ${r.steps.length}`, meta: st.text, out }); console.log(path.relative(WS, out)); } }
|
|
1030
1039
|
return;
|
|
1031
1040
|
}
|
|
@@ -1050,6 +1059,21 @@ async function listCommand(what, ref) {
|
|
|
1050
1059
|
const { shoppingList, listText } = await import('../lib/list.mjs'), l = shoppingList(s);
|
|
1051
1060
|
return console.log(opt('json') ? JSON.stringify(l, null, 2) : listText(ref, l));
|
|
1052
1061
|
}
|
|
1062
|
+
if (what === 'beams' && opt('jigs')) {
|
|
1063
|
+
const { writeJigs, jigsText } = await import('../lib/jigs.mjs'), r = await writeJigs(s), rel = (f) => path.relative(WS, f);
|
|
1064
|
+
const shown = { ...r, plates: r.plates.map((p) => ({ ...p, file: rel(p.file) })) };
|
|
1065
|
+
if (opt('preview') && r.parts.length) {
|
|
1066
|
+
const out = paths.preview(s.project, `${s.name}-jigs.png`);
|
|
1067
|
+
await preview(r.parts.flatMap((o) => o.parts.map((p) => ({ name: p.name, label: p.name, role: 'part', triangles: p.triangles }))), { title: `${s.a.title || s.name}: jigs`, meta: `${r.jigs.length} jigs on ${r.plates.length} plate${r.plates.length === 1 ? '' : 's'}`, out });
|
|
1068
|
+
shown.preview = rel(out);
|
|
1069
|
+
}
|
|
1070
|
+
delete shown.parts;
|
|
1071
|
+
process.exitCode = r.findings.some((f) => f.level === 'fail') ? 1 : 0;
|
|
1072
|
+
if (opt('json')) return console.log(JSON.stringify(shown, null, 2));
|
|
1073
|
+
console.log(jigsText(ref, shown));
|
|
1074
|
+
if (shown.preview) say(shown.preview);
|
|
1075
|
+
return;
|
|
1076
|
+
}
|
|
1053
1077
|
if (what === 'beams') {
|
|
1054
1078
|
const { writeBeamSheets } = await import('../lib/beams.mjs'), sheets = writeBeamSheets(s);
|
|
1055
1079
|
if (opt('json')) return console.log(JSON.stringify(sheets.map((x) => ({ ...x, file: path.relative(WS, x.file) })), null, 2));
|