create-rulecad 0.3.2 → 0.3.4
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/index.mjs +1 -1
- package/package.json +1 -1
- package/template/AGENTS.md +12 -1
- package/template/projects/home/objects/soap-tray.json +77 -11
package/index.mjs
CHANGED
|
@@ -20,7 +20,7 @@ fs.renameSync(path.join(dir, 'gitignore'), path.join(dir, '.gitignore')); // npm
|
|
|
20
20
|
const readme = path.join(dir, 'README.md');
|
|
21
21
|
fs.writeFileSync(readme, fs.readFileSync(readme, 'utf8').replaceAll('NAME', name));
|
|
22
22
|
// $RULECAD_LOCAL: a rulecad checkout to use instead of npm (to try unpublished changes)
|
|
23
|
-
const from = (pkg) => (process.env.RULECAD_LOCAL ? `file:${path.join(path.resolve(process.env.RULECAD_LOCAL), 'packages', pkg)}` : '^0.
|
|
23
|
+
const from = (pkg) => (process.env.RULECAD_LOCAL ? `file:${path.join(path.resolve(process.env.RULECAD_LOCAL), 'packages', pkg)}` : '^0.4.0');
|
|
24
24
|
fs.writeFileSync(path.join(dir, 'package.json'), `${JSON.stringify({
|
|
25
25
|
name, private: true, type: 'module',
|
|
26
26
|
scripts: { check: 'cad check home/soap-tray' },
|
package/package.json
CHANGED
package/template/AGENTS.md
CHANGED
|
@@ -29,7 +29,11 @@ variable says which rule it comes from. Follow these steps; they're what makes a
|
|
|
29
29
|
## Changing a design
|
|
30
30
|
1. `npx cad history <project>/<object>` first: read the print log. A failed print is the reason for most changes:
|
|
31
31
|
fix the rule or variable it points at (a measured fit beats a community rule).
|
|
32
|
-
2. Change, then check, preview and look, as for a new part.
|
|
32
|
+
2. Change, then check, preview and look, as for a new part. Change values with `npx cad set <project>/<object>
|
|
33
|
+
name=value` and assemblies with `npx cad add fit|joint|item|pose …`: they keep the file's layout and refuse an edit
|
|
34
|
+
that breaks it. `npx cad values` lists an object's numbers; `npx cad why <project>/<object>.<name>` shows what a
|
|
35
|
+
value depends on, down to the rules (estimates marked). `--json` on check, values and why gives data to act on:
|
|
36
|
+
each finding has a code, its numbers and where it is.
|
|
33
37
|
3. `npx cad release <project>/<object> -m "what changed, for the person" --dry-run` shows the bump and why. If it's
|
|
34
38
|
major, tell the person which interface values changed: earlier prints may no longer fit.
|
|
35
39
|
4. Release only when the person agrees. Don't use `--force` without asking.
|
|
@@ -40,6 +44,10 @@ variable says which rule it comes from. Follow these steps; they're what makes a
|
|
|
40
44
|
- Holes and slots get the printer's hole compensation; parts that slide together get its fit clearance. Chamfer
|
|
41
45
|
bottom edges.
|
|
42
46
|
- An overhang warning means supports: say so in `orientation`, or change the shape or orientation.
|
|
47
|
+
- Use the print-aware features in `v.shapes` before drawing your own: `countersink`, `teardropHole`, `nutPocket`,
|
|
48
|
+
`crushRibs`, `wallOpening` print without supports as drawn. Use `v.ops.union/subtract/intersect` for booleans: the
|
|
49
|
+
workspace can switch them to Manifold (faster, watertight) without touching the design.
|
|
50
|
+
- Designs run sandboxed: they may import only `@jscad/modeling`, `@rulecad/shapes` and files in their project.
|
|
43
51
|
- Something printed under the part and removed afterwards is a named `support` part (`return { cap, pillar }`, both
|
|
44
52
|
described in the .json's `parts`), not part of the shape. Look at `cad preview --explode` too.
|
|
45
53
|
|
|
@@ -56,6 +64,9 @@ variable says which rule it comes from. Follow these steps; they're what makes a
|
|
|
56
64
|
with ranges from rules. An overlap or gap outside its range is a finding: report it with the numbers, and never
|
|
57
65
|
widen a range to make it pass without saying why.
|
|
58
66
|
- Build bigger things from checked assemblies used as items, rather than placing their objects again.
|
|
67
|
+
- Things that move are one assembly with joints and poses, not a copy per position: give the objects anchors, join
|
|
68
|
+
them with joints, name the positions in `poses`, and run `cad check --sweep` to find where parts collide on the way.
|
|
69
|
+
See "Joints and poses" in the cad README.
|
|
59
70
|
- A part is named in fits as `<item>.<part>`; an object that returns one unnamed shape has one part, `body`.
|
|
60
71
|
- A gap fit can't tell whether holes line up. Where a board screws into a part, add a holes fit
|
|
61
72
|
(`{ "holes": "pcb.board", "into": "case.body", "depth": "m2.insert_length" }`).
|
|
@@ -1,20 +1,86 @@
|
|
|
1
1
|
{
|
|
2
|
+
"$schema": "https://jonibach.github.io/rulecad/schemas/object.schema.json",
|
|
2
3
|
"name": "soap-tray",
|
|
3
4
|
"title": "Soap tray",
|
|
4
5
|
"version": "0.1.0",
|
|
5
|
-
"uses": [
|
|
6
|
+
"uses": [
|
|
7
|
+
"x1c"
|
|
8
|
+
],
|
|
6
9
|
"material": "PLA",
|
|
7
10
|
"orientation": "Flat side down on the bed. Walls are straight up, so it prints without supports.",
|
|
8
11
|
"variables": {
|
|
9
|
-
"length": {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
"length": {
|
|
13
|
+
"value": 110,
|
|
14
|
+
"unit": "mm",
|
|
15
|
+
"rule": "Long enough for a bar of soap",
|
|
16
|
+
"label": "Length",
|
|
17
|
+
"show": true,
|
|
18
|
+
"tweak": {
|
|
19
|
+
"min": 70,
|
|
20
|
+
"max": 180
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"width": {
|
|
24
|
+
"value": 75,
|
|
25
|
+
"unit": "mm",
|
|
26
|
+
"rule": "Wide enough for a bar of soap",
|
|
27
|
+
"label": "Width",
|
|
28
|
+
"show": true,
|
|
29
|
+
"tweak": {
|
|
30
|
+
"min": 50,
|
|
31
|
+
"max": 120
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"height": {
|
|
35
|
+
"value": "x1c.layer * 60",
|
|
36
|
+
"unit": "mm",
|
|
37
|
+
"rule": "A whole number of layers",
|
|
38
|
+
"label": "Height",
|
|
39
|
+
"show": true
|
|
40
|
+
},
|
|
41
|
+
"wall": {
|
|
42
|
+
"value": "x1c.line * 4",
|
|
43
|
+
"unit": "mm",
|
|
44
|
+
"rule": "Four print lines: stiff, and no gaps between lines",
|
|
45
|
+
"label": "Wall"
|
|
46
|
+
},
|
|
47
|
+
"floor": {
|
|
48
|
+
"value": "x1c.layer * 8",
|
|
49
|
+
"unit": "mm",
|
|
50
|
+
"rule": "Eight layers under the ribs"
|
|
51
|
+
},
|
|
52
|
+
"rib_height": {
|
|
53
|
+
"value": "x1c.layer * 15",
|
|
54
|
+
"unit": "mm",
|
|
55
|
+
"rule": "Holds the soap up out of the water",
|
|
56
|
+
"label": "Rib height",
|
|
57
|
+
"show": true
|
|
58
|
+
},
|
|
59
|
+
"rib_width": {
|
|
60
|
+
"value": "x1c.line * 4",
|
|
61
|
+
"unit": "mm",
|
|
62
|
+
"rule": "Four print lines"
|
|
63
|
+
},
|
|
64
|
+
"pitch": {
|
|
65
|
+
"value": 12,
|
|
66
|
+
"unit": "mm",
|
|
67
|
+
"rule": "Ribs this far apart: soap rests on several, water runs between",
|
|
68
|
+
"label": "Rib spacing",
|
|
69
|
+
"show": true,
|
|
70
|
+
"tweak": {
|
|
71
|
+
"min": 8,
|
|
72
|
+
"max": 20
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"slot": {
|
|
76
|
+
"value": "3 + x1c.hole_comp",
|
|
77
|
+
"unit": "mm",
|
|
78
|
+
"rule": "Drain slots between the ribs, widened for how holes print small"
|
|
79
|
+
},
|
|
80
|
+
"margin": {
|
|
81
|
+
"value": 6,
|
|
82
|
+
"unit": "mm",
|
|
83
|
+
"rule": "Solid floor between the slots and the walls"
|
|
84
|
+
}
|
|
19
85
|
}
|
|
20
86
|
}
|