From 1237203137d38a2a882fab7bdfe5b241c73ef2d7 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:03:27 -0400 Subject: [PATCH] Wave 363/509: Kernel rig: untrim removes holes from a sheet, a cylinder sheet and a solid's face, and refuses a face with none (and 1 more) 2 commits, squashed; the originals stay reachable from tag archive/merge-main-develop. - a01d82f30 jyviko: Kernel rig: untrim removes holes from a sheet, a cylinder sheet and a solid's face, and refuses a face with none - b2cc77094 jyviko: Kernel rig: unstitch takes a box and a cylinder apart into their faces, or one face out, and refuses a single face Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01DtL5M41G8Nua7HvuFPZkmJ --- .../cov-unstitch-box-every-face/expected.json | 26 ++++ .../cov-unstitch-box-every-face/recipe.json | 19 +++ .../cov-unstitch-box-top-only/expected.json | 14 ++ .../cov-unstitch-box-top-only/recipe.json | 27 ++++ .../expected.json | 15 ++ .../recipe.json | 18 +++ .../expected.json | 8 ++ .../recipe.json | 57 ++++++++ .../expected.json | 26 ++++ .../recipe.json | 128 ++++++++++++++++++ .../expected.json | 8 ++ .../recipe.json | 66 +++++++++ .../expected.json | 26 ++++ .../recipe.json | 84 ++++++++++++ .../expected.json | 26 ++++ .../recipe.json | 51 +++++++ 16 files changed, 599 insertions(+) create mode 100644 tests/kernel-cases/surfaces/cov-unstitch-box-every-face/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-unstitch-box-every-face/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-unstitch-box-top-only/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-unstitch-box-top-only/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-unstitch-cylinder-caps-and-side/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-unstitch-cylinder-caps-and-side/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-unstitch-one-face-sheet-refused/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-unstitch-one-face-sheet-refused/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-untrim-cylinder-sheet-hole-in-place/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-untrim-cylinder-sheet-hole-in-place/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-untrim-face-without-holes-refused/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-untrim-face-without-holes-refused/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-untrim-sheet-hole-in-place/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-untrim-sheet-hole-in-place/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-untrim-solid-top-face-copied-out/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-untrim-solid-top-face-copied-out/recipe.json diff --git a/tests/kernel-cases/surfaces/cov-unstitch-box-every-face/expected.json b/tests/kernel-cases/surfaces/cov-unstitch-box-every-face/expected.json new file mode 100644 index 000000000..0be8573b4 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-unstitch-box-every-face/expected.json @@ -0,0 +1,26 @@ +{ + "sources": [], + "what": "a 20 x 10 x 10 box unstitched: six surface bodies, one a face", + "source": "analytic", + "method": "no faces picked: every face its own surface body; areas 2 (200 + 200 + 100) = 1000; each face keeps its 4 edges, now free: 24", + "valid": false, + "body_count": 6, + "faces": 6, + "boundary_edges": 24, + "area_mm2": 1000.0, + "surface_types": [ + "plane" + ], + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 20, + 10, + 10 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-unstitch-box-every-face/recipe.json b/tests/kernel-cases/surfaces/cov-unstitch-box-every-face/recipe.json new file mode 100644 index 000000000..8bfecc18b --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-unstitch-box-every-face/recipe.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 10, + "height": 10, + "body_name": "Box" + } + }, + { + "command": "surface.unstitch", + "params": { + "body": "Box" + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-unstitch-box-top-only/expected.json b/tests/kernel-cases/surfaces/cov-unstitch-box-top-only/expected.json new file mode 100644 index 000000000..e0ce57bb9 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-unstitch-box-top-only/expected.json @@ -0,0 +1,14 @@ +{ + "sources": [], + "what": "the top of a box unstitched: the top a surface body, the open box the other", + "source": "analytic", + "method": "the picked face (top, 200) its own body, the other five (800) stay together under the box's name: 2 bodies, area 1000, free edges 4 (the top's) + 4 (the open box's rim)", + "valid": false, + "body_count": 2, + "faces": 6, + "boundary_edges": 8, + "area_mm2": 1000.0, + "surface_types": [ + "plane" + ] +} diff --git a/tests/kernel-cases/surfaces/cov-unstitch-box-top-only/recipe.json b/tests/kernel-cases/surfaces/cov-unstitch-box-top-only/recipe.json new file mode 100644 index 000000000..33bf21733 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-unstitch-box-top-only/recipe.json @@ -0,0 +1,27 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 10, + "height": 10, + "body_name": "Box" + } + }, + { + "command": "surface.unstitch", + "params": { + "body": "Box", + "faces": [ + [ + 10, + 5, + 10 + ] + ], + "body_name": "Top" + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-unstitch-cylinder-caps-and-side/expected.json b/tests/kernel-cases/surfaces/cov-unstitch-cylinder-caps-and-side/expected.json new file mode 100644 index 000000000..5781d8cc9 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-unstitch-cylinder-caps-and-side/expected.json @@ -0,0 +1,15 @@ +{ + "sources": [], + "what": "a cylinder r 5, 10 high, unstitched: the side and the two caps, each a surface body", + "source": "analytic", + "method": "side 2 pi 5 10 = 314.16 (a cylinder, closed on its seam), caps 2 x 25 pi = 157.08 (planes): 3 bodies, area 471.24; free edges: each cap's circle and the side's two circles, 4", + "valid": false, + "body_count": 3, + "faces": 3, + "boundary_edges": 4, + "area_mm2": 471.23889803846896, + "surface_types": [ + "cylinder", + "plane" + ] +} diff --git a/tests/kernel-cases/surfaces/cov-unstitch-cylinder-caps-and-side/recipe.json b/tests/kernel-cases/surfaces/cov-unstitch-cylinder-caps-and-side/recipe.json new file mode 100644 index 000000000..b78647a63 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-unstitch-cylinder-caps-and-side/recipe.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "command": "solid.cylinder", + "params": { + "radius": 5, + "height": 10, + "body_name": "Post" + } + }, + { + "command": "surface.unstitch", + "params": { + "body": "Post" + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-unstitch-one-face-sheet-refused/expected.json b/tests/kernel-cases/surfaces/cov-unstitch-one-face-sheet-refused/expected.json new file mode 100644 index 000000000..6ab0afc1a --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-unstitch-one-face-sheet-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "unstitch on a body of one face: nothing to take apart, refused", + "source": "invariants", + "method": "a single face is already as far apart as it goes", + "outcome": "refused", + "refusal": "the body has one face: nothing to unstitch" +} diff --git a/tests/kernel-cases/surfaces/cov-unstitch-one-face-sheet-refused/recipe.json b/tests/kernel-cases/surfaces/cov-unstitch-one-face-sheet-refused/recipe.json new file mode 100644 index 000000000..ac3b9012f --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-unstitch-one-face-sheet-refused/recipe.json @@ -0,0 +1,57 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "Sheet sketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 10, + 10 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.patch", + "params": { + "sketch": "Sheet sketch", + "body_name": "Sheet" + } + }, + { + "command": "surface.unstitch", + "params": { + "body": "Sheet" + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-untrim-cylinder-sheet-hole-in-place/expected.json b/tests/kernel-cases/surfaces/cov-untrim-cylinder-sheet-hole-in-place/expected.json new file mode 100644 index 000000000..2c45cc412 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-untrim-cylinder-sheet-hole-in-place/expected.json @@ -0,0 +1,26 @@ +{ + "sources": [], + "what": "a quarter-cylinder sheet r 10, 20 high, with a square window cut through it at 45 degrees, untrimmed in place: the cylinder face whole again", + "source": "analytic", + "method": "the window's loop is projected onto the cylinder along the sketch normal (1,1,0)/sqrt2 and cut out; untrimming every hole leaves the quarter cylinder: A = (pi/2) 10 20 = 314.16, one cylinder face with 4 free edges (two arcs, two rulings)", + "valid": false, + "body_count": 1, + "faces": 1, + "boundary_edges": 4, + "area_mm2": 314.1592653589793, + "surface_types": [ + "cylinder" + ], + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 10, + 10, + 20 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-untrim-cylinder-sheet-hole-in-place/recipe.json b/tests/kernel-cases/surfaces/cov-untrim-cylinder-sheet-hole-in-place/recipe.json new file mode 100644 index 000000000..cae8c02a3 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-untrim-cylinder-sheet-hole-in-place/recipe.json @@ -0,0 +1,128 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "Arc" + } + }, + { + "command": "sketch.arc.center_point", + "params": { + "center": [ + 0, + 0 + ], + "start": [ + 10, + 0 + ], + "end": [ + 0, + 10 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.extrude", + "params": { + "sketch": "Arc", + "curves": [ + "a1" + ], + "distance": 20, + "body_name": "Quarter" + } + }, + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + -0.7071067811865476, + 0.7071067811865476, + 0 + ], + "y_dir": [ + 0, + 0, + 1 + ] + }, + "name": "Window" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + -2, + 8 + ], + "p1": [ + 2, + 12 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.trim", + "params": { + "body": "Quarter", + "curves": { + "sketch": "Window" + }, + "keep": [ + 9.84807753012208, + 1.7364817766693033, + 2 + ] + } + }, + { + "command": "surface.untrim", + "params": { + "face": { + "body": "Quarter", + "point": [ + 9.84807753012208, + 1.7364817766693033, + 2 + ] + }, + "holes": "all", + "in_place": true + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-untrim-face-without-holes-refused/expected.json b/tests/kernel-cases/surfaces/cov-untrim-face-without-holes-refused/expected.json new file mode 100644 index 000000000..d0eb8a6e7 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-untrim-face-without-holes-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "untrim on a face with no holes and its outer boundary kept: nothing to do, refused", + "source": "invariants", + "method": "the face has no inner loop and outer is not asked: the command says so", + "outcome": "refused", + "refusal": "the face has no holes to remove" +} diff --git a/tests/kernel-cases/surfaces/cov-untrim-face-without-holes-refused/recipe.json b/tests/kernel-cases/surfaces/cov-untrim-face-without-holes-refused/recipe.json new file mode 100644 index 000000000..981eb510c --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-untrim-face-without-holes-refused/recipe.json @@ -0,0 +1,66 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "Sheet sketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 10, + 10 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.patch", + "params": { + "sketch": "Sheet sketch", + "body_name": "Sheet" + } + }, + { + "command": "surface.untrim", + "params": { + "face": { + "body": "Sheet", + "point": [ + 5, + 5, + 0 + ] + }, + "holes": "all", + "in_place": true + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-untrim-sheet-hole-in-place/expected.json b/tests/kernel-cases/surfaces/cov-untrim-sheet-hole-in-place/expected.json new file mode 100644 index 000000000..0668e5027 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-untrim-sheet-hole-in-place/expected.json @@ -0,0 +1,26 @@ +{ + "sources": [], + "what": "a square sheet 20 x 20 with a round hole r 4, untrimmed in place: the hole is gone", + "source": "analytic", + "method": "before: 400 - 16 pi = 349.73; untrimmed: the whole square, area 400, one plane face with its 4 outer edges free", + "valid": false, + "body_count": 1, + "faces": 1, + "boundary_edges": 4, + "area_mm2": 400.0, + "surface_types": [ + "plane" + ], + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 20, + 20, + 0 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-untrim-sheet-hole-in-place/recipe.json b/tests/kernel-cases/surfaces/cov-untrim-sheet-hole-in-place/recipe.json new file mode 100644 index 000000000..425c84a6c --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-untrim-sheet-hole-in-place/recipe.json @@ -0,0 +1,84 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "Holed sketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 20, + 20 + ] + } + }, + { + "command": "sketch.circle.center", + "params": { + "center": [ + 10, + 10 + ], + "radius": 4 + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.patch", + "params": { + "sketch": "Holed sketch", + "profiles": [ + { + "point": [ + 2, + 2 + ] + } + ], + "body_name": "Holed" + } + }, + { + "command": "surface.untrim", + "params": { + "face": { + "body": "Holed", + "point": [ + 2, + 2, + 0 + ] + }, + "holes": "all", + "in_place": true + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-untrim-solid-top-face-copied-out/expected.json b/tests/kernel-cases/surfaces/cov-untrim-solid-top-face-copied-out/expected.json new file mode 100644 index 000000000..c63f9aa8b --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-untrim-solid-top-face-copied-out/expected.json @@ -0,0 +1,26 @@ +{ + "sources": [], + "what": "the top face of a block with a through hole, untrimmed: a solid's face is copied out, without the hole", + "source": "analytic", + "method": "block 20 x 20 x 10 cut by a cylinder r 4 through it; the top face (z = 10) untrimmed of its hole as a new surface body: the full 20 x 20 square, area 400; the block is removed so only the copy is graded", + "valid": false, + "body_count": 1, + "faces": 1, + "boundary_edges": 4, + "area_mm2": 400.0, + "surface_types": [ + "plane" + ], + "bbox": { + "min": [ + 0, + 0, + 10 + ], + "max": [ + 20, + 20, + 10 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-untrim-solid-top-face-copied-out/recipe.json b/tests/kernel-cases/surfaces/cov-untrim-solid-top-face-copied-out/recipe.json new file mode 100644 index 000000000..f4c7d551c --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-untrim-solid-top-face-copied-out/recipe.json @@ -0,0 +1,51 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "body_name": "Block" + } + }, + { + "command": "solid.cylinder", + "params": { + "radius": 4, + "height": 10, + "base": [ + 10, + 10, + 0 + ], + "operation": "cut", + "targets": [ + "Block" + ] + } + }, + { + "command": "surface.untrim", + "params": { + "face": { + "body": "Block", + "point": [ + 2, + 2, + 10 + ] + }, + "body_name": "Lid" + } + }, + { + "command": "solid.remove", + "params": { + "bodies": [ + "Block" + ] + } + } + ] +}