SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.
fix(skills): correct statements that no longer match 0.21.0 (#5899)
Matt Ruhland13c4a62a7194
diff --git a/skills/solidcraft-checking/SKILL.md b/skills/solidcraft-checking/SKILL.mdindex 900a3536fd..be46019096 100644--- a/skills/solidcraft-checking/SKILL.md+++ b/skills/solidcraft-checking/SKILL.md@@ -7,7 +7,7 @@ description: Use alongside solidcraft-modeling and solidcraft-editing whenever y`solidcraft-modeling` and `solidcraft-editing` cover the commands, plane axes, ids, edge picks and the MCP workflow: load the one that fits first. This skill adds checks for errors SolidCraft does not report, and the work around a design kept in a repo.-`$SKILL` below is the folder this file is in (`~/.claude/skills/solidcraft-checking` for a user install). Written against SolidCraft 0.8.0. `scripts/tests/test_facts.py` checks every trap and convention below, and the facts behind the corrections in `solidcraft-modeling`. After a SolidCraft upgrade, run the tests and fix the text where they fail:+`$SKILL` below is the folder this file is in (`~/.claude/skills/solidcraft-checking` for a user install). Checked against SolidCraft 0.21.0. `scripts/tests/test_facts.py` checks every trap and convention below, and the facts behind the corrections in `solidcraft-modeling`. After a SolidCraft upgrade, run the tests and fix the text where they fail:`PYTHONDONTWRITEBYTECODE=1 uv run --no-project --with pytest --with build123d pytest -p no:cacheprovider $SKILL/scripts/tests`## Scripts@@ -37,8 +37,7 @@ In `$SKILL/scripts/`:5. **Measurement accuracy.** The `solidcraft-modeling` reference gives how far measured volumes stray from computed ones. Centre of mass and bounding box come out up to about 5e-5 of the part size off. Set test tolerances as the template says.6. **Expressions.** They have `+ - * / ^ %`, `sin cos tan asin acos atan atan2 sqrt abs min max floor ceil round mod trunc exp ln log log10 pow sign hypot` (`log` is base 10), `pi` and units; no `if` and no comparisons. Build steps from `floor`, `mod`, `min`, `max` and `sign`, which gives 1 at 0. `asin acos atan atan2` return angles, so a unitless parameter cannot hold them.7. **Snapping.** A point created exactly on an existing point or the origin becomes coincident with it (`connect` defaults to true).-8. **Rectangle symmetry.** Opposite sides of a rectangle run in opposite directions, so `sketch.constraint.symmetry` on two sides conflicts with the rectangle; make two corner points symmetric instead.-9. **Repeated body names.** A repeated `body_name` is renamed (`Body1`) without an error, so `targets` reach only the first body.+8. **Repeated body names.** A repeated `body_name` is renamed (`Body1`) without an error, so `targets` reach only the first body.## Conventionsdiff --git a/skills/solidcraft-checking/scripts/tests/test_facts.py b/skills/solidcraft-checking/scripts/tests/test_facts.pyindex cbe7da64da..5eb79fdda7 100644--- a/skills/solidcraft-checking/scripts/tests/test_facts.py+++ b/skills/solidcraft-checking/scripts/tests/test_facts.py@@ -227,13 +227,6 @@ def test_a_point_created_on_the_origin_snaps_to_it():assert sketch_dof([cmd("sketch.create", plane="XY"), cmd("sketch.circle.center", center=[0, 0], radius=5)]) == 1-def test_symmetric_rectangle_sides_conflict_and_corners_do_not():- rectangle = [cmd("sketch.create", plane="XY"), cmd("sketch.rectangle.two_point", p0=[-10, 2], p1=[10, 8])]- with pytest.raises(SolidCraftError, match="conflicts"):- execute([*rectangle, cmd("sketch.constraint.symmetry", a="l4", b="l2", line="y")])- execute([*rectangle, cmd("sketch.constraint.symmetry", a="p1", b="p2", line="y")])--def test_a_repeated_body_name_is_renamed_and_targets_reach_the_first_body():inspection = execute([cmd("solid.box", length=10, width=10, height=10, body_name="M"),@@ -328,6 +321,59 @@ def test_a_slot_along_y_takes_a_horizontal_dimension_on_its_second_arc():cmd("sketch.dimension", entities=["origin", "a2.center"], type="horizontal", value="10 mm"))) == 0+def test_slot_ids_count_on_from_the_curves_before_it():+ created = run_commands([+ cmd("sketch.create", plane="XY"),+ cmd("sketch.rectangle.two_point", p0=[-30, -20], p1=[30, 20]),+ cmd("sketch.slot.overall", p0=[-10, 0], p1=[10, 0], width=4),+ ])[-2]["created"]+ assert created["curves"] == ["l5", "a1", "l6", "a2"]+ assert created["points"] == ["p5", "p6", "p7", "p8", "a1.center", "a2.center"]+++def test_two_concentric_circles_extrude_as_a_ring():+ body = execute([+ cmd("sketch.create", plane="XY"),+ cmd("sketch.circle.center", center=[0, 0], radius=10),+ cmd("sketch.circle.center", center=[0, 0], radius=6),+ cmd("sketch.finish"),+ cmd("solid.extrude", distance="5 mm"),+ ])["bodies"][0]+ assert body["volume_mm3"] == pytest.approx(pi * (10 ** 2 - 6 ** 2) * 5, rel=2e-4)+++CUBE = cmd("solid.box", length=40, width=40, height=10, center=[0, 0, 5], body_name="B")+++def test_an_edge_pick_far_from_every_edge_is_refused():+ with pytest.raises(SolidCraftError, match="nearest edge is 15.000 mm away"):+ execute([CUBE, cmd("solid.fillet", edges=[[20, 20, 25]], radius=1)])++[email protected]("offset", ["0 mm", "-5 mm"])+def test_a_hole_sketch_under_the_part_drills_up_into_it(offset):+ body = execute([+ CUBE,+ cmd("sketch.create", plane="XY", offset=offset, name="Hole sketch"),+ cmd("sketch.point", point=[0, 0]),+ cmd("sketch.finish"),+ cmd("solid.hole", sketch="Hole sketch", diameter=6, depth=4),+ ])["bodies"][0]+ assert body["volume_mm3"] == pytest.approx(40 * 40 * 10 - pi * 9 * 4, rel=2e-4)+ assert body["center_of_mass"][2] > 5+++def test_a_fillet_between_curved_faces_stops_the_shell():+ neck = [+ cmd("solid.cylinder", radius=8, height=20, body_name="C"),+ cmd("solid.sphere", radius=15, center=[0, 0, 30], operation="join", targets=["C"]),+ ]+ shell = cmd("solid.shell", faces=[[0, 0, 0]], thickness=1.5)+ with pytest.raises(SolidCraftError, match="offset: only bodies with planes"):+ execute([*neck, cmd("solid.fillet", edges=[[8, 0, 30 - (15 ** 2 - 8 ** 2) ** 0.5]], radius=2), shell])+ execute([*neck, shell])++OPEN_BOX = [cmd("solid.box", length=40, width=30, height=20, center=[0, 0, 10], body_name="B"),cmd("solid.fillet", edges=[[20, 15, 10], [-20, 15, 10], [20, -15, 10], [-20, -15, 10]], radius=3),diff --git a/skills/solidcraft-mechanisms/SKILL.md b/skills/solidcraft-mechanisms/SKILL.mdindex 6e435ec00d..890b875a44 100644--- a/skills/solidcraft-mechanisms/SKILL.md+++ b/skills/solidcraft-mechanisms/SKILL.md@@ -59,7 +59,7 @@ Written against SolidCraft `main` after 0.11.1, which counts the degrees of free- **Trace:** `motion.trace {"occurrence":..., "point":[x,y,z], "joint":..., "from":0, "to":360}` (or `"study":...` instead of joint, from and to) answers the world path of a point of a part, such as a coupler curve, without changing the design. It ends at `stopped_at` where a loop or contact stops the motion. `motion.trace.keep` with the same params keeps it as a 3D sketch spline.- **Plot:** `motion.plot {"study":..., "joints":[...], "duration":seconds}` answers each joint value's `value`, `velocity` and `acceleration` per sample (finite differences; per step, or per second with a duration), and with `"occurrence"` and `"point"` a point's `position`, `velocity`, `acceleration`, `speed`. Check a follower's rate against the analytic one this way, without changing the design.- **Collisions:** `motion.interference {"study":..., "occurrences":[...], "against":[...]}` plays the study (contact sets don't stop it) and lists each colliding pair with `first_step` and `steps` ranges; `clear: true` when none. It takes at most 256 bodies: on a big design list the moving part as `occurrences` and what it must miss as `against`. Parts joined at a knuckle often overlap by design and show up at every step.-- **Sweep until contact:** `joint.sweep {"joint":..., "from":0, "to":120, "against":[...], "report_gaps":true}` answers how far a hinge, door or linkage opens: `stopped_at` (last clear value, bisected to `refine` mm, default 0.01), `stopped_by` `{a, b, at}` (or `"loop"`, `"limit"`), per-sample `min_gap_mm` and the nearest each part came (`min_gap`). It runs on a copy; `"apply":true` leaves the design at the stop. Pairs touching at `from` (`touching_at_start`) stop it only once they pass into each other.+- **Sweep until contact:** `joint.sweep {"joint":..., "from":0, "to":120, "occurrences":[...], "against":[...], "report_gaps":true}` answers how far a hinge, door or linkage opens: `stopped_at` (last clear value, bisected to `refine` mm, default 0.01), `stopped_by` `{a, b, at}` (or `"loop"`, `"limit"`), per-sample `min_gap_mm` and the nearest each part came (`min_gap`). It runs on a copy; `"apply":true` leaves the design at the stop. Pairs touching at `from` (`touching_at_start`) stop it only once they pass into each other.## Verify- **Each joint:** `execute occurrence.properties {"occurrence":"Wing:1"}` (under 1 KB) gives the world bbox and centre of mass of one occurrence. Joining must not move them.diff --git a/skills/solidcraft-modeling/SKILL.md b/skills/solidcraft-modeling/SKILL.mdindex aa15f9afcf..290092d2aa 100644--- a/skills/solidcraft-modeling/SKILL.md+++ b/skills/solidcraft-modeling/SKILL.md@@ -37,15 +37,17 @@ Work the part out as numbers first. Then build it in a few large `batch` calls,A plain number never follows a parameter.- **Repeats:** `solid.pattern.rectangular` takes expression spacing; `solid.mirror` takes `XY`/`XZ`/`YZ`, a construction plane or `{origin, normal}` (origin coordinates may be length expressions such as `["half", 0, 0]`). A mirror or pattern feature cannot be mirrored or patterned again.-- **Edge and face picks** snap to the nearest edge or face. There is no distance limit and no error, so compute the exact midpoint from your geometry (the vertical corner edge of a centred box is `[w/2, d/2, h/2]`).+- **Edge and face picks** snap to the nearest edge or face. An edge pick farther than 5% of the body's size from every edge is refused (`the nearest edge is 15.000 mm away`). On a large body that limit is wide (about 48 mm on a 949 mm board), so compute the exact midpoint from your geometry (the vertical corner edge of a centred box is `[w/2, d/2, h/2]`).- Picks must be plain numbers.- A pick is resolved once and then follows its edge when parameters change.- A face can be given by name instead of a point (`faces:["F1:+z"]`, the `face` of `sheet.convert`). `body_topology` lists each face's `name`, a `point` that lies on it (the centroid of a face with a hole is in the hole) and, for a cylinder, `{origin, axis, radius}`.-- **Profiles:** extrude takes every region by default. For a ring or a boss with a hole, pass `profiles`.-- **Order:** fillet the outside edges before you shell, so the shell follows the fillets. An edge of the face the shell removes, such as the rim of an open box, is the exception: round it after the shell, because the shell can fail on it.+- **Profiles:** extrude takes every region by default, and a region inside another is a hole in it: two concentric circles give a ring. A third circle inside the ring gives a separate disc body. Pass `profiles` to choose regions.+- **Order:** fillet the outside edges before you shell, so the shell follows the fillets. There are two exceptions:+ - An edge of the face the shell removes, such as the rim of an open box: round it after the shell, because the shell can fail on it.+ - A fillet between two curved faces, such as a sphere joined to a cylinder: the shell then fails with `offset: only bodies with planes, cylinders, cones, spheres and tori`. Shell first. The inside corner then stays sharp, so the wall there is thinner than `thickness`.## Verify-- **Each stage:** run `measure {}` (about 1 KB) and compare the volume, bbox and face count with your numbers. A cut or hole that leaves the volume unchanged has missed, even though it reported success.+- **Each stage:** run `measure {}` (about 0.9 KB per body) and compare the volume, bbox and face count with your numbers. A cut or hole that leaves the volume unchanged has missed, even though it reported success.- **Timeline health:** `inspect_design {"measure":false,"sketches":false}` shows each feature's `error` and `warning`.- **Parameter test:** run `set_parameter`. Expect `errors: []`, then `measure` again; the COM and bbox should move by the amounts you computed.- **Positions:** `measure` does not say where a feature sits.diff --git a/skills/solidcraft-modeling/reference.md b/skills/solidcraft-modeling/reference.mdindex c9435e0b1f..88a43fb47c 100644--- a/skills/solidcraft-modeling/reference.md+++ b/skills/solidcraft-modeling/reference.md@@ -22,7 +22,7 @@ These are the shapes of the commands a part build needs, so an agent rarely has- Draw a feature at height z at sketch y = **-z**.- A cut with a positive distance goes into the wall.- **Top face:** sketch on `{"plane":"XY","offset":"h"}`.-- **Hole direction:** `solid.hole {sketch}` drills from the sketch plane along -normal. A hole sketch at z=0 under a part drills into empty space and still reports success, so put the sketch on the top face.+- **Hole direction:** `solid.hole {sketch}` drills into the part from the face nearest the sketch. A hole sketch at z=0, or below the part, drills up into the bottom face. Put the sketch on the face the hole starts from.## Ids@@ -32,7 +32,7 @@ These are the shapes of the commands a part build needs, so an agent rarely has- **Rectangles:** `sketch.rectangle.*` also returns `sides {bottom,right,top,left}` and `corners {bottom_left,...}`.- `rectangle.center` adds 2 construction diagonals, so each corner joins 3 lines. Its centre point is `p5`.- `sketch.fillet {point}` therefore fails on its corners. Use `{a:"l1", b:"l4", radius}` or the 3D `solid.fillet`.-- **Slots:** `sketch.slot.overall` and `sketch.slot.center_to_center` create curves `l1, a1, l2, a2` and points `p1`-`p4`, `a1.center`, `a2.center`.+- **Slots:** `sketch.slot.overall` and `sketch.slot.center_to_center` create 2 lines, 2 arcs and 4 points, plus `a1.center` and `a2.center`. The ids count on from what the sketch already has: in an empty sketch `l1, a1, l2, a2` and `p1`-`p4`, after a `rectangle.two_point` `l5, a1, l6, a2` and `p5`-`p8`.- The `length` role of `slot.overall` is the overall length. The arc centres are at ±(length/2 - width/2).- After `length` and `width`, 3 dof remain. To remove them, dimension `origin` to `a1.center` horizontally and vertically, and `origin` to `a2.center` vertically. For a slot along Y the solver refuses that last dimension as over-constraining; dimension `a2.center` horizontally instead.- `sketch.slot.center_point` creates no centre point. Dimension an arc centre instead.@@ -73,12 +73,12 @@ Distances are unsigned. Draw the geometry on the correct side first, and the dim| Command | Minimal params | Traps ||---|---|---|-| `solid.extrude` | `distance` | `profiles` defaults to **every region**, so two concentric circles give a solid disc. Pick regions with `[{"point":[x,y]}]` or `[index]`. Other options: `operation` (new/join/cut/intersect/auto), `direction` (positive/negative/symmetric), `through_all: true`, `start_offset`. A cut that misses reports success. |+| `solid.extrude` | `distance` | `profiles` defaults to **every region**, with a region inside another as a hole in it: two concentric circles give a ring. Pick regions with `[{"point":[x,y]}]` or `[index]`. Other options: `operation` (new/join/cut/intersect/auto), `direction` (positive/negative/symmetric), `through_all: true`, `start_offset`. A cut that misses reports success. || `solid.box` | `length`, `width`, `height` | `center:[x,y,z]` or `corner`. The quickest way to block out a part. `body_name` names the body it makes. With `operation:"cut"`, `targets:["Top"]` cuts only the bodies listed, so the cutter can pass through other bodies. || `solid.cylinder` | `radius` or `diameter`, `height` | `base` is the centre of the bottom (default origin), `axis` defaults to `Z`. Expressions work in `base`. Always pass `operation`. `body_name` and `targets` work as for `solid.box`. || `sketch.slot.overall` / `sketch.slot.center_to_center` | `p0`, `p1` (overall ends / arc centres), `width` | Ids and dof are in the "Ids" section above. |-| `solid.fillet` / `solid.chamfer` | `edges:[[x,y,z]]`, `radius` / `distance` | The pick snaps to the **nearest** edge, with no distance limit and no error, so check that the face count changed. One pick takes the whole tangent chain: a rounded rim needs 1 point, not 8. |-| `solid.shell` | `faces:[[x,y,z]]`, `thickness` | A point on each face to remove, or its name from `body_topology`. Fillet first, except an edge of a removed face (see Order in `SKILL.md`). |+| `solid.fillet` / `solid.chamfer` | `edges:[[x,y,z]]`, `radius` / `distance` | The pick snaps to the **nearest** edge. A pick farther than 5% of the body's size from every edge is refused, so check that the face count changed. One pick takes the whole tangent chain: a rounded rim needs 1 point, not 8. |+| `solid.shell` | `faces:[[x,y,z]]`, `thickness` | A point on each face to remove, or its name from `body_topology`. Fillet first, except an edge of a removed face or a fillet between curved faces (see Order in `SKILL.md`). Bodies with lofted or swept faces are refused (`offset: only bodies with planes, cylinders, cones, spheres and tori`): hollow a loft with a smaller loft and `operation: cut`. || `solid.hole` | `position:[x,y,z]` on a face (numbers or length expressions such as `["40", "width/2", "t"]`, which the hole then follows) + `diameter`, or `sketch` (+ `points`) | `clearance:"M3"`. `depth` defaults to through all. `type` is one of simple/drilled/counterbore/countersink. A `countersink` needs `cs_diameter` and `cs_angle`; a `counterbore` needs `cb_diameter` and `cb_depth`. `position` is a fixed point; to tie it to the part, add `references: [{edge:[x,y,z], distance}]` (up to two straight edges of the face): the centre then sits at those distances from the edges and follows them. || `solid.pattern.rectangular` | `features`, `dir1`, `count1`, `spacing1` (+ `dir2`, `count2`, `spacing2`) | Spacing takes expressions and follows parameters. || `solid.pattern.circular` | `features`, `axis` (`"Z"` or `{origin, dir}`), `count` | `angle` defaults to 360 deg. A full pattern keeps the COM on the axis, so check its radius with a top-view screenshot. |@@ -138,10 +138,10 @@ After `set_parameter L=120` the volume is 35335.2 mm³, and the holes stay in th| `list_commands {}` | **Over 100 KB.** Never call it unfiltered; filter on a distinctive word such as `"hole"` or `"slot"`. || `body_topology` | 25-45 KB || `inspect_design {}` | 12 KB, and it grows with the sketches |-| `inspect_design {"measure":false,"sketches":false}` | 4 KB: parameters, timeline errors, bodies |+| `inspect_design {"measure":false,"sketches":false}` | 4 KB for one part: parameters, timeline errors, bodies. About 65 B more per body (14 KB at 210 bodies) || `sketch.inspect` | 5 KB per small sketch || `parameters.list {"filter":"feature"}` | 3 KB |-| `measure {}` | 1 KB: volume, bbox, COM, face/edge/vertex counts |+| `measure {}` | about 0.9 KB per body: volume, bbox, COM, face/edge/vertex counts. On a large design, `execute inspect.measure {"bodies":[...]}` measures only the listed bodies || `sketch.solve` | under 100 B: dof, status, profile count || `screenshot {"source":"model","width":480,"height":320}` | one small image. Without `source`, a bridged server returns the whole app window and ignores the size. |