Skip to content

SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.

Wave 374/509: Kernel rig: inspect cases, the gap between two spheres, their lens where they overlap, none past the clearance (and 3 more)

jyviko45ee28379e8f
diff --git a/tests/kernel-cases/inspect/cov-clearance-gap-between-two-spheres/expected.json b/tests/kernel-cases/inspect/cov-clearance-gap-between-two-spheres/expected.json
new file mode 100644
index 0000000000..af414d55bf
--- /dev/null
+++ b/tests/kernel-cases/inspect/cov-clearance-gap-between-two-spheres/expected.json
@@ -0,0 +1,46 @@
+{
+ "sources": [],
+ "what": "the gap between two spheres",
+ "source": "analytic",
+ "method": "spheres r 5 on (0,0,0) and (20,0,0): 20 - 5 - 5 = 10 apart, from (5,0,0) to (15,0,0)",
+ "results": [
+ {
+ "command": 2,
+ "pointer": "/overlaps",
+ "value": []
+ },
+ {
+ "command": 2,
+ "pointer": "/near/0/a",
+ "value": "A"
+ },
+ {
+ "command": 2,
+ "pointer": "/near/0/b",
+ "value": "B"
+ },
+ {
+ "command": 2,
+ "pointer": "/near/0/distance_mm",
+ "value": 10.0
+ },
+ {
+ "command": 2,
+ "pointer": "/near/0/from",
+ "value": [
+ 5,
+ 0,
+ 0
+ ]
+ },
+ {
+ "command": 2,
+ "pointer": "/near/0/to",
+ "value": [
+ 15,
+ 0,
+ 0
+ ]
+ }
+ ]
+}
diff --git a/tests/kernel-cases/inspect/cov-clearance-gap-between-two-spheres/recipe.json b/tests/kernel-cases/inspect/cov-clearance-gap-between-two-spheres/recipe.json
new file mode 100644
index 0000000000..1461bdb5d3
--- /dev/null
+++ b/tests/kernel-cases/inspect/cov-clearance-gap-between-two-spheres/recipe.json
@@ -0,0 +1,36 @@
+{
+ "commands": [
+ {
+ "command": "solid.sphere",
+ "params": {
+ "center": [
+ 0,
+ 0,
+ 0
+ ],
+ "radius": 5,
+ "body_name": "A",
+ "operation": "new"
+ }
+ },
+ {
+ "command": "solid.sphere",
+ "params": {
+ "center": [
+ 20,
+ 0,
+ 0
+ ],
+ "radius": 5,
+ "body_name": "B",
+ "operation": "new"
+ }
+ },
+ {
+ "command": "inspect.clearance",
+ "params": {
+ "clearance": 15
+ }
+ }
+ ]
+}
diff --git a/tests/kernel-cases/inspect/cov-clearance-overlapping-spheres/expected.json b/tests/kernel-cases/inspect/cov-clearance-overlapping-spheres/expected.json
new file mode 100644
index 0000000000..07c05664d2
--- /dev/null
+++ b/tests/kernel-cases/inspect/cov-clearance-overlapping-spheres/expected.json
@@ -0,0 +1,22 @@
+{
+ "sources": [],
+ "what": "the shared volume of two overlapping spheres",
+ "source": "analytic",
+ "method": "spheres r 5 on (0,0,0) and (8,0,0): the lens pi (4r + d)(2r - d)^2 / 12 = pi 28 4 / 12 = 29.3215, centred on (4,0,0)",
+ "results": [
+ {
+ "command": 2,
+ "pointer": "/overlaps/0/volume_mm3",
+ "value": 29.321531433504735
+ },
+ {
+ "command": 2,
+ "pointer": "/overlaps/0/center",
+ "value": [
+ 4,
+ 0,
+ 0
+ ]
+ }
+ ]
+}
diff --git a/tests/kernel-cases/inspect/cov-clearance-overlapping-spheres/recipe.json b/tests/kernel-cases/inspect/cov-clearance-overlapping-spheres/recipe.json
new file mode 100644
index 0000000000..d4886dc8f7
--- /dev/null
+++ b/tests/kernel-cases/inspect/cov-clearance-overlapping-spheres/recipe.json
@@ -0,0 +1,34 @@
+{
+ "commands": [
+ {
+ "command": "solid.sphere",
+ "params": {
+ "center": [
+ 0,
+ 0,
+ 0
+ ],
+ "radius": 5,
+ "body_name": "A",
+ "operation": "new"
+ }
+ },
+ {
+ "command": "solid.sphere",
+ "params": {
+ "center": [
+ 8,
+ 0,
+ 0
+ ],
+ "radius": 5,
+ "body_name": "B",
+ "operation": "new"
+ }
+ },
+ {
+ "command": "inspect.clearance",
+ "params": {}
+ }
+ ]
+}
diff --git a/tests/kernel-cases/inspect/cov-clearance-spheres-farther-than-the-clearance/expected.json b/tests/kernel-cases/inspect/cov-clearance-spheres-farther-than-the-clearance/expected.json
new file mode 100644
index 0000000000..8f4b8e3afa
--- /dev/null
+++ b/tests/kernel-cases/inspect/cov-clearance-spheres-farther-than-the-clearance/expected.json
@@ -0,0 +1,18 @@
+{
+ "sources": [],
+ "what": "two spheres farther apart than the clearance asked",
+ "source": "analytic",
+ "method": "spheres r 5 on (0,0,0) and (20,0,0) are 10 apart; closer than 5 asked: none",
+ "results": [
+ {
+ "command": 2,
+ "pointer": "/overlaps",
+ "value": []
+ },
+ {
+ "command": 2,
+ "pointer": "/near",
+ "value": []
+ }
+ ]
+}
diff --git a/tests/kernel-cases/inspect/cov-clearance-spheres-farther-than-the-clearance/recipe.json b/tests/kernel-cases/inspect/cov-clearance-spheres-farther-than-the-clearance/recipe.json
new file mode 100644
index 0000000000..ccf0012463
--- /dev/null
+++ b/tests/kernel-cases/inspect/cov-clearance-spheres-farther-than-the-clearance/recipe.json
@@ -0,0 +1,36 @@
+{
+ "commands": [
+ {
+ "command": "solid.sphere",
+ "params": {
+ "center": [
+ 0,
+ 0,
+ 0
+ ],
+ "radius": 5,
+ "body_name": "A",
+ "operation": "new"
+ }
+ },
+ {
+ "command": "solid.sphere",
+ "params": {
+ "center": [
+ 20,
+ 0,
+ 0
+ ],
+ "radius": 5,
+ "body_name": "B",
+ "operation": "new"
+ }
+ },
+ {
+ "command": "inspect.clearance",
+ "params": {
+ "clearance": 5
+ }
+ }
+ ]
+}
diff --git a/tests/kernel-cases/inspect/cov-compare-identical-boxes/expected.json b/tests/kernel-cases/inspect/cov-compare-identical-boxes/expected.json
new file mode 100644
index 0000000000..e1d52a15b7
--- /dev/null
+++ b/tests/kernel-cases/inspect/cov-compare-identical-boxes/expected.json
@@ -0,0 +1,23 @@
+{
+ "sources": [],
+ "what": "two identical boxes",
+ "source": "analytic",
+ "method": "boxes 40 x 30 x 20 on the same corner: identical, no region, B - A = 0",
+ "results": [
+ {
+ "command": 2,
+ "pointer": "/identical",
+ "value": true
+ },
+ {
+ "command": 2,
+ "pointer": "/regions",
+ "value": []
+ },
+ {
+ "command": 2,
+ "pointer": "/difference/volume_mm3",
+ "value": 0.0
+ }
+ ]
+}
diff --git a/tests/kernel-cases/inspect/cov-compare-identical-boxes/recipe.json b/tests/kernel-cases/inspect/cov-compare-identical-boxes/recipe.json
new file mode 100644
index 0000000000..0d31b1e065
--- /dev/null
+++ b/tests/kernel-cases/inspect/cov-compare-identical-boxes/recipe.json
@@ -0,0 +1,31 @@
+{
+ "commands": [
+ {
+ "command": "solid.box",
+ "params": {
+ "length": 40,
+ "width": 30,
+ "height": 20,
+ "body_name": "A",
+ "operation": "new"
+ }
+ },
+ {
+ "command": "solid.box",
+ "params": {
+ "length": 40,
+ "width": 30,
+ "height": 20,
+ "body_name": "B",
+ "operation": "new"
+ }
+ },
+ {
+ "command": "inspect.compare",
+ "params": {
+ "a": "A",
+ "b": "B"
+ }
+ }
+ ]
+}
diff --git a/tests/kernel-cases/inspect/cov-compare-refuses-a-tolerance-out-of-range/expected.json b/tests/kernel-cases/inspect/cov-compare-refuses-a-tolerance-out-of-range/expected.json
new file mode 100644
index 0000000000..b9545a4ab3
--- /dev/null
+++ b/tests/kernel-cases/inspect/cov-compare-refuses-a-tolerance-out-of-range/expected.json
@@ -0,0 +1,8 @@
+{
+ "sources": [],
+ "what": "compare with a 0 mm tolerance",
+ "source": "analytic",
+ "method": "the tolerance must be 0.001 to 10 mm: 0 is refused",
+ "outcome": "refused",
+ "refusal": "tolerance"
+}
diff --git a/tests/kernel-cases/inspect/cov-compare-refuses-a-tolerance-out-of-range/recipe.json b/tests/kernel-cases/inspect/cov-compare-refuses-a-tolerance-out-of-range/recipe.json
new file mode 100644
index 0000000000..4a8a6c9bc2
--- /dev/null
+++ b/tests/kernel-cases/inspect/cov-compare-refuses-a-tolerance-out-of-range/recipe.json
@@ -0,0 +1,32 @@
+{
+ "commands": [
+ {
+ "command": "solid.box",
+ "params": {
+ "length": 40,
+ "width": 30,
+ "height": 20,
+ "body_name": "A",
+ "operation": "new"
+ }
+ },
+ {
+ "command": "solid.box",
+ "params": {
+ "length": 40,
+ "width": 30,
+ "height": 20,
+ "body_name": "B",
+ "operation": "new"
+ }
+ },
+ {
+ "command": "inspect.compare",
+ "params": {
+ "a": "A",
+ "b": "B",
+ "tolerance": 0
+ }
+ }
+ ]
+}
diff --git a/tests/kernel-cases/inspect/cov-compare-taller-box/expected.json b/tests/kernel-cases/inspect/cov-compare-taller-box/expected.json
new file mode 100644
index 0000000000..fb9f6b54ad
--- /dev/null
+++ b/tests/kernel-cases/inspect/cov-compare-taller-box/expected.json
@@ -0,0 +1,53 @@
+{
+ "sources": [],
+ "what": "a box against one 5 mm taller",
+ "source": "analytic",
+ "method": "box A 40 x 30 x 20 and B 40 x 30 x 25 on the same corner: B - A is the slab z 20..25, V 6000, only in B, at most 5 from A",
+ "results": [
+ {
+ "command": 2,
+ "pointer": "/a/volume_mm3",
+ "value": 24000.0
+ },
+ {
+ "command": 2,
+ "pointer": "/b/volume_mm3",
+ "value": 30000.0
+ },
+ {
+ "command": 2,
+ "pointer": "/difference/volume_mm3",
+ "value": 6000.0
+ },
+ {
+ "command": 2,
+ "pointer": "/identical",
+ "value": false
+ },
+ {
+ "command": 2,
+ "pointer": "/regions/0/side",
+ "value": "only_in_b"
+ },
+ {
+ "command": 2,
+ "pointer": "/regions/0/volume_mm3",
+ "value": 6000.0
+ },
+ {
+ "command": 2,
+ "pointer": "/only_in_b/volume_mm3",
+ "value": 6000.0
+ },
+ {
+ "command": 2,
+ "pointer": "/only_in_a/volume_mm3",
+ "value": 0.0
+ },
+ {
+ "command": 2,
+ "pointer": "/deviation/max_mm",
+ "value": 5.0
+ }
+ ]
+}
diff --git a/tests/kernel-cases/inspect/cov-compare-taller-box/recipe.json b/tests/kernel-cases/inspect/cov-compare-taller-box/recipe.json
new file mode 100644
index 0000000000..5eb76e1841
--- /dev/null
+++ b/tests/kernel-cases/inspect/cov-compare-taller-box/recipe.json
@@ -0,0 +1,31 @@
+{
+ "commands": [
+ {
+ "command": "solid.box",
+ "params": {
+ "length": 40,
+ "width": 30,
+ "height": 20,
+ "body_name": "A",
+ "operation": "new"
+ }
+ },
+ {
+ "command": "solid.box",
+ "params": {
+ "length": 40,
+ "width": 30,
+ "height": 25,
+ "body_name": "B",
+ "operation": "new"
+ }
+ },
+ {
+ "command": "inspect.compare",
+ "params": {
+ "a": "A",
+ "b": "B"
+ }
+ }
+ ]
+}
diff --git a/tests/kernel-cases/inspect/cov-curvature-comb-circle-and-line/expected.json b/tests/kernel-cases/inspect/cov-curvature-comb-circle-and-line/expected.json
new file mode 100644
index 0000000000..285efa83e1
--- /dev/null
+++ b/tests/kernel-cases/inspect/cov-curvature-comb-circle-and-line/expected.json
@@ -0,0 +1,28 @@
+{
+ "sources": [],
+ "what": "the combs of a sketch circle and a line",
+ "source": "analytic",
+ "method": "circle r 7: curvature 1/7 everywhere, radius 7; a line: straight, no radius",
+ "results": [
+ {
+ "command": 4,
+ "pointer": "/combs/0/min_radius",
+ "value": 7.0
+ },
+ {
+ "command": 4,
+ "pointer": "/combs/0/max_curvature",
+ "value": 0.14285714285714285
+ },
+ {
+ "command": 4,
+ "pointer": "/combs/1/min_radius",
+ "value": null
+ },
+ {
+ "command": 4,
+ "pointer": "/combs/1/max_curvature",
+ "value": 0.0
+ }
+ ]
+}
diff --git a/tests/kernel-cases/inspect/cov-curvature-comb-circle-and-line/recipe.json b/tests/kernel-cases/inspect/cov-curvature-comb-circle-and-line/recipe.json
new file mode 100644
index 0000000000..09a86df83d
--- /dev/null
+++ b/tests/kernel-cases/inspect/cov-curvature-comb-circle-and-line/recipe.json
@@ -0,0 +1,50 @@
+{
+ "commands": [
+ {
+ "command": "sketch.create",
+ "params": {
+ "plane": "XY",
+ "name": "S"
+ }
+ },
+ {
+ "command": "sketch.circle.center",
+ "params": {
+ "center": [
+ 0,
+ 0
+ ],
+ "radius": 7
+ }
+ },
+ {
+ "command": "sketch.line",
+ "params": {
+ "points": [
+ [
+ 0,
+ 20
+ ],
+ [
+ 10,
+ 20
+ ]
+ ]
+ }
+ },
+ {
+ "command": "sketch.finish",
+ "params": {}
+ },
+ {
+ "command": "inspect.curvature_comb",
+ "params": {
+ "sketch": "S",
+ "curves": [
+ "c1",
+ "l1"
+ ]
+ }
+ }
+ ]
+}
diff --git a/tests/kernel-cases/inspect/cov-curvature-comb-cylinder-edge/expected.json b/tests/kernel-cases/inspect/cov-curvature-comb-cylinder-edge/expected.json
new file mode 100644
index 0000000000..2af9c42d82
--- /dev/null
+++ b/tests/kernel-cases/inspect/cov-curvature-comb-cylinder-edge/expected.json
@@ -0,0 +1,18 @@
+{
+ "sources": [],
+ "what": "the comb along a cylinder's top edge",
+ "source": "analytic",
+ "method": "a cylinder r 5 on (60,0,0): its top edge is a circle of r 5, curvature 1/5",
+ "results": [
+ {
+ "command": 1,
+ "pointer": "/combs/0/min_radius",
+ "value": 5.0
+ },
+ {
+ "command": 1,
+ "pointer": "/combs/0/max_curvature",
+ "value": 0.2
+ }
+ ]
+}
diff --git a/tests/kernel-cases/inspect/cov-curvature-comb-cylinder-edge/recipe.json b/tests/kernel-cases/inspect/cov-curvature-comb-cylinder-edge/recipe.json
new file mode 100644
index 0000000000..6640bd674c
--- /dev/null
+++ b/tests/kernel-cases/inspect/cov-curvature-comb-cylinder-edge/recipe.json
@@ -0,0 +1,30 @@
+{
+ "commands": [
+ {
+ "command": "solid.cylinder",
+ "params": {
+ "base": [
+ 60,
+ 0,
+ 0
+ ],
+ "radius": 5,
+ "height": 10,
+ "body_name": "Cyl",
+ "operation": "new"
+ }
+ },
+ {
+ "command": "inspect.curvature_comb",
+ "params": {
+ "edges": [
+ [
+ 65,
+ 0,
+ 10
+ ]
+ ]
+ }
+ }
+ ]
+}
diff --git a/tests/kernel-cases/inspect/cov-curvature-comb-refuses-nothing-picked/expected.json b/tests/kernel-cases/inspect/cov-curvature-comb-refuses-nothing-picked/expected.json
new file mode 100644
index 0000000000..af2f4ee342
--- /dev/null
+++ b/tests/kernel-cases/inspect/cov-curvature-comb-refuses-nothing-picked/expected.json
@@ -0,0 +1,8 @@
+{
+ "sources": [],
+ "what": "a comb with no curve, edge or face",
+ "source": "analytic",
+ "method": "box 40 x 30 x 20 with a corner at the origin; nothing picked: refused",
+ "outcome": "refused",
+ "refusal": "give `curves`, `edges` or `faces`"
+}
diff --git a/tests/kernel-cases/inspect/cov-curvature-comb-refuses-nothing-picked/recipe.json b/tests/kernel-cases/inspect/cov-curvature-comb-refuses-nothing-picked/recipe.json
new file mode 100644
index 0000000000..22b640b8eb
--- /dev/null
+++ b/tests/kernel-cases/inspect/cov-curvature-comb-refuses-nothing-picked/recipe.json
@@ -0,0 +1,18 @@
+{
+ "commands": [
+ {
+ "command": "solid.box",
+ "params": {
+ "length": 40,
+ "width": 30,
+ "height": 20,
+ "body_name": "Box",
+ "operation": "new"
+ }
+ },
+ {
+ "command": "inspect.curvature_comb",
+ "params": {}
+ }
+ ]
+}
diff --git a/tests/kernel-cases/inspect/cov-isocurve-cube-top/expected.json b/tests/kernel-cases/inspect/cov-isocurve-cube-top/expected.json
new file mode 100644
index 0000000000..04b6119aa9
--- /dev/null
+++ b/tests/kernel-cases/inspect/cov-isocurve-cube-top/expected.json
@@ -0,0 +1,28 @@
+{
+ "sources": [],
+ "what": "three isocurves each way across a cube's top",
+ "source": "analytic",
+ "method": "cube 40 with a corner at the origin: its top is the plane z = 40, 0..40 each way; 3 curves each way, evenly spaced, are x = 10, 20, 30 and y = 10, 20, 30: 3 u-curves and 3 v-curves",
+ "results": [
+ {
+ "command": 1,
+ "pointer": "/faces/0/body",
+ "value": "Cube"
+ },
+ {
+ "command": 1,
+ "pointer": "/faces/0/count",
+ "value": 3
+ },
+ {
+ "command": 1,
+ "pointer": "/faces/0/u_curves",
+ "value": 3
+ },
+ {
+ "command": 1,
+ "pointer": "/faces/0/v_curves",
+ "value": 3
+ }
+ ]
+}
diff --git a/tests/kernel-cases/inspect/cov-isocurve-cube-top/recipe.json b/tests/kernel-cases/inspect/cov-isocurve-cube-top/recipe.json
new file mode 100644
index 0000000000..4853108dc6
--- /dev/null
+++ b/tests/kernel-cases/inspect/cov-isocurve-cube-top/recipe.json
@@ -0,0 +1,27 @@
+{
+ "commands": [
+ {
+ "command": "solid.box",
+ "params": {
+ "length": 40,
+ "width": 40,
+ "height": 40,
+ "body_name": "Cube",
+ "operation": "new"
+ }
+ },
+ {
+ "command": "inspect.isocurve",
+ "params": {
+ "faces": [
+ [
+ 20,
+ 15,
+ 40
+ ]
+ ],
+ "count": 3
+ }
+ }
+ ]
+}
diff --git a/tests/kernel-cases/inspect/cov-isocurve-refuses-zero-curves/expected.json b/tests/kernel-cases/inspect/cov-isocurve-refuses-zero-curves/expected.json
new file mode 100644
index 0000000000..5899bdf41f
--- /dev/null
+++ b/tests/kernel-cases/inspect/cov-isocurve-refuses-zero-curves/expected.json
@@ -0,0 +1,8 @@
+{
+ "sources": [],
+ "what": "isocurves with a count of 0",
+ "source": "analytic",
+ "method": "box 40 x 30 x 20 with a corner at the origin: a count is a whole number 1 to 100: 0 is refused",
+ "outcome": "refused",
+ "refusal": "`count` must be a whole number of curves each way"
+}
diff --git a/tests/kernel-cases/inspect/cov-isocurve-refuses-zero-curves/recipe.json b/tests/kernel-cases/inspect/cov-isocurve-refuses-zero-curves/recipe.json
new file mode 100644
index 0000000000..9676dfb67c
--- /dev/null
+++ b/tests/kernel-cases/inspect/cov-isocurve-refuses-zero-curves/recipe.json
@@ -0,0 +1,27 @@
+{
+ "commands": [
+ {
+ "command": "solid.box",
+ "params": {
+ "length": 40,
+ "width": 30,
+ "height": 20,
+ "body_name": "Box",
+ "operation": "new"
+ }
+ },
+ {
+ "command": "inspect.isocurve",
+ "params": {
+ "faces": [
+ [
+ 20,
+ 15,
+ 20
+ ]
+ ],
+ "count": 0
+ }
+ }
+ ]
+}