@rulecad/cad 0.7.55 → 0.7.56

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,21 @@ 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
+ - A fit with `"fastens": true` is for what holds parts without screws (pins, a press, a clip). An older assembly with
97
+ a holes fit (`{ "holes": "pcb.board", "into": "case.body", … }`) and a fit that fastens the same parts gets a
98
+ `fasten.suggest` note from `cad check`: `npx cad add fasten <project>/<assembly> --from-fits` puts the fasten in
99
+ their place. Check it after, and report what changed.
100
+ - A board screwed into its case is a `fasten` too, through the board's own mounting holes:
101
+ `{ "screw": "M2 cap", "through": ["pcb"], "into": "case", "holes": "pcb.board" }`, into bosses the case draws with
102
+ `v.fixings.insertBoss('M2', ...)` under `v.pcb.board_holes`.
96
103
  - A part built around another (a case around its board) reads it: `"uses": ["macropad/pcb"]`, then
97
104
  `pcb.board_w` and `v.pcb.board_holes`. Never copy another object's numbers by hand.
98
105
 
@@ -100,6 +107,8 @@ variable says which rule it comes from. Follow these steps; they're what makes a
100
107
  - `"engine": "pcb"` in the .json; `main(v)` returns a board built with `v.pcb` (see @rulecad/pcb's README).
101
108
  - Parts come from rule sets where one exists (`v.pcb.xiao`, `qwiic`, `jstph`, `header`), or any standard footprint by
102
109
  name (`v.pcb.part('U2', 'soic8', x, y)`). Turn parts in quarter turns with `rotation`, held in a variable.
110
+ - A board's mounting holes are named by their screws' thread, never typed: `v.pcb.mount('M2', x, y)` in its `holes`
111
+ is the thread's clearance hole from its rule set, as the fab drills it (`{ fit: 'close' }` or `'loose'` for the others).
103
112
  - Join pins with `nets` (`GND: ['U1.GND', 'J1.GND']`) and let the autorouter draw them; `cad check` runs the fab's
104
113
  design rules. Look at the copper preview: connectors should face the edge their plug comes from.
105
114
 
package/CHANGELOG.md ADDED
@@ -0,0 +1,108 @@
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.56: screws through fixings, end to end (Fixings 3)
9
+
10
+ ### What reads fixings now
11
+
12
+ - **Designs:** `v.fixings` (from `@rulecad/fixings`, bound to the project's printer, its material and the workspace's
13
+ own thread sets) is how the worked examples, the tutorial, the starter project and the machine templates draw every
14
+ screw hole, seat and nut pocket. None of them types a screw size any more.
15
+ - **Motors:** `motor.mount` checks a motor's screws as bought, through fixings: their engagement in the motor's tapped
16
+ holes must be at least one diameter (`engagement.steel`), and a counterbored plate is read as one. `cad order`
17
+ counts a motor's screws with the key that turns them, and `cad list` names their head.
18
+ - **Boards:** `v.pcb.mount('M2', x, y)` reads the workspace's thread sets before the kit's, and a build that uses it
19
+ is cached by them, as a `v.fixings` build is. A `fasten` through a board's holes (`"holes": "pcb.board"`) holds them
20
+ to the thread's clearance hole as the fab drills it, with nothing added for a printer.
21
+ - **Assemblies:** `fasten` is the one way to say a screwed joint. A fit with `"fastens": true` is for what holds parts
22
+ without screws (pins, a press, a clip), with one exception for now: a NEMA motor's mounting screws stay on its
23
+ `"fastens": true` fit, which counts them in `cad list`, because `fasten` and `motor.mount` still choose different
24
+ lengths for the same screw.
25
+
26
+ ### Added
27
+
28
+ - `fasten.suggest`: where a holes fit and a fit that fastens join the same two items, `cad check` notes the fasten that
29
+ would stand for both, with the entry to paste. The screw is read from the fit's `fastener`, else from a thread set
30
+ the holes fit's `depth` names, else from the board's holes as drawn.
31
+ - `cad add fasten <project>/<assembly> --from-fits` writes that fasten in their place: the holes fit goes, and the fit
32
+ that fastens keeps only its gap range. The file's own layout is kept.
33
+ - A screw across a yoke or a split clamp: name the part under the head first in `through` and again as `into`, and
34
+ place each screw with an anchor (`at`). Along the screw, the part's first stretch of material is the head's side
35
+ and the rest is the far side.
36
+ - `cad rules check` gives notes, which never fail: each alias a set lists in `"interface"`, and, for a workspace's own
37
+ copy of a kit set, what the kit's set has that the copy lacks. `--json` carries them as `notes`.
38
+ - The assembly schema takes a holes fit and a fasten's `holes`; editors get fasten snippets.
39
+
40
+ ### Fixed
41
+
42
+ - A fasten's nut, washer and insert are the size of their own thread. Before, every nut in an assembly took the
43
+ 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
44
+ as an M5.
45
+ - Thread engagement is compared rounded to the micron, so "engages 4 mm where 4 mm is asked" passes.
46
+
47
+ ### Printed sizes that moved: the worked examples (EXAMPLES.md) and the tutorial
48
+
49
+ The tutorial and chapters 1 to 11 and 15 move nothing: each hole that now comes from `v.fixings` comes out at the
50
+ 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
51
+ volume and outline are unchanged. Chapter 6 gains a part: a printed case for the four-key pad, with a heat-set
52
+ 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
53
+ moved). Chapters 12 to 14 are the repository's bench arm and leg written out in full, and
54
+ move what the bench moved (volumes in mm3):
55
+
56
+ | Chapter | Part | What moved | Volume | Reason |
57
+ |---|---|---|---|---|
58
+ | 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) |
59
+ | 12 | arm/upper | home switch M2 pilots 1.8 to 2.1 mm | 100104.83 to 100088.32 | As the base |
60
+ | 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 |
61
+ | 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 |
62
+ | 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 |
63
+ | 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 |
64
+ | 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 |
65
+ | 14 | leg/spindle | as arm/spindle | 5729.69 to 6119.54 | As arm/spindle |
66
+ | 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 |
67
+ | 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 |
68
+ | 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`) |
69
+
70
+ 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
71
+ quadruped in chapter 14 is 3474 g as a machine (was 3369 g), mostly its 105 g of screws, now counted.
72
+
73
+ ### Printed sizes that moved: the repository's bench workspace
74
+
75
+ `examples/bench` is not published, but it holds printed references, so its moves are listed here too.
76
+ - `bench/arm` and `bench/leg` moved exactly as chapters 12 to 14 above (they are the same files).
77
+ - `benchmarks/shoulder-housing`: the counterbore for an M3 cap head went from 6.4 to 6 mm across (volume 27363.5 to
78
+ 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
79
+ its hole compensation 0.1 mm.
80
+ - `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)
81
+ plus the printer's 0.1 mm. Its build runs a topology optimisation that takes over 30 minutes, so this one is left to
82
+ the dimension table CI writes on the pull request.
83
+ - Every other bench, benchmark and showcase part keeps its sizes: the typed holes became the same figures from
84
+ `v.fixings`. The bench's own copies of the M2 to M5 thread sets were made whole from the kit's; every value they
85
+ held was already the kit's.
86
+
87
+ ### Findings that changed
88
+
89
+ - `arm/arm-upright`: a new `fasten.load` warning, "a twist of 1.455 N m about the one screw is held by friction
90
+ alone", on the upper arm's screw into the spindle. The spindle's hexagon carries that twist, which the check cannot
91
+ see.
92
+ - `leg/stand`: two `fasten.access` warnings: the shin's screws 1 and 3 are reached only by a ball-end key in the
93
+ stand's pose. Put the shin on before the leg goes on the stand.
94
+
95
+ ### What a workspace should change
96
+
97
+ - Nothing breaks: an assembly without `fasten` checks as before, and typed holes keep working.
98
+ - Where parts screw together with a holes fit and a fit that `fastens`, run `npx cad check`: it notes the fasten
99
+ that would replace them. `npx cad add fasten <project>/<assembly> --from-fits` writes it. Check again, and fix the
100
+ part, never the fasten, where it fails.
101
+ - Draw screw holes with `v.fixings` (`v.fixings.hole('M3', { depth, at })`, `holeModel('M3', { kind: 'pilot' })`,
102
+ `counterboreModel('M3 cap')`) instead of variables such as `m3.clearance + x1c.hole_comp`. The sizes stay the same
103
+ where the old sum was the thread's figure plus the printer's compensation.
104
+ - A workspace with its own copies of thread sets (`rules/m3.json`): run `npx cad rules check` and copy across what
105
+ the kit's set has that the copy lacks, or delete the copy, so pilots, clearances and sold lengths all come from one
106
+ place.
107
+ - A fit's `"fastener"` and `"count"` are for what is not a screw (pins, a clip). Once a fasten holds a joint, the
108
+ fasten counts its screws at the length it chose; `--from-fits` takes the old fields off the fit for you.