diff --git a/tests/kernel-cases/surfaces/KNOWN_FAILING b/tests/kernel-cases/surfaces/KNOWN_FAILING index a514c68f3..a0d907a73 100644 --- a/tests/kernel-cases/surfaces/KNOWN_FAILING +++ b/tests/kernel-cases/surfaces/KNOWN_FAILING @@ -4,3 +4,4 @@ # line in the same pull request. # Baseline: rig-cases-surfaces 45f69c0e5 with SMLib 60b1c6a, aarch64 Linux. cov-fair-single-span-face-has-nothing-free-to-move surface.fair refuses a face of degree 1 one way ("a fairness term does not fit the net's degrees"): kernel/src/fair.rs checks its second-derivative terms against the net's degrees instead of fairing only the direction that has them +cov-thicken-cylinder-sheet-symmetric-tube the tube's two flat end rings come back as B-spline faces, not planes (surface_types bspline, cylinder): volume, faces and box are right; the exact plane is lost in SMLib's thicken or in its record conversion diff --git a/tests/kernel-cases/surfaces/cov-thicken-cylinder-sheet-symmetric-tube/expected.json b/tests/kernel-cases/surfaces/cov-thicken-cylinder-sheet-symmetric-tube/expected.json new file mode 100644 index 000000000..0695c4578 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-thicken-cylinder-sheet-symmetric-tube/expected.json @@ -0,0 +1,25 @@ +{ + "sources": [], + "what": "a cylinder wall r 10, 20 high, thickened 2 symmetric: a tube r 9..11", + "source": "analytic", + "method": "symmetric splits the thickness 1 each side: V = pi (11^2 - 9^2) 20 = 800 pi = 2513.27; faces: outer and inner cylinders and two flat rings, 4", + "body_count": 1, + "faces": 4, + "volume_mm3": 2513.2741228718346, + "surface_types": [ + "cylinder", + "plane" + ], + "bbox": { + "min": [ + -11, + -11, + 0 + ], + "max": [ + 11, + 11, + 20 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-thicken-cylinder-sheet-symmetric-tube/recipe.json b/tests/kernel-cases/surfaces/cov-thicken-cylinder-sheet-symmetric-tube/recipe.json new file mode 100644 index 000000000..faffe6c08 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-thicken-cylinder-sheet-symmetric-tube/recipe.json @@ -0,0 +1,72 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "Ring" + } + }, + { + "command": "sketch.circle.center", + "params": { + "center": [ + 0, + 0 + ], + "radius": 10 + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.extrude", + "params": { + "sketch": "Ring", + "curves": [ + "c1" + ], + "distance": 20, + "body_name": "Wall" + } + }, + { + "command": "surface.thicken", + "params": { + "bodies": [ + "Wall" + ], + "thickness": 2, + "symmetric": true, + "operation": "new", + "body_name": "Tube" + } + }, + { + "command": "solid.remove", + "params": { + "bodies": [ + "Wall" + ] + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-thicken-square-sheet-into-a-slab/expected.json b/tests/kernel-cases/surfaces/cov-thicken-square-sheet-into-a-slab/expected.json new file mode 100644 index 000000000..8822690f2 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-thicken-square-sheet-into-a-slab/expected.json @@ -0,0 +1,22 @@ +{ + "sources": [], + "what": "a 10 x 10 sheet on XY thickened 2 along its normal: a slab", + "source": "analytic", + "method": "the box 10 x 10 x 2 at z 0..2 (the patch faces +z): V = 200, A = 280, 6 faces", + "body_count": 1, + "faces": 6, + "volume_mm3": 200.0, + "area_mm2": 280.0, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 10, + 10, + 2 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-thicken-square-sheet-into-a-slab/recipe.json b/tests/kernel-cases/surfaces/cov-thicken-square-sheet-into-a-slab/recipe.json new file mode 100644 index 000000000..5de833e66 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-thicken-square-sheet-into-a-slab/recipe.json @@ -0,0 +1,70 @@ +{ + "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.thicken", + "params": { + "bodies": [ + "Sheet" + ], + "thickness": 2, + "operation": "new", + "body_name": "Slab" + } + }, + { + "command": "solid.remove", + "params": { + "bodies": [ + "Sheet" + ] + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-trim-keep-with-without-with-refused/expected.json b/tests/kernel-cases/surfaces/cov-trim-keep-with-without-with-refused/expected.json new file mode 100644 index 000000000..43e0846c6 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-trim-keep-with-without-with-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "a plane trim given keep_with, which only a mutual trim takes: refused", + "source": "invariants", + "method": "keep_with names what to keep of the other surface of a mutual trim; with no other surface it means nothing", + "outcome": "refused", + "refusal": "belong to a mutual trim" +} diff --git a/tests/kernel-cases/surfaces/cov-trim-keep-with-without-with-refused/recipe.json b/tests/kernel-cases/surfaces/cov-trim-keep-with-without-with-refused/recipe.json new file mode 100644 index 000000000..2645aefd8 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-trim-keep-with-without-with-refused/recipe.json @@ -0,0 +1,79 @@ +{ + "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": [ + 20, + 20 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.patch", + "params": { + "sketch": "Sheet sketch", + "body_name": "Sheet" + } + }, + { + "command": "surface.trim", + "params": { + "body": "Sheet", + "plane": { + "origin": [ + 10, + 0, + 0 + ], + "normal": [ + 1, + 0, + 0 + ] + }, + "keep": [ + 5, + 5, + 0 + ], + "keep_with": [ + 1, + 1, + 0 + ] + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-trim-sheet-by-a-circle-keeps-the-outside/expected.json b/tests/kernel-cases/surfaces/cov-trim-sheet-by-a-circle-keeps-the-outside/expected.json new file mode 100644 index 000000000..7322bcd3e --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-trim-sheet-by-a-circle-keeps-the-outside/expected.json @@ -0,0 +1,26 @@ +{ + "sources": [], + "what": "a 20 x 20 sheet trimmed by a circle r 4 drawn on it, keeping the outside: a sheet with a hole", + "source": "analytic", + "method": "A = 400 - 16 pi = 349.73, one plane face, free edges the 4 sides and the circle", + "valid": false, + "body_count": 1, + "faces": 1, + "boundary_edges": 5, + "area_mm2": 349.7345175425633, + "surface_types": [ + "plane" + ], + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 20, + 20, + 0 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-trim-sheet-by-a-circle-keeps-the-outside/recipe.json b/tests/kernel-cases/surfaces/cov-trim-sheet-by-a-circle-keeps-the-outside/recipe.json new file mode 100644 index 000000000..67b9bed26 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-trim-sheet-by-a-circle-keeps-the-outside/recipe.json @@ -0,0 +1,102 @@ +{ + "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": [ + 20, + 20 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.patch", + "params": { + "sketch": "Sheet sketch", + "body_name": "Sheet" + } + }, + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "Cut" + } + }, + { + "command": "sketch.circle.center", + "params": { + "center": [ + 10, + 10 + ], + "radius": 4 + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.trim", + "params": { + "body": "Sheet", + "curves": { + "sketch": "Cut" + }, + "keep": [ + 1, + 1, + 0 + ] + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-trim-square-sheet-by-a-plane/expected.json b/tests/kernel-cases/surfaces/cov-trim-square-sheet-by-a-plane/expected.json new file mode 100644 index 000000000..26b827235 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-trim-square-sheet-by-a-plane/expected.json @@ -0,0 +1,26 @@ +{ + "sources": [], + "what": "a 20 x 20 sheet trimmed by the plane x = 10, keeping x < 10", + "source": "analytic", + "method": "the half x 0..10: area 200, one plane face, 4 free edges", + "valid": false, + "body_count": 1, + "faces": 1, + "boundary_edges": 4, + "area_mm2": 200.0, + "surface_types": [ + "plane" + ], + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 10, + 20, + 0 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-trim-square-sheet-by-a-plane/recipe.json b/tests/kernel-cases/surfaces/cov-trim-square-sheet-by-a-plane/recipe.json new file mode 100644 index 000000000..c34933013 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-trim-square-sheet-by-a-plane/recipe.json @@ -0,0 +1,74 @@ +{ + "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": [ + 20, + 20 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.patch", + "params": { + "sketch": "Sheet sketch", + "body_name": "Sheet" + } + }, + { + "command": "surface.trim", + "params": { + "body": "Sheet", + "plane": { + "origin": [ + 10, + 0, + 0 + ], + "normal": [ + 1, + 0, + 0 + ] + }, + "keep": [ + 5, + 5, + 0 + ] + } + } + ] +}