@rulecad/cad 0.7.55 → 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
@@ -85,14 +85,78 @@ variable says which rule it comes from. Follow these steps; they're what makes a
85
85
  them with joints, name the positions in `poses`, and run `cad check --sweep` to find where parts collide on the way.
86
86
  See "Joints and poses" in the cad README.
87
87
  - A part is named in fits as `<item>.<part>`; an object that returns one unnamed shape has one part, `body`.
88
- - Where parts screw together, say so with `fasten`, which knows the screw:
88
+ - **A screwed joint is a `fasten`**, which knows the screw:
89
89
  `{ "screw": "M3 cap", "through": ["bracket"], "into": "base", "at": ["bracket.h1", "bracket.h2"] }` (anchors on the
90
- holes' axes), or `"holes": "bracket.body"` to use the part's own holes; `npx cad add fasten …` writes it. The check
91
- reads the holes from the parts as drawn: one axis through the stack, a clearance hole in each part passed, a pilot,
92
- insert or nut at the far end, the length chosen from what is sold, thread engaged, and the seat under the head.
93
- Report what it finds with its numbers, and fix the part, never the relation, to make it pass.
94
- - A gap fit can't tell whether holes line up. Where a board only rests on its screws' bosses, a holes fit follows them
95
- (`{ "holes": "pcb.board", "into": "case.body", "depth": "m2.insert_length" }`).
90
+ holes' axes), or `"holes": "bracket.body"` to use the part's own holes; `npx cad add fasten …` writes it. Draw each
91
+ part's holes with `v.fixings` (a clearance hole where the screw passes, a pilot, insert or nut seat where it ends),
92
+ and name the screw by thread and head with no length: the check chooses one. It reads the holes from the parts as
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
+ length chosen from what is sold, thread engaged, the seat under the head and the key's way to it, and `cad list`
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.
153
+ - A fit with `"fastens": true` is for what holds parts without screws (pins, a press, a clip). An older assembly with
154
+ a holes fit (`{ "holes": "pcb.board", "into": "case.body", … }`) and a fit that fastens the same parts gets a
155
+ `fasten.suggest` note from `cad check`: `npx cad add fasten <project>/<assembly> --from-fits` puts the fasten in
156
+ their place. Check it after, and report what changed.
157
+ - A board screwed into its case is a `fasten` too, through the board's own mounting holes:
158
+ `{ "screw": "M2 cap", "through": ["pcb"], "into": "case", "holes": "pcb.board" }`, into bosses the case draws with
159
+ `v.fixings.insertBoss('M2', ...)` under `v.pcb.board_holes`.
96
160
  - A part built around another (a case around its board) reads it: `"uses": ["macropad/pcb"]`, then
97
161
  `pcb.board_w` and `v.pcb.board_holes`. Never copy another object's numbers by hand.
98
162
 
@@ -100,6 +164,8 @@ variable says which rule it comes from. Follow these steps; they're what makes a
100
164
  - `"engine": "pcb"` in the .json; `main(v)` returns a board built with `v.pcb` (see @rulecad/pcb's README).
101
165
  - Parts come from rule sets where one exists (`v.pcb.xiao`, `qwiic`, `jstph`, `header`), or any standard footprint by
102
166
  name (`v.pcb.part('U2', 'soic8', x, y)`). Turn parts in quarter turns with `rotation`, held in a variable.
167
+ - A board's mounting holes are named by their screws' thread, never typed: `v.pcb.mount('M2', x, y)` in its `holes`
168
+ is the thread's clearance hole from its rule set, as the fab drills it (`{ fit: 'close' }` or `'loose'` for the others).
103
169
  - Join pins with `nets` (`GND: ['U1.GND', 'J1.GND']`) and let the autorouter draw them; `cad check` runs the fab's
104
170
  design rules. Look at the copper preview: connectors should face the edge their plug comes from.
105
171
 
package/CHANGELOG.md ADDED
@@ -0,0 +1,149 @@
1
+ # Changelog: @rulecad/cad
2
+
3
+ What changed in each release, for someone upgrading a workspace. A **printed size** is a dimension of a part you
4
+ print (a hole's diameter, a seat's depth, a part's outline). Each release lists every printed size that moved, with
5
+ its reason. A **fasten** is an entry in an assembly's `"fasten"` list: one screwed joint, naming the screw by thread
6
+ and head, the parts it passes through and the part it ends in.
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
+
49
+ ## 0.7.56: screws through fixings, end to end (Fixings 3)
50
+
51
+ ### What reads fixings now
52
+
53
+ - **Designs:** `v.fixings` (from `@rulecad/fixings`, bound to the project's printer, its material and the workspace's
54
+ own thread sets) is how the worked examples, the tutorial, the starter project and the machine templates draw every
55
+ screw hole, seat and nut pocket. None of them types a screw size any more.
56
+ - **Motors:** `motor.mount` checks a motor's screws as bought, through fixings: their engagement in the motor's tapped
57
+ holes must be at least one diameter (`engagement.steel`), and a counterbored plate is read as one. `cad order`
58
+ counts a motor's screws with the key that turns them, and `cad list` names their head.
59
+ - **Boards:** `v.pcb.mount('M2', x, y)` reads the workspace's thread sets before the kit's, and a build that uses it
60
+ is cached by them, as a `v.fixings` build is. A `fasten` through a board's holes (`"holes": "pcb.board"`) holds them
61
+ to the thread's clearance hole as the fab drills it, with nothing added for a printer.
62
+ - **Assemblies:** `fasten` is the one way to say a screwed joint. A fit with `"fastens": true` is for what holds parts
63
+ without screws (pins, a press, a clip), with one exception for now: a NEMA motor's mounting screws stay on its
64
+ `"fastens": true` fit, which counts them in `cad list`, because `fasten` and `motor.mount` still choose different
65
+ lengths for the same screw.
66
+
67
+ ### Added
68
+
69
+ - `fasten.suggest`: where a holes fit and a fit that fastens join the same two items, `cad check` notes the fasten that
70
+ would stand for both, with the entry to paste. The screw is read from the fit's `fastener`, else from a thread set
71
+ the holes fit's `depth` names, else from the board's holes as drawn.
72
+ - `cad add fasten <project>/<assembly> --from-fits` writes that fasten in their place: the holes fit goes, and the fit
73
+ that fastens keeps only its gap range. The file's own layout is kept.
74
+ - A screw across a yoke or a split clamp: name the part under the head first in `through` and again as `into`, and
75
+ place each screw with an anchor (`at`). Along the screw, the part's first stretch of material is the head's side
76
+ and the rest is the far side.
77
+ - `cad rules check` gives notes, which never fail: each alias a set lists in `"interface"`, and, for a workspace's own
78
+ copy of a kit set, what the kit's set has that the copy lacks. `--json` carries them as `notes`.
79
+ - The assembly schema takes a holes fit and a fasten's `holes`; editors get fasten snippets.
80
+
81
+ ### Fixed
82
+
83
+ - A fasten's nut, washer and insert are the size of their own thread. Before, every nut in an assembly took the
84
+ first one's size: a bench with M5 nuts on two bolts and an M4 nut on a third listed 3 M5 nuts and drew the M4 nut
85
+ as an M5.
86
+ - Thread engagement is compared rounded to the micron, so "engages 4 mm where 4 mm is asked" passes.
87
+
88
+ ### Printed sizes that moved: the worked examples (EXAMPLES.md) and the tutorial
89
+
90
+ The tutorial and chapters 1 to 11 and 15 move nothing: each hole that now comes from `v.fixings` comes out at the
91
+ size it was typed at (an M3 clearance hole 3.5 mm, an M3 pilot 2.9 mm, an M4 clearance hole 4.6 mm), and each part's
92
+ volume and outline are unchanged. Chapter 6 gains a part: a printed case for the four-key pad, with a heat-set
93
+ insert's boss under each of the board's M2 holes, and the board screwed into it with a fasten (new, so nothing in it
94
+ moved). Chapters 12 to 14 are the repository's bench arm and leg written out in full, and
95
+ move what the bench moved (volumes in mm3):
96
+
97
+ | Chapter | Part | What moved | Volume | Reason |
98
+ |---|---|---|---|---|
99
+ | 12 | arm/base | M5 bolt holes 5.5 to 5.6 mm; home switch M2 pilots 1.8 to 2.1 mm | 76200.62 to 76161.41 | The printer's hole compensation (0.1 mm) is now added to the M5 clearance hole, as to every other. The 1.8 mm pilot was the M2 clearance less 0.6 mm, which is no thread's figure; it is now the M2 pilot (a community figure) |
100
+ | 12 | arm/upper | home switch M2 pilots 1.8 to 2.1 mm | 100104.83 to 100088.32 | As the base |
101
+ | 12 | arm/holder | pen clamp pilot 2.8 to 2.9 mm | 25547.38 to 25546.69 | The M3 clearance less 0.6 mm, replaced by the M3 pilot measured on the X1C |
102
+ | 12 | arm/spindle | countersinks 5.5 to 6.82 mm across; disc 46 to 48 mm across | 5729.69 to 6119.54 | 5.5 mm was a cap head's diameter. An ISO 10642 M3 countersunk head needs 6.72 mm, so the heads stood about 0.6 mm proud under the bridge. The disc grew to keep 0.6 mm of edge beside the wider countersinks |
103
+ | 12 | arm/forearm | boss counterbores sunk 1.5 mm (was 0.2); yoke cheeks made parallel; yoke heads counterbored 3 mm | 25738.92 to 25907.74 | An M3x16 from the old depth ran 2.7 mm past the elbow output's flange into the planet gears. Sunk 1.5 mm, an M3x12 engages the whole 5 mm flange and stops at its face. The cheeks were tapered 3.6 degrees under the heads and nuts, so no head sat flat. The 28 mm yoke needs a 30.4 mm screw and nut, longer than the longest M3 cap screw sold (30 mm): the counterbore makes an M3x30 fit |
104
+ | 13 | arm/gripper | SG90 servo pilots 1.8 to 1.7 mm | 29345.82 to 29350.21 | The servo's own screws, sized from its tabs' holes by `v.motors`, as its mount already was |
105
+ | 13 | arm/zframe | 28BYJ-48 motor ear holes 4.2 to 4.6 mm | 42170.27 to 42111.32 | The motor's mount takes M4 screws (`cad list` buys M4x16): the M4 clearance hole with the printer's compensation |
106
+ | 14 | leg/spindle | as arm/spindle | 5729.69 to 6119.54 | As arm/spindle |
107
+ | 14 | leg/shin | boss counterbores sunk 1.5 mm (was 0.2) | 34176.92 to 34080.07 | As the forearm: the screws stop short of the knee's planet gears |
108
+ | 14 | leg/foot | M5 bolt holes 5.5 to 5.6 mm | 13379.21 to 13351.41 | As arm/base: hole compensation on the M5 clearance |
109
+ | 14 | leg/side | beam holes 2.9 mm pilot to 3.5 mm clearance | 66414.18 to 66341.87 | The screw passes through the side plate into the beam's pilot. With a pilot in both, the screw gripped both parts and could not clamp them together (`fasten.clearance`) |
110
+
111
+ Masses that follow: the arm prints 439.4 g (was 438.7 g), and `cad list arm/arm` now counts 30.4 g of fixings. The
112
+ quadruped in chapter 14 is 3474 g as a machine (was 3369 g), mostly its 105 g of screws, now counted.
113
+
114
+ ### Printed sizes that moved: the repository's bench workspace
115
+
116
+ `examples/bench` is not published, but it holds printed references, so its moves are listed here too.
117
+ - `bench/arm` and `bench/leg` moved exactly as chapters 12 to 14 above (they are the same files).
118
+ - `benchmarks/shoulder-housing`: the counterbore for an M3 cap head went from 6.4 to 6 mm across (volume 27363.5 to
119
+ 27413.23 mm3). It is now the kit's counterbore: the M3 head 5.5 mm, plus the printer's fit 0.2 mm each side, plus
120
+ its hole compensation 0.1 mm.
121
+ - `showcase/guitar`: the screw hole is expected to go from 4.5 to 4.6 mm, the M4 clearance hole (ISO 273, 4.5 mm)
122
+ plus the printer's 0.1 mm. Its build runs a topology optimisation that takes over 30 minutes, so this one is left to
123
+ the dimension table CI writes on the pull request.
124
+ - Every other bench, benchmark and showcase part keeps its sizes: the typed holes became the same figures from
125
+ `v.fixings`. The bench's own copies of the M2 to M5 thread sets were made whole from the kit's; every value they
126
+ held was already the kit's.
127
+
128
+ ### Findings that changed
129
+
130
+ - `arm/arm-upright`: a new `fasten.load` warning, "a twist of 1.455 N m about the one screw is held by friction
131
+ alone", on the upper arm's screw into the spindle. The spindle's hexagon carries that twist, which the check cannot
132
+ see.
133
+ - `leg/stand`: two `fasten.access` warnings: the shin's screws 1 and 3 are reached only by a ball-end key in the
134
+ stand's pose. Put the shin on before the leg goes on the stand.
135
+
136
+ ### What a workspace should change
137
+
138
+ - Nothing breaks: an assembly without `fasten` checks as before, and typed holes keep working.
139
+ - Where parts screw together with a holes fit and a fit that `fastens`, run `npx cad check`: it notes the fasten
140
+ that would replace them. `npx cad add fasten <project>/<assembly> --from-fits` writes it. Check again, and fix the
141
+ part, never the fasten, where it fails.
142
+ - Draw screw holes with `v.fixings` (`v.fixings.hole('M3', { depth, at })`, `holeModel('M3', { kind: 'pilot' })`,
143
+ `counterboreModel('M3 cap')`) instead of variables such as `m3.clearance + x1c.hole_comp`. The sizes stay the same
144
+ where the old sum was the thread's figure plus the printer's compensation.
145
+ - A workspace with its own copies of thread sets (`rules/m3.json`): run `npx cad rules check` and copy across what
146
+ the kit's set has that the copy lacks, or delete the copy, so pilots, clearances and sold lengths all come from one
147
+ place.
148
+ - A fit's `"fastener"` and `"count"` are for what is not a screw (pins, a clip). Once a fasten holds a joint, the
149
+ fasten counts its screws at the length it chose; `--from-fits` takes the old fields off the fit for you.