SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.
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)
jyviko1237203137d3
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.jsonnew file mode 100644index 0000000000..0be8573b4f--- /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.jsonnew file mode 100644index 0000000000..8bfecc18bf--- /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.jsonnew file mode 100644index 0000000000..e0ce57bb9a--- /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.jsonnew file mode 100644index 0000000000..33bf21733f--- /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.jsonnew file mode 100644index 0000000000..5781d8cc97--- /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.jsonnew file mode 100644index 0000000000..b78647a632--- /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.jsonnew file mode 100644index 0000000000..6ab0afc1aa--- /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.jsonnew file mode 100644index 0000000000..ac3b9012f2--- /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.jsonnew file mode 100644index 0000000000..2c45cc4126--- /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.jsonnew file mode 100644index 0000000000..cae8c02a3c--- /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.jsonnew file mode 100644index 0000000000..d0eb8a6e7f--- /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.jsonnew file mode 100644index 0000000000..981eb510c9--- /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.jsonnew file mode 100644index 0000000000..0668e50274--- /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.jsonnew file mode 100644index 0000000000..425c84a6c2--- /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.jsonnew file mode 100644index 0000000000..c63f9aa8b5--- /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.jsonnew file mode 100644index 0000000000..f4c7d551ca--- /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"+ ]+ }+ }+ ]+}