Skip to content

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

Wave 369/509: Kernel rig: construction cases, the axis of a cylinder, a torus and a circular edge, and a flat face refused (and 3 more)

jyvikoca8fc27e8b6a
diff --git a/tests/kernel-cases/construction/cov-axis-normal-to-a-cylinder-refuses-a-point-on-its-axis/expected.json b/tests/kernel-cases/construction/cov-axis-normal-to-a-cylinder-refuses-a-point-on-its-axis/expected.json
new file mode 100644
index 0000000000..37d5498073
--- /dev/null
+++ b/tests/kernel-cases/construction/cov-axis-normal-to-a-cylinder-refuses-a-point-on-its-axis/expected.json
@@ -0,0 +1,8 @@
+{
+ "sources": [],
+ "what": "an axis square to a cylinder's side through a point on the cylinder's axis",
+ "source": "analytic",
+ "method": "cylinder r 5, h 10 on (60,0,0) along +Z: every radial line passes through (60,0,5), so no one normal: refused",
+ "outcome": "refused",
+ "refusal": "the point is on the face's axis"
+}
diff --git a/tests/kernel-cases/construction/cov-axis-normal-to-a-cylinder-refuses-a-point-on-its-axis/recipe.json b/tests/kernel-cases/construction/cov-axis-normal-to-a-cylinder-refuses-a-point-on-its-axis/recipe.json
new file mode 100644
index 0000000000..4b16354ba0
--- /dev/null
+++ b/tests/kernel-cases/construction/cov-axis-normal-to-a-cylinder-refuses-a-point-on-its-axis/recipe.json
@@ -0,0 +1,38 @@
+{
+ "commands": [
+ {
+ "command": "solid.cylinder",
+ "params": {
+ "base": [
+ 60,
+ 0,
+ 0
+ ],
+ "radius": 5,
+ "height": 10,
+ "body_name": "Cyl",
+ "operation": "new"
+ }
+ },
+ {
+ "command": "construct.axis.normal_to_face",
+ "params": {
+ "face": {
+ "face": [
+ 65,
+ 0,
+ 5
+ ]
+ },
+ "point": {
+ "point": [
+ 60,
+ 0,
+ 5
+ ]
+ },
+ "name": "A"
+ }
+ }
+ ]
+}
diff --git a/tests/kernel-cases/construction/cov-axis-normal-to-a-cylinder-through-an-outside-point/expected.json b/tests/kernel-cases/construction/cov-axis-normal-to-a-cylinder-through-an-outside-point/expected.json
new file mode 100644
index 0000000000..874e1a5976
--- /dev/null
+++ b/tests/kernel-cases/construction/cov-axis-normal-to-a-cylinder-through-an-outside-point/expected.json
@@ -0,0 +1,22 @@
+{
+ "sources": [],
+ "what": "an axis square to a cylinder's side through a point outside it",
+ "source": "analytic",
+ "method": "cylinder r 5, h 10 on (60,0,0) along +Z: through (66,8,5), 10 from the axis along (0.6,0.8,0): the radial line through (60,0,5) along (3,4,0)",
+ "construction": {
+ "A": {
+ "axis": {
+ "through": [
+ 60,
+ 0,
+ 5
+ ],
+ "dir": [
+ 3,
+ 4,
+ 0
+ ]
+ }
+ }
+ }
+}
diff --git a/tests/kernel-cases/construction/cov-axis-normal-to-a-cylinder-through-an-outside-point/recipe.json b/tests/kernel-cases/construction/cov-axis-normal-to-a-cylinder-through-an-outside-point/recipe.json
new file mode 100644
index 0000000000..d242a4a99a
--- /dev/null
+++ b/tests/kernel-cases/construction/cov-axis-normal-to-a-cylinder-through-an-outside-point/recipe.json
@@ -0,0 +1,38 @@
+{
+ "commands": [
+ {
+ "command": "solid.cylinder",
+ "params": {
+ "base": [
+ 60,
+ 0,
+ 0
+ ],
+ "radius": 5,
+ "height": 10,
+ "body_name": "Cyl",
+ "operation": "new"
+ }
+ },
+ {
+ "command": "construct.axis.normal_to_face",
+ "params": {
+ "face": {
+ "face": [
+ 65,
+ 0,
+ 5
+ ]
+ },
+ "point": {
+ "point": [
+ 66,
+ 8,
+ 5
+ ]
+ },
+ "name": "A"
+ }
+ }
+ ]
+}
diff --git a/tests/kernel-cases/construction/cov-axis-normal-to-a-flat-face/expected.json b/tests/kernel-cases/construction/cov-axis-normal-to-a-flat-face/expected.json
new file mode 100644
index 0000000000..5014fa9caa
--- /dev/null
+++ b/tests/kernel-cases/construction/cov-axis-normal-to-a-flat-face/expected.json
@@ -0,0 +1,22 @@
+{
+ "sources": [],
+ "what": "an axis square to a box's top through a point above it",
+ "source": "analytic",
+ "method": "box 40 x 30 x 20 with a corner at the origin (x 0..40, y 0..30, z 0..20): the top is z = 20, normal Z; through (12,7,30) square to it: the line x 12, y 7 along Z",
+ "construction": {
+ "A": {
+ "axis": {
+ "through": [
+ 12,
+ 7,
+ 20
+ ],
+ "dir": [
+ 0,
+ 0,
+ 1
+ ]
+ }
+ }
+ }
+}
diff --git a/tests/kernel-cases/construction/cov-axis-normal-to-a-flat-face/recipe.json b/tests/kernel-cases/construction/cov-axis-normal-to-a-flat-face/recipe.json
new file mode 100644
index 0000000000..bfee23e78f
--- /dev/null
+++ b/tests/kernel-cases/construction/cov-axis-normal-to-a-flat-face/recipe.json
@@ -0,0 +1,33 @@
+{
+ "commands": [
+ {
+ "command": "solid.box",
+ "params": {
+ "length": 40,
+ "width": 30,
+ "height": 20,
+ "body_name": "Box"
+ }
+ },
+ {
+ "command": "construct.axis.normal_to_face",
+ "params": {
+ "face": {
+ "face": [
+ 10,
+ 10,
+ 20
+ ]
+ },
+ "point": {
+ "point": [
+ 12,
+ 7,
+ 30
+ ]
+ },
+ "name": "A"
+ }
+ }
+ ]
+}
diff --git a/tests/kernel-cases/construction/cov-axis-through-a-circular-edge/expected.json b/tests/kernel-cases/construction/cov-axis-through-a-circular-edge/expected.json
new file mode 100644
index 0000000000..a329700ed3
--- /dev/null
+++ b/tests/kernel-cases/construction/cov-axis-through-a-circular-edge/expected.json
@@ -0,0 +1,22 @@
+{
+ "sources": [],
+ "what": "the axis through a circular edge",
+ "source": "analytic",
+ "method": "cylinder r 5, h 10 on (60,0,0) along +Z: its top edge is the circle r 5 about (60,0,10) in z = 10: the line through its centre along its normal Z",
+ "construction": {
+ "A": {
+ "axis": {
+ "through": [
+ 60,
+ 0,
+ 10
+ ],
+ "dir": [
+ 0,
+ 0,
+ 1
+ ]
+ }
+ }
+ }
+}
diff --git a/tests/kernel-cases/construction/cov-axis-through-a-circular-edge/recipe.json b/tests/kernel-cases/construction/cov-axis-through-a-circular-edge/recipe.json
new file mode 100644
index 0000000000..5f2c5015e0
--- /dev/null
+++ b/tests/kernel-cases/construction/cov-axis-through-a-circular-edge/recipe.json
@@ -0,0 +1,31 @@
+{
+ "commands": [
+ {
+ "command": "solid.cylinder",
+ "params": {
+ "base": [
+ 60,
+ 0,
+ 0
+ ],
+ "radius": 5,
+ "height": 10,
+ "body_name": "Cyl",
+ "operation": "new"
+ }
+ },
+ {
+ "command": "construct.axis.through_cylinder",
+ "params": {
+ "face": {
+ "edge": [
+ 65,
+ 0,
+ 10
+ ]
+ },
+ "name": "A"
+ }
+ }
+ ]
+}
diff --git a/tests/kernel-cases/construction/cov-axis-through-a-cylinder/expected.json b/tests/kernel-cases/construction/cov-axis-through-a-cylinder/expected.json
new file mode 100644
index 0000000000..cd0d4a3bb6
--- /dev/null
+++ b/tests/kernel-cases/construction/cov-axis-through-a-cylinder/expected.json
@@ -0,0 +1,22 @@
+{
+ "sources": [],
+ "what": "the axis of a cylinder's side",
+ "source": "analytic",
+ "method": "cylinder r 5, h 10 on (60,0,0) along +Z: the line through (60,0,0) along Z",
+ "construction": {
+ "A": {
+ "axis": {
+ "through": [
+ 60,
+ 0,
+ 0
+ ],
+ "dir": [
+ 0,
+ 0,
+ 1
+ ]
+ }
+ }
+ }
+}
diff --git a/tests/kernel-cases/construction/cov-axis-through-a-cylinder/recipe.json b/tests/kernel-cases/construction/cov-axis-through-a-cylinder/recipe.json
new file mode 100644
index 0000000000..016dfd2e02
--- /dev/null
+++ b/tests/kernel-cases/construction/cov-axis-through-a-cylinder/recipe.json
@@ -0,0 +1,31 @@
+{
+ "commands": [
+ {
+ "command": "solid.cylinder",
+ "params": {
+ "base": [
+ 60,
+ 0,
+ 0
+ ],
+ "radius": 5,
+ "height": 10,
+ "body_name": "Cyl",
+ "operation": "new"
+ }
+ },
+ {
+ "command": "construct.axis.through_cylinder",
+ "params": {
+ "face": {
+ "face": [
+ 65,
+ 0,
+ 5
+ ]
+ },
+ "name": "A"
+ }
+ }
+ ]
+}
diff --git a/tests/kernel-cases/construction/cov-axis-through-a-torus/expected.json b/tests/kernel-cases/construction/cov-axis-through-a-torus/expected.json
new file mode 100644
index 0000000000..6bafc9171c
--- /dev/null
+++ b/tests/kernel-cases/construction/cov-axis-through-a-torus/expected.json
@@ -0,0 +1,22 @@
+{
+ "sources": [],
+ "what": "the axis of a torus",
+ "source": "analytic",
+ "method": "torus major 10, minor 2 centred on (0,60,0) about Z: the line through (0,60,0) along Z",
+ "construction": {
+ "A": {
+ "axis": {
+ "through": [
+ 0,
+ 60,
+ 0
+ ],
+ "dir": [
+ 0,
+ 0,
+ 1
+ ]
+ }
+ }
+ }
+}
diff --git a/tests/kernel-cases/construction/cov-axis-through-a-torus/recipe.json b/tests/kernel-cases/construction/cov-axis-through-a-torus/recipe.json
new file mode 100644
index 0000000000..5bbf5f1db0
--- /dev/null
+++ b/tests/kernel-cases/construction/cov-axis-through-a-torus/recipe.json
@@ -0,0 +1,31 @@
+{
+ "commands": [
+ {
+ "command": "solid.torus",
+ "params": {
+ "center": [
+ 0,
+ 60,
+ 0
+ ],
+ "major": 10,
+ "minor": 2,
+ "body_name": "Ring",
+ "operation": "new"
+ }
+ },
+ {
+ "command": "construct.axis.through_cylinder",
+ "params": {
+ "face": {
+ "face": [
+ 12,
+ 60,
+ 0
+ ]
+ },
+ "name": "A"
+ }
+ }
+ ]
+}
diff --git a/tests/kernel-cases/construction/cov-axis-through-cylinder-refuses-a-flat-face/expected.json b/tests/kernel-cases/construction/cov-axis-through-cylinder-refuses-a-flat-face/expected.json
new file mode 100644
index 0000000000..8e5f5615b8
--- /dev/null
+++ b/tests/kernel-cases/construction/cov-axis-through-cylinder-refuses-a-flat-face/expected.json
@@ -0,0 +1,8 @@
+{
+ "sources": [],
+ "what": "an axis through a flat face",
+ "source": "analytic",
+ "method": "box 40 x 30 x 20 with a corner at the origin (x 0..40, y 0..30, z 0..20): the top is a plane, with no axis: refused",
+ "outcome": "refused",
+ "refusal": "the face is not a cylinder, cone or torus"
+}
diff --git a/tests/kernel-cases/construction/cov-axis-through-cylinder-refuses-a-flat-face/recipe.json b/tests/kernel-cases/construction/cov-axis-through-cylinder-refuses-a-flat-face/recipe.json
new file mode 100644
index 0000000000..2818dbdc84
--- /dev/null
+++ b/tests/kernel-cases/construction/cov-axis-through-cylinder-refuses-a-flat-face/recipe.json
@@ -0,0 +1,26 @@
+{
+ "commands": [
+ {
+ "command": "solid.box",
+ "params": {
+ "length": 40,
+ "width": 30,
+ "height": 20,
+ "body_name": "Box"
+ }
+ },
+ {
+ "command": "construct.axis.through_cylinder",
+ "params": {
+ "face": {
+ "face": [
+ 20,
+ 15,
+ 20
+ ]
+ },
+ "name": "A"
+ }
+ }
+ ]
+}
diff --git a/tests/kernel-cases/construction/cov-axis-two-planes-box-top-and-side/expected.json b/tests/kernel-cases/construction/cov-axis-two-planes-box-top-and-side/expected.json
new file mode 100644
index 0000000000..83f888078f
--- /dev/null
+++ b/tests/kernel-cases/construction/cov-axis-two-planes-box-top-and-side/expected.json
@@ -0,0 +1,22 @@
+{
+ "sources": [],
+ "what": "the axis where a box's top and right side meet",
+ "source": "analytic",
+ "method": "box 40 x 30 x 20 with a corner at the origin (x 0..40, y 0..30, z 0..20): z = 20 and x = 40 meet on the line through (40,0,20) along Y",
+ "construction": {
+ "A": {
+ "axis": {
+ "through": [
+ 40,
+ 0,
+ 20
+ ],
+ "dir": [
+ 0,
+ 1,
+ 0
+ ]
+ }
+ }
+ }
+}
diff --git a/tests/kernel-cases/construction/cov-axis-two-planes-box-top-and-side/recipe.json b/tests/kernel-cases/construction/cov-axis-two-planes-box-top-and-side/recipe.json
new file mode 100644
index 0000000000..6ed68fc372
--- /dev/null
+++ b/tests/kernel-cases/construction/cov-axis-two-planes-box-top-and-side/recipe.json
@@ -0,0 +1,33 @@
+{
+ "commands": [
+ {
+ "command": "solid.box",
+ "params": {
+ "length": 40,
+ "width": 30,
+ "height": 20,
+ "body_name": "Box"
+ }
+ },
+ {
+ "command": "construct.axis.two_planes",
+ "params": {
+ "a": {
+ "face": [
+ 20,
+ 15,
+ 20
+ ]
+ },
+ "b": {
+ "face": [
+ 40,
+ 15,
+ 10
+ ]
+ },
+ "name": "A"
+ }
+ }
+ ]
+}
diff --git a/tests/kernel-cases/construction/cov-axis-two-planes-refuses-parallel-planes/expected.json b/tests/kernel-cases/construction/cov-axis-two-planes-refuses-parallel-planes/expected.json
new file mode 100644
index 0000000000..adff5fb018
--- /dev/null
+++ b/tests/kernel-cases/construction/cov-axis-two-planes-refuses-parallel-planes/expected.json
@@ -0,0 +1,8 @@
+{
+ "sources": [],
+ "what": "an axis between two parallel planes",
+ "source": "analytic",
+ "method": "box 40 x 30 x 20 with a corner at the origin (x 0..40, y 0..30, z 0..20): XY and the top z = 20 are parallel and never meet: refused",
+ "outcome": "refused",
+ "refusal": "the planes are parallel"
+}
diff --git a/tests/kernel-cases/construction/cov-axis-two-planes-refuses-parallel-planes/recipe.json b/tests/kernel-cases/construction/cov-axis-two-planes-refuses-parallel-planes/recipe.json
new file mode 100644
index 0000000000..86d4d484fe
--- /dev/null
+++ b/tests/kernel-cases/construction/cov-axis-two-planes-refuses-parallel-planes/recipe.json
@@ -0,0 +1,27 @@
+{
+ "commands": [
+ {
+ "command": "solid.box",
+ "params": {
+ "length": 40,
+ "width": 30,
+ "height": 20,
+ "body_name": "Box"
+ }
+ },
+ {
+ "command": "construct.axis.two_planes",
+ "params": {
+ "a": "XY",
+ "b": {
+ "face": [
+ 20,
+ 15,
+ 20
+ ]
+ },
+ "name": "A"
+ }
+ }
+ ]
+}
diff --git a/tests/kernel-cases/construction/cov-axis-two-planes-slanted/expected.json b/tests/kernel-cases/construction/cov-axis-two-planes-slanted/expected.json
new file mode 100644
index 0000000000..409b8c0dae
--- /dev/null
+++ b/tests/kernel-cases/construction/cov-axis-two-planes-slanted/expected.json
@@ -0,0 +1,22 @@
+{
+ "sources": [],
+ "what": "the axis where two slanted planes meet",
+ "source": "analytic",
+ "method": "x + y = 10 (normal (1,1,0) through (10,0,0)) and y + z = 6 (normal (0,1,1) through (0,0,6)): direction (1,1,0) x (0,1,1) = (1,-1,1); (10,0,6) is on both",
+ "construction": {
+ "A": {
+ "axis": {
+ "through": [
+ 10,
+ 0,
+ 6
+ ],
+ "dir": [
+ 1,
+ -1,
+ 1
+ ]
+ }
+ }
+ }
+}
diff --git a/tests/kernel-cases/construction/cov-axis-two-planes-slanted/recipe.json b/tests/kernel-cases/construction/cov-axis-two-planes-slanted/recipe.json
new file mode 100644
index 0000000000..39a4f9c185
--- /dev/null
+++ b/tests/kernel-cases/construction/cov-axis-two-planes-slanted/recipe.json
@@ -0,0 +1,38 @@
+{
+ "commands": [
+ {
+ "command": "construct.axis.two_planes",
+ "params": {
+ "a": {
+ "plane": {
+ "origin": [
+ 10,
+ 0,
+ 0
+ ],
+ "normal": [
+ 1,
+ 1,
+ 0
+ ]
+ }
+ },
+ "b": {
+ "plane": {
+ "origin": [
+ 0,
+ 0,
+ 6
+ ],
+ "normal": [
+ 0,
+ 1,
+ 1
+ ]
+ }
+ },
+ "name": "A"
+ }
+ }
+ ]
+}
diff --git a/tests/kernel-cases/construction/cov-plane-at-angle-about-its-own-normal/expected.json b/tests/kernel-cases/construction/cov-plane-at-angle-about-its-own-normal/expected.json
new file mode 100644
index 0000000000..9853c7bc74
--- /dev/null
+++ b/tests/kernel-cases/construction/cov-plane-at-angle-about-its-own-normal/expected.json
@@ -0,0 +1,22 @@
+{
+ "sources": [],
+ "what": "XY turned about Z, its own normal",
+ "source": "analytic",
+ "method": "a turn about the plane's normal maps the plane onto itself: XY, normal Z through the origin",
+ "construction": {
+ "P": {
+ "plane": {
+ "through": [
+ 3,
+ 4,
+ 0
+ ],
+ "normal": [
+ 0,
+ 0,
+ 1
+ ]
+ }
+ }
+ }
+}
diff --git a/tests/kernel-cases/construction/cov-plane-at-angle-about-its-own-normal/recipe.json b/tests/kernel-cases/construction/cov-plane-at-angle-about-its-own-normal/recipe.json
new file mode 100644
index 0000000000..792827825d
--- /dev/null
+++ b/tests/kernel-cases/construction/cov-plane-at-angle-about-its-own-normal/recipe.json
@@ -0,0 +1,13 @@
+{
+ "commands": [
+ {
+ "command": "construct.plane.at_angle",
+ "params": {
+ "base": "XY",
+ "axis": "Z",
+ "angle": "30 deg",
+ "name": "P"
+ }
+ }
+ ]
+}
diff --git a/tests/kernel-cases/construction/cov-plane-at-angle-face-off-the-axis/expected.json b/tests/kernel-cases/construction/cov-plane-at-angle-face-off-the-axis/expected.json
new file mode 100644
index 0000000000..78866877d1
--- /dev/null
+++ b/tests/kernel-cases/construction/cov-plane-at-angle-face-off-the-axis/expected.json
@@ -0,0 +1,22 @@
+{
+ "sources": [],
+ "what": "a box's top turned 45 degrees about X, which lies off it",
+ "source": "analytic",
+ "method": "box 40 x 30 x 20 with a corner at the origin (x 0..40, y 0..30, z 0..20): the top z = 20 turned +45 deg about the X axis through the origin: normal (0, -1/sqrt2, 1/sqrt2), and its point (0,0,20) goes to (0, -20/sqrt2, 20/sqrt2): the plane -y + z = 20 sqrt2, 20 from the axis",
+ "construction": {
+ "P": {
+ "plane": {
+ "through": [
+ 0,
+ -14.14213562373095,
+ 14.14213562373095
+ ],
+ "normal": [
+ 0,
+ -1,
+ 1
+ ]
+ }
+ }
+ }
+}
diff --git a/tests/kernel-cases/construction/cov-plane-at-angle-face-off-the-axis/recipe.json b/tests/kernel-cases/construction/cov-plane-at-angle-face-off-the-axis/recipe.json
new file mode 100644
index 0000000000..f48a9ef456
--- /dev/null
+++ b/tests/kernel-cases/construction/cov-plane-at-angle-face-off-the-axis/recipe.json
@@ -0,0 +1,28 @@
+{
+ "commands": [
+ {
+ "command": "solid.box",
+ "params": {
+ "length": 40,
+ "width": 30,
+ "height": 20,
+ "body_name": "Box"
+ }
+ },
+ {
+ "command": "construct.plane.at_angle",
+ "params": {
+ "base": {
+ "face": [
+ 5,
+ 5,
+ 20
+ ]
+ },
+ "axis": "X",
+ "angle": "45 deg",
+ "name": "P"
+ }
+ }
+ ]
+}
diff --git a/tests/kernel-cases/construction/cov-plane-at-angle-xy-about-x-30/expected.json b/tests/kernel-cases/construction/cov-plane-at-angle-xy-about-x-30/expected.json
new file mode 100644
index 0000000000..d782b770c5
--- /dev/null
+++ b/tests/kernel-cases/construction/cov-plane-at-angle-xy-about-x-30/expected.json
@@ -0,0 +1,22 @@
+{
+ "sources": [],
+ "what": "XY turned 30 degrees about X",
+ "source": "analytic",
+ "method": "turning XY's normal Z by +30 deg about +X (right hand): (0, -sin 30, cos 30) = (0, -1/2, sqrt3/2); the plane keeps the X axis",
+ "construction": {
+ "P": {
+ "plane": {
+ "through": [
+ 25,
+ 0,
+ 0
+ ],
+ "normal": [
+ 0,
+ -0.5,
+ 0.8660254037844386
+ ]
+ }
+ }
+ }
+}
diff --git a/tests/kernel-cases/construction/cov-plane-at-angle-xy-about-x-30/recipe.json b/tests/kernel-cases/construction/cov-plane-at-angle-xy-about-x-30/recipe.json
new file mode 100644
index 0000000000..ca6d54143f
--- /dev/null
+++ b/tests/kernel-cases/construction/cov-plane-at-angle-xy-about-x-30/recipe.json
@@ -0,0 +1,13 @@
+{
+ "commands": [
+ {
+ "command": "construct.plane.at_angle",
+ "params": {
+ "base": "XY",
+ "axis": "X",
+ "angle": "30 deg",
+ "name": "P"
+ }
+ }
+ ]
+}