From de606715b031ada49371c50b447fb153a3d56279 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 01:27:37 -0400 Subject: [PATCH 001/108] Placement tests: a body mirrored in SMLib reads back from its record valid Since an operation's result is its record (f11c0c571), a mirrored body is SMLib's transform read back from SMLib's export, and two SMLib defects there made it invalid: a mirrored cylinder came back inside out the wrong way (SmCylinder::IsNurbSurfaceCylinder; its edges 10 to 30 mm off the surface), and every edge's own tolerance was reset to the body's (SmBrep::Transform). Both are fixed in SMLib (fix/mirrored-cylinder-from-nurbs e02e63e, c603293, with e008e82 for a scaled body without vertices); this test needs the SMLib pin moved past them. A plate with a through hole and a box with two rounds meeting at a corner, mirrored in x = 30 and read back from their records: SMLib finds both valid and their volumes are the originals'. Co-Authored-By: Claude Opus 5.5 --- crates/kernel/src/placement_tests.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/crates/kernel/src/placement_tests.rs b/crates/kernel/src/placement_tests.rs index e788d39bc..239281cae 100644 --- a/crates/kernel/src/placement_tests.rs +++ b/crates/kernel/src/placement_tests.rs @@ -73,3 +73,25 @@ fn periodic_step_seam_survives_identity_rotation_and_translation() { assert_topology(body, &rigid, [[0., 1., 0., 0.], [-1., 0., 0., 0.], [0., 0., 1., 0.], [10., 10., 30., 1.]]); assert_eq!(crate::step_export(&[body], "source snapshot").unwrap(), unchanged); } + +/// A body mirrored in SMLib reads back from its record as the same valid solid: a plate with a +/// through hole (the hole's cylinder comes out inside out) and a box with two rounds meeting at a +/// corner (their intersection edge has a tolerance of its own, wider than the body's). Read back +/// from the record, the hole's cylinder swept the wrong way about its axis 30 mm off its NURBS, +/// and the rounds' shared edge lost its tolerance to the body's. +#[test] +fn mirrored_bodies_read_back_from_their_records_valid() { + let plate = crate::box_solid(Vec3::ZERO, Vec3::new(30., 40., 20.)).unwrap(); + let hole = crate::cylinder(Vec3::new(20., 20., -5.), Vec3::Z, 5.0, 30.0).unwrap(); + let holed = crate::boolean(&plate, &hole, crate::BoolOp::Cut).unwrap().unwrap(); + let rounded = crate::fillet(&plate, &[Vec3::new(15., 0., 20.), Vec3::new(0., 0., 10.)], 3.0).unwrap(); + // The mirror in x = 30. + let mirror = [[-1., 0., 0., 0.], [0., 1., 0., 0.], [0., 0., 1., 0.], [60., 0., 0., 1.]]; + for (what, body) in [("holed plate", holed), ("rounded box", rounded)] { + let mirrored = transform_matrix(&body, mirror).unwrap(); + let read_back = Body::from_record(mirrored.record().clone()).unwrap(); + assert!(matches!(crate::validity(&read_back).smlib, Some(crate::SmlibCheck::Valid)), "{what}: {:?}", crate::validity(&read_back).smlib); + let (want, got) = (crate::measure(&body).unwrap().volume, crate::measure(&read_back).unwrap().volume); + assert!((got - want).abs() < 1e-6 * want, "{what}: volume {got}, expected {want}"); + } +} From f3b77d71b3d9c12de0f7cc7cb7a100a2358f2c51 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 07:44:22 -0400 Subject: [PATCH 002/108] Tests: expectations for the SMLib fixes of 2026-10-29 With SMLib integration-overnight + b78bd4a (the fixes of 2026-10-29), three expectations that held a refusal now build, each checked against its exact answer: - rig fillets/1207-fillet-box-end-edge-into-unblended-round (was ...-refused): the end face's top edge of a cube rounded r3 along its top back edge, rounded r1 alone (tangent chain off), builds. Its round runs on along y through the r3 round's end until that surface drops below it at y = 17 + sqrt(5): V = 8000 - 20 (9 - 9 pi/4) - 17 (1 - pi/4) - 0.218236 = 7957.505202 (the last term the section under the round, integrated exactly); SMLib gives 7957.505245. - blend_smlib smooth_edges_and_unfinished_tangent_chains_are_refused_saying_why: the same cube builds, at that volume. - modify_history_tests::smlib::draft_tilts_a_side_and_keeps_its_name: the rod's side, a cylinder along the pull, drafts 5 deg to a frustum, radius 5 at the neutral plane and 5 - 10 tan 5 deg at the top, at its exact volume. tests/kernel-cases/fillets/KNOWN_FAILING drops 1557-fillet-vertical-corners-after- bottom-rounds, which passes now; the other eight still fail, so the gate holds (81 pass, 8 known failing, no regression). Co-Authored-By: Claude Opus 5.5 --- crates/kernel/src/blend_smlib.rs | 15 +++++++++------ crates/kernel/src/modify_history_tests.rs | 9 ++++++--- .../expected.json | 10 ---------- .../expected.json | 14 ++++++++++++++ .../recipe.json | 0 tests/kernel-cases/fillets/KNOWN_FAILING | 3 +-- 6 files changed, 30 insertions(+), 21 deletions(-) delete mode 100644 tests/kernel-cases/fillets/1207-fillet-box-end-edge-into-unblended-round-refused/expected.json create mode 100644 tests/kernel-cases/fillets/1207-fillet-box-end-edge-into-unblended-round/expected.json rename tests/kernel-cases/fillets/{1207-fillet-box-end-edge-into-unblended-round-refused => 1207-fillet-box-end-edge-into-unblended-round}/recipe.json (100%) diff --git a/crates/kernel/src/blend_smlib.rs b/crates/kernel/src/blend_smlib.rs index f7747e37f..1e6e7e10f 100644 --- a/crates/kernel/src/blend_smlib.rs +++ b/crates/kernel/src/blend_smlib.rs @@ -610,9 +610,10 @@ mod tests { /// A smooth edge (a round's seam with the face it runs into) has nothing to round: refused /// before SMLib, saying so. An edge that runs on tangentially into one left out is SMLib's to - /// end: where it cannot (the end face's top edge into the round's end arc) the refusal says - /// why, and rounded with its tangent chain the edge builds; where it can (a vertical edge run - /// on up a top round's end arc into the corner, ladder 07-fillets/018) it builds. + /// end: the end face's top edge into the round's end arc builds, its round run on through the + /// arc's round until it leaves the material (rig fillets/1207-fillet-box-end-edge-into- + /// unblended-round), and with its tangent chain the edge builds too; a vertical edge run on + /// up a top round's end arc into the corner (ladder 07-fillets/018) builds. #[test] fn smooth_edges_and_unfinished_tangent_chains_are_refused_saying_why() { let b = cube(); @@ -620,10 +621,12 @@ mod tests { // the seam where the r3 round meets the top, 3 in from the old edge let seam = imp::blend(&rounded, "fillet", Kind::Round, &[Vec3::new(10.0, 17.0, 20.0)], &[1.0]).unwrap_err().to_string(); assert!(seam.contains("is smooth: its faces meet tangentially, so there is nothing to round"), "{seam}"); - // the end face's top edge runs on tangentially into the round's end arc + // the end face's top edge runs on tangentially into the round's end arc: its r1 round + // goes on along y through the r3 round until that drops below it, at y = 17 + sqrt(5) + // (the rig case's closed form: 8000 - 20 (9 - 9 pi/4) - 17 (1 - pi/4) - 0.218236) let top = Vec3::new(0.0, 8.0, 20.0); - let alone = imp::blend(&rounded, "fillet", Kind::Round, &[top], &[1.0]).unwrap_err().to_string(); - assert!(alone.contains("continues tangentially"), "{alone}"); + let alone = fillet(&rounded, &[top], 1.0).unwrap(); + assert!((volume(&alone) - 7957.505202).abs() < 1e-3, "{}", volume(&alone)); let chain = crate::tangent_chain(&rounded, &[top]).unwrap(); assert!(chain.len() > 1, "{chain:?}"); let whole = fillet(&rounded, &chain, 1.0).unwrap(); diff --git a/crates/kernel/src/modify_history_tests.rs b/crates/kernel/src/modify_history_tests.rs index 89f355277..9a8247856 100644 --- a/crates/kernel/src/modify_history_tests.rs +++ b/crates/kernel/src/modify_history_tests.rs @@ -596,10 +596,13 @@ mod smlib { let tilted = with(h, &[face(face_at(&b, side))]); assert_eq!(tilted.len(), 1, "{h:?}"); assert_eq!(h.faces[tilted[0]].change, Change::Modified); - // A round wall isn't flat; the top isn't parallel to the pull. + // A round wall along the pull leans in the same way: the rod drafts to a frustum, radius + // 5 at the neutral plane and 5 - 10 tan 5 deg at the top. The top isn't parallel to the pull. let rod = cylinder(Vec3::ZERO, Vec3::Z, 5.0, 10.0).unwrap(); - let e = offset_backend::draft(&rod, &[Vec3::new(5.0, 0.0, 5.0)], &Plane::XY, Vec3::Z, 5.0 * deg).unwrap_err(); - assert!(e.to_string().contains("not supported yet"), "{e}"); + let frustum = offset_backend::draft(&rod, &[Vec3::new(5.0, 0.0, 5.0)], &Plane::XY, Vec3::Z, 5.0 * deg).unwrap(); + let top = 5.0 - 10.0 * (5.0 * deg).tan(); + let exact = std::f64::consts::PI * 10.0 * (25.0 + 5.0 * top + top * top) / 3.0; + assert!((volume(&frustum) - exact).abs() < 1e-3, "{} vs {exact}", volume(&frustum)); let e = offset_backend::draft(&b, &[Vec3::new(20.0, 15.0, 20.0)], &Plane::XY, Vec3::Z, 5.0 * deg).unwrap_err(); assert!(e.to_string().contains("not supported yet"), "{e}"); } diff --git a/tests/kernel-cases/fillets/1207-fillet-box-end-edge-into-unblended-round-refused/expected.json b/tests/kernel-cases/fillets/1207-fillet-box-end-edge-into-unblended-round-refused/expected.json deleted file mode 100644 index ce28c6391..000000000 --- a/tests/kernel-cases/fillets/1207-fillet-box-end-edge-into-unblended-round-refused/expected.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "sources": [ - "tangency-labs/solidcraft#1207" - ], - "what": "an edge that runs on tangentially into a round left out of the blend (tangent chain off) is refused saying so: a blend cannot end where its edge continues smoothly", - "source": "invariants", - "method": "cube 20, its top back edge (y=20, z=20) rounded r3; the end face's top edge (x=0, z=20, y 0..17) then rounded r1 alone, tangent_chain false: at (0, 17, 20) it continues tangentially into the round's end arc, which is not blended with it. A round has no end there (SMLib blends a tangent chain as one sequence), so the right answer is a clean refusal naming that; with the tangent chain on it builds", - "outcome": "refused", - "refusal": "continues tangentially" -} \ No newline at end of file diff --git a/tests/kernel-cases/fillets/1207-fillet-box-end-edge-into-unblended-round/expected.json b/tests/kernel-cases/fillets/1207-fillet-box-end-edge-into-unblended-round/expected.json new file mode 100644 index 000000000..c7c237e6f --- /dev/null +++ b/tests/kernel-cases/fillets/1207-fillet-box-end-edge-into-unblended-round/expected.json @@ -0,0 +1,14 @@ +{ + "sources": [ + "tangency-labs/solidcraft#1207" + ], + "what": "an edge that runs on tangentially into a round left out of the blend (tangent chain off) is rounded on past the round's end arc until it leaves the material", + "source": "analytic", + "method": "cube 20 (V0 = 8000), its top back edge (y=20, z=20) rounded r3: removes 20 (9 - 9 pi/4) = 38.628316. The end face's top edge (x=0, z=20, y 0..17) then rounded r1 alone, tangent_chain false: over y 0..17 it removes 17 (1 - pi/4) = 3.648231; at y=17 the edge goes on tangentially into the r3 round's end arc, and the r1 round's cylinder (axis x=1, z=19) runs on along y through the r3 round, cutting the part of its section under the round's surface z = 17 + sqrt(9 - (y-17)^2) until that surface drops below z=19 at y = 17 + sqrt(5): with t = sqrt(9 - (y-17)^2) - 2, the section's area under it is t - (t sqrt(1-t^2) + asin t)/2, integrated over y 17..17+sqrt(5) (Simpson, 200000 steps) = 0.218236. V = 8000 - 38.628316 - 3.648231 - 0.218236 = 7957.505202", + "outcome": "solid", + "body_count": 1, + "volume_mm3": 7957.505202, + "continuity": { + "order": "g1" + } +} diff --git a/tests/kernel-cases/fillets/1207-fillet-box-end-edge-into-unblended-round-refused/recipe.json b/tests/kernel-cases/fillets/1207-fillet-box-end-edge-into-unblended-round/recipe.json similarity index 100% rename from tests/kernel-cases/fillets/1207-fillet-box-end-edge-into-unblended-round-refused/recipe.json rename to tests/kernel-cases/fillets/1207-fillet-box-end-edge-into-unblended-round/recipe.json diff --git a/tests/kernel-cases/fillets/KNOWN_FAILING b/tests/kernel-cases/fillets/KNOWN_FAILING index 17646555d..6cfa257e0 100644 --- a/tests/kernel-cases/fillets/KNOWN_FAILING +++ b/tests/kernel-cases/fillets/KNOWN_FAILING @@ -1,9 +1,8 @@ # The fillet cases that fail today, one a line: ` `. Sorted. The fillet # rig gate (.github/workflows/fillet-rig.yml) fails on a case that fails and is not listed here, # and on a listed case that passes: a fix removes its line in the same pull request. -# Baseline: develop 229739a70 (SMLib 7e917f0), aarch64 Linux, 2026-10-29. +# Baseline: develop 242bbc89f with the SMLib fixes of 2026-10-29 (integration-overnight + b78bd4a), aarch64 Linux. 1207-fillet-bar-top-edge-after-boss-arc-round-r0-5 SMLib's check refuses the round: internal coincident control points in a B-spline curve (an internal pole) -1557-fillet-vertical-corners-after-bottom-rounds SMLib status 1001 since bodies are read back from their records (#8625): the bottom rounds come back as SmCylinder where SMLib's blend made SmCone(0), and the corner-ball trace starts 2.78e-4 off 4782-fillet-bar-edge-wider-than-both-faces SMLib status 1001: a convex round past both its faces is not yet built by subtraction 4782-fillet-two-end-verticals-past-a-full-round SMLib's result is not a closed solid, where a refusal naming 7.5 mm (fillet_max for the exact fit) is right 5158-fillet-round-just-past-a-10mm-face SMLib status 1001: a convex round 0.01 past its face is not yet built by subtraction (10.0001-10.04 open) From 567b764b93df4813c02e937c73bd0b8e014d697c Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 15:23:18 -0400 Subject: [PATCH 003/108] Viewport tests: the offset ellipse ring's 512 wall joins are all smooth SMLib now sweeps a curve within the tolerance of a circle as itself, not as that circle's cylinder (tangency-labs/smlib#31, 3cfbbdd), so the offset curves' pieces meet with one curvature at every wall join of the ring (the largest curvature jump 4.2e-7): all 512 are smooth, where 400 were and the other 112 jumped by 0.9-3.6%. The comments that said the pieces meet only tangentially, or at small real creases, go. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/viewport.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/ui-egui/src/viewport.rs b/crates/ui-egui/src/viewport.rs index 4a59d6adf..a59485328 100644 --- a/crates/ui-egui/src/viewport.rs +++ b/crates/ui-egui/src/viewport.rs @@ -8567,10 +8567,10 @@ mod tests { let b = st.bodies.first().unwrap(); let mesh = b.mesh(); assert_eq!(mesh.edges.len(), 1536); - // Of the 512 wall joins, the offset curves' pieces meet with one curvature at 400; at the - // other 112 the curvature jumps by 0.9-3.6% (the offsets' pieces meet only tangentially) - // and the join is drawn. - assert_eq!(mesh.smooth_edges.iter().filter(|f| **f).count(), 400); + // SMLib sweeps each piece of the offset curves as itself (none is taken for a circle + // near it), so the pieces meet with one curvature at all 512 wall joins (the largest + // curvature jump 4.2e-7) and no join is drawn. + assert_eq!(mesh.smooth_edges.iter().filter(|f| **f).count(), 512); let smooth = mesh.smooth_edges.iter().position(|f| *f).unwrap(); let expected = mesh.edges.iter().enumerate().filter(|(i, _)| mesh.shaded_edge_visible(*i)).map(|(_, e)| e.len() - 1).sum::(); let shaded = build_scene(&app).merged(); @@ -8578,8 +8578,8 @@ mod tests { assert!(!shaded.tris.is_empty()); app.ui.visual_style = 2; let wire = build_scene(&app).merged(); - // The wireframe draws every edge but seams, and a seam measured as a crease (the offset - // ellipse's pieces meet at small real creases) is no seam. + // The wireframe draws every edge but seams, the smooth wall joins among them: they are + // edges between faces, hidden only when shaded. let expected_wire = mesh.edges.iter().enumerate().filter(|(i, _)| mesh.edge_visible(*i)).map(|(_, e)| e.len() - 1).sum::(); assert_eq!(wire.lines.len() / crate::gpu::LINE_SIZE, expected_wire); assert!(expected_wire > expected); From 9d0fb564e0e5cfe8b3c1036981d410e04b8db063 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 15:50:15 -0400 Subject: [PATCH 004/108] =?UTF-8?q?SMLib:=20pinned=20at=2060b1c6a:=20the?= =?UTF-8?q?=2043=20fixes=20of=202026-10-29=20(tangency-labs/smlib#14?= =?UTF-8?q?=E2=80=93#56)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From 7e917f0 to 60b1c6a on tangency-labs/smlib replay/1.0.1, 45 commits in 43 pull requests: - Booleans (#28, #29, #34, #39, #45, #47, #55, #56): a coincident edge split with its edge, a plane grown to cover a face however far, a seam point classified to its face, intersection loops closed only along edges that lie on each other, curves inside one ProtoVertex split at its vertices, an intersection along a face's own edge taken as that edge, a plane a hair into a cylinder touching it along one line (and crossing it in two), faces and loops apart not intersected. - Transforms (#48, #49, #50): a mirrored cylinder read back from its NURBS turns the right way, a rotation or reflection keeps every tolerance and a scale scales them, a scaled body's model size is measured from its geometry. - Fillets and chamfers (#24, #30, #51): a chamfer round an arc is a cone, a gentle corner in a variable radius splits the round, a seam round's corner ball sits where the cylinders' axes meet. - Shell and offset (#17, #22, #23, #25, #26, #32, #38): closed faces and closed sheets offset, exact lines and conics between analytic faces, cones and cylinders extended as themselves, a cone's apex offset as a sphere, a wall that would turn a face inside out refused, neighbours extended to reach a face moved past the body's size, an open edge's trim point on a closed curve. - Draft (#27, #53): a cylinder along the pull drafts to a cone, a cone about the pull to the cone its turned generators make. - Sweeps (#14, #31, #36, #37, #40, #43, #44): a whole turn of a holed profile leaves the void, a curve near a circle swept as itself (text outlines' Béziers pass the check), an arc centred across the axis revolves to an exact B-spline surface of revolution, a minor circle on the axis and a horn torus, line and arc paths swept exactly piece by piece. - Surfaces (#18, #19, #20, #21): a B-spline starter in Bezier form, extend by the distance across the surface and as the same cone or cylinder, untrim in place. - Intersections (#35, #46, #52): a curve into a pole keeps its tangent, a periodic value just past the top wraps a period down, a curve from a singular point starts inside. - Checks, history, measure (#15, #16, #33, #41, #42, #54): a face whose edges moved is Modified, SMLib's warnings are no failed test, sheet faces count in the area, internal poles sought in the knot's row, a collapsed seam not classified, a small loop oriented on the surface's scale. Co-Authored-By: Claude Opus 5.5 --- crates/smlib/SMLIB_PREBUILT | 16 ++++++++-------- crates/smlib/SMLIB_REV | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/smlib/SMLIB_PREBUILT b/crates/smlib/SMLIB_PREBUILT index 207dd839f..de61afd1d 100644 --- a/crates/smlib/SMLIB_PREBUILT +++ b/crates/smlib/SMLIB_PREBUILT @@ -1,10 +1,10 @@ # Rust target, SHA-256 of smlib-.tar.gz in the release prebuilt- of # tangency-labs/smlib. Written by scripts/fetch-smlib.sh --pin; never edited by hand. -aarch64-apple-darwin d5f9ee5b49f2b1b9777a27942401516a59384105c2dce58a6bd571efe7d77aa8 -aarch64-pc-windows-msvc d5df522ed4459dad9ffba4d5b22c05f8bebcf4d5ba217f62395c2ea689492f14 -aarch64-unknown-linux-gnu b7849d6dbdb358380b7352742dccfd33a71bc423e1fda18566fcd58a0b406ff3 -i686-pc-windows-msvc 6b7cb77f7fd05f5f458689e49547ec9d9d4920f28cd79f5c16ae44fa8682bc46 -wasm32-unknown-unknown 63f9c65ae041d1db4b8ffb7306bd6a4f4b7f125f6fb1772ca5dcc14763c76bd6 -x86_64-apple-darwin 99a5e32ae73c82f9020a046245312cb5352974069a464af3ac9da1f624800ad1 -x86_64-pc-windows-msvc 828211a338c42be882eb9084fef89087479b713dd641bb3aa0b3b2b70a2b3bfa -x86_64-unknown-linux-gnu f69203a49aa1c1a4272364cb13585c84557c466f4863adc66cb1a5f623462289 +aarch64-apple-darwin 49c6cc428f3d1d4d9b20d9b2bf85377058c1ef016396082f1d7fa17d6f3c9e3b +aarch64-pc-windows-msvc e675f1f8eccdc8c902fbb300ba6eca0443a73ecf207ab10a5ecdffa411a0b5df +aarch64-unknown-linux-gnu 042f9c6af6053673e3ffd20c9791034a66748538a72b88f3bc08ba17eeca103a +i686-pc-windows-msvc 53fcb55669647484b70e707298e927b70b24301078f3181aa0544854dbcbfe86 +wasm32-unknown-unknown ef5a257974f2ff24c3420fdc4357d67a8da7a8b253508f5af7e549f5556c01ea +x86_64-apple-darwin b06dd703c07a0527623f77a70bfc421f580a278d5a18fd5828358b6803098dbe +x86_64-pc-windows-msvc 9a572adf26454401273f9c0d509956c684dd8f9eb8c389846ded36b9fabcdf0f +x86_64-unknown-linux-gnu 8eda2121cb7f3c50a6d6865c0daae8ed81a910e8cf3e5c5008bc3ffb60d2cf81 diff --git a/crates/smlib/SMLIB_REV b/crates/smlib/SMLIB_REV index 4ae676f19..380a58799 100644 --- a/crates/smlib/SMLIB_REV +++ b/crates/smlib/SMLIB_REV @@ -1 +1 @@ -7e917f0a308d620491fdbc07c5e07fb29a2b8300 +60b1c6a33da2af524206d20155096f361ae9484c From bb4299e5659d17e51a52fe5ad66976174d357d61 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Wed, 28 Oct 2026 22:43:03 -0400 Subject: [PATCH 005/108] Tests: a drafted cube side leaves the bottom and the opposite side Kept, the rest Modified Drafting a cube's side about its bottom edge (on the neutral plane) tilts the side and moves the edges it shares with the top and the two faces beside it: those four are trimmed differently (Modified); the bottom and the opposite side are untouched (Kept). Truck called all six Modified; SMLib's history called the moved neighbours Kept. Needs the SMLib fix "history: a face whose edges an operation moved is Modified, not Kept" (SMLib branch devgreen-kernel-records, cdaf205) and a pin bump. Co-Authored-By: Claude Opus 5.5 --- crates/kernel/src/modify_history_tests.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/kernel/src/modify_history_tests.rs b/crates/kernel/src/modify_history_tests.rs index 9a8247856..7d953e830 100644 --- a/crates/kernel/src/modify_history_tests.rs +++ b/crates/kernel/src/modify_history_tests.rs @@ -280,7 +280,10 @@ fn draft_tilts_faces() { let side = Vec3::new(40.0, 15.0, 10.0); let r = crate::draft(&b, &[side], &Plane::XY, Vec3::Z, 5f64.to_radians()).unwrap(); let h = verified(&r, &b, Reach { made: 0.0, moved: 2.0 }); - assert_eq!(changes(h), [0, 6, 0, 0, 0]); + // The side tilts about its bottom edge (on the neutral plane z = 0); the top and the two + // faces beside it lose a wedge along their moved edges. The bottom and the opposite side + // are untouched. + assert_eq!(changes(h), [2, 4, 0, 0, 0]); assert_eq!(with(h, &[face(face_at(&b, side))]).len(), 1); // Walls of a body that is not convex. let l = ell(); From 29adfd0d7f89fc14db6341b9a057f622f7122eda Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 00:56:48 -0400 Subject: [PATCH 006/108] Kernel tests: the barrel's side is the exact surface of revolution of its arc The barrel's arc has its centre across the axis, so its side is the inner (lemon) zone of a spindle torus, which SMLib's torus does not describe (its meridian is on the X side): SMLib (revolve-spindle) sweeps it as the exact rational surface of revolution. shell_of_a_revolved_barrel asserted an analytic torus of major radius -10. As the owner decided, it now asserts what matters: two flat caps and the curved side, the closed-form volume, 14 mm round at mid height, and after the shell the two offset faces (the inner wall and floor; truck's side was in halves). Needs SMLib with revolve-spindle (pin bump). Co-Authored-By: Claude Opus 5.5 --- crates/kernel/tests/shell_barrel.rs | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/crates/kernel/tests/shell_barrel.rs b/crates/kernel/tests/shell_barrel.rs index fb933cbfb..fc7422ae9 100644 --- a/crates/kernel/tests/shell_barrel.rs +++ b/crates/kernel/tests/shell_barrel.rs @@ -43,13 +43,19 @@ fn check_volume(body: &Body, lo: f64, hi: f64) { #[test] fn shell_of_a_revolved_barrel() { let barrel = barrel(); - let side = (0..barrel.face_count()) - .find_map(|i| match face_surface(&barrel, i) { - Some(s @ FaceSurface::Torus { major, minor, .. }) if (major - CENTRE).abs() < 1e-6 && (minor - RADIUS).abs() < 1e-6 => Some(s), - _ => None, - }) - .expect("barrel side is the inner sheet of a spindle torus"); - assert!(side.nearest(Vec3::new(15.0, 0.0, HALF_HEIGHT)).unwrap().dist(Vec3::new(14.0, 0.0, HALF_HEIGHT)) < 1e-6); + // The side is the inner (lemon) zone of a spindle torus: SMLib's torus describes only its + // outer zone, so the side is the exact rational surface of revolution of the arc. Two flat + // caps and that side; the solid is the closed-form barrel, 14 mm round at mid height (`contains` asks the display mesh, so a margin round it). + assert_eq!(barrel.face_count(), 3); + let planes = (0..barrel.face_count()).filter(|i| matches!(face_surface(&barrel, *i), Some(FaceSurface::Plane { .. }))).count(); + assert_eq!(planes, 2, "two caps and the curved side"); + let full = integral(RADIUS, 2.0 * HALF_HEIGHT) - integral(RADIUS, 0.0); + let volume = measure(&barrel).unwrap().volume; + assert!((volume - full).abs() < full * 1e-3, "{volume} vs {full}"); + for turn in [0.0, 1.0, 2.5, 4.0] { + let (c, s) = (f64::cos(turn), f64::sin(turn)); + assert!(barrel.contains(Vec3::new(13.8 * c, 13.8 * s, HALF_HEIGHT)) && !barrel.contains(Vec3::new(14.2 * c, 14.2 * s, HALF_HEIGHT))); + } let result = shell(&barrel, &[Vec3::new(0.0, 0.0, 2.0 * HALF_HEIGHT)], 2.0).unwrap(); assert!(result.validity().is_empty(), "{:?}", result.validity()); assert_eq!(result.shell_count(), 1); @@ -62,7 +68,8 @@ fn shell_of_a_revolved_barrel() { check_volume(&result, 2.0, 2.0 * HALF_HEIGHT); let history = result.history().expect("exact shell face history"); assert_eq!(history.operands, 1); - assert_eq!(history.faces.iter().filter(|f| matches!(f.origins.as_slice(), [FaceOrigin::Offset { operand: 0, .. }])).count(), 4); + // The inner wall and the inner floor, offsets of the barrel's side and bottom (the top opened). + assert_eq!(history.faces.iter().filter(|f| matches!(f.origins.as_slice(), [FaceOrigin::Offset { operand: 0, .. }])).count(), 2); let step = step_export(&[&result], "barrel shell").unwrap(); let imported = step_import(&step).unwrap(); assert_eq!(imported.bodies.len(), 1); From 5ada4fc8a560aa9d6f19c33ae37ac739026f19fb Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 18:59:21 -0400 Subject: [PATCH 007/108] SMLib: pin 90aabff, a shelled round stays a cylinder and a step wall is ruled as its plane tangency-labs/smlib#57 on top of 60b1c6a. It fixes the two engine tests the earlier pin broke: press_pull_on_curved_faces and a_shell_fillet_does_not_follow_a_gone_edge_onto_a_smooth_seam, with their expectations unchanged. Co-Authored-By: Claude Opus 5.5 --- crates/smlib/SMLIB_PREBUILT | 16 ++++++++-------- crates/smlib/SMLIB_REV | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/smlib/SMLIB_PREBUILT b/crates/smlib/SMLIB_PREBUILT index de61afd1d..57562e10a 100644 --- a/crates/smlib/SMLIB_PREBUILT +++ b/crates/smlib/SMLIB_PREBUILT @@ -1,10 +1,10 @@ # Rust target, SHA-256 of smlib-.tar.gz in the release prebuilt- of # tangency-labs/smlib. Written by scripts/fetch-smlib.sh --pin; never edited by hand. -aarch64-apple-darwin 49c6cc428f3d1d4d9b20d9b2bf85377058c1ef016396082f1d7fa17d6f3c9e3b -aarch64-pc-windows-msvc e675f1f8eccdc8c902fbb300ba6eca0443a73ecf207ab10a5ecdffa411a0b5df -aarch64-unknown-linux-gnu 042f9c6af6053673e3ffd20c9791034a66748538a72b88f3bc08ba17eeca103a -i686-pc-windows-msvc 53fcb55669647484b70e707298e927b70b24301078f3181aa0544854dbcbfe86 -wasm32-unknown-unknown ef5a257974f2ff24c3420fdc4357d67a8da7a8b253508f5af7e549f5556c01ea -x86_64-apple-darwin b06dd703c07a0527623f77a70bfc421f580a278d5a18fd5828358b6803098dbe -x86_64-pc-windows-msvc 9a572adf26454401273f9c0d509956c684dd8f9eb8c389846ded36b9fabcdf0f -x86_64-unknown-linux-gnu 8eda2121cb7f3c50a6d6865c0daae8ed81a910e8cf3e5c5008bc3ffb60d2cf81 +aarch64-apple-darwin 0288998e1d7e0bc14149f7abc2cd7e44852a66af43b187a700981cffdfbc89dc +aarch64-pc-windows-msvc 51992eb16f529c0969a22d9c852c65c582dd48a8ca5febf28a5f28186dbec000 +aarch64-unknown-linux-gnu 9d0b96bbaf7ae255c0bcd8828fb3cbb0b3ffda053de47bca73edf8429efcffad +i686-pc-windows-msvc 26f130fc69f57bd0aa0552b653dde5120a6526525145f4f1cf91b8c0914de95f +wasm32-unknown-unknown a5a0b287078e4d1f216e8d78194cbb839fcd65a2ad9cb93b491ee5aa46902f7d +x86_64-apple-darwin 83768b97779df83aa11319668be3c78dad1d84f21e20ea6d923ff2a7bf352889 +x86_64-pc-windows-msvc 21f688d0d3d4c5d9e1e3cb33fb2991701a1172299d36bb6342238836a11cb85e +x86_64-unknown-linux-gnu 5c6145e288a3e7cd741d1f3f2b96a5a39016c9ceac950b1e05ae75a5f4cb5f53 diff --git a/crates/smlib/SMLIB_REV b/crates/smlib/SMLIB_REV index 380a58799..670339da7 100644 --- a/crates/smlib/SMLIB_REV +++ b/crates/smlib/SMLIB_REV @@ -1 +1 @@ -60b1c6a33da2af524206d20155096f361ae9484c +90aabff7937853f94ab1ddb9115382844f369793 From 9008d13f31fb0b485ab6cb380d7215c0c0e738b3 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:40:15 -0400 Subject: [PATCH 008/108] Surface Extrude: a symmetric distance is the total, as for a solid extrude A symmetric surface.extrude given no convention now splits its distance evenly around the start plane (10 mm: 5 mm each side), the way solid.extrude reads it, instead of going the distance each way. Both commands take their default from one function, which a session setting (surface_extrude_symmetric_per_side) can turn back to the per-side reading for surface extrudes. timeline.edit and timeline.redefine give a one-sided surface extrude made symmetric the same default. Saved designs are unchanged: every surface extrude saved its convention (legacy_per_side), and one saved before the marker existed reads per side as it always did. The help of both commands says how the distance is read. The 3830 kernel case, recorded with the per-side reading, now says so explicitly. Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/cmd/edit.rs | 12 ++- .../src/cmd/extrude_convention_tests.rs | 97 +++++++++++++++++-- crates/engine/src/cmd/features.rs | 18 +++- crates/engine/src/cmd/surface.rs | 5 +- crates/engine/src/lib.rs | 8 ++ .../recipe.json | 1 + 6 files changed, 122 insertions(+), 19 deletions(-) diff --git a/crates/engine/src/cmd/edit.rs b/crates/engine/src/cmd/edit.rs index d4a81c856..31655f997 100644 --- a/crates/engine/src/cmd/edit.rs +++ b/crates/engine/src/cmd/edit.rs @@ -1047,12 +1047,16 @@ fn edit_feature(s: &mut Session, p: &Value) -> Result { resolve_feature_names(&mut v, &s.doc, cmd)?; let mut nf: Feature = serde_json::from_value(v.clone()).map_err(|e| bad(cmd, format!("invalid feature: {e}")))?; nf.id = f.id; - if let (FeatureKind::Extrude { extent: old, .. }, FeatureKind::Extrude { extent: new, .. }) = (&f.kind, &mut nf.kind) + // A one-sided extrude made symmetric takes the convention a new one would: its old marker + // never read a symmetric distance. + let maker = if matches!(f.kind, FeatureKind::SurfaceExtrude { .. }) { "surface.extrude" } else { "solid.extrude" }; + if let (FeatureKind::Extrude { extent: old, .. }, FeatureKind::Extrude { extent: new, .. }) + | (FeatureKind::SurfaceExtrude { extent: old, .. }, FeatureKind::SurfaceExtrude { extent: new, .. }) = (&f.kind, &mut nf.kind) && old.direction != solidcraft_doc::Direction::Symmetric && new.direction == solidcraft_doc::Direction::Symmetric && set.get("extent").and_then(|e| e.get("convention")).is_none() { - new.convention = solidcraft_doc::ExtrudeConvention::TotalDistance; + new.convention = super::features::default_extrude_convention(s, maker); } if std::mem::discriminant(&nf.kind) != std::mem::discriminant(&f.kind) { return Err(bad(cmd, "the feature type cannot change")); @@ -1410,10 +1414,10 @@ fn redefine(s: &mut Session, p: &Value) -> Result { && matches!(cid, "solid.extrude" | "surface.extrude") && let Some(parameters) = params.as_object_mut() { - let convention = if cid == "surface.extrude" || extent.direction == solidcraft_doc::Direction::Symmetric { + let convention = if extent.direction == solidcraft_doc::Direction::Symmetric { extent.convention } else { - solidcraft_doc::ExtrudeConvention::TotalDistance + super::features::default_extrude_convention(s, cid) }; parameters.entry("convention").or_insert_with(|| json!(convention)); } diff --git a/crates/engine/src/cmd/extrude_convention_tests.rs b/crates/engine/src/cmd/extrude_convention_tests.rs index 09d2a223e..8dd40a9ea 100644 --- a/crates/engine/src/cmd/extrude_convention_tests.rs +++ b/crates/engine/src/cmd/extrude_convention_tests.rs @@ -123,23 +123,102 @@ fn symmetric_extrude_thin_wall_uses_total_distance_and_to_object_remains_one_sid check(&fixture(json!({"to":[0,0,10]})), 0.0, 10.0); } +/// The z range of surface body `name`. +fn sheet_z(s: &Session, name: &str) -> (f64, f64) { + assert!(s.model.results.iter().all(|r| r.error.is_none())); + let st = s.model.state(); + let bounds = st.body(name).unwrap().mesh().bounds(); + (bounds.min.z, bounds.max.z) +} + +fn assert_z(s: &Session, name: &str, lo: f64, hi: f64) { + let (z0, z1) = sheet_z(s, name); + assert!((z0 - lo).abs() < 1e-7 && (z1 - hi).abs() < 1e-7, "{name}: {z0}..{z1}, want {lo}..{hi}"); +} + +/// A symmetric surface extrude reads its distance as a solid one does: the total, split evenly +/// around the start plane, through a redefine and a save. #[test] -fn surface_extrude_shared_extent_retains_its_existing_per_side_semantics() { +fn surface_extrude_symmetric_distance_is_the_total_like_solid_extrude() { let mut s = fixture(json!({})); run(&mut s, "surface.extrude", json!({"sketch":"Square","distance":"10 mm","direction":"symmetric","name":"Sheet","body_name":"Sheet"})); - let check_sheet = |s: &Session| { - let st = s.model.state(); - let bounds = st.body("Sheet").unwrap().mesh().bounds(); - assert!((bounds.min.z + 10.0).abs() < 1e-7 && (bounds.max.z - 10.0).abs() < 1e-7); - }; - check_sheet(&s); + assert_z(&s, "Sheet", -5.0, 5.0); + let FeatureKind::SurfaceExtrude { extent, .. } = &s.doc.find_feature("Sheet").unwrap().kind else { panic!("surface extrude") }; + assert_eq!(extent.convention, ExtrudeConvention::TotalDistance); run( &mut s, "timeline.redefine", json!({"feature":"Sheet","command":"surface.extrude","params":{"sketch":"Square","distance":"10 mm","direction":"symmetric","body_name":"Sheet"}}), ); - check_sheet(&s); - check_sheet(&Session::new(Document::from_json(&s.doc.to_json()).unwrap())); + assert_z(&s, "Sheet", -5.0, 5.0); + assert_z(&Session::new(Document::from_json(&s.doc.to_json()).unwrap()), "Sheet", -5.0, 5.0); + // A one-sided surface extrude made symmetric splits its distance too, as a solid one does. + run(&mut s, "surface.extrude", json!({"sketch":"Square","distance":"10 mm","convention":"legacy_per_side","name":"Wall","body_name":"Wall"})); + assert_z(&s, "Wall", 0.0, 10.0); + run(&mut s, "timeline.edit", json!({"feature":"Wall","set":{"extent":{"direction":"symmetric"}}})); + assert_z(&s, "Wall", -5.0, 5.0); +} + +/// Surface extrudes saved before they matched solid ones stored `legacy_per_side` (or, older +/// still, no marker): they rebuild the distance on each side, and keep it through edits. +#[test] +fn older_symmetric_surface_extrudes_keep_the_distance_on_each_side() { + let mut s = fixture(json!({})); + run( + &mut s, + "surface.extrude", + json!({"sketch":"Square","distance":"10 mm","direction":"symmetric","convention":"legacy_per_side","name":"Sheet","body_name":"Sheet"}), + ); + assert_z(&s, "Sheet", -10.0, 10.0); + let marked: Value = serde_json::from_str(&s.doc.to_json()).unwrap(); + let mut unmarked = marked.clone(); + unmarked["format"] = json!("solidcraft/21"); + unmarked.as_object_mut().unwrap().remove("format_pending"); + for f in unmarked["features"].as_array_mut().unwrap() { + if let Some(extent) = f.get_mut("extent").and_then(Value::as_object_mut) { + extent.remove("convention"); + } + } + for saved in [marked, unmarked] { + let mut s = Session::new(Document::from_json(&saved.to_string()).unwrap()); + assert_z(&s, "Sheet", -10.0, 10.0); + run(&mut s, "timeline.edit", json!({"feature":"Sheet","set":{"extent":{"distance":"12 mm"}}})); + assert_z(&s, "Sheet", -12.0, 12.0); + run( + &mut s, + "timeline.redefine", + json!({"feature":"Sheet","command":"surface.extrude","params":{"sketch":"Square","distance":"10 mm","direction":"symmetric","body_name":"Sheet"}}), + ); + assert_z(&s, "Sheet", -10.0, 10.0); + } +} + +/// The preference brings back the per-side reading for new surface extrudes only: solid +/// extrudes and an explicit `convention` are unchanged by it. +#[test] +fn the_per_side_preference_keeps_the_older_surface_extrude_reading() { + let mut s = fixture(json!({})); + s.surface_extrude_symmetric_per_side = true; + run(&mut s, "surface.extrude", json!({"sketch":"Square","distance":"10 mm","direction":"symmetric","name":"Sheet","body_name":"Sheet"})); + assert_z(&s, "Sheet", -10.0, 10.0); + let FeatureKind::SurfaceExtrude { extent, .. } = &s.doc.find_feature("Sheet").unwrap().kind else { panic!("surface extrude") }; + assert_eq!(extent.convention, ExtrudeConvention::LegacyPerSide); + run( + &mut s, + "surface.extrude", + json!({"sketch":"Square","distance":"10 mm","direction":"symmetric","convention":"total_distance","name":"Total","body_name":"Total"}), + ); + assert_z(&s, "Total", -5.0, 5.0); + run(&mut s, "solid.extrude", json!({"sketch":"Square","distance":"10 mm","direction":"symmetric","operation":"new","body_name":"Solid"})); + assert_z(&s, "Solid", -5.0, 5.0); + // The saved marker, not the preference, decides on reopening. + s.surface_extrude_symmetric_per_side = false; + let reopened = Session::new(Document::from_json(&s.doc.to_json()).unwrap()); + assert_z(&reopened, "Sheet", -10.0, 10.0); + // A design opened or started keeps the user's choice. + s.surface_extrude_symmetric_per_side = true; + s.replace_design(Session::default()); + assert!(s.surface_extrude_symmetric_per_side); } /// A second distance goes the other way from the first side (#2700): along the normal when the diff --git a/crates/engine/src/cmd/features.rs b/crates/engine/src/cmd/features.rs index 816143638..398cc0455 100644 --- a/crates/engine/src/cmd/features.rs +++ b/crates/engine/src/cmd/features.rs @@ -25,7 +25,7 @@ pub static COMMANDS: &[CommandSpec] = &[ .key("E") .contract(&EXTRUDE_CONTRACT) .output(output_schema_for::) - .params("distance: expr (or through_all: true); taper?: angle expr (positive: outward, so the far end is larger along the extrusion direction; negative: inward, so the far end is smaller); corner?: preserve_curvature|tangent|round (how a taper closes a sharp corner its offset opens: each wall continues as itself, a line's plane or an arc's cone, until it meets its neighbour; each continues straight along its end tangent; or an arc about the corner. Without it, each profile preserves curvature where every curve is a line or an arc and takes tangent where another curve has a corner, and the feature's warning says so; a corner rule given is kept, and refused where the kernel cannot build it); sketch?: id|name (default: active or last sketch); profiles?: all | [index] | [{curves: [ids]}] (the profile whose outer loop is made of exactly these curves, or pieces of them; found again on every recompute, so it follows parameter changes; islands inside are its holes; an error when no profile or several match) | [{point:[x,y]}] (index and point picks are stored by their curves when that finds the same profile; a pick on a drawn profile that reference geometry, such as the projected outline of the face the sketch is on, cuts into regions takes the whole drawn profile); exact_regions?: bool (each index or point pick is exactly the region it names, as the dialogs send); default: every drawn profile, except that a loop inside another is its hole and a loop inside that hole is material again; face?: [x,y,z] (extrude a planar body face instead of a sketch profile); faces?: [[x,y,z],…] (coplanar faces of one body); face_body?: name (whose face, where faces of several bodies meet at the point); direction?: positive|negative|symmetric (distance is total thickness, split evenly around the start plane); convention?: total_distance|legacy_per_side (default total_distance; legacy preserves older symmetric extents); distance2?: expr (Two Sides: a second distance the other way from the first side, which may be through_all or to; with direction: negative the first side goes against the normal and distance2 along it); start_offset?: expr (along the sketch normal, also with direction: negative); to?: [x,y,z] (To Object: a face, vertex or point; to_offset?: expr past it); from?: [x,y,z] (From Object: start at that face or point); operation?: new|join|cut|intersect|auto (cut into a body, otherwise join existing solids; new in an empty component); touching?: separate|one_body (what a join makes of pieces that share no face: separate, the default, makes each piece that touches another only along an edge or at a point a body of its own and keeps pieces that touch nothing in one body; one_body keeps every piece in one body); targets?: [body] (Join from a face, or from a sketch on a body's face, defaults to that face's body; explicit targets or participants override); name?; body_name?; thin?: true (Thin: a wall along sketch curves instead of the profiles) with curves?: [curve ids] (open chains and closed loops, joined where they meet end to end; default: every drawn curve of the sketch), thickness: expr, side?: center|inside|outside|two_sides (a closed loop's inside is the area it encloses, an open chain's the side it bends toward, a straight line's the left of its first curve as drawn; default center), thickness2?: expr (two_sides: the thickness outside); corners are mitred, crossing walls are one"), + .params("distance: expr (or through_all: true); taper?: angle expr (positive: outward, so the far end is larger along the extrusion direction; negative: inward, so the far end is smaller); corner?: preserve_curvature|tangent|round (how a taper closes a sharp corner its offset opens: each wall continues as itself, a line's plane or an arc's cone, until it meets its neighbour; each continues straight along its end tangent; or an arc about the corner. Without it, each profile preserves curvature where every curve is a line or an arc and takes tangent where another curve has a corner, and the feature's warning says so; a corner rule given is kept, and refused where the kernel cannot build it); sketch?: id|name (default: active or last sketch); profiles?: all | [index] | [{curves: [ids]}] (the profile whose outer loop is made of exactly these curves, or pieces of them; found again on every recompute, so it follows parameter changes; islands inside are its holes; an error when no profile or several match) | [{point:[x,y]}] (index and point picks are stored by their curves when that finds the same profile; a pick on a drawn profile that reference geometry, such as the projected outline of the face the sketch is on, cuts into regions takes the whole drawn profile); exact_regions?: bool (each index or point pick is exactly the region it names, as the dialogs send); default: every drawn profile, except that a loop inside another is its hole and a loop inside that hole is material again; face?: [x,y,z] (extrude a planar body face instead of a sketch profile); faces?: [[x,y,z],…] (coplanar faces of one body); face_body?: name (whose face, where faces of several bodies meet at the point); direction?: positive|negative|symmetric (distance is total thickness, split evenly around the start plane); convention?: total_distance|legacy_per_side (how a symmetric distance is read; default total_distance, split evenly around the start plane; legacy_per_side: the distance on each side, as older symmetric extrudes keep); distance2?: expr (Two Sides: a second distance the other way from the first side, which may be through_all or to; with direction: negative the first side goes against the normal and distance2 along it); start_offset?: expr (along the sketch normal, also with direction: negative); to?: [x,y,z] (To Object: a face, vertex or point; to_offset?: expr past it); from?: [x,y,z] (From Object: start at that face or point); operation?: new|join|cut|intersect|auto (cut into a body, otherwise join existing solids; new in an empty component); touching?: separate|one_body (what a join makes of pieces that share no face: separate, the default, makes each piece that touches another only along an edge or at a point a body of its own and keeps pieces that touch nothing in one body; one_body keeps every piece in one body); targets?: [body] (Join from a face, or from a sketch on a body's face, defaults to that face's body; explicit targets or participants override); name?; body_name?; thin?: true (Thin: a wall along sketch curves instead of the profiles) with curves?: [curve ids] (open chains and closed loops, joined where they meet end to end; default: every drawn curve of the sketch), thickness: expr, side?: center|inside|outside|two_sides (a closed loop's inside is the area it encloses, an open chain's the side it bends toward, a straight line's the left of its first curve as drawn; default center), thickness2?: expr (two_sides: the thickness outside); corners are mitred, crossing walls are one"), CommandSpec::new("solid.revolve", "Revolve", revolve) .at("SOLID", "CREATE") .icon("revolve") @@ -1120,6 +1120,18 @@ fn thin_regions(s: &Session, ss: &solidcraft_doc::SolvedSketch, thin: &ThinWall) solidcraft_sketch::thin_wall_regions(&curves, inside, outside).map_err(|e| format!("thin wall: {e}")) } +/// How a new extent of `cmd` (`solid.extrude` or `surface.extrude`) reads a symmetric distance +/// when the call doesn't say: the total, split evenly around the start plane, for both. A surface +/// extrude reads it on each side, as surface extrudes did before, while the user's preference +/// says so ([`Session::surface_extrude_symmetric_per_side`]). +pub(crate) fn default_extrude_convention(s: &Session, cmd: &str) -> solidcraft_doc::ExtrudeConvention { + if cmd == "surface.extrude" && s.surface_extrude_symmetric_per_side { + solidcraft_doc::ExtrudeConvention::LegacyPerSide + } else { + solidcraft_doc::ExtrudeConvention::TotalDistance + } +} + /// An extrude's extent from its parameters: distance (or through all, or to an object), the /// side(s), a second distance, a start offset, a taper, and from an object. pub(super) fn extent_param(s: &Session, p: &Value, cmd: &str) -> Result { @@ -1156,9 +1168,7 @@ pub(super) fn extent_param(s: &Session, p: &Value, cmd: &str) -> Result check_expr(s, d, Kind::Length, cmd, "start_offset")?; } let convention = match p.get("convention") { - // Surface Extrude shares Extent but retains its existing per-side distance semantics. - None if cmd == "surface.extrude" => solidcraft_doc::ExtrudeConvention::LegacyPerSide, - None => solidcraft_doc::ExtrudeConvention::TotalDistance, + None => default_extrude_convention(s, cmd), Some(value) => serde_json::from_value(value.clone()).map_err(|_| bad(cmd, "`convention` must be total_distance or legacy_per_side"))?, }; Ok(Extent { diff --git a/crates/engine/src/cmd/surface.rs b/crates/engine/src/cmd/surface.rs index dc1d320e0..d9b617042 100644 --- a/crates/engine/src/cmd/surface.rs +++ b/crates/engine/src/cmd/surface.rs @@ -39,7 +39,7 @@ pub static COMMANDS: &[CommandSpec] = &[ CommandSpec::new("surface.extrude", "Surface Extrude", surface_extrude) .at("SURFACE", "CREATE") .icon("surface_extrude") - .params("sketch?: id|name; curves?: [curve ids] (open or closed chains of curves meeting end to end) and/or profiles? (their boundaries; the default when no curves are given); distance: expr; direction?: positive|negative|symmetric; distance2?: expr; start_offset?: expr; name?, body_name? (a surface body: walls only, no caps)"), + .params("sketch?: id|name; curves?: [curve ids] (open or closed chains of curves meeting end to end) and/or profiles? (their boundaries; the default when no curves are given); distance: expr; direction?: positive|negative|symmetric (symmetric: distance is the total, split evenly around the start plane, as solid.extrude); convention?: total_distance|legacy_per_side (as solid.extrude; default total_distance, or legacy_per_side, the distance on each side, under the user's preference for the older reading); distance2?: expr; start_offset?: expr; name?, body_name? (a surface body: walls only, no caps)"), CommandSpec::new("surface.revolve", "Surface Revolve", surface_revolve) .at("SURFACE", "CREATE") .icon("surface_revolve") @@ -797,7 +797,8 @@ mod tests { // The line's wall and the half circle's (radius 5): length × height. let want = (10.0 + std::f64::consts::PI * 5.0) * 4.0; assert!((area(&s, "Wall") - want).abs() < want * 1e-3, "{} vs {want}", area(&s, "Wall")); - run(&mut s, "surface.extrude", json!({"sketch": "S", "curves": ["l1"], "distance": 2, "direction": "symmetric", "body_name": "Both"})); + // Symmetric: the distance is the total, split evenly around the sketch plane. + run(&mut s, "surface.extrude", json!({"sketch": "S", "curves": ["l1"], "distance": 4, "direction": "symmetric", "body_name": "Both"})); let bb = solidcraft_kernel::measure(&s.world_state().unwrap().body("Both").unwrap().body).unwrap().bbox; assert!((bb.min.z + 2.0).abs() < 1e-9 && (bb.max.z - 2.0).abs() < 1e-9, "{bb:?}"); run(&mut s, "edit.undo", json!({})); diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rs index 3a45a9abc..7b93a7426 100644 --- a/crates/engine/src/lib.rs +++ b/crates/engine/src/lib.rs @@ -380,6 +380,10 @@ pub struct Session { /// A new metric tapped hole given no `diameter` drills the major diameter less the pitch, /// as before the tap maker's drills (a user preference); false: the tap maker's drill. pub metric_tap_drill_major_less_pitch: bool, + /// A new symmetric surface extrude given no `convention` reads its distance on each side, as + /// surface extrudes did before they matched solid ones (a user preference); false: the total, + /// split evenly around the start plane, as a solid extrude reads it. + pub surface_extrude_symmetric_per_side: bool, /// How calls that break a command's parameter contract are treated (off by default). It /// belongs to the session, not the design, so it survives opening and starting designs. pub param_check: schema::ParamCheck, @@ -600,6 +604,7 @@ impl Session { followed: None, auto_project: true, metric_tap_drill_major_less_pitch: false, + surface_extrude_symmetric_per_side: false, param_check: schema::ParamCheck::Off, easyprint_upload: None, live_links: None, @@ -647,6 +652,7 @@ impl Session { pub fn replace_design(&mut self, fresh: Session) { let auto_project = self.auto_project; let metric_tap_drill_major_less_pitch = self.metric_tap_drill_major_less_pitch; + let surface_extrude_symmetric_per_side = self.surface_extrude_symmetric_per_side; let param_check = self.param_check; let easyprint_upload = self.easyprint_upload.take(); let render_viewport = self.render_viewport.clone(); @@ -663,6 +669,7 @@ impl Session { self.command_check = command_check; self.auto_project = auto_project; self.metric_tap_drill_major_less_pitch = metric_tap_drill_major_less_pitch; + self.surface_extrude_symmetric_per_side = surface_extrude_symmetric_per_side; self.param_check = param_check; self.easyprint_upload = easyprint_upload; self.render_viewport = render_viewport; @@ -1406,6 +1413,7 @@ impl Session { followed: None, auto_project: self.auto_project, metric_tap_drill_major_less_pitch: self.metric_tap_drill_major_less_pitch, + surface_extrude_symmetric_per_side: self.surface_extrude_symmetric_per_side, param_check: self.param_check, easyprint_upload: self.easyprint_upload.clone(), live_links: None, diff --git a/tests/kernel-cases/booleans/3830-split-cup-by-extended-spline-surface/recipe.json b/tests/kernel-cases/booleans/3830-split-cup-by-extended-spline-surface/recipe.json index 3049ad63f..0952745c8 100644 --- a/tests/kernel-cases/booleans/3830-split-cup-by-extended-spline-surface/recipe.json +++ b/tests/kernel-cases/booleans/3830-split-cup-by-extended-spline-surface/recipe.json @@ -105,6 +105,7 @@ ], "distance": 30, "direction": "symmetric", + "convention": "legacy_per_side", "body_name": "Body2" } }, From de5c338e783b653598b6ee76b2cf6dd0f26545a7 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:50:34 -0400 Subject: [PATCH 009/108] Preferences: keep the older per-side reading of a symmetric surface extrude Design defaults gains a Surfaces section with one setting, surface_extrude_symmetric_per_side (off by default). When it is on, new symmetric surface extrudes go their distance each way, as they did before they matched solid extrudes. The app hands it to the session before every command and each frame, and it stays with the user across tabs and new designs, like the metric tap drill rule. The Surface Extrude dialog now sends a feature's stored convention only when the feature is already symmetric, so a one-sided one switched to Symmetric takes the new reading, as in the solid Extrude dialog. Labels in en, ar, he, ja, zh, de and ko. Co-Authored-By: Claude Opus 5.5 --- .../surface-extrude-symmetric-total.json | 30 ++++++++++++++++ crates/ui-egui/src/dialogs_surface.rs | 6 +++- crates/ui-egui/src/documents.rs | 1 + crates/ui-egui/src/lib.rs | 4 ++- crates/ui-egui/src/prefs.rs | 36 ++++++++++++++++++- crates/ui-egui/src/prefs/design.rs | 4 +++ 6 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 assets/locales/pending/surface-extrude-symmetric-total.json diff --git a/assets/locales/pending/surface-extrude-symmetric-total.json b/assets/locales/pending/surface-extrude-symmetric-total.json new file mode 100644 index 000000000..4d6c40391 --- /dev/null +++ b/assets/locales/pending/surface-extrude-symmetric-total.json @@ -0,0 +1,30 @@ +{ + "en": { + "prefs.surface_extrude_symmetric_per_side": "Symmetric surface extrudes go the distance each way (10 mm: 20 mm in all), as before, not the total like solid extrudes", + "prefs.surfaces": "Surfaces" + }, + "ar": { + "prefs.surface_extrude_symmetric_per_side": "يمتد بثق السطح المتماثل بالمسافة في كل جانب كما كان من قبل (10 مم: 20 مم إجمالًا)، لا بالمسافة الكلية كبثق المجسم", + "prefs.surfaces": "الأسطح" + }, + "he": { + "prefs.surface_extrude_symmetric_per_side": "שליפת משטח סימטרית נשלפת את המרחק לכל צד כמו קודם (10 מ\"מ: 20 מ\"מ בסך הכול), ולא את המרחק הכולל כמו שליפת גוף", + "prefs.surfaces": "משטחים" + }, + "ja": { + "prefs.surface_extrude_symmetric_per_side": "対称のサーフェス押し出しを、ソリッドの押し出しのような合計ではなく、以前のように両側にそれぞれその距離だけ押し出す(10 mm: 合計 20 mm)", + "prefs.surfaces": "サーフェス" + }, + "zh": { + "prefs.surface_extrude_symmetric_per_side": "对称曲面拉伸像以前一样向两侧各拉伸该距离(10 mm:共 20 mm),而非像实体拉伸那样取总距离", + "prefs.surfaces": "曲面" + }, + "de": { + "prefs.surface_extrude_symmetric_per_side": "Symmetrische Flächen-Extrusionen wie bisher um den Abstand nach jeder Seite (10 mm: insgesamt 20 mm), nicht um die Gesamtlänge wie Volumen-Extrusionen", + "prefs.surfaces": "Flächen" + }, + "ko": { + "prefs.surface_extrude_symmetric_per_side": "대칭 서피스 돌출을 솔리드 돌출처럼 전체 거리가 아니라 이전처럼 양쪽으로 각각 그 거리만큼 돌출 (10 mm: 총 20 mm)", + "prefs.surfaces": "서피스" + } +} diff --git a/crates/ui-egui/src/dialogs_surface.rs b/crates/ui-egui/src/dialogs_surface.rs index b5678aa22..23066271e 100644 --- a/crates/ui-egui/src/dialogs_surface.rs +++ b/crates/ui-egui/src/dialogs_surface.rs @@ -937,8 +937,12 @@ pub fn for_feature(app: &SolveApp, kind: &FeatureKind, frame: &Mat) -> Option<(K if let Some(input) = ins.first_mut() { input.items = sels; } + // A symmetric extrude keeps the reading it was made with; a one-sided one made + // symmetric here takes a new one's (timeline.redefine fills it in either way). let mut extra = Map::new(); - extra.insert("convention".into(), json!(extent.convention)); + if extent.direction == Direction::Symmetric { + extra.insert("convention".into(), json!(extent.convention)); + } return Some((Kind::Surface(k), ins, extra)); } FeatureKind::Patch { sketch, edges, crown, continuity, points, .. } => { diff --git a/crates/ui-egui/src/documents.rs b/crates/ui-egui/src/documents.rs index 0c0296aa4..8e859fb55 100644 --- a/crates/ui-egui/src/documents.rs +++ b/crates/ui-egui/src/documents.rs @@ -159,6 +159,7 @@ fn swap_in(app: &mut SolveApp, mut slot: DocSlot) -> DocSlot { // Preferences the session holds go with the user, not the tab (#680). app.session.auto_project = out.session.auto_project; app.session.metric_tap_drill_major_less_pitch = out.session.metric_tap_drill_major_less_pitch; + app.session.surface_extrude_symmetric_per_side = out.session.surface_extrude_symmetric_per_side; // So does the host's pre-command check: every tab is held to it. app.session.set_command_check(out.session.command_check()); // Views cache by revision: the incoming design must not look unchanged. diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index b6dd8b45c..8b0819186 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -978,8 +978,10 @@ impl SolveApp { if matches!(id, "file.save_mesh" | "file.send_to_slicer") { solidcraft_engine::slicers::set_chosen_programs(&self.preferences.custom_slicers); } - // The preference the hole command reads, current even before the next frame applies it. + // The preferences the hole and surface extrude commands read, current even before the + // next frame applies them. self.session.metric_tap_drill_major_less_pitch = self.preferences.metric_tap_drill_major_less_pitch; + self.session.surface_extrude_symmetric_per_side = self.preferences.surface_extrude_symmetric_per_side; let t0 = now_ms(); let r = self.session.execute(id, ¶ms).map_err(|e| e.to_string()); self.big_operation |= now_ms() - t0 >= recovery_ui::BIG_OPERATION_MS; diff --git a/crates/ui-egui/src/prefs.rs b/crates/ui-egui/src/prefs.rs index 2ab6b458e..21286834f 100644 --- a/crates/ui-egui/src/prefs.rs +++ b/crates/ui-egui/src/prefs.rs @@ -637,6 +637,10 @@ preference_settings! { /// the tap maker's drills; off by default: the tap maker's drill (M8: 6.8 mm). Saved designs /// keep the drill they stored either way. metric_tap_drill_major_less_pitch: bool = false, PAGE_DESIGN => check_id("prefs.metric_tap_drill_major_less_pitch"); + /// New symmetric surface extrudes go their distance each way, as before they matched solid + /// extrudes; off by default: the distance is the total, split evenly around the start plane. + /// Saved designs keep the reading they stored either way. + surface_extrude_symmetric_per_side: bool = false, PAGE_DESIGN => check_id("prefs.surface_extrude_symmetric_per_side"); /// Reopen the saved designs that were open when the app was last closed (#5542). reopen_designs: bool = true, PAGE_GENERAL; /// Those designs' files, in tab order, as the last quit left them. @@ -1122,8 +1126,10 @@ fn defaults(app: &mut SolveApp, page: usize) { /// the interface scale. pub fn apply(app: &mut SolveApp, ctx: &egui::Context) { apply_network(&app.preferences); - // The hole command reads the metric tapped drill rule from the session. + // The hole command reads the metric tapped drill rule from the session, Surface Extrude its + // symmetric reading. app.session.metric_tap_drill_major_less_pitch = app.preferences.metric_tap_drill_major_less_pitch; + app.session.surface_extrude_symmetric_per_side = app.preferences.surface_extrude_symmetric_per_side; // The profiler records while the preference is on (switched when it changes; at start-up only // when on, so SOLIDCRAFT_PROFILE=1 is not undone by the default). let profile = app.preferences.profile_operations; @@ -2484,6 +2490,34 @@ mod tests { assert!(h.app.session.metric_tap_drill_major_less_pitch); } + /// New symmetric surface extrudes read their distance as the total, as solid extrudes do; the + /// preference brings back the distance on each side they took before. It reaches the command + /// whether set through the control channel or the Preferences page, and survives a new design. + #[test] + fn the_surface_extrude_preference_keeps_the_distance_on_each_side() { + use serde_json::json; + let height = |h: &mut crate::scenario::Harness, name: &str| { + h.app.run("sketch.create", json!({"plane":"XY"})).unwrap(); + h.app.run("sketch.rectangle.two_point", json!({"p0":[0,0],"p1":[10,10]})).unwrap(); + h.app.run("sketch.finish", json!({})).unwrap(); + h.app.run("surface.extrude", json!({"distance":"10 mm","direction":"symmetric","body_name":name})).unwrap(); + let st = h.app.session.world_state().unwrap(); + let b = st.body(name).unwrap().mesh().bounds(); + b.max.z - b.min.z + }; + let mut h = crate::scenario::Harness::new(); + h.frames(1); + assert!(!h.app.preferences.surface_extrude_symmetric_per_side, "off by default"); + assert!((height(&mut h, "Total") - 10.0).abs() < 1e-7); + let mut h = crate::scenario::Harness::new(); + h.call("ui.prefs", json!({"surface_extrude_symmetric_per_side": true})); + h.frames(2); + assert!(h.app.session.surface_extrude_symmetric_per_side); + assert!((height(&mut h, "Each") - 20.0).abs() < 1e-7); + h.app.run("file.new", json!({})).unwrap(); + assert!(h.app.session.surface_extrude_symmetric_per_side); + } + #[test] fn the_ghost_position_defaults_round_trips_and_reads_tolerantly() { use super::SpaceMouseGhost::{LeftViewport as Current, LeftWindow as Left, RightViewport as Right}; diff --git a/crates/ui-egui/src/prefs/design.rs b/crates/ui-egui/src/prefs/design.rs index 07d8843c4..5b7b902c9 100644 --- a/crates/ui-egui/src/prefs/design.rs +++ b/crates/ui-egui/src/prefs/design.rs @@ -40,6 +40,10 @@ pub(super) fn show(app: &mut SolveApp, ui: &mut egui::Ui) { let check = setting::metric_tap_drill_major_less_pitch(app, ui); crate::scenario::publish_handle("prefs:metric_tap_drill_major_less_pitch", check.rect.center()); }); + ui_kit::settings_section(ui, "surfaces", app.tr("prefs.surfaces"), |ui| { + let check = setting::surface_extrude_symmetric_per_side(app, ui); + crate::scenario::publish_handle("prefs:surface_extrude_symmetric_per_side", check.rect.center()); + }); ui_kit::settings_section(ui, "orientation", app.tr("prefs.orientation"), |ui| { ui.horizontal_wrapped(|ui| { for (id, label, y_up) in [("z", "Z up", false), ("y", "Y up", true)] { From ac70662d636578781380decaa1bcb4f8955cf36a Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 00:34:55 -0400 Subject: [PATCH 010/108] Sweeps: a path through a drawn 3D arc follows the arc, not a spline through its three points MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit path_points took any wire with three or more fit points as a fitted spline, and a 3D arc keeps its start, through and end points as its fit: the pipe along a quarter arc of radius 20 ran along the cubic through those three points and came out 388.06 mm³, not π·2²·10π = 394.78. A wire with its exact arc (Wire::arc) now goes to the kernel as that circle, from its start counter-clockwise about its normal through its sweep (kernel::curve_path of the record circle). Co-Authored-By: Claude Opus 5.5 --- crates/doc/src/eval.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crates/doc/src/eval.rs b/crates/doc/src/eval.rs index 0ea238841..289dab12a 100644 --- a/crates/doc/src/eval.rs +++ b/crates/doc/src/eval.rs @@ -5118,6 +5118,15 @@ fn path_points(ps: &SolvedSketch, ids: &[String], start: Vec3) -> Result { + let x = (arc.start - arc.center).normalized().ok_or_else(|| DocError::Invalid("a 3D arc of no radius".into()))?; + let y = arc.normal.cross(x); + let frame = solidcraft_geom::brep::Frame { origin: arc.center.into(), x_axis: x.into(), y_axis: y.into() }; + let circle = solidcraft_geom::brep::Curve::Circle { frame, radius: arc.radius }; + kernel::PathPiece::Segs(kernel::curve_path(&circle, [0.0, solidcraft_sketch::arc_sweep(arc)])?) + } Some(w) if w.fit.len() >= 3 => kernel::PathPiece::Spline { fit: w.fit.clone(), reversed: false }, Some(w) if !w.exact.is_empty() => { let mut segs = Vec::new(); From 7664925fbfb6ed004f999c8dda399c0d1b504087 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 00:46:51 -0400 Subject: [PATCH 011/108] Sketch: Project onto Surface keeps the side the projection meets first, in one curve MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SMLib's parallel projection (CreateParallelProjectionCurves) gives every curve where the projecting lines cross the face: a line projected down onto a ball came back as its top and its bottom, each split at the pole, and the link's first wire was half the bottom. A projection onto a surface is where those lines first hit it (owner's decision, as mainstream CAD does): a curve is now kept only when the first hit on the body's mesh along the line through its middle is the curve itself (within 4 chord tolerances), and the pieces that meet end to end are joined in whatever order and direction they come, a piece run the other way exactly (its knots and control points reversed; a line's, circle's or ellipse's parameter mirrored). The ball's top is then one wire from x = -10 to 10. three_d_sketch_curves now expects that exact curve: one wire, its ends at (±10, 0, √300), every point of its exact curves on the sphere of radius 20 in y = 0 over the top, to the projection's own tolerance (a millionth of the body's size), and sweeps_and_pipes_follow_3d_sketch_curves pipes along the whole joined top. Both pass on the pinned SMLib (90aabff): the pieces lie 9.1e-6 off the sphere against a 4e-5 tolerance and meet at the pole within 4.7e-8 rad, since the fork's 8d95600 keeps the pole's exact tangent in StepBackFromSingularity. Co-Authored-By: Claude Opus 5.5 --- crates/doc/src/project.rs | 118 +++++++++++++++--- crates/engine/src/cmd/sketch_project_tests.rs | 22 +++- 2 files changed, 122 insertions(+), 18 deletions(-) diff --git a/crates/doc/src/project.rs b/crates/doc/src/project.rs index 37a5dff11..a50ff5622 100644 --- a/crates/doc/src/project.rs +++ b/crates/doc/src/project.rs @@ -366,8 +366,9 @@ fn edge_curves(body: Option<&crate::ModelBody>, e: usize) -> Vec { } /// The sketch segments `segs` of `ss` projected along the sketch normal `normal` (turned toward -/// the face) onto the face of `target` at `at`: SMLib's projection, the pieces that meet end to -/// end joined into one wire each, every wire its points (for display) and its exact curves. +/// the face) onto the face of `target` at `at`: SMLib's projection, the side of the face the +/// projection meets first ([`first_hits`]), the pieces that meet end to end joined into one wire +/// each, every wire its points (for display) and its exact curves. fn projected_wires( target: &crate::ModelBody, at: Vec3, @@ -378,30 +379,119 @@ fn projected_wires( ) -> Result<(Vec>, Vec>)> { let from = segs.first().map(|s| ss.plane.to_world(s.start())).unwrap_or(at); let toward = if (at - from).dot(normal) < 0.0 { normal * -1.0 } else { normal }; - joined_wires(crate::kernel::project_onto_face(&target.body, at, &ss.plane, segs, toward)?, size * 1e-6) + let curves = crate::kernel::project_onto_face(&target.body, at, &ss.plane, segs, toward)?; + joined_wires(first_hits(target, curves, toward)?, size * 1e-6) } -/// Record curves as wires: curves that meet end to end (within `tol`) one wire, each wire its -/// points (for display) and its exact curves. +/// Of the curves a parallel projection along `toward` made on a face of `target`, the ones the +/// projection meets first: SMLib gives every curve where the projecting lines cross the face +/// (both sides of a sphere), and a projection onto a surface is where they first hit it. A curve +/// is kept when the first hit along the line through its middle, on the body's mesh, is the +/// curve itself (within the mesh's chord tolerance, a few times over), not a point of the body +/// in front of it. +fn first_hits( + target: &crate::ModelBody, + curves: Vec<(solidcraft_geom::brep::Curve, [f64; 2])>, + toward: Vec3, +) -> Result> { + let Some(dir) = toward.normalized() else { return Ok(curves) }; + let mesh = target.mesh(); + let reach = 2.0 * mesh.bounds().diagonal().max(1e-9); + let slack = 4.0 * target.display_tol(); + let mut kept = Vec::with_capacity(curves.len()); + for (curve, interval) in curves { + let eval = solidcraft_geom::brep::eval::CurveEval::new(&curve).map_err(|e| DocError::Invalid(format!("projected curve: {e}")))?; + let mid = eval.point(0.5 * (interval[0] + interval[1])).ok_or_else(|| DocError::Invalid("projected curve: no middle point".into()))?; + let origin = mid - dir * reach; + let front = mesh.raycast(origin, dir).is_some_and(|(t, _)| t < reach - slack); + if !front { + kept.push((curve, interval)); + } + } + Ok(kept) +} + +/// Record curves as wires: curves that meet end to end (within `tol`) one wire, in any order and +/// direction they come (a projection split at a sphere's pole into two pieces that both end there +/// joins again there, the second run the other way), each wire its points (for display) and its +/// exact curves. fn joined_wires(curves: Vec<(solidcraft_geom::brep::Curve, [f64; 2])>, tol: f64) -> Result<(Vec>, Vec>)> { let (mut wires, mut exact): (Vec>, Vec>) = (Vec::new(), Vec::new()); for (curve, interval) in curves { let pts = crate::kernel::PathPiece::Segs(crate::kernel::curve_path(&curve, interval)?).points(); - let Some(start) = pts.first().copied() else { continue }; - match (wires.last_mut(), exact.last_mut()) { - (Some(w), Some(e)) if w.last().is_some_and(|end| end.dist(start) <= tol) => { - w.extend(pts.into_iter().skip(1)); - e.push(WireCurve { curve, interval }); - } - _ => { - wires.push(pts); - exact.push(vec![WireCurve { curve, interval }]); + if pts.is_empty() { + continue; + } + wires.push(pts); + exact.push(vec![WireCurve { curve, interval }]); + } + // Join a wire onto the one that ends where it starts (or ends, turned round), until no two + // meet: each join removes a wire. + 'join: loop { + for i in 0..wires.len() { + for j in 0..wires.len() { + let (Some(a), Some(b)) = (wires.get(i), wires.get(j)) else { continue }; + let (Some(end), Some(start), Some(last)) = (a.last(), b.first(), b.last()) else { continue }; + let turned = if i == j { + continue; + } else if end.dist(*start) <= tol { + false + } else if end.dist(*last) <= tol && exact.get(j).is_some_and(|e| e.iter().all(|c| reversed(c).is_some())) { + true + } else { + continue; + }; + let (mut w, mut e) = (wires.remove(j), exact.remove(j)); + if turned { + w.reverse(); + e = e.iter().rev().filter_map(reversed).collect(); + } + let i = if j < i { i - 1 } else { i }; + if let (Some(into), Some(curves)) = (wires.get_mut(i), exact.get_mut(i)) { + into.extend(w.into_iter().skip(1)); + curves.extend(e); + } + continue 'join; } } + break; } Ok((wires, exact)) } +/// `c` run the other way: the same points, its parameter `t` now `c0 + c1 - t` over the curve's +/// own knots (a line's `1 - t`, a circle's or ellipse's angle negated with its y axis turned). +/// Exact; `None` for a curve kind it doesn't turn. +fn reversed(c: &WireCurve) -> Option { + use solidcraft_geom::brep::{Curve, Frame}; + let [t0, t1] = c.interval; + let flip = |frame: &Frame| Frame { origin: frame.origin, x_axis: frame.x_axis, y_axis: frame.y_axis.map(|v| -v) }; + let (curve, interval) = match &c.curve { + Curve::Line { start, end } => (Curve::Line { start: *end, end: *start }, [1.0 - t1, 1.0 - t0]), + Curve::Circle { frame, radius } => (Curve::Circle { frame: flip(frame), radius: *radius }, [-t1, -t0]), + Curve::Ellipse { frame, radii } => (Curve::Ellipse { frame: flip(frame), radii: *radii }, [-t1, -t0]), + Curve::Spline { knots, points } => { + let sum = knots.first()? + knots.last()?; + ( + Curve::Spline { knots: knots.iter().rev().map(|k| sum - k).collect(), points: points.iter().rev().copied().collect() }, + [sum - t1, sum - t0], + ) + } + Curve::RationalSpline { knots, homogeneous } => { + let sum = knots.first()? + knots.last()?; + ( + Curve::RationalSpline { + knots: knots.iter().rev().map(|k| sum - k).collect(), + homogeneous: homogeneous.iter().rev().copied().collect(), + }, + [sum - t1, sum - t0], + ) + } + _ => return None, + }; + Some(WireCurve { curve, interval }) +} + /// Curve `ci` of the solved sketch `ss` as its exact pieces in space, in the order its polyline /// runs; none where a piece has no record curve. fn sketch_curves(ss: &crate::eval::SolvedSketch, ci: usize) -> Vec { diff --git a/crates/engine/src/cmd/sketch_project_tests.rs b/crates/engine/src/cmd/sketch_project_tests.rs index 7a49f87c1..6c32703a2 100644 --- a/crates/engine/src/cmd/sketch_project_tests.rs +++ b/crates/engine/src/cmd/sketch_project_tests.rs @@ -379,14 +379,28 @@ fn three_d_sketch_curves() { let src = s.doc.features.last().unwrap().id; run(&mut s, "sketch.create", json!({"plane": "XY"})); let r = run(&mut s, "sketch.project_to_surface", json!({"curves": [{"sketch": src, "curve": l}], "face": [0, 0, 20]})); + // The line's projection where it first meets the sphere: the arc of the great circle in y = 0 + // from x = -10 to 10 over the top (z = √(400 − x²)), one wire though SMLib splits it at the + // pole, and no curve on the far side. + assert_eq!(r["links"][0]["wires"].as_array().unwrap().len(), 1, "{r}"); let wid = r["links"][0]["wires"][0].as_str().unwrap().to_string(); let st = s.model.state(); let sk = &st.sketch(s.active_sketch.unwrap()).unwrap().sketch; let w = &sk.wires[sk.wire_index(&wid).unwrap()]; - assert!(w.pts.len() > 20); - for p in &w.pts { - assert!((p.len() - 20.0).abs() < 0.1, "{p:?}"); - assert!(p.z > 0.0); + assert!(!w.exact.is_empty()); + // SMLib makes projected curves to a millionth of the body's size (the sphere's 40 mm box). + let tol = 40.0 * 1e-6; + let ends = [*w.pts.first().unwrap(), *w.pts.last().unwrap()]; + let top = 300f64.sqrt(); + assert!(ends.iter().all(|e| (e.x.abs() - 10.0).abs() < tol && e.y.abs() < tol && (e.z - top).abs() < tol), "{ends:?}"); + assert!((ends[0].x + ends[1].x).abs() < tol, "{ends:?}"); + // Along its exact curves (the wire's points are its spans' polygon), on the sphere's top. + for c in &w.exact { + let eval = solidcraft_geom::brep::eval::CurveEval::new(&c.curve).unwrap(); + for k in 0..=32 { + let p = eval.point(c.interval[0] + (c.interval[1] - c.interval[0]) * f64::from(k) / 32.0).unwrap(); + assert!((p.len() - 20.0).abs() < tol && p.y.abs() < tol && p.z >= top - tol, "{p:?}"); + } } // Delete the wire. run(&mut s, "sketch.delete", json!({"entities": [wid]})); From 6c5537df6f93fbe8160070ef2ffa8a21e17f0fb0 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 09:45:12 -0400 Subject: [PATCH 012/108] Kernel ladder: a gate run fails on any case whose status or counts differ from the golden `cargo xtask kernel-cases --ladder --gate` grades every ladder case against tests/kernel-cases/ladder/golden.json and fails on a changed status or count, better or worse, or a case with no golden; times stay report-only, since they are the machine's. A right change is re-recorded with --record "why" in the same pull request. Co-Authored-By: Claude Opus 5.5 --- xtask/src/kernel_cases.rs | 2 +- xtask/src/kernel_ladder.rs | 81 ++++++++++++++++++++++++++++++++++---- xtask/src/main.rs | 7 ++-- 3 files changed, 78 insertions(+), 12 deletions(-) diff --git a/xtask/src/kernel_cases.rs b/xtask/src/kernel_cases.rs index ff9499f1f..7121ea2ed 100644 --- a/xtask/src/kernel_cases.rs +++ b/xtask/src/kernel_cases.rs @@ -276,7 +276,7 @@ fn write_report(dir: &Path, list: &[PathBuf], results: &[Value]) -> Result-/`). See [`tests/kernel-cases/README.md`](../tests/kernel-cases/README.md) for the format. The fillet cases are also a regression gate: CI's Fillet rig workflow runs them on every pull request that touches fillet code and fails on a case that fails and [`fillets/KNOWN_FAILING`](../tests/kernel-cases/fillets/KNOWN_FAILING) does not list, or a listed case that passes.\n\n", + "# Kernel regression rig\n\nGenerated by `cargo xtask kernel-cases`. Every geometry case the old kernel (truck) got wrong, as an issue, a PR or a crash report recorded it, is a use case in [`tests/kernel-cases/`](../tests/kernel-cases/) with its own right answer: numbers from analysis or a hand calculation (**analytic**) where the geometry has them, and otherwise the invariants (**invariants**): the operation succeeds, or refuses cleanly where that is the right answer; each body is one closed shell that passes the record's structure and geometry checks and SMLib's own check; the expected face, edge and vertex counts. Never a kernel's output, and never a commercial kernel's.\n\nThe cases run on SMLib, SolidCraft's kernel. A failing case stays failing until the kernel is fixed; there is no workaround on SolidCraft's side. A failed SMLib call leaves its inputs for replay in the run's output folder (`target/kernel-cases/dumps/-/`). See [`tests/kernel-cases/README.md`](../tests/kernel-cases/README.md) for the format. Every area is also a regression gate: CI's Kernel rig workflow runs them on every pull request that touches the kernel and fails on a case that fails and its area's `KNOWN_FAILING` (such as [`fillets/KNOWN_FAILING`](../tests/kernel-cases/fillets/KNOWN_FAILING)) does not list, or a listed case that passes.\n\n", ); md += "## Coverage\n\n| Area | Cases | Results |\n|---|---|---|\n"; for (area, (n, statuses)) in &areas { diff --git a/xtask/src/kernel_ladder.rs b/xtask/src/kernel_ladder.rs index 93efd826b..5e384c7a5 100644 --- a/xtask/src/kernel_ladder.rs +++ b/xtask/src/kernel_ladder.rs @@ -1,4 +1,4 @@ -//! `cargo xtask kernel-cases --ladder [--record REASON]`: the kernel complexity ladder. +//! `cargo xtask kernel-cases --ladder [--record REASON | --gate]`: the kernel complexity ladder. //! //! `tests/kernel-cases/ladder/ladder.json` lists tiers in order of complexity and, per tier, its //! cases in order (paths under `tests/kernel-cases/`, so a tier may also list rig cases from other @@ -9,6 +9,8 @@ //! not shared with other cases. `--record REASON` re-measures the golden and re-sorts each tier //! by time, fastest first; both files are committed. The run's output folder (`--out`, default //! `target/kernel-ladder`) holds `results.json` and the SMLib dumps, as the rig's does. +//! `--gate` makes the run a regression gate instead of the report: it fails on any case whose +//! status or counts differ from the golden (times aside, which are the machine's). //! //! The report, `docs/kernel-ladder.md`, gives per tier the counts per status and the robustness //! frontier: the first case, in ladder order, that fails. @@ -103,17 +105,26 @@ fn golden_entry(r: &Value) -> Value { /// What changed against the golden: a slowdown, a status change, other counts. fn flags(r: &Value, g: Option<&Value>) -> Vec { - let Some(g) = g else { return vec!["no golden".into()] }; - let mut out = Vec::new(); - if g["status"] != r["status"] { - out.push(format!("status was {}", g["status"].as_str().unwrap_or("?"))); - } - if let (Some(now), Some(then)) = (r["seconds"].as_f64(), g["seconds"].as_f64()) + let mut out = changes(r, g); + if let Some(g) = g + && let (Some(now), Some(then)) = (r["seconds"].as_f64(), g["seconds"].as_f64()) && now > then * SLOWDOWN_FACTOR && now - then > SLOWDOWN_MIN_S { out.push(format!("slower: {now:.2} s (golden {then:.2} s)")); } + out +} + +/// What changed against the golden that the machine does not explain: no golden, a status +/// change, other counts. Times are left out (they depend on the machine the golden was recorded +/// on), so these are what the gate fails on. +fn changes(r: &Value, g: Option<&Value>) -> Vec { + let Some(g) = g else { return vec!["no golden".into()] }; + let mut out = Vec::new(); + if g["status"] != r["status"] { + out.push(format!("status was {}", g["status"].as_str().unwrap_or("?"))); + } for k in ["body_count", "faces", "edges", "vertices"] { let (now, then) = (&r["measured"][k], &g["measured"][k]); if !now.is_null() && !then.is_null() && now != then { @@ -123,6 +134,35 @@ fn flags(r: &Value, g: Option<&Value>) -> Vec { out } +/// The ladder's regression gate (`--gate`): every case's status and counts are the golden's. A +/// case that changed fails it, better or worse, as does a case with no golden: the change is +/// re-recorded with its reason (`--record`) in the same pull request. +fn gate(tiers: &[Tier], results: &BTreeMap, golden: &Value) -> Result { + let mut problems = Vec::new(); + let mut pass = 0; + for c in tiers.iter().flat_map(|t| &t.cases) { + let Some(r) = results.get(c) else { + problems.push(format!("{c}: no result")); + continue; + }; + pass += usize::from(r["status"] == "pass"); + let changed = changes(r, golden["cases"].get(c)); + if !changed.is_empty() { + problems.push(format!("CHANGED ({}): {c}: {}", r["status"].as_str().unwrap_or("?"), changed.join("; "))); + } + } + let n: usize = tiers.iter().map(|t| t.cases.len()).sum(); + if problems.is_empty() { + Ok(format!("kernel ladder gate: {pass}/{n} pass, every case as the golden records it")) + } else { + Err(format!( + "kernel ladder gate: {} case(s) differ from tests/kernel-cases/ladder/golden.json (re-record with --record \"why\" if the change is right):\n {}", + problems.len(), + problems.join("\n ") + )) + } +} + fn secs(v: &Value) -> String { v.as_f64().map(|s| format!("{s:.3}")).unwrap_or_else(|| "–".into()) } @@ -218,6 +258,10 @@ pub fn run(rest: &[&str]) -> Result<(), String> { Some(None) => return Err("--record needs a reason: --record \"why the golden changes\"".into()), Some(Some(r)) => Some(r.to_string()), }; + let gate_run = rest.contains(&"--gate"); + if gate_run && reason.is_some() { + return Err("--gate and --record: a gate run compares with the golden, a record run rewrites it".into()); + } let mut o = options(rest, "target/kernel-ladder")?; // Times are compared with the golden: cases run one at a time unless --jobs says otherwise, // so they don't share the machine with each other. @@ -236,7 +280,10 @@ pub fn run(rest: &[&str]) -> Result<(), String> { save_results(&o, &all)?; let results: BTreeMap = all.into_iter().map(|r| (rel_of(&r), r)).collect(); let golden = read(&golden_path()); - if let Some(reason) = &reason { + if gate_run { + // A gate run grades against the golden; the report stays the last full run's. + println!("{}", gate(&tiers, &results, &golden)?); + } else if let Some(reason) = &reason { record(reason, &manifest, &tiers, &results, &golden)?; let tiers = self::tiers(&read(&manifest_path()))?; println!("{}", write_report(&tiers, &results, &read(&golden_path()))?); @@ -264,6 +311,24 @@ mod tests { assert_eq!(flags(&same, None), ["no golden"]); } + #[test] + fn the_gate_fails_on_any_change_but_time() { + let t = vec![Tier { tier: "01-a".into(), what: String::new(), cases: vec!["ladder/01-a/001-x".into(), "ladder/01-a/002-y".into()] }]; + let golden = json!({"cases": { + "ladder/01-a/001-x": {"status": "pass", "seconds": 1.0, "measured": {"faces": 6}}, + "ladder/01-a/002-y": {"status": "fail", "seconds": 1.0} + }}); + let run = |x: Value, y: Value| gate(&t, &BTreeMap::from([("ladder/01-a/001-x".to_string(), x), ("ladder/01-a/002-y".to_string(), y)]), &golden); + // Ten times slower is the machine, not a change. + assert!(run(json!({"status": "pass", "seconds": 10.0, "measured": {"faces": 6}}), json!({"status": "fail"})).is_ok()); + let fixed = run(json!({"status": "pass", "measured": {"faces": 6}}), json!({"status": "pass"})).unwrap_err(); + assert!(fixed.contains("CHANGED (pass): ladder/01-a/002-y: status was fail"), "{fixed}"); + let counts = run(json!({"status": "pass", "measured": {"faces": 7}}), json!({"status": "fail"})).unwrap_err(); + assert!(counts.contains("faces 7 (golden 6)"), "{counts}"); + let unrecorded = gate(&t, &BTreeMap::new(), &golden).unwrap_err(); + assert!(unrecorded.contains("ladder/01-a/001-x: no result"), "{unrecorded}"); + } + #[test] fn tiers_need_paths() { let m = json!({"tiers": [{"tier": "01-a", "what": "w", "cases": ["ladder/01-a/001-x"]}]}); diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 6916254c3..13be4f8d7 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -55,12 +55,13 @@ commands: each failing SMLib call (--cli: a solidcraft-cli built with --features smlib) --known-failing FILE: a regression gate instead of the report: fails on a case that fails and FILE does not list, and on a listed case that passes - (tests/kernel-cases/fillets/KNOWN_FAILING, CI's fillet rig job) - --ladder [--record REASON]: the complexity ladder instead + (tests/kernel-cases//KNOWN_FAILING, CI's Kernel rig workflow) + --ladder [--record REASON | --gate]: the complexity ladder instead (tests/kernel-cases/ladder/ladder.json, tiers in order), graded and compared with its timing golden (one case at a time unless --jobs), into docs/kernel-ladder.md (DIR default target/kernel-ladder); --record re-measures - the golden and re-sorts each tier by time + the golden and re-sorts each tier by time; --gate fails on any case whose status + or counts differ from the golden, instead of the report action-matrix [--bless] [--results FILE] [--from DIR] try every ordinary action on every face, edge, vertex and body of the design corpus and compare with tests/action_matrix/baseline.json (--bless rewrites it; From ee2a1ea061bbd44bcc3ae4b49b99fe0adafed5fd Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 09:47:08 -0400 Subject: [PATCH 013/108] CI: maintainers' pull requests run the tests, and the reference tests run on pull requests A pull request whose author is an owner, member or collaborator of the repository runs Clippy, Native Linux tests, GPU path tests and the reference tests without the approved-for-ci label, scoped to the affected packages as before; others still wait for the label. The reference tests leave the pull request fast lane: they run when solidcraft-cli is selected. ci.yml can also be called (workflow_call) by the release gate, and runs as Run workflow does. Pushes, merge groups and the nightly run are unchanged. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 41 ++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 740ab4c94..cac0919e7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,8 +12,9 @@ # checks (no archive to upload and download). The GPU path tracer's tests run one at a time # (.config/nextest.toml), so they have a job of their own in four shards (GPU path tests). A few # heavy tests (see .config/nextest.toml) are skipped on pull requests and run on pushes to main and -# nightly. The reference tests and the doc tests run in the merge queue, on main and nightly, not -# on pull requests (the fast lane, in Select checks); a break there is fixed forward on main. The +# nightly. The reference tests run on a pull request that selects solidcraft-cli (they replay +# recipes through it). The doc tests run in the merge queue, on main and nightly, not on pull +# requests (the fast lane, in Select checks); a break there is fixed forward on main. The # Windows jobs (D3D12 shaders and app startup) run nightly, and in the merge queue only for a group # that changes what they exercise. Only main saves the build caches; pull requests restore them. # sccache is on a Blacksmith sticky disk that only main commits. @@ -21,8 +22,9 @@ # commit, or when nothing a build reads changed since the last push to main whose run passed. # Otherwise it runs everything. # Heavy checks wait for review: a pull request without the `approved-for-ci` label runs only -# Select checks, the format and repository checks and a quick compile. Adding the label (after -# review) runs everything above, and every later push to the PR does too, except a push that only +# Select checks, the format and repository checks and a quick compile, unless its author is an +# owner, member or collaborator of the repository (they could push the code to a branch here +# anyway). Adding the label (after review) runs everything above, and every later push to the PR does too, except a push that only # merges main into a change that already passed (scripts/ci/main_merge.py): it carries that # result and runs the repository checks. Merge groups, the nightly run and Run workflow are not # pull requests and always run the full suite. @@ -31,6 +33,8 @@ # `ci` job still runs and reports the commit's real result (see the `ci` job): the merge queue # reads `ci` from the newest run of a commit, so a run without it would block a PR that passed. # Cross-compilation is opt-in through Run workflow; release builds remain in release.yml. +# The release gate (release-gate.yml) calls this workflow (workflow_call) as a Run workflow with +# cross-compilation on. # Every Linux job runs on Blacksmith's Ubuntu 24.04 runners (blacksmith-vcpu-ubuntu-2404), sized # per job: 32 vCPU for the tests, 16 for Clippy, the GPU path tests, the archive build (nightly) and the merge queue's, 8 for compiles, doc and reference tests, 4 for the light checks, 2 for Select checks and ci. # The Windows shader job runs on Blacksmith's Windows Server 2025 runners (blacksmith-8vcpu-windows-2025); @@ -64,6 +68,14 @@ on: description: "Also check WebAssembly and RISC-V (before a release)" type: boolean default: false + # The release gate (release-gate.yml): the event stays the caller's (workflow_dispatch), so a + # call runs exactly what Run workflow runs. + workflow_call: + inputs: + cross_compile: + description: "Also check WebAssembly and RISC-V (before a release)" + type: boolean + default: false permissions: contents: read @@ -137,6 +149,9 @@ jobs: HEAD_REF: ${{ github.event.pull_request.head.ref }} REPO: ${{ github.repository }} APPROVED: ${{ contains(github.event.pull_request.labels.*.name, 'approved-for-ci') }} + # An owner, member or collaborator could push the change to a branch here: their pull + # requests need no label. + TRUSTED: ${{ contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association) }} GH_TOKEN: ${{ github.token }} run: | native=false @@ -230,16 +245,18 @@ jobs: if [ "$EVENT_NAME" = pull_request ] && [ "$full" != true ]; then case " $packages " in *" solidcraft-cli "*) ;; *) oracle=false ;; esac fi - # The pull request fast lane: Windows, the reference tests and the doc tests run on main - # (and the nightly), not on every pull request push; a break there is fixed forward on - # main. Over three days of pull requests the doc tests were the only failing job 3 times - # in about 7,900 runner-minutes, and the reference tests never were. + # The pull request fast lane: Windows and the doc tests run on main (and the nightly), + # not on every pull request push; a break there is fixed forward on main. Over three + # days of pull requests the doc tests were the only failing job 3 times in about 7,900 + # runner-minutes. The reference tests run when solidcraft-cli is selected (above): a + # kernel change that broke them went unseen until a full run on develop. doctests=$native - if [ "$EVENT_NAME" = pull_request ]; then windows=false; oracle=false; doctests=false; fi - # Until a maintainer adds approved-for-ci, a pull request gets a quick compile instead of - # Clippy, the tests and the doc tests. + if [ "$EVENT_NAME" = pull_request ]; then windows=false; doctests=false; fi + # Until a maintainer adds approved-for-ci, a pull request from outside the repository's + # owners, members and collaborators gets a quick compile instead of Clippy, the tests, + # the reference tests and the doc tests. quick=false - if [ "$EVENT_NAME" = pull_request ] && [ "$APPROVED" != true ]; then + if [ "$EVENT_NAME" = pull_request ] && [ "$APPROVED" != true ] && [ "$TRUSTED" != true ]; then quick=$native native=false oracle=false From b4fcd59100cce3a61bfb3768d3d81526a2427ce7 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 09:48:29 -0400 Subject: [PATCH 014/108] Kernel rig: every area and the ladder as a parallel gate on pull requests that touch the kernel kernel-rig.yml builds solidcraft-cli once (release, SMLib prebuilt; sccache on a sticky disk that only pushes to main and develop commit) and hands it, with the rig's runner, to a matrix of eleven shards: the ten areas of tests/kernel-cases/, each against its KNOWN_FAILING, and the ladder against its golden. One path filter covers the kernel surface; drafts skip; a new push cancels a pull request's old run; merge groups always run it, and the release gate calls it. The areas other than fillets get a KNOWN_FAILING with only its header, to be seeded from develop after the SMLib pin bump. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/kernel-rig.yml | 175 ++++++++++++++++++ tests/kernel-cases/booleans/KNOWN_FAILING | 4 + tests/kernel-cases/continuity/KNOWN_FAILING | 4 + tests/kernel-cases/crashes/KNOWN_FAILING | 4 + tests/kernel-cases/import/KNOWN_FAILING | 4 + tests/kernel-cases/sheet-metal/KNOWN_FAILING | 4 + tests/kernel-cases/shell/KNOWN_FAILING | 4 + tests/kernel-cases/sweeps/KNOWN_FAILING | 4 + tests/kernel-cases/tessellation/KNOWN_FAILING | 4 + tests/kernel-cases/threads/KNOWN_FAILING | 4 + 10 files changed, 211 insertions(+) create mode 100644 .github/workflows/kernel-rig.yml create mode 100644 tests/kernel-cases/booleans/KNOWN_FAILING create mode 100644 tests/kernel-cases/continuity/KNOWN_FAILING create mode 100644 tests/kernel-cases/crashes/KNOWN_FAILING create mode 100644 tests/kernel-cases/import/KNOWN_FAILING create mode 100644 tests/kernel-cases/sheet-metal/KNOWN_FAILING create mode 100644 tests/kernel-cases/shell/KNOWN_FAILING create mode 100644 tests/kernel-cases/sweeps/KNOWN_FAILING create mode 100644 tests/kernel-cases/tessellation/KNOWN_FAILING create mode 100644 tests/kernel-cases/threads/KNOWN_FAILING diff --git a/.github/workflows/kernel-rig.yml b/.github/workflows/kernel-rig.yml new file mode 100644 index 000000000..18aede4d5 --- /dev/null +++ b/.github/workflows/kernel-rig.yml @@ -0,0 +1,175 @@ +# The kernel rig and the complexity ladder as a regression gate. A pull request that touches the +# kernel surface (the paths below) builds solidcraft-cli once (release, SMLib prebuilt), hands it +# to a matrix of shards as an artifact, and each shard runs one area of tests/kernel-cases/ (or +# the ladder) in parallel, so the wall time is the build plus the slowest shard. See +# tests/kernel-cases/README.md. +# +# - An area fails on a regression (a case that fails and its tests/kernel-cases//KNOWN_FAILING +# does not list) or on a listed case that passes (it is fixed: remove its line in the same pull +# request, so the list only shrinks). +# - The ladder fails on any case whose status or counts differ from +# tests/kernel-cases/ladder/golden.json; a right change is re-recorded (`--record "why"`). +# +# GitHub filters a workflow by whole files, so any change to crates/doc/src/eval*.rs or +# crates/engine/src/cmd/features*.rs selects it. Pushes to main and develop that touch the same +# paths run it too and commit the compiler cache (a Blacksmith sticky disk) that every other run +# mounts read-only. A merge group (once the queue is on) always runs it: it is the last check +# before the change lands. The release gate (release-gate.yml) calls it (workflow_call). +name: Kernel rig + +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + paths: + - "crates/kernel/**" + - "crates/geom/**" + - "crates/smlib/**" + - "crates/step/**" + - "crates/doc/src/eval*.rs" + - "crates/engine/src/cmd/features*.rs" + - "tests/kernel-cases/**" + # The rig itself: the grading, the runner and this workflow. + - "apps/solidcraft-cli/src/kernel_cases.rs" + - "xtask/src/kernel_cases.rs" + - "xtask/src/kernel_ladder.rs" + - "scripts/fetch-smlib.sh" + - ".github/workflows/kernel-rig.yml" + push: + branches: [main, develop] + # The same paths as pull_request. + paths: + - "crates/kernel/**" + - "crates/geom/**" + - "crates/smlib/**" + - "crates/step/**" + - "crates/doc/src/eval*.rs" + - "crates/engine/src/cmd/features*.rs" + - "tests/kernel-cases/**" + # The rig itself: the grading, the runner and this workflow. + - "apps/solidcraft-cli/src/kernel_cases.rs" + - "xtask/src/kernel_cases.rs" + - "xtask/src/kernel_ladder.rs" + - "scripts/fetch-smlib.sh" + - ".github/workflows/kernel-rig.yml" + merge_group: + workflow_call: + workflow_dispatch: + +permissions: + contents: read + +concurrency: + # A new push to a pull request replaces its old run. + group: kernel-rig-${{ github.event_name }}-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + name: Build the CLI + # Draft pull requests run no CI, as in ci.yml. + if: github.event_name != 'pull_request' || !github.event.pull_request.draft + runs-on: blacksmith-8vcpu-ubuntu-2404 + timeout-minutes: 60 + env: + CARGO_INCREMENTAL: "0" + RUSTC_WRAPPER: sccache + SCCACHE_DIR: /home/runner/.cache/sccache + SCCACHE_CACHE_SIZE: 10G + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Size parallel compiles to the job's memory + run: scripts/ci/build-jobs.sh + - uses: dtolnay/rust-toolchain@stable + # Only pushes to main and develop commit the cache; pull requests, merge groups and forks + # mount a clone and never write back. + - name: Mount the compiler cache + uses: useblacksmith/stickydisk@3f6be1451e3cad893b778bc93495c80452a5da26 # v1.7.2 + continue-on-error: true + with: + key: ${{ github.repository }}-sccache-kernel-rig + path: /home/runner/.cache/sccache + commit: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop') && 'on-change' || 'false' }} + - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 + with: + key: kernel-rig + save-if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop') }} + - name: Fetch SMLib (crates/smlib/SMLIB_REV) + shell: bash + run: scripts/fetch-smlib.sh + - name: Set up compiler cache + uses: mozilla-actions/sccache-action@fc920bf0ec8de6ee65d409111f7ec508035751ba # v0.0.11 + with: + version: v0.16.0 + - name: Build the CLI (release, SMLib) and the rig's runner + run: | + cargo build --release --locked -p solidcraft-cli --features smlib + cargo build --locked -p xtask + # A tar keeps the executable bits, which an artifact drops. xtask finds the repository from + # the path it was built in (CARGO_MANIFEST_DIR), which is the same checkout path in every + # job of this workflow. + - name: Pack the binaries + run: tar -cf "$RUNNER_TEMP/kernel-rig-bin.tar" -C target release/solidcraft-cli debug/xtask + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: kernel-rig-bin + path: ${{ runner.temp }}/kernel-rig-bin.tar + retention-days: 1 + - name: Compiler cache statistics + if: always() + run: sccache --show-stats + + shard: + name: Kernel rig (${{ matrix.shard }}) + needs: build + runs-on: blacksmith-4vcpu-ubuntu-2404 + timeout-minutes: 30 + strategy: + fail-fast: false + matrix: + # Every area of tests/kernel-cases/ and the ladder. On the build box (aarch64, 4 cases at + # a time) the slowest areas took about 1 minute (booleans, 212 s of cases with one of + # 84 s; threads, 161 s) and the ladder, one case at a time, 92 s: no area needs splitting. + shard: [booleans, continuity, crashes, fillets, import, ladder, sheet-metal, shell, sweeps, tessellation, threads] + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: kernel-rig-bin + path: ${{ runner.temp }} + - name: Unpack the binaries + run: mkdir -p target && tar -xf "$RUNNER_TEMP/kernel-rig-bin.tar" -C target + - name: Run the cases against the known-failing list (the ladder against its golden) + env: + SHARD: ${{ matrix.shard }} + run: | + if [ "$SHARD" = ladder ]; then + set -- --ladder --gate + else + set -- --area "$SHARD" --known-failing "tests/kernel-cases/$SHARD/KNOWN_FAILING" + fi + target/debug/xtask kernel-cases "$@" --cli target/release/solidcraft-cli --out "$RUNNER_TEMP/kernel-rig" + - name: Keep the results + if: always() + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: kernel-rig-results-${{ matrix.shard }} + path: ${{ runner.temp }}/kernel-rig/results.json + if-no-files-found: ignore + + # One check for the whole gate, for branch protection and the merge queue. + kernel-rig: + name: kernel-rig + needs: [build, shard] + if: always() && (github.event_name != 'pull_request' || !github.event.pull_request.draft) + runs-on: blacksmith-2vcpu-ubuntu-2404 + steps: + - name: Every shard passed + env: + BUILD: ${{ needs.build.result }} + SHARDS: ${{ needs.shard.result }} + run: | + test "$BUILD" = success + test "$SHARDS" = success diff --git a/tests/kernel-cases/booleans/KNOWN_FAILING b/tests/kernel-cases/booleans/KNOWN_FAILING new file mode 100644 index 000000000..01f33ea2a --- /dev/null +++ b/tests/kernel-cases/booleans/KNOWN_FAILING @@ -0,0 +1,4 @@ +# The booleans cases that fail today, one a line: ` `. Sorted. The kernel +# rig gate (.github/workflows/kernel-rig.yml) fails on a case that fails and is not listed here, +# and on a listed case that passes: a fix removes its line in the same pull request. +# Baseline: not seeded yet; seeded from a develop run after the SMLib pin bump. diff --git a/tests/kernel-cases/continuity/KNOWN_FAILING b/tests/kernel-cases/continuity/KNOWN_FAILING new file mode 100644 index 000000000..6220878c6 --- /dev/null +++ b/tests/kernel-cases/continuity/KNOWN_FAILING @@ -0,0 +1,4 @@ +# The continuity cases that fail today, one a line: ` `. Sorted. The kernel +# rig gate (.github/workflows/kernel-rig.yml) fails on a case that fails and is not listed here, +# and on a listed case that passes: a fix removes its line in the same pull request. +# Baseline: not seeded yet; seeded from a develop run after the SMLib pin bump. diff --git a/tests/kernel-cases/crashes/KNOWN_FAILING b/tests/kernel-cases/crashes/KNOWN_FAILING new file mode 100644 index 000000000..b322b1f3b --- /dev/null +++ b/tests/kernel-cases/crashes/KNOWN_FAILING @@ -0,0 +1,4 @@ +# The crashes cases that fail today, one a line: ` `. Sorted. The kernel +# rig gate (.github/workflows/kernel-rig.yml) fails on a case that fails and is not listed here, +# and on a listed case that passes: a fix removes its line in the same pull request. +# Baseline: not seeded yet; seeded from a develop run after the SMLib pin bump. diff --git a/tests/kernel-cases/import/KNOWN_FAILING b/tests/kernel-cases/import/KNOWN_FAILING new file mode 100644 index 000000000..636c9e35e --- /dev/null +++ b/tests/kernel-cases/import/KNOWN_FAILING @@ -0,0 +1,4 @@ +# The import cases that fail today, one a line: ` `. Sorted. The kernel +# rig gate (.github/workflows/kernel-rig.yml) fails on a case that fails and is not listed here, +# and on a listed case that passes: a fix removes its line in the same pull request. +# Baseline: not seeded yet; seeded from a develop run after the SMLib pin bump. diff --git a/tests/kernel-cases/sheet-metal/KNOWN_FAILING b/tests/kernel-cases/sheet-metal/KNOWN_FAILING new file mode 100644 index 000000000..2ac87890e --- /dev/null +++ b/tests/kernel-cases/sheet-metal/KNOWN_FAILING @@ -0,0 +1,4 @@ +# The sheet-metal cases that fail today, one a line: ` `. Sorted. The kernel +# rig gate (.github/workflows/kernel-rig.yml) fails on a case that fails and is not listed here, +# and on a listed case that passes: a fix removes its line in the same pull request. +# Baseline: not seeded yet; seeded from a develop run after the SMLib pin bump. diff --git a/tests/kernel-cases/shell/KNOWN_FAILING b/tests/kernel-cases/shell/KNOWN_FAILING new file mode 100644 index 000000000..07f36eb3c --- /dev/null +++ b/tests/kernel-cases/shell/KNOWN_FAILING @@ -0,0 +1,4 @@ +# The shell cases that fail today, one a line: ` `. Sorted. The kernel +# rig gate (.github/workflows/kernel-rig.yml) fails on a case that fails and is not listed here, +# and on a listed case that passes: a fix removes its line in the same pull request. +# Baseline: not seeded yet; seeded from a develop run after the SMLib pin bump. diff --git a/tests/kernel-cases/sweeps/KNOWN_FAILING b/tests/kernel-cases/sweeps/KNOWN_FAILING new file mode 100644 index 000000000..82aa00854 --- /dev/null +++ b/tests/kernel-cases/sweeps/KNOWN_FAILING @@ -0,0 +1,4 @@ +# The sweeps cases that fail today, one a line: ` `. Sorted. The kernel +# rig gate (.github/workflows/kernel-rig.yml) fails on a case that fails and is not listed here, +# and on a listed case that passes: a fix removes its line in the same pull request. +# Baseline: not seeded yet; seeded from a develop run after the SMLib pin bump. diff --git a/tests/kernel-cases/tessellation/KNOWN_FAILING b/tests/kernel-cases/tessellation/KNOWN_FAILING new file mode 100644 index 000000000..1f7f372c3 --- /dev/null +++ b/tests/kernel-cases/tessellation/KNOWN_FAILING @@ -0,0 +1,4 @@ +# The tessellation cases that fail today, one a line: ` `. Sorted. The kernel +# rig gate (.github/workflows/kernel-rig.yml) fails on a case that fails and is not listed here, +# and on a listed case that passes: a fix removes its line in the same pull request. +# Baseline: not seeded yet; seeded from a develop run after the SMLib pin bump. diff --git a/tests/kernel-cases/threads/KNOWN_FAILING b/tests/kernel-cases/threads/KNOWN_FAILING new file mode 100644 index 000000000..07e2659a7 --- /dev/null +++ b/tests/kernel-cases/threads/KNOWN_FAILING @@ -0,0 +1,4 @@ +# The threads cases that fail today, one a line: ` `. Sorted. The kernel +# rig gate (.github/workflows/kernel-rig.yml) fails on a case that fails and is not listed here, +# and on a listed case that passes: a fix removes its line in the same pull request. +# Baseline: not seeded yet; seeded from a develop run after the SMLib pin bump. From 18d2dddac6eb4f9bec2093cb8ecd7f75bf9f0953 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 09:48:29 -0400 Subject: [PATCH 015/108] Release gate: every check in full and in parallel before a branch replaces main release-gate.yml, run by hand on a branch, calls ci.yml as Run workflow with cross-compilation (every native suite in full, reference, doc and GPU path tests, the whole action matrix, property tests, web-offline, wasm, Windows FXC and startup), kernel-rig.yml (every area and the ladder) and release.yml as a dry run (every package and its smoke tests), and passes only when all three pass. release.yml can now be called (workflow_call). Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release-gate.yml | 70 ++++++++++++++++++++++++++++++ .github/workflows/release.yml | 13 ++++++ 2 files changed, 83 insertions(+) create mode 100644 .github/workflows/release-gate.yml diff --git a/.github/workflows/release-gate.yml b/.github/workflows/release-gate.yml new file mode 100644 index 000000000..de7ad30dc --- /dev/null +++ b/.github/workflows/release-gate.yml @@ -0,0 +1,70 @@ +# The release gate: everything, in full and in parallel, on one branch's head, before that branch +# replaces main as a release (develop, rebased onto main). Run it by hand: +# gh workflow run release-gate.yml --ref develop +# It calls the workflows that own each check instead of copying their jobs: +# - ci.yml as Run workflow with cross-compilation: every native suite in full (not scoped), the +# reference tests, the doc tests, the GPU path tests, the action matrix (all 16 shards) and its +# determinism check, the property tests, the repository checks (web-offline among them), +# WebAssembly and RISC-V, Windows D3D12 FXC and Windows app startup; +# - kernel-rig.yml: every rig area against its KNOWN_FAILING and the ladder against its golden; +# - release.yml as a dry run (draft false): the Linux, Flatpak, Snap, FreeBSD, macOS, Windows and +# web packages with their smoke tests and package checks. +# The gate passes only when all three pass. Before main is replaced, tag the old main +# (main-before-develop-) and push the tag. +name: Release gate + +on: + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: release-gate-${{ github.ref }} + cancel-in-progress: false + +jobs: + ci: + name: CI + uses: ./.github/workflows/ci.yml + permissions: + contents: read + # Select checks reads this commit's other runs. + actions: read + with: + cross_compile: true + + kernel-rig: + name: Kernel rig + uses: ./.github/workflows/kernel-rig.yml + permissions: + contents: read + + packages: + name: Packages + uses: ./.github/workflows/release.yml + # release.yml's last job asks for contents: write (it creates releases); a dry run only keeps + # the files as an artifact. + permissions: + contents: write + actions: read + secrets: inherit + with: + draft: false + + release-gate: + name: release-gate + needs: [ci, kernel-rig, packages] + if: always() + runs-on: blacksmith-2vcpu-ubuntu-2404 + steps: + - name: Every part passed + env: + CI: ${{ needs.ci.result }} + KERNEL_RIG: ${{ needs.kernel-rig.result }} + PACKAGES: ${{ needs.packages.result }} + run: | + echo "ci=$CI kernel-rig=$KERNEL_RIG packages=$PACKAGES" + test "$CI" = success + test "$KERNEL_RIG" = success + test "$PACKAGES" = success diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0329f134f..07bcbe839 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,6 +20,7 @@ # releases/latest/download/ links in the README keep working across releases. # # A dry run: dispatch with draft=false (the default). Only the release branch may create drafts. +# The release gate (release-gate.yml) calls it as such a dry run. # A dry run from any branch also test-signs the Windows files when SIGNPATH_API_TOKEN exists: # gh workflow run release.yml --ref -f draft=false [-f signpath_signing_policy=test-signing] name: Release @@ -40,6 +41,18 @@ on: description: "SignPath signing policy for the Windows files (empty: the repository variable, else test-signing)" type: string default: "" + # The release gate (release-gate.yml): a dry run (draft false) of every package and its checks. + # The event stays the caller's (workflow_dispatch), so a call runs as a dispatched dry run does. + workflow_call: + inputs: + draft: + description: "Create/update a draft (release branch only; off: build artifacts only)" + type: boolean + default: false + signpath_signing_policy: + description: "SignPath signing policy for the Windows files (empty: the repository variable, else test-signing)" + type: string + default: "" permissions: contents: read From e7117776990b03f2c0a72c15bd5b56d2e1a84aa3 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 09:50:12 -0400 Subject: [PATCH 016/108] Docs: the kernel rig gate, updating a known-failing list, re-recording the ladder golden tests/kernel-cases/README.md describes the kernel rig gate for every area, how a pull request updates its area's KNOWN_FAILING, and the ladder's --gate and --record. The tests skill and CONTRIBUTING say which pull requests run the native and reference tests, and what the release gate runs. Co-Authored-By: Claude Opus 5.5 --- CONTRIBUTING.md | 3 +- skills/solidcraft-tests/SKILL.md | 2 ++ tests/kernel-cases/README.md | 56 +++++++++++++++++++++++--------- 3 files changed, 44 insertions(+), 17 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 80f7ad2c0..5d30a666b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -241,7 +241,8 @@ the surface itself). Expected values are either worked out in closed form (`tools/oracle-analytic/`) or computed by building the same recipe in FreeCAD, run as a separate program (`tools/freecad-oracle/`); each file says which. The generated [reference test report](docs/oracle.md) has the current case count and results. The reference-test -CI job runs `cargo xtask oracle` during full validation; pull-request runs skip it. A case that +CI job runs `cargo xtask oracle` during full validation, and on pull requests that reach +`solidcraft-cli`. A case that fails because of a known bug names its issue in `expected.json` (`"known_failure": "#123"`); never change an expected value to match SolidCraft's output. diff --git a/skills/solidcraft-tests/SKILL.md b/skills/solidcraft-tests/SKILL.md index 4f4798f06..4a6113881 100644 --- a/skills/solidcraft-tests/SKILL.md +++ b/skills/solidcraft-tests/SKILL.md @@ -25,6 +25,8 @@ A failing test without its fix cannot merge: it turns `main` red for everyone. I ## Goldens, matrices and skipped tests - The reference for what the kernel builds is the kernel-cases ladder (`tests/kernel-cases/ladder/`, `cargo xtask kernel-cases --ladder`, `docs/kernel-ladder.md`). +- Kernel PRs run the kernel rig gate (`kernel-rig.yml`): each area against its `KNOWN_FAILING`, the ladder against its golden. In the same PR, a fix removes its line, a new failing case adds one, a changed ladder result is re-recorded (`--ladder --record "why"`); see `tests/kernel-cases/README.md`. +- Maintainers' PRs run the native, GPU path and reference tests on the affected packages; others wait for `approved-for-ci`. `release-gate.yml` runs everything in full before develop replaces main. - The action matrix is a ratchet: record a newly passing action with `cargo xtask action-matrix --bless` (`docs/action-matrix.md`). - Pull requests skip a few heavy tests, which run in the merge queue, nightly and on `main`. Check that validation after merging. The list is in `.config/nextest.toml` and the testing page. - Mutation testing finds behaviour the suites miss: `docs/mutation-testing.md`. diff --git a/tests/kernel-cases/README.md b/tests/kernel-cases/README.md index 632291ac5..f130ef323 100644 --- a/tests/kernel-cases/README.md +++ b/tests/kernel-cases/README.md @@ -97,27 +97,43 @@ the frozen truck-geometry PRs, a `kernel-paused` PR), for the report's coverage | `tolerance` | Optional overrides: `rel`, `abs_mm`, `mesh_mm`, `weld_mm`. | | `missing` | A capability SolidCraft has no command or parameter for yet (`"solid.thread has no start count"`): the case is reported **not supported yet** without running, so the gap stays visible. | -## The fillet gate +## The kernel rig gate -The fillet cases are the fillet regression suite: each is one small case of one issue, with its -exact answer. `.github/workflows/fillet-rig.yml` runs them on every pull request (not a draft) -that touches fillet code: `crates/kernel/src/{blend*,fillet*,*corner*,continuity*}.rs`, -`crates/smlib/**` (`SMLIB_REV` and `SMLIB_PREBUILT` included), `crates/doc/src/eval*.rs`, -`crates/engine/src/cmd/features.rs`, `tests/kernel-cases/fillets/**` and the rig's own code -(GitHub filters whole files, so any change to `eval*.rs` or `features.rs` runs it). One release -build of `solidcraft-cli`, then: +Every area is a regression suite: each case is one small case of one issue, with its exact +answer. `.github/workflows/kernel-rig.yml` runs them all, and the ladder, on every pull request +(not a draft) that touches the kernel surface: `crates/kernel/**`, `crates/geom/**`, +`crates/smlib/**` (`SMLIB_REV` and `SMLIB_PREBUILT` included), `crates/step/**`, +`crates/doc/src/eval*.rs`, `crates/engine/src/cmd/features*.rs`, `tests/kernel-cases/**` and the +rig's own code (GitHub filters whole files, so any change to `eval*.rs` or `features*.rs` runs +it). Pushes to main and develop on the same paths, merge groups and the release gate +(`release-gate.yml`) run it too. One job builds `solidcraft-cli` (release, SMLib) and the rig's +runner, and hands both to a matrix of shards, one per area plus the ladder, that run in +parallel; the `kernel-rig` check passes when every shard does. (`fillet-rig.yml`, the earlier +fillet-only gate, folds into it.) Each area's shard runs: ```sh -cargo xtask kernel-cases --area fillets --cli target/release/solidcraft-cli \ - --known-failing tests/kernel-cases/fillets/KNOWN_FAILING +cargo xtask kernel-cases --area --cli target/release/solidcraft-cli \ + --known-failing tests/kernel-cases//KNOWN_FAILING ``` -`fillets/KNOWN_FAILING` lists the cases that fail today, sorted, one a line with its cause -(` `; `#` starts a comment). The gate fails on a **regression**, a case -that fails (or crashes, hangs, or is not supported yet) and is not listed, and on a **fixed** case, -one listed that passes: a fix removes its line in the same pull request, so the list only shrinks. -A new case that fails today goes in with its line. With `--known-failing` the run writes no -report; `docs/kernel-cases.md` stays the full run's. +`/KNOWN_FAILING` lists the cases of that area that fail today, sorted, one a line with its +cause (` `; `#` starts a comment; the header names the baseline: the +develop commit and SMLib revision it was taken from). The gate fails on a **regression**, a +case that fails (or crashes, hangs, or is not supported yet) and is not listed, and on a +**fixed** case, one listed that passes. With `--known-failing` the run writes no report; +`docs/kernel-cases.md` stays the full run's. + +**Updating a list.** The pull request that changes an outcome changes the list in the same pull +request, so the list only shrinks and never goes stale: + +- a fix (yours, or an SMLib pin bump): remove the line of each case the shard reports as + `FIXED`; +- a new case that fails today: add its line, sorted, with the cause from its result + (`results.json` in the shard's `kernel-rig-results-` artifact, or a local run); +- a regression: fix it in the same pull request. + +To check a list locally before pushing: `cargo xtask kernel-cases --area --cli +target/release/solidcraft-cli --known-failing tests/kernel-cases//KNOWN_FAILING`. ## The complexity ladder @@ -137,9 +153,17 @@ running part grows one tier at a time through `base`), so the last case carries ```sh cargo xtask kernel-cases --ladder --cli target/release/solidcraft-cli +cargo xtask kernel-cases --ladder --cli target/release/solidcraft-cli --gate cargo xtask kernel-cases --ladder --cli target/release/solidcraft-cli --record "why" ``` +The ladder needs no known-failing list: the golden is the reference. Its shard in the kernel rig +gate runs with `--gate`, which fails on any case whose status or counts differ from the golden, +better or worse, and on a case with no golden; times are not compared there (they are the +machine's). A pull request that changes a ladder result re-records the golden with +`--record "why the golden changes"` and commits `golden.json` and +`ladder.json` with it. + Ladder runs measure one case at a time (unless `--jobs`) and keep their output in `target/kernel-ladder` (`--out`); `--record` rewrites the golden and sorts each tier by time, fastest first; commit both files. The report, `docs/kernel-ladder.md`, gives per tier the counts From d84d00bb44e97a0b66cf9c78456b0a85e78b9d17 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 10:00:34 -0400 Subject: [PATCH 017/108] Release gate: the packages' dry run is unsigned and skips the release job The gate passes no secrets to release.yml, so the macOS and Windows signing steps skip as they do on a fork (no signing secret, no SignPath quota), and the new packages_only input skips the release job (checksums, update signing, publishing). The call still grants contents: write, which GitHub checks for the skipped job before the run. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release-gate.yml | 14 +++++++++----- .github/workflows/release.yml | 13 +++++++++++-- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release-gate.yml b/.github/workflows/release-gate.yml index de7ad30dc..537a1ab8c 100644 --- a/.github/workflows/release-gate.yml +++ b/.github/workflows/release-gate.yml @@ -7,8 +7,10 @@ # determinism check, the property tests, the repository checks (web-offline among them), # WebAssembly and RISC-V, Windows D3D12 FXC and Windows app startup; # - kernel-rig.yml: every rig area against its KNOWN_FAILING and the ladder against its golden; -# - release.yml as a dry run (draft false): the Linux, Flatpak, Snap, FreeBSD, macOS, Windows and -# web packages with their smoke tests and package checks. +# - release.yml as a dry run (draft false, packages_only): the Linux, Flatpak, Snap, FreeBSD, +# macOS, Windows and web packages with their smoke tests and package checks, unsigned (no +# secrets are passed, so no signing secret or SignPath quota is used) and without the release +# job (checksums, update signing, publishing). # The gate passes only when all three pass. Before main is replaced, tag the old main # (main-before-develop-) and push the tag. name: Release gate @@ -43,14 +45,16 @@ jobs: packages: name: Packages uses: ./.github/workflows/release.yml - # release.yml's last job asks for contents: write (it creates releases); a dry run only keeps - # the files as an artifact. + # No secrets: the signing steps skip without them. GitHub checks a called workflow's job + # permissions before the run, skipped jobs included, so the release job's contents: write must + # be granted here; packages_only skips that job, and no step that runs writes to the + # repository. actions: read is the Windows job's. permissions: contents: write actions: read - secrets: inherit with: draft: false + packages_only: true release-gate: name: release-gate diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 07bcbe839..c8da47b70 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,8 @@ # releases/latest/download/ links in the README keep working across releases. # # A dry run: dispatch with draft=false (the default). Only the release branch may create drafts. -# The release gate (release-gate.yml) calls it as such a dry run. +# The release gate (release-gate.yml) calls it as such a dry run, without secrets (unsigned) and +# without the release job (packages_only). # A dry run from any branch also test-signs the Windows files when SIGNPATH_API_TOKEN exists: # gh workflow run release.yml --ref -f draft=false [-f signpath_signing_policy=test-signing] name: Release @@ -43,8 +44,15 @@ on: default: "" # The release gate (release-gate.yml): a dry run (draft false) of every package and its checks. # The event stays the caller's (workflow_dispatch), so a call runs as a dispatched dry run does. + # The gate passes no secrets, so nothing is signed (the signing steps skip without their + # secrets, as on a fork), and packages_only skips the release job (checksums, update signing, + # publishing). workflow_call: inputs: + packages_only: + description: "Build and check every package only: no release job" + type: boolean + default: false draft: description: "Create/update a draft (release branch only; off: build artifacts only)" type: boolean @@ -600,7 +608,8 @@ jobs: release: name: GitHub Release or dry-run artifacts needs: [version, linux, flatpak, snap, freebsd, macos, windows, web] - if: needs.version.outputs.build == 'true' + # Not for the release gate (packages_only): it builds and checks the packages, nothing more. + if: needs.version.outputs.build == 'true' && !inputs.packages_only runs-on: ubuntu-latest permissions: contents: write From 02e1f18412da606111cc61a5e939ea4ac8c2b9ff Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:47:06 -0400 Subject: [PATCH 018/108] Kernel rig: each area runs only when the files its PATHS lists change, every area on the shared core A plan job (scripts/ci/kernel_rig_plan.py, with its self-test) maps a pull request's changed files to the areas: tests/kernel-cases//PATHS for each area, tests/kernel-cases/PATHS-ALL for the shared core, the ladder whenever any area runs. Areas come from the folders, so a new one needs no workflow edit. Pushes, merge groups, the release gate and runs by hand run every area. The kernel-rig check counts a skipped build or shard as passed only when the plan selected none. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/kernel-rig.yml | 113 +++++++++++++++----- scripts/ci/kernel_rig_plan.py | 142 ++++++++++++++++++++++++++ scripts/ci/test_kernel_rig_plan.py | 142 ++++++++++++++++++++++++++ tests/kernel-cases/PATHS-ALL | 58 +++++++++++ tests/kernel-cases/booleans/PATHS | 30 ++++++ tests/kernel-cases/continuity/PATHS | 17 +++ tests/kernel-cases/crashes/PATHS | 21 ++++ tests/kernel-cases/fillets/PATHS | 15 +++ tests/kernel-cases/import/PATHS | 22 ++++ tests/kernel-cases/sheet-metal/PATHS | 15 +++ tests/kernel-cases/shell/PATHS | 19 ++++ tests/kernel-cases/sweeps/PATHS | 20 ++++ tests/kernel-cases/tessellation/PATHS | 7 ++ tests/kernel-cases/threads/PATHS | 12 +++ 14 files changed, 606 insertions(+), 27 deletions(-) create mode 100644 scripts/ci/kernel_rig_plan.py create mode 100644 scripts/ci/test_kernel_rig_plan.py create mode 100644 tests/kernel-cases/PATHS-ALL create mode 100644 tests/kernel-cases/booleans/PATHS create mode 100644 tests/kernel-cases/continuity/PATHS create mode 100644 tests/kernel-cases/crashes/PATHS create mode 100644 tests/kernel-cases/fillets/PATHS create mode 100644 tests/kernel-cases/import/PATHS create mode 100644 tests/kernel-cases/sheet-metal/PATHS create mode 100644 tests/kernel-cases/shell/PATHS create mode 100644 tests/kernel-cases/sweeps/PATHS create mode 100644 tests/kernel-cases/tessellation/PATHS create mode 100644 tests/kernel-cases/threads/PATHS diff --git a/.github/workflows/kernel-rig.yml b/.github/workflows/kernel-rig.yml index 18aede4d5..ba811a7fb 100644 --- a/.github/workflows/kernel-rig.yml +++ b/.github/workflows/kernel-rig.yml @@ -1,8 +1,11 @@ -# The kernel rig and the complexity ladder as a regression gate. A pull request that touches the -# kernel surface (the paths below) builds solidcraft-cli once (release, SMLib prebuilt), hands it -# to a matrix of shards as an artifact, and each shard runs one area of tests/kernel-cases/ (or -# the ladder) in parallel, so the wall time is the build plus the slowest shard. See -# tests/kernel-cases/README.md. +# The kernel rig and the complexity ladder as a regression gate. A plan job maps a pull request's +# changed files to the rig areas they can affect (scripts/ci/kernel_rig_plan.py): an area runs +# when a file its tests/kernel-cases//PATHS lists changes, or one of its cases; every area +# runs when the shared core in tests/kernel-cases/PATHS-ALL changes; the ladder runs whenever any +# area does. One job then builds solidcraft-cli once (release, SMLib prebuilt), checks that every +# registry command has a case or an exemption (tests/kernel-cases/EXEMPT), and hands the CLI to a +# matrix of shards as an artifact, one per selected area plus the ladder, in parallel, so the +# wall time is the build plus the slowest shard. See tests/kernel-cases/README.md. # # - An area fails on a regression (a case that fails and its tests/kernel-cases//KNOWN_FAILING # does not list) or on a listed case that passes (it is fixed: remove its line in the same pull @@ -10,11 +13,13 @@ # - The ladder fails on any case whose status or counts differ from # tests/kernel-cases/ladder/golden.json; a right change is re-recorded (`--record "why"`). # -# GitHub filters a workflow by whole files, so any change to crates/doc/src/eval*.rs or -# crates/engine/src/cmd/features*.rs selects it. Pushes to main and develop that touch the same -# paths run it too and commit the compiler cache (a Blacksmith sticky disk) that every other run -# mounts read-only. A merge group (once the queue is on) always runs it: it is the last check -# before the change lands. The release gate (release-gate.yml) calls it (workflow_call). +# The trigger paths are whole folders that hold every area's PATHS (a self-test, +# scripts/ci/test_kernel_rig_plan.py, checks they do), so a pull request that touches none of +# them (the UI, docs, packaging) starts no runner at all, and a new area needs no edit here: the +# plan finds the areas from the folders. Pushes to main and develop on the same paths, merge groups +# (once the queue is on), the release gate (release-gate.yml, workflow_call) and a run by hand run +# every area; those pushes also commit the compiler cache (a Blacksmith sticky disk) that every +# other run mounts read-only. name: Kernel rig on: @@ -25,14 +30,17 @@ on: - "crates/geom/**" - "crates/smlib/**" - "crates/step/**" - - "crates/doc/src/eval*.rs" - - "crates/engine/src/cmd/features*.rs" + - "crates/io/src/**" + - "crates/doc/src/**" + - "crates/engine/src/**" - "tests/kernel-cases/**" - # The rig itself: the grading, the runner and this workflow. + # The rig itself: the grading, the runner, the selection and this workflow. - "apps/solidcraft-cli/src/kernel_cases.rs" - "xtask/src/kernel_cases.rs" - "xtask/src/kernel_ladder.rs" - "scripts/fetch-smlib.sh" + - "scripts/ci/kernel_rig_plan.py" + - "scripts/ci/test_kernel_rig_plan.py" - ".github/workflows/kernel-rig.yml" push: branches: [main, develop] @@ -42,14 +50,17 @@ on: - "crates/geom/**" - "crates/smlib/**" - "crates/step/**" - - "crates/doc/src/eval*.rs" - - "crates/engine/src/cmd/features*.rs" + - "crates/io/src/**" + - "crates/doc/src/**" + - "crates/engine/src/**" - "tests/kernel-cases/**" - # The rig itself: the grading, the runner and this workflow. + # The rig itself: the grading, the runner, the selection and this workflow. - "apps/solidcraft-cli/src/kernel_cases.rs" - "xtask/src/kernel_cases.rs" - "xtask/src/kernel_ladder.rs" - "scripts/fetch-smlib.sh" + - "scripts/ci/kernel_rig_plan.py" + - "scripts/ci/test_kernel_rig_plan.py" - ".github/workflows/kernel-rig.yml" merge_group: workflow_call: @@ -67,10 +78,44 @@ env: CARGO_TERM_COLOR: always jobs: - build: - name: Build the CLI + plan: + name: Select the rig areas # Draft pull requests run no CI, as in ci.yml. if: github.event_name != 'pull_request' || !github.event.pull_request.draft + runs-on: blacksmith-2vcpu-ubuntu-2404 + timeout-minutes: 5 + outputs: + # The shard matrix (JSON list of areas and the ladder; [] when nothing is selected). + shards: ${{ steps.plan.outputs.shards }} + # Whether the build job, and with it the coverage check, runs. + build: ${{ steps.plan.outputs.build }} + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + # A pull request's diff needs its base's history. + fetch-depth: ${{ github.event_name == 'pull_request' && '0' || '1' }} + - name: Selection self-test + run: python3 -I scripts/ci/test_kernel_rig_plan.py + - id: plan + name: Map the changed files to areas + env: + EVENT_NAME: ${{ github.event_name }} + BASE_SHA: ${{ github.event.pull_request.base.sha }} + HEAD_SHA: ${{ github.event.pull_request.head.sha }} + run: | + # Pull requests run the areas their diff reaches; pushes, merge groups, the release + # gate and a run by hand run every area. + if [ "$EVENT_NAME" = pull_request ]; then + git diff --no-renames --name-only -z "$BASE_SHA...$HEAD_SHA" > "$RUNNER_TEMP/rig-paths" + python3 -I scripts/ci/kernel_rig_plan.py --paths "$RUNNER_TEMP/rig-paths" --github-output "$GITHUB_OUTPUT" + else + python3 -I scripts/ci/kernel_rig_plan.py --all --github-output "$GITHUB_OUTPUT" + fi + + build: + name: Build the CLI + needs: plan + if: needs.plan.outputs.build == 'true' runs-on: blacksmith-8vcpu-ubuntu-2404 timeout-minutes: 60 env: @@ -110,9 +155,15 @@ jobs: # A tar keeps the executable bits, which an artifact drops. xtask finds the repository from # the path it was built in (CARGO_MANIFEST_DIR), which is the same checkout path in every # job of this workflow. + # Every registry command is used by a case or listed in tests/kernel-cases/EXEMPT. + - name: Every command has a case + run: target/debug/xtask kernel-cases --coverage --cli target/release/solidcraft-cli + # A coverage-only run (the registry or the cases changed, no area selected) runs no shard. - name: Pack the binaries + if: needs.plan.outputs.shards != '[]' run: tar -cf "$RUNNER_TEMP/kernel-rig-bin.tar" -C target release/solidcraft-cli debug/xtask - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + if: needs.plan.outputs.shards != '[]' with: name: kernel-rig-bin path: ${{ runner.temp }}/kernel-rig-bin.tar @@ -123,16 +174,18 @@ jobs: shard: name: Kernel rig (${{ matrix.shard }}) - needs: build + needs: [plan, build] + if: needs.plan.outputs.shards != '[]' runs-on: blacksmith-4vcpu-ubuntu-2404 timeout-minutes: 30 strategy: fail-fast: false matrix: - # Every area of tests/kernel-cases/ and the ladder. On the build box (aarch64, 4 cases at - # a time) the slowest areas took about 1 minute (booleans, 212 s of cases with one of - # 84 s; threads, 161 s) and the ladder, one case at a time, 92 s: no area needs splitting. - shard: [booleans, continuity, crashes, fillets, import, ladder, sheet-metal, shell, sweeps, tessellation, threads] + # The areas of tests/kernel-cases/ the plan selected, and the ladder. On the build box + # (aarch64, 4 cases at a time) the slowest areas took about 1 minute (booleans, 212 s of + # cases with one of 84 s; threads, 161 s) and the ladder, one case at a time, 92 s: no area + # needs splitting. + shard: ${{ fromJSON(needs.plan.outputs.shards) }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 @@ -162,14 +215,20 @@ jobs: # One check for the whole gate, for branch protection and the merge queue. kernel-rig: name: kernel-rig - needs: [build, shard] + needs: [plan, build, shard] if: always() && (github.event_name != 'pull_request' || !github.event.pull_request.draft) runs-on: blacksmith-2vcpu-ubuntu-2404 steps: - - name: Every shard passed + # A skipped build or shard counts as passed only when the plan selected none. + - name: Every selected job passed env: + PLAN: ${{ needs.plan.result }} + WANT_BUILD: ${{ needs.plan.outputs.build }} + WANT_SHARDS: ${{ needs.plan.outputs.shards }} BUILD: ${{ needs.build.result }} SHARDS: ${{ needs.shard.result }} run: | - test "$BUILD" = success - test "$SHARDS" = success + echo "plan=$PLAN build=$BUILD shards=$SHARDS selected=$WANT_SHARDS" + test "$PLAN" = success + if [ "$WANT_BUILD" = true ]; then test "$BUILD" = success; else test "$BUILD" = skipped; fi + if [ "$WANT_SHARDS" != '[]' ]; then test "$SHARDS" = success; else test "$SHARDS" = skipped; fi diff --git a/scripts/ci/kernel_rig_plan.py b/scripts/ci/kernel_rig_plan.py new file mode 100644 index 000000000..511621287 --- /dev/null +++ b/scripts/ci/kernel_rig_plan.py @@ -0,0 +1,142 @@ +#!/usr/bin/env python3 +"""Select the kernel rig areas a pull request affects (.github/workflows/kernel-rig.yml). + +Usage: kernel_rig_plan.py (--all | --paths FILE) [--root DIR] [--github-output FILE] + +FILE holds the changed paths relative to the repository root, separated by NUL (git diff -z); +"-" reads standard input. --all selects every area (pushes, merge groups, the release gate, a run +by hand). --root is the repository (default: two folders up from this script). + +The areas are the folders of tests/kernel-cases/ (the ladder aside), so a new area joins by +having a folder with its cases, its KNOWN_FAILING and its PATHS. A changed path selects: +- every area, when it matches tests/kernel-cases/PATHS-ALL (the shared core: SMLib, geom, the + kernel's core, the rig's grader and runner, the workflow); +- an area, when it is under tests/kernel-cases// or matches that area's PATHS: one git + pathspec glob a line (`*` within a folder, `**` across folders), `#` starts a comment. +The ladder spans every operation: it runs whenever any area does, and on a change under +tests/kernel-cases/ladder/. + +The coverage check (`cargo xtask kernel-cases --coverage`) runs in the build job. The build runs +when a shard does, or when the command registry or the cases may have changed (COVERAGE below), +so a new command without a case fails on its own pull request. + +Prints and optionally appends to $GITHUB_OUTPUT: + shards=["booleans", ..., "ladder"] the shard matrix, JSON (empty list: no shard runs) + build=true|false the build job (and the coverage check) runs +""" +import argparse +import json +import os +import re +import sys + +CASES = "tests/kernel-cases" +LADDER = "ladder" +# Changes here may add or remove a registry command, or the case that covers one: the coverage +# check must see them even when no area runs. +COVERAGE = ( + "crates/engine/src/cmd/**", + "tests/kernel-cases/EXEMPT", + "tests/kernel-cases/**/recipe.json", + "xtask/src/kernel_cases.rs", +) + + +def glob_regex(glob): + """A git pathspec glob (`:(glob)` magic) as a regular expression over a whole path: `**/` + matches any folders (none too), a trailing `/**` everything below, `*` and `?` stay within + one folder.""" + out, i = [], 0 + while i < len(glob): + if glob.startswith("**/", i): + out.append("(?:.*/)?") + i += 3 + elif glob.startswith("**", i): + out.append(".*") + i += 2 + elif glob[i] == "*": + out.append("[^/]*") + i += 1 + elif glob[i] == "?": + out.append("[^/]") + i += 1 + else: + out.append(re.escape(glob[i])) + i += 1 + return re.compile("".join(out) + r"\Z") + + +def read_globs(path): + """The globs of a PATHS file: one a line, blank lines and `#` comments skipped.""" + with open(path, encoding="utf-8") as f: + lines = [line.strip() for line in f] + globs = [line for line in lines if line and not line.startswith("#")] + for g in globs: + if g.startswith("/") or g.startswith(":") or "\\" in g: + raise SystemExit(f"{path}: `{g}`: a glob is relative to the repository root, with / and no pathspec magic") + return globs + + +def areas(root): + """Every area (a folder of tests/kernel-cases/ but the ladder) with its PATHS globs.""" + base = os.path.join(root, CASES) + out = {} + for name in sorted(os.listdir(base)): + if name == LADDER or not os.path.isdir(os.path.join(base, name)): + continue + paths = os.path.join(base, name, "PATHS") + if not os.path.isfile(paths): + raise SystemExit(f"{CASES}/{name}/PATHS is missing: every area lists the source files whose change reruns it") + out[name] = read_globs(paths) + return out + + +def matches(globs, path): + return any(glob_regex(g).match(path) for g in globs) + + +def select(root, paths, everything=False): + """Return (shards, build): the areas to run, in order and the ladder last, and whether the + build job runs.""" + by_area = areas(root) + if everything: + return [*by_area, LADDER], True + shared = read_globs(os.path.join(root, CASES, "PATHS-ALL")) + hit, ladder = set(), False + for path in paths: + if matches(shared, path): + return [*by_area, LADDER], True + if path.startswith(f"{CASES}/{LADDER}/"): + ladder = True + for area, globs in by_area.items(): + if path.startswith(f"{CASES}/{area}/") or matches(globs, path): + hit.add(area) + shards = [a for a in by_area if a in hit] + if shards or ladder: + shards.append(LADDER) + return shards, bool(shards) or any(matches(COVERAGE, p) for p in paths) + + +def read_paths(src): + data = sys.stdin.buffer.read() if src == "-" else open(src, "rb").read() + return [p.decode() for p in data.split(b"\0") if p] + + +def main(): + ap = argparse.ArgumentParser() + group = ap.add_mutually_exclusive_group(required=True) + group.add_argument("--paths") + group.add_argument("--all", action="store_true") + ap.add_argument("--root", default=os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) + ap.add_argument("--github-output") + a = ap.parse_args() + shards, build = select(a.root, [] if a.all else read_paths(a.paths), everything=a.all) + lines = [f"shards={json.dumps(shards)}", f"build={'true' if build else 'false'}"] + print("\n".join(lines)) + if a.github_output: + with open(a.github_output, "a", encoding="utf-8") as f: + f.write("\n".join(lines) + "\n") + + +if __name__ == "__main__": + main() diff --git a/scripts/ci/test_kernel_rig_plan.py b/scripts/ci/test_kernel_rig_plan.py new file mode 100644 index 000000000..27466383a --- /dev/null +++ b/scripts/ci/test_kernel_rig_plan.py @@ -0,0 +1,142 @@ +#!/usr/bin/env python3 +"""Self-test for kernel_rig_plan.py. Run: python3 -I scripts/ci/test_kernel_rig_plan.py (from the +repo root). + +Uses a small synthetic tests/kernel-cases/, then the real one: every area has its PATHS and +KNOWN_FAILING, every glob names files that exist, and the workflow's trigger paths cover them all. +""" +import os +import re +import subprocess +import sys +import tempfile +import unittest + +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +import kernel_rig_plan as plan # noqa: E402 + +ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +WORKFLOW = os.path.join(ROOT, ".github", "workflows", "kernel-rig.yml") + + +def write(root, rel, text=""): + path = os.path.join(root, rel) + os.makedirs(os.path.dirname(path), exist_ok=True) + with open(path, "w", encoding="utf-8") as f: + f.write(text) + + +class Glob(unittest.TestCase): + def test_star_stays_in_a_folder_and_double_star_crosses(self): + self.assertTrue(plan.glob_regex("crates/kernel/src/blend*.rs").match("crates/kernel/src/blend_smlib.rs")) + self.assertFalse(plan.glob_regex("crates/kernel/src/*.rs").match("crates/kernel/src/tess/grid.rs")) + self.assertTrue(plan.glob_regex("crates/kernel/src/tess/**").match("crates/kernel/src/tess/a/b.rs")) + self.assertFalse(plan.glob_regex("crates/kernel/src/tess/**").match("crates/kernel/src/tess.rs")) + self.assertTrue(plan.glob_regex("tests/**/recipe.json").match("tests/recipe.json")) + self.assertTrue(plan.glob_regex("tests/**/recipe.json").match("tests/a/b/recipe.json")) + self.assertFalse(plan.glob_regex("a.rs").match("a.rsx")) + self.assertFalse(plan.glob_regex("a.rs").match("b/a.rs")) + + +class Synthetic(unittest.TestCase): + def setUp(self): + self.tmp = tempfile.TemporaryDirectory() + r = self.root = self.tmp.name + write(r, "tests/kernel-cases/PATHS-ALL", "# shared\ncrates/geom/**\n\n.github/workflows/kernel-rig.yml\n") + write(r, "tests/kernel-cases/fillets/PATHS", "# blends\ncrates/kernel/src/blend*.rs\n") + write(r, "tests/kernel-cases/shell/PATHS", "crates/kernel/src/offset*.rs\ncrates/kernel/src/blend_smlib.rs\n") + write(r, "tests/kernel-cases/ladder/ladder.json", "{}") + write(r, "tests/kernel-cases/README.md") + + def tearDown(self): + self.tmp.cleanup() + + def select(self, *paths): + return plan.select(self.root, list(paths)) + + def test_an_area_runs_on_its_paths_with_the_ladder(self): + self.assertEqual(self.select("crates/kernel/src/blend.rs"), (["fillets", "ladder"], True)) + self.assertEqual(self.select("crates/kernel/src/blend_smlib.rs"), (["fillets", "shell", "ladder"], True)) + + def test_a_change_to_an_areas_cases_runs_it(self): + self.assertEqual(self.select("tests/kernel-cases/shell/1-x/expected.json"), (["shell", "ladder"], True)) + self.assertEqual(self.select("tests/kernel-cases/shell/PATHS"), (["shell", "ladder"], True)) + self.assertEqual(self.select("tests/kernel-cases/ladder/golden.json"), (["ladder"], True)) + + def test_the_shared_core_runs_every_area(self): + for p in ["crates/geom/src/brep.rs", ".github/workflows/kernel-rig.yml"]: + self.assertEqual(self.select("docs/a.md", p), (["fillets", "shell", "ladder"], True), p) + + def test_unrelated_changes_run_nothing(self): + self.assertEqual(self.select("crates/ui-egui/src/app.rs", "docs/a.md", "tests/kernel-cases/README.md"), ([], False)) + + def test_a_registry_or_case_change_builds_for_the_coverage_check(self): + self.assertEqual(self.select("crates/engine/src/cmd/view_navigation.rs"), ([], True)) + self.assertEqual(self.select("tests/kernel-cases/EXEMPT"), ([], True)) + + def test_everything_runs_every_area(self): + self.assertEqual(plan.select(self.root, [], everything=True), (["fillets", "shell", "ladder"], True)) + + def test_a_new_area_joins_from_its_folder(self): + write(self.root, "tests/kernel-cases/surfaces/PATHS", "crates/kernel/src/surface_*.rs\n") + self.assertEqual(self.select("crates/kernel/src/surface_trim.rs"), (["surfaces", "ladder"], True)) + self.assertEqual(plan.select(self.root, [], everything=True)[0], ["fillets", "shell", "surfaces", "ladder"]) + + def test_an_area_without_paths_is_an_error(self): + os.makedirs(os.path.join(self.root, "tests/kernel-cases/plastic")) + with self.assertRaises(SystemExit) as e: + self.select("crates/geom/src/brep.rs") + self.assertIn("plastic/PATHS is missing", str(e.exception)) + + +def trigger_globs(): + """The pull_request trigger paths of the workflow (the push trigger lists the same).""" + with open(WORKFLOW, encoding="utf-8") as f: + text = f.read() + events = {} + for event in ("pull_request", "push"): + block = re.search(rf"^ {event}:\n((?: .*\n|\s*\n)+)", text, re.M) + assert block, event + paths = block.group(1).split("paths:", 1)[1] + events[event] = re.findall(r'^\s+- "([^"]+)"', paths, re.M) + return events + + +def sample(glob): + """A path the glob matches: each wildcard filled in.""" + return glob.replace("**", "x/y").replace("*", "x").replace("?", "x") + + +class Real(unittest.TestCase): + def test_every_area_has_its_lists_and_every_glob_names_files(self): + # Tracked files and new ones not yet committed (not the ignored ones). + ls = ["git", "ls-files", "--cached", "--others", "--exclude-standard"] + tracked = subprocess.run(ls, cwd=ROOT, check=True, capture_output=True, text=True).stdout.split("\n") + shared = plan.read_globs(os.path.join(ROOT, plan.CASES, "PATHS-ALL")) + areas = plan.areas(ROOT) + self.assertTrue(areas) + for area, globs in {"PATHS-ALL": shared, **areas}.items(): + if area != "PATHS-ALL": + self.assertTrue(os.path.isfile(os.path.join(ROOT, plan.CASES, area, "KNOWN_FAILING")), area) + for g in globs: + with self.subTest(area=area, glob=g): + rx = plan.glob_regex(g) + self.assertTrue(any(rx.match(t) for t in tracked), f"{area}: {g} matches no file") + + def test_the_workflow_triggers_on_every_glob(self): + events = trigger_globs() + self.assertEqual(events["pull_request"], events["push"]) + triggers = [plan.glob_regex(g) for g in events["pull_request"]] + globs = [*plan.read_globs(os.path.join(ROOT, plan.CASES, "PATHS-ALL")), *plan.COVERAGE] + for area, own in plan.areas(ROOT).items(): + globs += [*own, f"{plan.CASES}/{area}/**"] + for g in globs: + with self.subTest(glob=g): + self.assertTrue(any(t.match(sample(g)) for t in triggers), f"{g}: not under the workflow's trigger paths") + + def test_a_ui_change_runs_nothing(self): + self.assertEqual(plan.select(ROOT, ["crates/ui-egui/src/app.rs", "docs/kernel-cases.md", "README.md"]), ([], False)) + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/kernel-cases/PATHS-ALL b/tests/kernel-cases/PATHS-ALL new file mode 100644 index 000000000..098f3c205 --- /dev/null +++ b/tests/kernel-cases/PATHS-ALL @@ -0,0 +1,58 @@ +# The shared core: a change to any of these reruns every area of the kernel rig and the ladder +# (scripts/ci/kernel_rig_plan.py). One git pathspec glob a line, relative to the repository root: +# `*` stays within a folder, `**` crosses folders. Each area's own sources are in /PATHS. +# +# SMLib: the bindings, the schema 4 record bridge and the pinned revision (SMLIB_REV, +# SMLIB_PREBUILT), and the script that fetches it. +crates/smlib/** +scripts/fetch-smlib.sh +# The geometry every body is made of: B-rep record, curves, surfaces, meshes. +crates/geom/** +# The kernel's core, which every case goes through: bodies, extrude/revolve/primitives, booleans +# and placements, the planar prisms, the SMLib sweeps and booleans, history and provenance, the +# native bridge to SMLib, tessellation, and what the grader measures (measure, validity, counts). +crates/kernel/Cargo.toml +crates/kernel/src/body.rs +crates/kernel/src/boolean_record.rs +crates/kernel/src/build.rs +crates/kernel/src/freeform.rs +crates/kernel/src/heal.rs +crates/kernel/src/history.rs +crates/kernel/src/lib.rs +crates/kernel/src/measure.rs +crates/kernel/src/native.rs +crates/kernel/src/native/** +crates/kernel/src/numbered.rs +crates/kernel/src/ops.rs +crates/kernel/src/par.rs +crates/kernel/src/planar_regularize.rs +crates/kernel/src/planar_sources.rs +crates/kernel/src/plane_fit.rs +crates/kernel/src/prism.rs +crates/kernel/src/prism_curve.rs +crates/kernel/src/prism_measure.rs +crates/kernel/src/profile.rs +crates/kernel/src/provenance.rs +crates/kernel/src/record.rs +crates/kernel/src/shell_groups.rs +crates/kernel/src/smlib_boolean.rs +crates/kernel/src/smlib_sweeps.rs +crates/kernel/src/tess/** +crates/kernel/src/topo.rs +crates/kernel/src/validity.rs +crates/kernel/src/watch.rs +# Timeline evaluation and the model cache, which every feature is evaluated through. +crates/doc/src/eval.rs +crates/doc/src/model_cache.rs +crates/doc/src/walk.rs +# The command registry and the solid feature commands every case starts with (sketches made +# into boxes, cylinders, extrusions, revolutions, combines, moves; fillets, holes, shells, sweeps +# and lofts live there too). +crates/engine/src/cmd/features.rs +crates/engine/src/cmd/mod.rs +# The rig itself: the grader, the runner, the selection and this gate's workflow. +.github/workflows/kernel-rig.yml +apps/solidcraft-cli/src/kernel_cases.rs +scripts/ci/kernel_rig_plan.py +xtask/src/kernel_cases.rs +xtask/src/kernel_ladder.rs diff --git a/tests/kernel-cases/booleans/PATHS b/tests/kernel-cases/booleans/PATHS new file mode 100644 index 000000000..e94672b0e --- /dev/null +++ b/tests/kernel-cases/booleans/PATHS @@ -0,0 +1,30 @@ +# The source files whose change reruns this area of the kernel rig (scripts/ci/kernel_rig_plan.py), +# besides the shared core in ../PATHS-ALL. One git pathspec glob a line, relative to the +# repository root; `#` starts a comment. +# Combine, cuts, holes, patterns, split, mirror, draft, emboss, remove, press/pull, delete face, +# coils, text, surface extend/thicken, and bodies moved between components. +crates/doc/src/body_transfer.rs +crates/doc/src/body_transfer_sheet.rs +crates/doc/src/eval_more.rs +crates/doc/src/eval_surface.rs +crates/doc/src/hole_reference.rs +crates/doc/src/thread_catalog.rs +crates/engine/src/cmd/component.rs +crates/engine/src/cmd/delete.rs +crates/engine/src/cmd/features_more.rs +crates/engine/src/cmd/surface.rs +crates/kernel/src/assemble.rs +crates/kernel/src/delete_face.rs +crates/kernel/src/draft_corners.rs +crates/kernel/src/emboss.rs +crates/kernel/src/fill.rs +crates/kernel/src/helix.rs +crates/kernel/src/intersection.rs +crates/kernel/src/offset.rs +crates/kernel/src/offset_backend.rs +crates/kernel/src/polybool.rs +crates/kernel/src/polyhedron.rs +crates/kernel/src/sew.rs +crates/kernel/src/splitface.rs +crates/kernel/src/surface_extend.rs +crates/kernel/src/surfaces.rs diff --git a/tests/kernel-cases/continuity/PATHS b/tests/kernel-cases/continuity/PATHS new file mode 100644 index 000000000..3042e35cf --- /dev/null +++ b/tests/kernel-cases/continuity/PATHS @@ -0,0 +1,17 @@ +# The source files whose change reruns this area of the kernel rig (scripts/ci/kernel_rig_plan.py), +# besides the shared core in ../PATHS-ALL. One git pathspec glob a line, relative to the +# repository root; `#` starts a comment. +# Seams of designed order: fillets and chamfers, patches, stitches and trims, and the continuity +# measurement itself (Continuity Analysis). +crates/doc/src/eval_surface.rs +crates/engine/src/cmd/delete.rs +crates/engine/src/cmd/surface.rs +crates/engine/src/cmd/surface_analysis.rs +crates/kernel/src/blend*.rs +crates/kernel/src/continuity.rs +crates/kernel/src/continuity_order.rs +crates/kernel/src/corner_g2.rs +crates/kernel/src/delete_face.rs +crates/kernel/src/fill.rs +crates/kernel/src/surface_trim.rs +crates/kernel/src/surfaces.rs diff --git a/tests/kernel-cases/crashes/PATHS b/tests/kernel-cases/crashes/PATHS new file mode 100644 index 000000000..b126c37fc --- /dev/null +++ b/tests/kernel-cases/crashes/PATHS @@ -0,0 +1,21 @@ +# The source files whose change reruns this area of the kernel rig (scripts/ci/kernel_rig_plan.py), +# besides the shared core in ../PATHS-ALL. One git pathspec glob a line, relative to the +# repository root; `#` starts a comment. +# Crashes and hangs inside kernel operations: fillets, lofts, patterns, delete face, snap fits, +# export, measurement and document inspection. +crates/doc/src/plastic.rs +crates/engine/src/cmd/delete.rs +crates/engine/src/cmd/file.rs +crates/engine/src/cmd/inspect.rs +crates/engine/src/cmd/measure_sel.rs +crates/engine/src/cmd/plastic.rs +crates/kernel/src/blend*.rs +crates/kernel/src/corner_g2.rs +crates/kernel/src/delete_face.rs +crates/kernel/src/fill.rs +crates/kernel/src/lip.rs +crates/kernel/src/loft_blend.rs +crates/kernel/src/loft_rails.rs +crates/kernel/src/step.rs +crates/kernel/src/step_out.rs +crates/step/** diff --git a/tests/kernel-cases/fillets/PATHS b/tests/kernel-cases/fillets/PATHS new file mode 100644 index 000000000..1eed0ecad --- /dev/null +++ b/tests/kernel-cases/fillets/PATHS @@ -0,0 +1,15 @@ +# The source files whose change reruns this area of the kernel rig (scripts/ci/kernel_rig_plan.py), +# besides the shared core in ../PATHS-ALL. One git pathspec glob a line, relative to the +# repository root; `#` starts a comment. +# Fillets and chamfers (constant, per-edge, variable, G2 corners), with the drafts, shells, holes +# and patterns they round, and the continuity the blends are graded on. +crates/doc/src/hole_reference.rs +crates/kernel/src/blend*.rs +crates/kernel/src/continuity.rs +crates/kernel/src/continuity_order.rs +crates/kernel/src/corner_g2.rs +crates/kernel/src/draft_corners.rs +crates/kernel/src/fill.rs +crates/kernel/src/offset.rs +crates/kernel/src/offset_backend.rs +crates/kernel/src/polyhedron.rs diff --git a/tests/kernel-cases/import/PATHS b/tests/kernel-cases/import/PATHS new file mode 100644 index 000000000..7769bec96 --- /dev/null +++ b/tests/kernel-cases/import/PATHS @@ -0,0 +1,22 @@ +# The source files whose change reruns this area of the kernel rig (scripts/ci/kernel_rig_plan.py), +# besides the shared core in ../PATHS-ALL. One git pathspec glob a line, relative to the +# repository root; `#` starts a comment. +# STEP and IGES import and export, mesh import (3MF, STL, OBJ, glTF) and mesh-to-solid conversion. +crates/engine/src/cmd/file.rs +crates/engine/src/cmd/file_import.rs +crates/engine/src/cmd/mesh.rs +crates/io/src/formats.rs +crates/io/src/gltf_in.rs +crates/io/src/obj.rs +crates/io/src/threemf.rs +crates/kernel/src/iges_in.rs +crates/kernel/src/iges_in/** +crates/kernel/src/iges_out.rs +crates/kernel/src/mesh_convert.rs +crates/kernel/src/meshbody.rs +crates/kernel/src/sew.rs +crates/kernel/src/splitface.rs +crates/kernel/src/step.rs +crates/kernel/src/step_in/** +crates/kernel/src/step_out.rs +crates/step/** diff --git a/tests/kernel-cases/sheet-metal/PATHS b/tests/kernel-cases/sheet-metal/PATHS new file mode 100644 index 000000000..7bc3beaf4 --- /dev/null +++ b/tests/kernel-cases/sheet-metal/PATHS @@ -0,0 +1,15 @@ +# The source files whose change reruns this area of the kernel rig (scripts/ci/kernel_rig_plan.py), +# besides the shared core in ../PATHS-ALL. One git pathspec glob a line, relative to the +# repository root; `#` starts a comment. +# Sheet metal: rules, flanges, folds, unfold/refold, flat patterns, convert to sheet metal, with +# the parameters that drive them. +crates/doc/src/body_transfer_sheet.rs +crates/doc/src/params.rs +crates/doc/src/sheet.rs +crates/doc/src/sheet_convert.rs +crates/doc/src/sheet_face_names.rs +crates/engine/src/cmd/parameters.rs +crates/engine/src/cmd/sheet.rs +crates/kernel/src/offset_backend.rs +crates/kernel/src/polyhedron.rs +crates/kernel/src/sew.rs diff --git a/tests/kernel-cases/shell/PATHS b/tests/kernel-cases/shell/PATHS new file mode 100644 index 000000000..e7fae3072 --- /dev/null +++ b/tests/kernel-cases/shell/PATHS @@ -0,0 +1,19 @@ +# The source files whose change reruns this area of the kernel rig (scripts/ci/kernel_rig_plan.py), +# besides the shared core in ../PATHS-ALL. One git pathspec glob a line, relative to the +# repository root; `#` starts a comment. +# Shell, offset faces, thicken, split face and body, emboss and remove on shelled parts. +crates/doc/src/eval_more.rs +crates/doc/src/eval_surface.rs +crates/doc/src/params.rs +crates/engine/src/cmd/delete.rs +crates/engine/src/cmd/features_more.rs +crates/engine/src/cmd/parameters.rs +crates/engine/src/cmd/surface.rs +crates/kernel/src/delete_face.rs +crates/kernel/src/emboss.rs +crates/kernel/src/offset.rs +crates/kernel/src/offset_backend.rs +crates/kernel/src/polyhedron.rs +crates/kernel/src/splitface.rs +crates/kernel/src/surface_offset.rs +crates/kernel/src/surfaces.rs diff --git a/tests/kernel-cases/sweeps/PATHS b/tests/kernel-cases/sweeps/PATHS new file mode 100644 index 000000000..e15d0fea8 --- /dev/null +++ b/tests/kernel-cases/sweeps/PATHS @@ -0,0 +1,20 @@ +# The source files whose change reruns this area of the kernel rig (scripts/ci/kernel_rig_plan.py), +# besides the shared core in ../PATHS-ALL. One git pathspec glob a line, relative to the +# repository root; `#` starts a comment. +# Sweeps, lofts (rails, multi-section blends), pipes, coils, ribs, surface lofts and sweeps, their +# 3D sketch paths and the construction planes they run on. +crates/doc/src/construct.rs +crates/doc/src/eval_more.rs +crates/doc/src/eval_surface.rs +crates/doc/src/project3d.rs +crates/engine/src/cmd/construct.rs +crates/engine/src/cmd/features_more.rs +crates/engine/src/cmd/sketch_3d.rs +crates/engine/src/cmd/surface.rs +crates/kernel/src/helix.rs +crates/kernel/src/loft_blend.rs +crates/kernel/src/loft_rails.rs +crates/kernel/src/point_path.rs +crates/kernel/src/splitface.rs +crates/kernel/src/surfaces.rs +crates/kernel/src/sweep_path.rs diff --git a/tests/kernel-cases/tessellation/PATHS b/tests/kernel-cases/tessellation/PATHS new file mode 100644 index 000000000..fbec93da1 --- /dev/null +++ b/tests/kernel-cases/tessellation/PATHS @@ -0,0 +1,7 @@ +# The source files whose change reruns this area of the kernel rig (scripts/ci/kernel_rig_plan.py), +# besides the shared core in ../PATHS-ALL. One git pathspec glob a line, relative to the +# repository root; `#` starts a comment. +# Display meshes (the tessellator itself is in the shared core): which edges the shaded view +# smooths over, and mesh bodies. +crates/kernel/src/meshbody.rs +crates/kernel/src/smooth_edges.rs diff --git a/tests/kernel-cases/threads/PATHS b/tests/kernel-cases/threads/PATHS new file mode 100644 index 000000000..41e9d80cb --- /dev/null +++ b/tests/kernel-cases/threads/PATHS @@ -0,0 +1,12 @@ +# The source files whose change reruns this area of the kernel rig (scripts/ci/kernel_rig_plan.py), +# besides the shared core in ../PATHS-ALL. One git pathspec glob a line, relative to the +# repository root; `#` starts a comment. +# Modelled and cosmetic threads, tapped holes, and the thread and pipe-thread catalogues. +crates/doc/src/eval_thread.rs +crates/doc/src/hole_reference.rs +crates/doc/src/pipe_thread_catalog.rs +crates/doc/src/pipe_thread_sizes.rs +crates/doc/src/thread_catalog.rs +crates/doc/src/thread_forms.rs +crates/engine/src/cosmetic_threads.rs +crates/kernel/src/helix.rs From b67e93211d50ce7e1f54f59306fcd73f82e8085f Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:55:07 -0400 Subject: [PATCH 019/108] Kernel rig: an area's PATHS names only its own files, never the shared core The booleans area also reruns on sketch projection from the model. The selection self-test fails on an area glob that matches a file PATHS-ALL already covers, so a whole-crate glob cannot creep in. Co-Authored-By: Claude Opus 5.5 --- scripts/ci/test_kernel_rig_plan.py | 14 ++++++++++++++ tests/kernel-cases/booleans/PATHS | 5 ++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/scripts/ci/test_kernel_rig_plan.py b/scripts/ci/test_kernel_rig_plan.py index 27466383a..1c3bc1a67 100644 --- a/scripts/ci/test_kernel_rig_plan.py +++ b/scripts/ci/test_kernel_rig_plan.py @@ -123,6 +123,20 @@ class Real(unittest.TestCase): rx = plan.glob_regex(g) self.assertTrue(any(rx.match(t) for t in tracked), f"{area}: {g} matches no file") + def test_an_area_names_only_its_own_files(self): + # The shared core is in PATHS-ALL; an area's PATHS repeating it (or a whole crate's + # folder) would only blur what the area is about. + ls = ["git", "ls-files", "--cached", "--others", "--exclude-standard"] + files = subprocess.run(ls, cwd=ROOT, check=True, capture_output=True, text=True).stdout.split("\n") + shared = plan.read_globs(os.path.join(ROOT, plan.CASES, "PATHS-ALL")) + core = {f for f in files if plan.matches(shared, f)} + for area, globs in plan.areas(ROOT).items(): + for g in globs: + rx = plan.glob_regex(g) + overlap = sorted(f for f in core if rx.match(f)) + with self.subTest(area=area, glob=g): + self.assertFalse(overlap, f"{area}/PATHS: {g} names shared-core files (PATHS-ALL): {overlap[:3]}") + def test_the_workflow_triggers_on_every_glob(self): events = trigger_globs() self.assertEqual(events["pull_request"], events["push"]) diff --git a/tests/kernel-cases/booleans/PATHS b/tests/kernel-cases/booleans/PATHS index e94672b0e..effcf85ed 100644 --- a/tests/kernel-cases/booleans/PATHS +++ b/tests/kernel-cases/booleans/PATHS @@ -2,16 +2,19 @@ # besides the shared core in ../PATHS-ALL. One git pathspec glob a line, relative to the # repository root; `#` starts a comment. # Combine, cuts, holes, patterns, split, mirror, draft, emboss, remove, press/pull, delete face, -# coils, text, surface extend/thicken, and bodies moved between components. +# coils, text, surface extend/thicken, sketches projected from the model, and bodies moved between +# components. crates/doc/src/body_transfer.rs crates/doc/src/body_transfer_sheet.rs crates/doc/src/eval_more.rs crates/doc/src/eval_surface.rs crates/doc/src/hole_reference.rs +crates/doc/src/project.rs crates/doc/src/thread_catalog.rs crates/engine/src/cmd/component.rs crates/engine/src/cmd/delete.rs crates/engine/src/cmd/features_more.rs +crates/engine/src/cmd/sketch_project.rs crates/engine/src/cmd/surface.rs crates/kernel/src/assemble.rs crates/kernel/src/delete_face.rs From d671bbbc12e5eb180e5d2439c0e5798035dbb482 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:55:07 -0400 Subject: [PATCH 020/108] Kernel rig: every registry command has a case or an exemption (kernel-cases --coverage) cargo xtask kernel-cases --coverage lists every built registry command that no recipe.json under tests/kernel-cases runs and fails unless tests/kernel-cases/EXEMPT lists it. EXEMPT holds 252 commands with no geometry to grade and, under [to cover], 133 geometry commands still waiting for a case; a listed command a case now uses, or one the registry no longer has, fails the check, so the to-cover section only shrinks. The gate's build job runs it. Co-Authored-By: Claude Opus 5.5 --- tests/kernel-cases/EXEMPT | 399 ++++++++++++++++++++++++++++++++++++++ xtask/src/kernel_cases.rs | 181 ++++++++++++++++- xtask/src/main.rs | 5 +- 3 files changed, 583 insertions(+), 2 deletions(-) create mode 100644 tests/kernel-cases/EXEMPT diff --git a/tests/kernel-cases/EXEMPT b/tests/kernel-cases/EXEMPT new file mode 100644 index 000000000..5bd7ed2b3 --- /dev/null +++ b/tests/kernel-cases/EXEMPT @@ -0,0 +1,399 @@ +# Registry commands with no kernel rig case (`cargo xtask kernel-cases --coverage`). Every other +# command of `solidcraft-cli commands` (planned ones aside) must be run by some recipe.json under +# tests/kernel-cases/. One line a command: ` `; `#` starts a comment. +# Each section is sorted, with no id twice. +# +# Commands with no geometry to grade: the view, rendering, appearance, materials, selection, the +# browser, files and saving, documents, diagnostics, and component, parameter and timeline +# bookkeeping. Each is covered by the engine's and the UI's own tests. + +appearance.assign appearance only: colours and textures +appearance.library appearance only: colours and textures +appearance.list appearance only: colours and textures +assembly.bom a bill of materials report +body.rename a body name +browser.collapse_all the browser tree: order, groups and folding +browser.expand_all the browser tree: order, groups and folding +browser.group the browser tree: order, groups and folding +browser.move the browser tree: order, groups and folding +browser.order the browser tree: order, groups and folding +browser.rename_group the browser tree: order, groups and folding +browser.ungroup the browser tree: order, groups and folding +canvas.calibrate reference images, and sketches traced from them (sketch only) +canvas.decal reference images, and sketches traced from them (sketch only) +canvas.delete reference images, and sketches traced from them (sketch only) +canvas.edit reference images, and sketches traced from them (sketch only) +canvas.insert reference images, and sketches traced from them (sketch only) +canvas.to_sketch reference images, and sketches traced from them (sketch only) +component.break_link component links +component.copies a listing of identical copies +component.cycle_color component colours +component.delete removes a component: no geometry built +component.links component links +component.list a listing +component.metadata component metadata +component.metadata.set component metadata +component.properties component properties +component.relink component links +component.rename a component name +component.replace_with_link component links +component.unlock component locking +component.update_links component links +contact.list a listing of contact sets +diagnostics.crash_report crash reports +diagnostics.crash_reports crash reports +diagnostics.crash_reports.clear crash reports +diagnostics.crash_test crash reports +diagnostics.profile timing: where a command's time goes +doc.open opening and recovering documents +doc.recover opening and recovering documents +doc.recovery_discard opening and recovering documents +doc.recovery_list opening and recovering documents +document.metadata document metadata and revisions +document.metadata.remove document metadata and revisions +document.metadata.set document metadata and revisions +document.revision document metadata and revisions +edit.checkpoint undo, redo and checkpoints: an earlier state restored, no new geometry +edit.redo undo, redo and checkpoints: an earlier state restored, no new geometry +edit.restore_checkpoint undo, redo and checkpoints: an earlier state restored, no new geometry +edit.undo undo, redo and checkpoints: an earlier state restored, no new geometry +engine.commands the command registry itself +engine.describe the command registry itself +explode.create exploded views: display offsets +explode.delete exploded views: display offsets +explode.list exploded views: display offsets +explode.show exploded views: display offsets +expr.evaluate expression evaluation +file.open_in_easyprint hands the file to another program +file.save saving the design +file.save_as saving the design +file.save_mesh saving a display mesh +file.send_to_slicer hands the file to a slicer +file.slicers a listing of slicers +frame.profile.list a listing of the profile library +frame.profile.properties a profile's section properties from the library +inspect.accessibility display analysis: shading +inspect.colored_components display: component colours +inspect.curvature_map display analysis: shading +inspect.environment_map display analysis: shading +inspect.silhouette display analysis: outline +inspect.zebra display analysis: shading +joint.list a listing of joints +library.apply material and appearance libraries +library.export material and appearance libraries +library.inspect material and appearance libraries +material.assign materials and their properties +material.create materials and their properties +material.delete materials and their properties +material.edit materials and their properties +material.inspect materials and their properties +material.list materials and their properties +material.properties.directional materials and their properties +material.properties.validate materials and their properties +model.edges a listing of the model's topology +model.faces a listing of the model's topology +model.threads a listing of the model's topology +motion.delete removes a motion study +motion.export writes a study's results to a file +motion.export_animation writes an animation +motion.list a listing of motion studies +motion.play plays a study in the view +occurrence.properties occurrence properties +parameters.comment parameter bookkeeping; a value change that rebuilds is parameters.change, which cases use +parameters.complete parameter bookkeeping; a value change that rebuilds is parameters.change, which cases use +parameters.delete parameter bookkeeping; a value change that rebuilds is parameters.change, which cases use +parameters.export parameter bookkeeping; a value change that rebuilds is parameters.change, which cases use +parameters.favorite parameter bookkeeping; a value change that rebuilds is parameters.change, which cases use +parameters.graph parameter bookkeeping; a value change that rebuilds is parameters.change, which cases use +parameters.import parameter bookkeeping; a value change that rebuilds is parameters.change, which cases use +parameters.list parameter bookkeeping; a value change that rebuilds is parameters.change, which cases use +parameters.move parameter bookkeeping; a value change that rebuilds is parameters.change, which cases use +parameters.rename parameter bookkeeping; a value change that rebuilds is parameters.change, which cases use +parameters.users parameter bookkeeping; a value change that rebuilds is parameters.change, which cases use +parts.library a listing of the parts library +plastic.rules a listing of plastic rules +render.aging.describe rendering: images, cameras, stages +render.backends rendering: images, cameras, stages +render.camera.fit rendering: images, cameras, stages +render.camera.get rendering: images, cameras, stages +render.camera.set rendering: images, cameras, stages +render.cancel rendering: images, cameras, stages +render.effects.describe rendering: images, cameras, stages +render.export rendering: images, cameras, stages +render.hdr.inspect rendering: images, cameras, stages +render.library.appearance.apply rendering: images, cameras, stages +render.library.describe rendering: images, cameras, stages +render.library.environment.apply rendering: images, cameras, stages +render.library.list rendering: images, cameras, stages +render.library.physical.prepare rendering: images, cameras, stages +render.library.preview rendering: images, cameras, stages +render.library.studio.apply rendering: images, cameras, stages +render.library.studio.prepare rendering: images, cameras, stages +render.library.surface.bind rendering: images, cameras, stages +render.library.surface.prepare rendering: images, cameras, stages +render.library.surface.unbind rendering: images, cameras, stages +render.library.targets rendering: images, cameras, stages +render.optics.bind rendering: images, cameras, stages +render.optics.unbind rendering: images, cameras, stages +render.preflight rendering: images, cameras, stages +render.preset.apply rendering: images, cameras, stages +render.preset.resolve rendering: images, cameras, stages +render.quality.prepare rendering: images, cameras, stages +render.result.pin rendering: images, cameras, stages +render.result.regrade rendering: images, cameras, stages +render.scene rendering: images, cameras, stages +render.settings.apply rendering: images, cameras, stages +render.settings.capture_hdr rendering: images, cameras, stages +render.settings.get rendering: images, cameras, stages +render.settings.set rendering: images, cameras, stages +render.shot.duplicate rendering: images, cameras, stages +render.shot.remove rendering: images, cameras, stages +render.shot.rename rendering: images, cameras, stages +render.stage.backdrop rendering: images, cameras, stages +render.stage.clear rendering: images, cameras, stages +render.stage.ground rendering: images, cameras, stages +render.start rendering: images, cameras, stages +render.status rendering: images, cameras, stages +select.clear the selection +select.set the selection +selection.delete deletes what is selected through the commands that own each kind +sheet.rules a listing of sheet metal rules +sketch.arc.tangent 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.auto_constrain 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.auto_constrain_from_datum 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.break 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.break_link 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.cancel 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.centerline 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.chain 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.chamfer.distance_angle 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.chamfer.equal_distance 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.chamfer.two_distance 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.circle.three_point 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.circle.three_tangent 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.circle.two_point 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.circle.two_tangent 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.constrainer 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.constraint.coincident 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.constraint.collinear 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.constraint.concentric 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.constraint.curvature 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.constraint.equal 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.constraint.midpoint 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.constraint.parallel 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.constraint.perpendicular 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.constraint.polygon 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.constraint.symmetry 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.construction 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.copy 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.cut 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.delete 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.dimension_text 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.drag 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.drag_end 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.draw.dimensioned 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.drawing_bounds 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.edit_text 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.export_dxf 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.extend 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.fillet 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.finish_auto_constrain 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.glyphs 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.infinite 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.insert_dxf 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.insert_svg 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.inspect 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.line.midpoint 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.loose_ends 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.loose_ends.tie 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.mirror 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.move 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.move3d 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.offset 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.offset.break 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.paste 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.pattern.rectangular 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.point3d 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.polygon.edge 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.rectangle.three_point 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.redefine 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.scale 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.slot.arc_center 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.slot.arc_three_point 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.slot.center_point 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.snap 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.solve 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.toggle_driven 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.transform 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.trim 2D sketch only (the sketch solver and engine tests); no kernel operation +sketch.trim.path 2D sketch only (the sketch solver and engine tests); no kernel operation +timeline.dependents a listing of dependents +timeline.export_script writes the history as a script +timeline.inspect a listing of the timeline +timeline.rename a feature name +timeline.rename_group a group name +view.ambient_occlusion the view: camera, layout, display +view.apply the view: camera, layout, display +view.back the view: camera, layout, display +view.bottom the view: camera, layout, display +view.delete the view: camera, layout, display +view.fit the view: camera, layout, display +view.front the view: camera, layout, display +view.graphics_preset the view: camera, layout, display +view.grid the view: camera, layout, display +view.ground_shadow the view: camera, layout, display +view.history_layout the view: camera, layout, display +view.home the view: camera, layout, display +view.isometric the view: camera, layout, display +view.layout the view: camera, layout, display +view.left the view: camera, layout, display +view.list the view: camera, layout, display +view.navigate the view: camera, layout, display +view.navigation_bar the view: camera, layout, display +view.normal_to the view: camera, layout, display +view.perspective the view: camera, layout, display +view.rename the view: camera, layout, display +view.right the view: camera, layout, display +view.save the view: camera, layout, display +view.spin the view: camera, layout, display +view.tool the view: camera, layout, display +view.top the view: camera, layout, display +view.visual_style the view: camera, layout, display + +# Commands that make or change geometry and have no case yet. This section only shrinks: +# the pull request that adds a case for one removes its line (the check fails on a listed command +# that a case uses), and a new geometry command gets a case, not a line here. +[to cover] +body.repair repair: the solid a refused or open part becomes +component.copy_bodies assemblies: bodies copied into a component +component.extract assemblies: bodies extracted to a design +component.from_bodies assemblies: a component made from bodies +component.insert_design assemblies: a design inserted +component.move_bodies assemblies: bodies moved between components +component.move_sketches assemblies: sketches moved between components +component.paste_new assemblies: a pasted new component +component.revert_position assemblies: a placement reverted +config.activate configurations: a configured part rebuilt per row +config.column configurations: a configured part rebuilt per row +config.configure configurations: a configured part rebuilt per row +config.preview configurations: a configured part rebuilt per row +config.row configurations: a configured part rebuilt per row +config.rule configurations: a configured part rebuilt per row +config.rules configurations: a configured part rebuilt per row +config.table configurations: a configured part rebuilt per row +construct.axis.edge construction: the plane, axis or point exactly +construct.axis.normal_to_face construction: the plane, axis or point exactly +construct.axis.through_cylinder construction: the plane, axis or point exactly +construct.axis.two_planes construction: the plane, axis or point exactly +construct.plane.at_angle construction: the plane, axis or point exactly +construct.plane.midplane construction: the plane, axis or point exactly +construct.plane.perpendicular construction: the plane, axis or point exactly +construct.plane.tangent construction: the plane, axis or point exactly +construct.plane.three_points construction: the plane, axis or point exactly +construct.plane.two_edges construction: the plane, axis or point exactly +construct.point.along_path construction: the plane, axis or point exactly +construct.point.center construction: the plane, axis or point exactly +construct.point.edge_plane construction: the plane, axis or point exactly +construct.point.three_planes construction: the plane, axis or point exactly +construct.point.two_edges construction: the plane, axis or point exactly +construct.point.vertex construction: the plane, axis or point exactly +contact.check assemblies: contact sets and what they report +contact.create assemblies: contact sets and what they report +contact.disable_all assemblies: contact sets and what they report +contact.edit assemblies: contact sets and what they report +contact.enable_all assemblies: contact sets and what they report +contact.enable_sets assemblies: contact sets and what they report +file.export_view_dxf drawings: the projection of the model a view DXF holds +frame.member frames: member bodies +frame.profile.insert frames: member bodies +inspect.center_of_mass inspect: the number or curves it reports +inspect.clearance inspect: the number or curves it reports +inspect.compare inspect: the number or curves it reports +inspect.continuity inspect: the number or curves it reports +inspect.curvature_comb inspect: the number or curves it reports +inspect.draft inspect: the number or curves it reports +inspect.interference inspect: the number or curves it reports +inspect.isocurve inspect: the number or curves it reports +inspect.minimum_radius inspect: the number or curves it reports +inspect.parameter_sweep inspect: results rebuilt over a parameter range +inspect.section inspect: the number or curves it reports +joint.as_built assemblies: joint placements and values +joint.cam assemblies: joint placements and values +joint.create assemblies: joint placements and values +joint.delete assemblies: joint placements and values +joint.drive assemblies: joint placements and values +joint.edit assemblies: joint placements and values +joint.gear assemblies: joint placements and values +joint.inspect assemblies: joint placements and values +joint.limits assemblies: joint placements and values +joint.motion_link assemblies: joint placements and values +joint.origin assemblies: joint placements and values +joint.rack_pinion assemblies: joint placements and values +joint.reach assemblies: joint placements and values +joint.rigid_group assemblies: joint placements and values +joint.screw assemblies: joint placements and values +joint.solve assemblies: joint placements and values +joint.sweep assemblies: joint placements and values +motion.interference assemblies: motion results +motion.plot assemblies: motion results +motion.study assemblies: motion results +motion.trace assemblies: motion results +motion.trace.edit assemblies: motion results +motion.trace.keep assemblies: motion results +occurrence.copy assemblies: an occurrence copied +occurrence.drag assemblies: an occurrence dragged to a placement +occurrence.reparent assemblies: an occurrence moved in the tree +parts.fastener standard parts: a fastener body +parts.insert standard parts: a part body +parts.resize standard parts: a part resized +plastic.assign_rule plastic: the feature body +plastic.boss plastic: the feature body +plastic.lip plastic: the feature body +plastic.manage_rules plastic: rules that rebuild the features using them +plastic.rest plastic: the feature body +sheet.export_bend_table sheet metal: the bend table of a flat pattern +sheet.export_dxf sheet metal: the flat pattern as DXF +sheet.hem sheet metal: the feature body +sheet.path_flange sheet metal: the feature body +sheet.perforate sheet metal: the feature body +sketch.arc3d sketch: a curve kind no case profiles yet +sketch.auto_project sketch from the model: curves the kernel computes from bodies +sketch.conic sketch: a curve kind no case profiles yet +sketch.fit_curves_to_section sketch from the model: curves the kernel computes from bodies +sketch.include_3d sketch from the model: curves the kernel computes from bodies +sketch.intersect sketch from the model: curves the kernel computes from bodies +sketch.intersection_curve sketch from the model: curves the kernel computes from bodies +sketch.isoparametric_curve sketch from the model: curves the kernel computes from bodies +sketch.project sketch from the model: curves the kernel computes from bodies +sketch.project_to_surface sketch from the model: curves the kernel computes from bodies +sketch.spline.control_point_5 sketch: a curve kind no case profiles yet +sketch.spline3d sketch: a curve kind no case profiles yet +sketch.spun_profile sketch from the model: curves the kernel computes from bodies +solid.align solid modelling: the body it makes +solid.boundary_fill solid modelling: the body it makes +solid.bounding_solid solid modelling: the body it makes +solid.cone solid modelling: the body it makes +solid.pattern.path solid modelling: the body it makes +solid.replace_face solid modelling: the body it makes +solid.scale solid modelling: the body it makes +solid.web solid modelling: the body it makes +surface.blend surfaces: the surface body it makes +surface.boundary surfaces: the surface body it makes +surface.fair surfaces: the surface body it makes +surface.match surfaces: the surface body it makes +surface.offset surfaces: the surface body it makes +surface.reverse_normal surfaces: the surface body it makes +surface.ruled surfaces: the surface body it makes +surface.unstitch surfaces: the surface body it makes +surface.untrim surfaces: the surface body it makes +timeline.compute_all timeline: the bodies after the rebuild +timeline.delete timeline: the bodies after the rebuild +timeline.edit timeline: the bodies after the rebuild +timeline.group timeline: the bodies after the rebuild +timeline.move_many timeline: the bodies after the rebuild +timeline.move_to_group timeline: the bodies after the rebuild +timeline.reorder timeline: the bodies after the rebuild +timeline.reorder_many timeline: the bodies after the rebuild +timeline.roll_to timeline: the bodies after the rebuild +timeline.suppress timeline: the bodies after the rebuild +timeline.ungroup timeline: the bodies after the rebuild diff --git a/xtask/src/kernel_cases.rs b/xtask/src/kernel_cases.rs index 7121ea2ed..ce3d2e983 100644 --- a/xtask/src/kernel_cases.rs +++ b/xtask/src/kernel_cases.rs @@ -335,6 +335,10 @@ pub fn run(rest: &[&str]) -> Result<(), String> { } let o = options(rest, "target/kernel-cases")?; let dir = root().join("tests/kernel-cases"); + if rest.contains(&"--coverage") { + println!("{}", run_coverage(&o, &dir)?); + return Ok(()); + } let list = cases(&dir, o.area.as_deref())?; if list.is_empty() { return Err(format!("no cases (recipe.json + expected.json) under {}", dir.display())); @@ -410,9 +414,145 @@ fn gate(text: &str, cases: &[String], statuses: &[&str]) -> Result Result, String> { + let mut cmd = match &o.cli { + Some(bin) => Command::new(bin), + None => { + let mut c = cargo(); + c.args(["run", "-q", "--release", "-p", "solidcraft-cli", "--"]); + c + } + }; + let out = cmd.current_dir(root()).arg("commands").output().map_err(|e| format!("solidcraft-cli: {e}"))?; + if !out.status.success() { + return Err(format!("solidcraft-cli commands failed:\n{}", String::from_utf8_lossy(&out.stderr))); + } + let list: Value = serde_json::from_slice(&out.stdout).map_err(|e| format!("commands JSON: {e}"))?; + let list = list.as_array().ok_or("commands JSON: not a list")?; + Ok(list.iter().filter_map(|c| Some((c["id"].as_str()?.to_string(), c["planned"].as_str().is_some_and(|p| !p.is_empty())))).collect()) +} + +/// Every command id the command scripts (`recipe.json`) under `dir` run, at any depth. +fn used_commands(dir: &Path) -> Result, String> { + let mut out = Vec::new(); + let mut todo = vec![dir.to_path_buf()]; + while let Some(d) = todo.pop() { + for e in std::fs::read_dir(&d).map_err(|e| format!("{}: {e}", d.display()))?.flatten() { + let p = e.path(); + if p.is_dir() { + todo.push(p); + } else if p.file_name().is_some_and(|n| n == "recipe.json") { + let text = std::fs::read_to_string(&p).map_err(|e| format!("{}: {e}", p.display()))?; + out.extend(recipe_commands(&text).map_err(|e| format!("{}: {e}", p.display()))?); + } + } + } + out.sort(); + out.dedup(); + Ok(out) +} + +/// The command ids a recipe runs: each `commands[].command` of a command script. An oracle +/// recipe (no `commands`) names features, not commands, and counts none. +fn recipe_commands(text: &str) -> Result, String> { + let v: Value = serde_json::from_str(text).map_err(|e| e.to_string())?; + let Some(list) = v.get("commands") else { return Ok(Vec::new()) }; + let list = list.as_array().ok_or("`commands` is not a list")?; + list.iter() + .enumerate() + .map(|(i, c)| c["command"].as_str().map(str::to_string).ok_or_else(|| format!("commands[{i}] has no `command` id"))) + .collect() +} + +/// One line of `tests/kernel-cases/EXEMPT`: a command with no case (its reason is for readers). +#[derive(Debug, PartialEq)] +struct Exempt<'a> { + id: &'a str, + /// Listed under `[to cover]`: a geometry command still waiting for its case. + to_cover: bool, +} + +/// The section header of the commands that make geometry but have no case yet. +const TO_COVER: &str = "[to cover]"; + +/// The commands `tests/kernel-cases/EXEMPT` exempts from the coverage check: one per line, +/// ` `; `#` starts a comment line. The lines before `[to cover]` have no +/// geometry to grade; those after it make geometry and wait for a case, so that section only +/// shrinks. Each section is sorted, with no id twice in the file, and every line gives a reason. +fn exempt(text: &str) -> Result>, String> { + let mut out: Vec = Vec::new(); + let mut to_cover = false; + let mut last: Option<&str> = None; + for (n, line) in text.lines().enumerate() { + let line = line.trim(); + if line.is_empty() || line.starts_with('#') { + continue; + } + if line == TO_COVER { + if to_cover { + return Err(format!("line {}: a second {TO_COVER} section", n + 1)); + } + to_cover = true; + last = None; + continue; + } + let (id, why) = line.split_once(char::is_whitespace).map_or((line, ""), |(c, w)| (c, w.trim())); + if why.is_empty() { + return Err(format!("line {}: {id} gives no reason (` `)", n + 1)); + } + if out.iter().any(|e| e.id == id) { + return Err(format!("line {}: {id} is listed twice", n + 1)); + } + if let Some(prev) = last + && prev > id + { + return Err(format!("line {}: {id} is out of order after {prev}: keep each section sorted", n + 1)); + } + last = Some(id); + out.push(Exempt { id, to_cover }); + } + Ok(out) +} + +/// The coverage check: every built command of `registry` (id, planned) is in `used` (run by a +/// case) or exempted by `exempt_text`; an exemption names a registered command that no case +/// uses, so a case that comes removes its line. +fn coverage(registry: &[(String, bool)], used: &[String], exempt_text: &str) -> Result { + let listed = exempt(exempt_text)?; + let mut problems = Vec::new(); + for e in &listed { + if !registry.iter().any(|(id, _)| id == e.id) { + problems.push(format!("EXEMPT lists {}, which is not a registry command: remove its line", e.id)); + } else if used.iter().any(|u| u == e.id) { + problems.push(format!("EXEMPT lists {}, which a case now uses: remove its line", e.id)); + } + } + let mut covered = 0; + for (id, _) in registry.iter().filter(|(_, planned)| !planned) { + if used.iter().any(|u| u == id) { + covered += 1; + } else if !listed.iter().any(|e| e.id == id) { + problems.push(format!("NO CASE: {id} (add a case under tests/kernel-cases/, or a line to EXEMPT)")); + } + } + if !problems.is_empty() { + return Err(format!("kernel-cases coverage:\n {}", problems.join("\n "))); + } + let to_cover = listed.iter().filter(|e| e.to_cover).count(); + Ok(format!("kernel-cases coverage: {covered} commands have a case, {} have no geometry, {to_cover} still to cover", listed.len() - to_cover)) +} + +fn run_coverage(o: &Options, dir: &Path) -> Result { + let file = dir.join("EXEMPT"); + let text = std::fs::read_to_string(&file).map_err(|e| format!("{}: {e}", file.display()))?; + coverage(®istry(o)?, &used_commands(dir)?, &text).map_err(|e| format!("{}: {e}", file.display())) +} + #[cfg(test)] mod tests { - use super::gate; + use super::{Exempt, coverage, exempt, gate, recipe_commands}; fn run(text: &str, cases: &[(&str, &str)]) -> Result { let names: Vec = cases.iter().map(|(c, _)| c.to_string()).collect(); @@ -438,4 +578,43 @@ mod tests { assert!(run("a x\na y\n", &[("a", "fail")]).unwrap_err().contains("a repeat of")); assert!(run("a\n", &[("a", "fail")]).unwrap_err().contains("gives no cause")); } + + #[test] + fn a_recipe_names_the_commands_of_its_script() { + let script = r#"{"base": "../a", "commands": [{"command": "solid.box", "params": {}}, {"command": "solid.fillet"}]}"#; + assert_eq!(recipe_commands(script).unwrap(), ["solid.box", "solid.fillet"]); + assert!(recipe_commands(r#"{"id": "01-box", "features": []}"#).unwrap().is_empty()); + assert!(recipe_commands(r#"{"commands": [{"params": {}}]}"#).unwrap_err().contains("no `command` id")); + assert!(recipe_commands(r#"{"commands": {}}"#).unwrap_err().contains("not a list")); + } + + #[test] + fn the_exempt_list_has_two_sorted_sections_with_a_reason_each() { + let text = "# header\nview.fit camera only\nview.top camera only\n\n[to cover]\nsolid.cone surfaces area\n"; + assert_eq!( + exempt(text).unwrap(), + [Exempt { id: "view.fit", to_cover: false }, Exempt { id: "view.top", to_cover: false }, Exempt { id: "solid.cone", to_cover: true },] + ); + assert!(exempt("view.top x\nview.fit x\n").unwrap_err().contains("out of order")); + assert!(exempt("view.fit x\n[to cover]\nview.fit y\n").unwrap_err().contains("listed twice")); + assert!(exempt("view.fit\n").unwrap_err().contains("gives no reason")); + assert!(exempt("[to cover]\n[to cover]\n").unwrap_err().contains("second")); + } + + #[test] + fn coverage_fails_on_a_command_with_no_case_and_on_a_stale_exemption() { + let registry: Vec<(String, bool)> = + [("solid.box", false), ("solid.cone", false), ("view.fit", false), ("surface.fillet", true)].map(|(i, p)| (i.to_string(), p)).to_vec(); + let used = ["solid.box".to_string()]; + let list = "view.fit camera only\n[to cover]\nsolid.cone surfaces area\n"; + let ok = coverage(®istry, &used, list).unwrap(); + assert!(ok.contains("1 commands have a case, 1 have no geometry, 1 still to cover"), "{ok}"); + let missing = coverage(®istry, &used, "view.fit camera only\n").unwrap_err(); + assert!(missing.contains("NO CASE: solid.cone"), "{missing}"); + assert!(!missing.contains("surface.fillet"), "a planned command needs no case: {missing}"); + let covered = coverage(®istry, &["solid.box".into(), "solid.cone".into()], list).unwrap_err(); + assert!(covered.contains("EXEMPT lists solid.cone, which a case now uses"), "{covered}"); + let gone = coverage(®istry, &used, "view.fit camera only\nview.gone removed\n[to cover]\nsolid.cone x\n").unwrap_err(); + assert!(gone.contains("view.gone, which is not a registry command"), "{gone}"); + } } diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 13be4f8d7..3d13136d9 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -47,7 +47,7 @@ commands: replay the reference tests (tests/oracle/*/recipe.json), compare with each case's expected.json and write docs/oracle.md (--cli: a solidcraft-cli already built, instead of cargo run --release) - kernel-cases [--area AREA] [--cli BIN] [--timeout S] [--jobs N] [--out DIR] [--known-failing FILE] + kernel-cases [--area AREA] [--cli BIN] [--timeout S] [--jobs N] [--out DIR] [--known-failing FILE] [--coverage] the kernel regression rig: run every case in tests/kernel-cases/// on SMLib (one process each, killed after --timeout, default 180 s), grade it against the case's own answer and write docs/kernel-cases.md; DIR (default @@ -62,6 +62,9 @@ commands: docs/kernel-ladder.md (DIR default target/kernel-ladder); --record re-measures the golden and re-sorts each tier by time; --gate fails on any case whose status or counts differ from the golden, instead of the report + --coverage: instead of running cases, fail on a registry command (the CLI's + `commands`, planned ones aside) that no recipe.json under tests/kernel-cases/ + uses and tests/kernel-cases/EXEMPT does not list, and on a stale EXEMPT line action-matrix [--bless] [--results FILE] [--from DIR] try every ordinary action on every face, edge, vertex and body of the design corpus and compare with tests/action_matrix/baseline.json (--bless rewrites it; From 6701b1c5e055e81a46945a431bfaac373ebcbf74 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:55:07 -0400 Subject: [PATCH 021/108] Docs: how the kernel rig picks its areas, how a new area joins, and the coverage check Co-Authored-By: Claude Opus 5.5 --- skills/solidcraft-tests/SKILL.md | 4 +-- tests/kernel-cases/README.md | 54 ++++++++++++++++++++++++++------ 2 files changed, 46 insertions(+), 12 deletions(-) diff --git a/skills/solidcraft-tests/SKILL.md b/skills/solidcraft-tests/SKILL.md index 4a6113881..63ed8d6e9 100644 --- a/skills/solidcraft-tests/SKILL.md +++ b/skills/solidcraft-tests/SKILL.md @@ -25,8 +25,8 @@ A failing test without its fix cannot merge: it turns `main` red for everyone. I ## Goldens, matrices and skipped tests - The reference for what the kernel builds is the kernel-cases ladder (`tests/kernel-cases/ladder/`, `cargo xtask kernel-cases --ladder`, `docs/kernel-ladder.md`). -- Kernel PRs run the kernel rig gate (`kernel-rig.yml`): each area against its `KNOWN_FAILING`, the ladder against its golden. In the same PR, a fix removes its line, a new failing case adds one, a changed ladder result is re-recorded (`--ladder --record "why"`); see `tests/kernel-cases/README.md`. +- Kernel PRs run `kernel-rig.yml`: the areas the diff reaches (`PATHS`) against `KNOWN_FAILING`, the ladder against its golden. In the same PR a fix removes its line, a new failing case adds one, a changed ladder result is re-recorded (`--record "why"`), a new command gets a case or an `EXEMPT` line; see `tests/kernel-cases/README.md`. - Maintainers' PRs run the native, GPU path and reference tests on the affected packages; others wait for `approved-for-ci`. `release-gate.yml` runs everything in full before develop replaces main. - The action matrix is a ratchet: record a newly passing action with `cargo xtask action-matrix --bless` (`docs/action-matrix.md`). - Pull requests skip a few heavy tests, which run in the merge queue, nightly and on `main`. Check that validation after merging. The list is in `.config/nextest.toml` and the testing page. -- Mutation testing finds behaviour the suites miss: `docs/mutation-testing.md`. +- Mutation testing finds what the suites miss: `docs/mutation-testing.md`. diff --git a/tests/kernel-cases/README.md b/tests/kernel-cases/README.md index f130ef323..709ec90c0 100644 --- a/tests/kernel-cases/README.md +++ b/tests/kernel-cases/README.md @@ -38,6 +38,8 @@ One directory per area, one per case: `tests/kernel-cases///`. | `fillets`, `sweeps`, `threads`, `sheet-metal`, `tessellation` | history rig | | `continuity` (designed seams of known order, G0 to G4, that prove the continuity measurement itself) | history rig | +Each area also has its gate files: `KNOWN_FAILING` and `PATHS` (see [the gate](#the-kernel-rig-gate)). + `` is `-`, such as `1894-prism-cut-touching-walls`. Each case has: @@ -100,16 +102,12 @@ the frozen truck-geometry PRs, a `kernel-paused` PR), for the report's coverage ## The kernel rig gate Every area is a regression suite: each case is one small case of one issue, with its exact -answer. `.github/workflows/kernel-rig.yml` runs them all, and the ladder, on every pull request -(not a draft) that touches the kernel surface: `crates/kernel/**`, `crates/geom/**`, -`crates/smlib/**` (`SMLIB_REV` and `SMLIB_PREBUILT` included), `crates/step/**`, -`crates/doc/src/eval*.rs`, `crates/engine/src/cmd/features*.rs`, `tests/kernel-cases/**` and the -rig's own code (GitHub filters whole files, so any change to `eval*.rs` or `features*.rs` runs -it). Pushes to main and develop on the same paths, merge groups and the release gate -(`release-gate.yml`) run it too. One job builds `solidcraft-cli` (release, SMLib) and the rig's -runner, and hands both to a matrix of shards, one per area plus the ladder, that run in -parallel; the `kernel-rig` check passes when every shard does. (`fillet-rig.yml`, the earlier -fillet-only gate, folds into it.) Each area's shard runs: +answer. `.github/workflows/kernel-rig.yml` runs them, and the ladder, on pull requests (not +drafts). A plan job (`scripts/ci/kernel_rig_plan.py`) picks the areas from the changed files, one +job builds `solidcraft-cli` (release, SMLib) and the rig's runner, and a matrix of shards, one per +selected area plus the ladder, runs them in parallel; the `kernel-rig` check passes when every +selected shard does (and when none was selected). Pushes to main and develop, merge groups, the +release gate (`release-gate.yml`) and a run by hand run every area. Each area's shard runs: ```sh cargo xtask kernel-cases --area --cli target/release/solidcraft-cli \ @@ -135,6 +133,42 @@ request, so the list only shrinks and never goes stale: To check a list locally before pushing: `cargo xtask kernel-cases --area --cli target/release/solidcraft-cli --known-failing tests/kernel-cases//KNOWN_FAILING`. +### Which areas a pull request runs + +- `/PATHS`: the source files whose change reruns that area, one git pathspec glob a line + (`*` within a folder, `**` across folders; `#` starts a comment): the engine command modules, + doc evaluation and kernel files its commands go through. Only the area's own files: never a + file `PATHS-ALL` covers, nor a whole crate (the self-test fails on either). +- `PATHS-ALL`: the shared core, whose change reruns every area: SMLib (`crates/smlib/**`, its pin + included) and `scripts/fetch-smlib.sh`, `crates/geom/**`, the kernel's core (bodies, extrude and + revolve, booleans, the SMLib bridge, tessellation, what the grader measures), timeline + evaluation, the solid feature commands, the grader, the runner and the workflow. +- A change under `/` (a case, its `KNOWN_FAILING`, its `PATHS`) reruns that area. +- The ladder spans every operation: it runs whenever any area does, and on a change under + `ladder/`. + +The workflow's trigger paths are whole folders that hold every `PATHS` glob (a self-test, +`scripts/ci/test_kernel_rig_plan.py`, checks it), so a pull request that touches none of them +starts no job at all. To see what a change would run: +`git diff --name-only -z origin/develop... | python3 scripts/ci/kernel_rig_plan.py --paths -`. + +**A new area** joins with its folder: its cases, a `KNOWN_FAILING` (empty but for its header +when every case passes), and a `PATHS` listing the files its commands go through. The plan finds +the areas from the folders, so the workflow needs no edit (unless a `PATHS` glob lies outside +the trigger paths, which the self-test reports). Add a row to the table under Layout. + +### Every command has a case + +`cargo xtask kernel-cases --coverage --cli target/release/solidcraft-cli` (run in the gate's +build job) lists every registry command (`solidcraft-cli commands`, planned ones aside) that no +`recipe.json` here runs, and fails unless `EXEMPT` lists it: one line a command, ` `, each section sorted. Lines before `[to cover]` have no geometry to grade (the +view, rendering, appearance, files, component and parameter bookkeeping, ...). Lines after it +make geometry and wait for a case: that section only shrinks. The check also fails on a listed +command that a case now uses (remove its line in the same pull request) or that the registry no +longer has. A new geometry command gets a case, not an `EXEMPT` line. The build job runs for this +check on any change to `crates/engine/src/cmd/`, a recipe or `EXEMPT`, even when no area does. + ## The complexity ladder `ladder/` orders kernel operations by complexity instead of by where they went wrong: tiers from From 585789c6067607888a04e800fc9a8d964bc731cc Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:50:20 -0400 Subject: [PATCH 022/108] Kernel rig: cone cases, a frustum on X and a full cone of negative height with their exact volume, area and centroid, and a zero height refused; a new solids area Co-Authored-By: Claude Opus 5.5 --- tests/kernel-cases/solids/KNOWN_FAILING | 4 +++ tests/kernel-cases/solids/PATHS | 9 +++++++ .../cov-cone-frustum-along-x/expected.json | 27 +++++++++++++++++++ .../cov-cone-frustum-along-x/recipe.json | 18 +++++++++++++ .../expected.json | 27 +++++++++++++++++++ .../recipe.json | 16 +++++++++++ .../expected.json | 8 ++++++ .../cov-cone-zero-height-refused/recipe.json | 11 ++++++++ 8 files changed, 120 insertions(+) create mode 100644 tests/kernel-cases/solids/KNOWN_FAILING create mode 100644 tests/kernel-cases/solids/PATHS create mode 100644 tests/kernel-cases/solids/cov-cone-frustum-along-x/expected.json create mode 100644 tests/kernel-cases/solids/cov-cone-frustum-along-x/recipe.json create mode 100644 tests/kernel-cases/solids/cov-cone-full-apex-negative-height/expected.json create mode 100644 tests/kernel-cases/solids/cov-cone-full-apex-negative-height/recipe.json create mode 100644 tests/kernel-cases/solids/cov-cone-zero-height-refused/expected.json create mode 100644 tests/kernel-cases/solids/cov-cone-zero-height-refused/recipe.json diff --git a/tests/kernel-cases/solids/KNOWN_FAILING b/tests/kernel-cases/solids/KNOWN_FAILING new file mode 100644 index 000000000..242ef035c --- /dev/null +++ b/tests/kernel-cases/solids/KNOWN_FAILING @@ -0,0 +1,4 @@ +# The solids cases that fail today, one a line: ` `. Sorted. A run with +# `--known-failing` fails on a case that fails and is not listed here, and on a listed case that +# passes: a fix removes its line in the same pull request. +# Baseline: rig-cases-solids-frames 45f69c0e5 with SMLib 60b1c6a, aarch64 Linux. diff --git a/tests/kernel-cases/solids/PATHS b/tests/kernel-cases/solids/PATHS new file mode 100644 index 000000000..7b538874c --- /dev/null +++ b/tests/kernel-cases/solids/PATHS @@ -0,0 +1,9 @@ +# Source files whose change must rerun the solids area (cones, scale, align, bounding solids). +apps/solidcraft-cli/src/kernel_cases.rs +crates/doc/src/eval.rs +crates/doc/src/eval_more.rs +crates/engine/src/cmd/features.rs +crates/engine/src/cmd/features_more.rs +crates/kernel/src/** +crates/smlib/** +tests/kernel-cases/solids/** diff --git a/tests/kernel-cases/solids/cov-cone-frustum-along-x/expected.json b/tests/kernel-cases/solids/cov-cone-frustum-along-x/expected.json new file mode 100644 index 000000000..032d0fe1b --- /dev/null +++ b/tests/kernel-cases/solids/cov-cone-frustum-along-x/expected.json @@ -0,0 +1,27 @@ +{ + "sources": [], + "what": "a truncated cone (frustum) R10 r5 h20 on the X axis from x=5", + "source": "analytic", + "method": "frustum: V = pi h/3 (R^2+Rr+r^2) = pi*20*175/3; A = pi(R^2+r^2) + pi(R+r) sqrt(h^2+(R-r)^2); centroid h(R^2+2Rr+3r^2)/(4(R^2+Rr+r^2)) = 7.857 from the base; faces: base, top, side = 3", + "body_count": 1, + "faces": 3, + "volume_mm3": 3665.191429188092, + "area_mm2": 1364.1829574548633, + "center_of_mass": [ + 12.857142857142858, + 0, + 0 + ], + "bbox": { + "min": [ + 5, + -10, + -10 + ], + "max": [ + 25, + 10, + 10 + ] + } +} diff --git a/tests/kernel-cases/solids/cov-cone-frustum-along-x/recipe.json b/tests/kernel-cases/solids/cov-cone-frustum-along-x/recipe.json new file mode 100644 index 000000000..515ddcf42 --- /dev/null +++ b/tests/kernel-cases/solids/cov-cone-frustum-along-x/recipe.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "command": "solid.cone", + "params": { + "radius": 10, + "top_radius": 5, + "height": 20, + "base": [ + 5, + 0, + 0 + ], + "axis": "X" + } + } + ] +} diff --git a/tests/kernel-cases/solids/cov-cone-full-apex-negative-height/expected.json b/tests/kernel-cases/solids/cov-cone-full-apex-negative-height/expected.json new file mode 100644 index 000000000..bdb086425 --- /dev/null +++ b/tests/kernel-cases/solids/cov-cone-full-apex-negative-height/expected.json @@ -0,0 +1,27 @@ +{ + "sources": [], + "what": "a full cone (top radius 0: an apex) r6, height -12 from a base at z=10: the apex at z=-2", + "source": "analytic", + "method": "V = pi r^2 h/3 = pi*36*4; A = pi r^2 + pi r sqrt(h^2+r^2); centroid h/4 from the base toward the apex: z = 10-3; faces: base and side = 2", + "body_count": 1, + "faces": 2, + "volume_mm3": 452.3893421169302, + "area_mm2": 365.99066584669873, + "center_of_mass": [ + 0, + 0, + 7 + ], + "bbox": { + "min": [ + -6, + -6, + -2 + ], + "max": [ + 6, + 6, + 10 + ] + } +} diff --git a/tests/kernel-cases/solids/cov-cone-full-apex-negative-height/recipe.json b/tests/kernel-cases/solids/cov-cone-full-apex-negative-height/recipe.json new file mode 100644 index 000000000..6ba0aabab --- /dev/null +++ b/tests/kernel-cases/solids/cov-cone-full-apex-negative-height/recipe.json @@ -0,0 +1,16 @@ +{ + "commands": [ + { + "command": "solid.cone", + "params": { + "radius": 6, + "height": -12, + "base": [ + 0, + 0, + 10 + ] + } + } + ] +} diff --git a/tests/kernel-cases/solids/cov-cone-zero-height-refused/expected.json b/tests/kernel-cases/solids/cov-cone-zero-height-refused/expected.json new file mode 100644 index 000000000..728ba07bc --- /dev/null +++ b/tests/kernel-cases/solids/cov-cone-zero-height-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "a cone of height 0 has no volume: refused", + "source": "analytic", + "method": "the base and the top coincide: no solid, a clean refusal naming the height", + "outcome": "refused", + "refusal": "height must not be zero" +} diff --git a/tests/kernel-cases/solids/cov-cone-zero-height-refused/recipe.json b/tests/kernel-cases/solids/cov-cone-zero-height-refused/recipe.json new file mode 100644 index 000000000..53a77ce84 --- /dev/null +++ b/tests/kernel-cases/solids/cov-cone-zero-height-refused/recipe.json @@ -0,0 +1,11 @@ +{ + "commands": [ + { + "command": "solid.cone", + "params": { + "radius": 5, + "height": 0 + } + } + ] +} From af8f28e343085712f4b5c12a34d99c1909d8d5a6 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:50:20 -0400 Subject: [PATCH 023/108] Kernel rig: scale cases, a cube doubled about its corner, a sphere scaled into an ellipsoid of the same volume, and a zero factor refused Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 26 ++++++++++++++++++ .../cov-scale-sphere-to-ellipsoid/recipe.json | 24 +++++++++++++++++ .../expected.json | 27 +++++++++++++++++++ .../recipe.json | 27 +++++++++++++++++++ .../expected.json | 8 ++++++ .../cov-scale-zero-factor-refused/recipe.json | 26 ++++++++++++++++++ 6 files changed, 138 insertions(+) create mode 100644 tests/kernel-cases/solids/cov-scale-sphere-to-ellipsoid/expected.json create mode 100644 tests/kernel-cases/solids/cov-scale-sphere-to-ellipsoid/recipe.json create mode 100644 tests/kernel-cases/solids/cov-scale-uniform-about-a-corner/expected.json create mode 100644 tests/kernel-cases/solids/cov-scale-uniform-about-a-corner/recipe.json create mode 100644 tests/kernel-cases/solids/cov-scale-zero-factor-refused/expected.json create mode 100644 tests/kernel-cases/solids/cov-scale-zero-factor-refused/recipe.json diff --git a/tests/kernel-cases/solids/cov-scale-sphere-to-ellipsoid/expected.json b/tests/kernel-cases/solids/cov-scale-sphere-to-ellipsoid/expected.json new file mode 100644 index 000000000..8556422ea --- /dev/null +++ b/tests/kernel-cases/solids/cov-scale-sphere-to-ellipsoid/expected.json @@ -0,0 +1,26 @@ +{ + "sources": [], + "what": "a sphere r10 scaled non-uniformly (1, 2, 0.5) into an ellipsoid", + "source": "analytic", + "method": "ellipsoid of semi-axes 10, 20, 5: V = 4/3 pi abc = 4/3 pi 1000 (the factors multiply to 1: the sphere's volume); bbox +-10, +-20, +-5; one closed face", + "body_count": 1, + "faces": 1, + "volume_mm3": 4188.790204786391, + "center_of_mass": [ + 0, + 0, + 0 + ], + "bbox": { + "min": [ + -10, + -20, + -5 + ], + "max": [ + 10, + 20, + 5 + ] + } +} diff --git a/tests/kernel-cases/solids/cov-scale-sphere-to-ellipsoid/recipe.json b/tests/kernel-cases/solids/cov-scale-sphere-to-ellipsoid/recipe.json new file mode 100644 index 000000000..13456cd45 --- /dev/null +++ b/tests/kernel-cases/solids/cov-scale-sphere-to-ellipsoid/recipe.json @@ -0,0 +1,24 @@ +{ + "commands": [ + { + "command": "solid.sphere", + "params": { + "radius": 10, + "body_name": "Ball" + } + }, + { + "command": "solid.scale", + "params": { + "bodies": [ + "Ball" + ], + "factors": [ + 1, + 2, + 0.5 + ] + } + } + ] +} diff --git a/tests/kernel-cases/solids/cov-scale-uniform-about-a-corner/expected.json b/tests/kernel-cases/solids/cov-scale-uniform-about-a-corner/expected.json new file mode 100644 index 000000000..7fb35055a --- /dev/null +++ b/tests/kernel-cases/solids/cov-scale-uniform-about-a-corner/expected.json @@ -0,0 +1,27 @@ +{ + "sources": [], + "what": "a 10 mm cube scaled 2x about its far corner (10,10,10)", + "source": "analytic", + "method": "p -> o + 2(p - o) with o = (10,10,10): the corner 0 goes to -10, 10 stays: a 20 mm cube from -10 to 10; V = 8000, A = 6*400", + "body_count": 1, + "faces": 6, + "volume_mm3": 8000.0, + "area_mm2": 2400.0, + "center_of_mass": [ + 0, + 0, + 0 + ], + "bbox": { + "min": [ + -10, + -10, + -10 + ], + "max": [ + 10, + 10, + 10 + ] + } +} diff --git a/tests/kernel-cases/solids/cov-scale-uniform-about-a-corner/recipe.json b/tests/kernel-cases/solids/cov-scale-uniform-about-a-corner/recipe.json new file mode 100644 index 000000000..818c835fc --- /dev/null +++ b/tests/kernel-cases/solids/cov-scale-uniform-about-a-corner/recipe.json @@ -0,0 +1,27 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 10, + "width": 10, + "height": 10, + "body_name": "Block" + } + }, + { + "command": "solid.scale", + "params": { + "bodies": [ + "Block" + ], + "factor": 2, + "origin": [ + 10, + 10, + 10 + ] + } + } + ] +} diff --git a/tests/kernel-cases/solids/cov-scale-zero-factor-refused/expected.json b/tests/kernel-cases/solids/cov-scale-zero-factor-refused/expected.json new file mode 100644 index 000000000..a4677525a --- /dev/null +++ b/tests/kernel-cases/solids/cov-scale-zero-factor-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "a scale factor of 0 flattens the body to a sheet: refused", + "source": "analytic", + "method": "a zero factor maps the cube onto a plane: no solid, a clean refusal", + "outcome": "refused", + "refusal": "scale factors must be positive" +} diff --git a/tests/kernel-cases/solids/cov-scale-zero-factor-refused/recipe.json b/tests/kernel-cases/solids/cov-scale-zero-factor-refused/recipe.json new file mode 100644 index 000000000..3e5f6dc64 --- /dev/null +++ b/tests/kernel-cases/solids/cov-scale-zero-factor-refused/recipe.json @@ -0,0 +1,26 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 10, + "width": 10, + "height": 10, + "body_name": "Block" + } + }, + { + "command": "solid.scale", + "params": { + "bodies": [ + "Block" + ], + "factors": [ + 1, + 0, + 1 + ] + } + } + ] +} From e1724be6291c0bc2b0fc9ecca87b942bace4e1da Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:50:20 -0400 Subject: [PATCH 024/108] Kernel rig: pattern on path cases, bosses along a line, bodies turning with an arc's tangent, and instances past the path's end refused Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 20 +++++ .../recipe.json | 61 ++++++++++++++++ .../expected.json | 21 ++++++ .../recipe.json | 73 +++++++++++++++++++ .../expected.json | 8 ++ .../recipe.json | 73 +++++++++++++++++++ 6 files changed, 256 insertions(+) create mode 100644 tests/kernel-cases/booleans/cov-pattern-path-bodies-turn-along-an-arc/expected.json create mode 100644 tests/kernel-cases/booleans/cov-pattern-path-bodies-turn-along-an-arc/recipe.json create mode 100644 tests/kernel-cases/booleans/cov-pattern-path-bosses-along-a-line/expected.json create mode 100644 tests/kernel-cases/booleans/cov-pattern-path-bosses-along-a-line/recipe.json create mode 100644 tests/kernel-cases/booleans/cov-pattern-path-past-the-end-refused/expected.json create mode 100644 tests/kernel-cases/booleans/cov-pattern-path-past-the-end-refused/recipe.json diff --git a/tests/kernel-cases/booleans/cov-pattern-path-bodies-turn-along-an-arc/expected.json b/tests/kernel-cases/booleans/cov-pattern-path-bodies-turn-along-an-arc/expected.json new file mode 100644 index 000000000..64a022f8f --- /dev/null +++ b/tests/kernel-cases/booleans/cov-pattern-path-bodies-turn-along-an-arc/expected.json @@ -0,0 +1,20 @@ +{ + "sources": [], + "what": "a body patterned 3 times along a half circle r20 with orientation path: each copy turns with the tangent", + "source": "analytic", + "method": "instances at 0, 90 and 180 deg along the arc, each turned with the tangent: the 4x2x2 key (long side radial) stays radial, at (0,20) 2 wide in X and 4 long in Y (y 18..22). Unturned it would be 4 wide in X (x -2..2, y 19..21). Three keys: V = 3*16, bbox x -22..22, y -1..22, z 0..2", + "body_count": 3, + "volume_mm3": 48.0, + "bbox": { + "min": [ + -22, + -1, + 0 + ], + "max": [ + 22, + 22, + 2 + ] + } +} diff --git a/tests/kernel-cases/booleans/cov-pattern-path-bodies-turn-along-an-arc/recipe.json b/tests/kernel-cases/booleans/cov-pattern-path-bodies-turn-along-an-arc/recipe.json new file mode 100644 index 000000000..dc1c6cd74 --- /dev/null +++ b/tests/kernel-cases/booleans/cov-pattern-path-bodies-turn-along-an-arc/recipe.json @@ -0,0 +1,61 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 4, + "width": 2, + "height": 2, + "center": [ + 20, + 0, + 1 + ], + "body_name": "Key" + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Path" + } + }, + { + "command": "sketch.arc.center_point", + "params": { + "center": [ + 0, + 0 + ], + "start": [ + 20, + 0 + ], + "sweep": 180, + "id": "arc" + } + }, + { + "command": "sketch.finish", + "params": { + "sketch": "Path" + } + }, + { + "command": "solid.pattern.path", + "params": { + "bodies": [ + "Key" + ], + "path_sketch": "Path", + "path": [ + "arc" + ], + "count": 3, + "distance": 62.83185307179586, + "orientation": "path" + } + } + ] +} diff --git a/tests/kernel-cases/booleans/cov-pattern-path-bosses-along-a-line/expected.json b/tests/kernel-cases/booleans/cov-pattern-path-bosses-along-a-line/expected.json new file mode 100644 index 000000000..acc43ee8b --- /dev/null +++ b/tests/kernel-cases/booleans/cov-pattern-path-bosses-along-a-line/expected.json @@ -0,0 +1,21 @@ +{ + "sources": [], + "what": "a boss joined to a plate, patterned 5 times 20 mm apart along a sketch line", + "source": "analytic", + "method": "plate 100x20x5 = 10000 plus 5 bosses r3 h5 at x = 10, 30 ... 90: 5 pi 9 5; faces: plate 6 + 2 a boss (side, top) = 16", + "body_count": 1, + "faces": 16, + "volume_mm3": 10706.858347057703, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 100, + 20, + 10 + ] + } +} diff --git a/tests/kernel-cases/booleans/cov-pattern-path-bosses-along-a-line/recipe.json b/tests/kernel-cases/booleans/cov-pattern-path-bosses-along-a-line/recipe.json new file mode 100644 index 000000000..8d71d29b5 --- /dev/null +++ b/tests/kernel-cases/booleans/cov-pattern-path-bosses-along-a-line/recipe.json @@ -0,0 +1,73 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 100, + "width": 20, + "height": 5, + "body_name": "Plate" + } + }, + { + "command": "solid.cylinder", + "params": { + "base": [ + 10, + 10, + 5 + ], + "radius": 3, + "height": 5, + "operation": "join", + "name": "Boss" + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Path" + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 10, + 10 + ], + [ + 90, + 10 + ] + ], + "ids": [ + "p1" + ], + "infer": false + } + }, + { + "command": "sketch.finish", + "params": { + "sketch": "Path" + } + }, + { + "command": "solid.pattern.path", + "params": { + "features": [ + "Boss" + ], + "path_sketch": "Path", + "path": [ + "p1" + ], + "count": 5, + "spacing": 20 + } + } + ] +} diff --git a/tests/kernel-cases/booleans/cov-pattern-path-past-the-end-refused/expected.json b/tests/kernel-cases/booleans/cov-pattern-path-past-the-end-refused/expected.json new file mode 100644 index 000000000..4114b4bcd --- /dev/null +++ b/tests/kernel-cases/booleans/cov-pattern-path-past-the-end-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "6 instances 20 mm apart need 100 mm of an 80 mm path: refused", + "source": "analytic", + "method": "(6 - 1) * 20 = 100 > 80: the last instances would leave the path; a clean refusal naming its length", + "outcome": "refused", + "refusal": "run past the end of the path (80.000 mm long)" +} diff --git a/tests/kernel-cases/booleans/cov-pattern-path-past-the-end-refused/recipe.json b/tests/kernel-cases/booleans/cov-pattern-path-past-the-end-refused/recipe.json new file mode 100644 index 000000000..a3c0621a0 --- /dev/null +++ b/tests/kernel-cases/booleans/cov-pattern-path-past-the-end-refused/recipe.json @@ -0,0 +1,73 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 100, + "width": 20, + "height": 5, + "body_name": "Plate" + } + }, + { + "command": "solid.cylinder", + "params": { + "base": [ + 10, + 10, + 5 + ], + "radius": 3, + "height": 5, + "operation": "join", + "name": "Boss" + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Path" + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 10, + 10 + ], + [ + 90, + 10 + ] + ], + "ids": [ + "p1" + ], + "infer": false + } + }, + { + "command": "sketch.finish", + "params": { + "sketch": "Path" + } + }, + { + "command": "solid.pattern.path", + "params": { + "features": [ + "Boss" + ], + "path_sketch": "Path", + "path": [ + "p1" + ], + "count": 6, + "spacing": 20 + } + } + ] +} From cf58e3735905758f71253d2bde2ea4117d7f96b3 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:50:20 -0400 Subject: [PATCH 025/108] Kernel rig: replace face cases, a top moved onto a plane and a lower step raised to the higher top (fails today: SMLib offset of faces refuses closing the step wall) Co-Authored-By: Claude Opus 5.5 --- tests/kernel-cases/shell/KNOWN_FAILING | 3 +- .../expected.json | 22 +++++++++++ .../recipe.json | 39 +++++++++++++++++++ .../expected.json | 22 +++++++++++ .../recipe.json | 37 ++++++++++++++++++ 5 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 tests/kernel-cases/shell/cov-replace-face-step-onto-the-higher-face/expected.json create mode 100644 tests/kernel-cases/shell/cov-replace-face-step-onto-the-higher-face/recipe.json create mode 100644 tests/kernel-cases/shell/cov-replace-face-top-onto-a-plane/expected.json create mode 100644 tests/kernel-cases/shell/cov-replace-face-top-onto-a-plane/recipe.json diff --git a/tests/kernel-cases/shell/KNOWN_FAILING b/tests/kernel-cases/shell/KNOWN_FAILING index 07f36eb3c..2cf633543 100644 --- a/tests/kernel-cases/shell/KNOWN_FAILING +++ b/tests/kernel-cases/shell/KNOWN_FAILING @@ -1,4 +1,5 @@ # The shell cases that fail today, one a line: ` `. Sorted. The kernel # rig gate (.github/workflows/kernel-rig.yml) fails on a case that fails and is not listed here, # and on a listed case that passes: a fix removes its line in the same pull request. -# Baseline: not seeded yet; seeded from a develop run after the SMLib pin bump. +# Baseline: 45f69c0e5 with SMLib 60b1c6a, aarch64 Linux. +cov-replace-face-step-onto-the-higher-face not supported yet: SMLib's offset of faces refuses (Unsupported) a move that closes a neighbouring face (the step wall) to nothing diff --git a/tests/kernel-cases/shell/cov-replace-face-step-onto-the-higher-face/expected.json b/tests/kernel-cases/shell/cov-replace-face-step-onto-the-higher-face/expected.json new file mode 100644 index 000000000..74ab5be41 --- /dev/null +++ b/tests/kernel-cases/shell/cov-replace-face-step-onto-the-higher-face/expected.json @@ -0,0 +1,22 @@ +{ + "sources": [], + "what": "the lower top of a stepped block replaced by the plane of the higher top: the step wall closes up and the tops become one face", + "source": "analytic", + "method": "stepped block (x 0..20 to z=20, x 20..40 to z=10); the lower top goes to z=20: a 40x30x20 block, V = 24000, A = 2(1200+800+600), the coplanar tops one face: 6 faces", + "body_count": 1, + "faces": 6, + "volume_mm3": 24000.0, + "area_mm2": 5200.0, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 40, + 30, + 20 + ] + } +} diff --git a/tests/kernel-cases/shell/cov-replace-face-step-onto-the-higher-face/recipe.json b/tests/kernel-cases/shell/cov-replace-face-step-onto-the-higher-face/recipe.json new file mode 100644 index 000000000..888381614 --- /dev/null +++ b/tests/kernel-cases/shell/cov-replace-face-step-onto-the-higher-face/recipe.json @@ -0,0 +1,39 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 10, + "body_name": "Block" + } + }, + { + "command": "solid.box", + "params": { + "length": 20, + "width": 30, + "height": 20, + "operation": "join" + } + }, + { + "command": "solid.replace_face", + "params": { + "faces": [ + [ + 30, + 15, + 10 + ] + ], + "target_face": [ + 10, + 15, + 20 + ] + } + } + ] +} diff --git a/tests/kernel-cases/shell/cov-replace-face-top-onto-a-plane/expected.json b/tests/kernel-cases/shell/cov-replace-face-top-onto-a-plane/expected.json new file mode 100644 index 000000000..c66f515d9 --- /dev/null +++ b/tests/kernel-cases/shell/cov-replace-face-top-onto-a-plane/expected.json @@ -0,0 +1,22 @@ +{ + "sources": [], + "what": "a block's top face replaced by the plane z=15", + "source": "analytic", + "method": "the top moves from z=10 to 15: a 40x30x15 block, V = 18000, A = 2(1200 + 600 + 450)", + "body_count": 1, + "faces": 6, + "volume_mm3": 18000.0, + "area_mm2": 4500.0, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 40, + 30, + 15 + ] + } +} diff --git a/tests/kernel-cases/shell/cov-replace-face-top-onto-a-plane/recipe.json b/tests/kernel-cases/shell/cov-replace-face-top-onto-a-plane/recipe.json new file mode 100644 index 000000000..f36e4201e --- /dev/null +++ b/tests/kernel-cases/shell/cov-replace-face-top-onto-a-plane/recipe.json @@ -0,0 +1,37 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 10, + "body_name": "Block" + } + }, + { + "command": "solid.replace_face", + "params": { + "faces": [ + [ + 20, + 15, + 10 + ] + ], + "target": { + "origin": [ + 0, + 0, + 15 + ], + "normal": [ + 0, + 0, + 1 + ] + } + } + } + ] +} From be4f15db63e11784f78a439f4e5a867f6759d085 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:50:20 -0400 Subject: [PATCH 026/108] Kernel rig: bounding solid cases, two boxes with a margin and a sphere's exact box Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 21 ++++++++++++ .../recipe.json | 25 ++++++++++++++ .../expected.json | 20 +++++++++++ .../recipe.json | 34 +++++++++++++++++++ 4 files changed, 100 insertions(+) create mode 100644 tests/kernel-cases/solids/cov-bounding-solid-of-a-sphere/expected.json create mode 100644 tests/kernel-cases/solids/cov-bounding-solid-of-a-sphere/recipe.json create mode 100644 tests/kernel-cases/solids/cov-bounding-solid-two-boxes-with-margin/expected.json create mode 100644 tests/kernel-cases/solids/cov-bounding-solid-two-boxes-with-margin/recipe.json diff --git a/tests/kernel-cases/solids/cov-bounding-solid-of-a-sphere/expected.json b/tests/kernel-cases/solids/cov-bounding-solid-of-a-sphere/expected.json new file mode 100644 index 000000000..a326179ed --- /dev/null +++ b/tests/kernel-cases/solids/cov-bounding-solid-of-a-sphere/expected.json @@ -0,0 +1,21 @@ +{ + "sources": [], + "what": "the bounding box of a sphere r10 at (5,5,5): a curved body's exact extremes, not its mesh's", + "source": "analytic", + "method": "the sphere spans 5 +- 10 on each axis: the box (-5,-5,-5)-(15,15,15) = 20^3 = 8000; with the sphere kept: V = 8000 + 4/3 pi 1000; faces 6 + 1", + "body_count": 2, + "faces": 7, + "volume_mm3": 12188.79020478639, + "bbox": { + "min": [ + -5, + -5, + -5 + ], + "max": [ + 15, + 15, + 15 + ] + } +} diff --git a/tests/kernel-cases/solids/cov-bounding-solid-of-a-sphere/recipe.json b/tests/kernel-cases/solids/cov-bounding-solid-of-a-sphere/recipe.json new file mode 100644 index 000000000..686f78767 --- /dev/null +++ b/tests/kernel-cases/solids/cov-bounding-solid-of-a-sphere/recipe.json @@ -0,0 +1,25 @@ +{ + "commands": [ + { + "command": "solid.sphere", + "params": { + "radius": 10, + "center": [ + 5, + 5, + 5 + ], + "body_name": "Ball" + } + }, + { + "command": "solid.bounding_solid", + "params": { + "bodies": [ + "Ball" + ], + "body_name": "Bound" + } + } + ] +} diff --git a/tests/kernel-cases/solids/cov-bounding-solid-two-boxes-with-margin/expected.json b/tests/kernel-cases/solids/cov-bounding-solid-two-boxes-with-margin/expected.json new file mode 100644 index 000000000..c2cdffc6d --- /dev/null +++ b/tests/kernel-cases/solids/cov-bounding-solid-two-boxes-with-margin/expected.json @@ -0,0 +1,20 @@ +{ + "sources": [], + "what": "the bounding box of two boxes (0..10 cube, 20..25 x 0..5 x 0..5) with a 2 mm margin", + "source": "analytic", + "method": "the boxes span (0,0,0)-(25,10,10); with 2 mm: (-2,-2,-2)-(27,12,12) = 29x14x14 = 5684; with both boxes kept: V = 1000 + 125 + 5684", + "body_count": 3, + "volume_mm3": 6809, + "bbox": { + "min": [ + -2, + -2, + -2 + ], + "max": [ + 27, + 12, + 12 + ] + } +} diff --git a/tests/kernel-cases/solids/cov-bounding-solid-two-boxes-with-margin/recipe.json b/tests/kernel-cases/solids/cov-bounding-solid-two-boxes-with-margin/recipe.json new file mode 100644 index 000000000..54f3a63d8 --- /dev/null +++ b/tests/kernel-cases/solids/cov-bounding-solid-two-boxes-with-margin/recipe.json @@ -0,0 +1,34 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 10, + "width": 10, + "height": 10, + "body_name": "A" + } + }, + { + "command": "solid.box", + "params": { + "length": 5, + "width": 5, + "height": 5, + "corner": [ + 20, + 0, + 0 + ], + "body_name": "B" + } + }, + { + "command": "solid.bounding_solid", + "params": { + "margin": 2, + "body_name": "Bound" + } + } + ] +} From a5513a4e178eab4e3d81216b0935771aa475daea Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:50:20 -0400 Subject: [PATCH 027/108] Kernel rig: boundary fill cases, the lens and the crescent of two cylinders, and a point outside every tool refused Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 21 ++++++++++ .../recipe.json | 42 +++++++++++++++++++ .../expected.json | 21 ++++++++++ .../recipe.json | 42 +++++++++++++++++++ .../expected.json | 8 ++++ .../recipe.json | 41 ++++++++++++++++++ 6 files changed, 175 insertions(+) create mode 100644 tests/kernel-cases/booleans/cov-boundary-fill-crescent-inside-one-tool/expected.json create mode 100644 tests/kernel-cases/booleans/cov-boundary-fill-crescent-inside-one-tool/recipe.json create mode 100644 tests/kernel-cases/booleans/cov-boundary-fill-lens-of-two-cylinders/expected.json create mode 100644 tests/kernel-cases/booleans/cov-boundary-fill-lens-of-two-cylinders/recipe.json create mode 100644 tests/kernel-cases/booleans/cov-boundary-fill-point-outside-every-tool-refused/expected.json create mode 100644 tests/kernel-cases/booleans/cov-boundary-fill-point-outside-every-tool-refused/recipe.json diff --git a/tests/kernel-cases/booleans/cov-boundary-fill-crescent-inside-one-tool/expected.json b/tests/kernel-cases/booleans/cov-boundary-fill-crescent-inside-one-tool/expected.json new file mode 100644 index 000000000..5e1c18404 --- /dev/null +++ b/tests/kernel-cases/booleans/cov-boundary-fill-crescent-inside-one-tool/expected.json @@ -0,0 +1,21 @@ +{ + "sources": [], + "what": "Boundary Fill of the cell inside one cylinder and outside the other: the crescent", + "source": "analytic", + "method": "A minus the lens: 1000 pi - 1228.370; faces: bottom, top, A's outer arc, B's inner arc = 4", + "body_count": 1, + "faces": 4, + "volume_mm3": 1913.222954981036, + "bbox": { + "min": [ + -10, + -10, + 0 + ], + "max": [ + 10, + 10, + 10 + ] + } +} diff --git a/tests/kernel-cases/booleans/cov-boundary-fill-crescent-inside-one-tool/recipe.json b/tests/kernel-cases/booleans/cov-boundary-fill-crescent-inside-one-tool/recipe.json new file mode 100644 index 000000000..d6256522f --- /dev/null +++ b/tests/kernel-cases/booleans/cov-boundary-fill-crescent-inside-one-tool/recipe.json @@ -0,0 +1,42 @@ +{ + "commands": [ + { + "command": "solid.cylinder", + "params": { + "radius": 10, + "height": 10, + "body_name": "A" + } + }, + { + "command": "solid.cylinder", + "params": { + "radius": 10, + "height": 10, + "base": [ + 10, + 0, + 0 + ], + "body_name": "B" + } + }, + { + "command": "solid.boundary_fill", + "params": { + "tools": [ + "A", + "B" + ], + "cells": [ + [ + -5, + 0, + 5 + ] + ], + "remove_tools": true + } + } + ] +} diff --git a/tests/kernel-cases/booleans/cov-boundary-fill-lens-of-two-cylinders/expected.json b/tests/kernel-cases/booleans/cov-boundary-fill-lens-of-two-cylinders/expected.json new file mode 100644 index 000000000..235cf5d6b --- /dev/null +++ b/tests/kernel-cases/booleans/cov-boundary-fill-lens-of-two-cylinders/expected.json @@ -0,0 +1,21 @@ +{ + "sources": [], + "what": "Boundary Fill of the cell inside both of two overlapping cylinders (r10, axes 10 apart): the lens", + "source": "analytic", + "method": "two circles r with centres d = r apart overlap in 2r^2 acos(d/2r) - (d/2) sqrt(4r^2-d^2) = 200 pi/3 - 5 sqrt 300 = 122.837; h 10. Faces: bottom, top, two cylinder arcs = 4", + "body_count": 1, + "faces": 4, + "volume_mm3": 1228.3696986087568, + "bbox": { + "min": [ + 0, + -8.660254037844387, + 0 + ], + "max": [ + 10, + 8.660254037844387, + 10 + ] + } +} diff --git a/tests/kernel-cases/booleans/cov-boundary-fill-lens-of-two-cylinders/recipe.json b/tests/kernel-cases/booleans/cov-boundary-fill-lens-of-two-cylinders/recipe.json new file mode 100644 index 000000000..0309db09c --- /dev/null +++ b/tests/kernel-cases/booleans/cov-boundary-fill-lens-of-two-cylinders/recipe.json @@ -0,0 +1,42 @@ +{ + "commands": [ + { + "command": "solid.cylinder", + "params": { + "radius": 10, + "height": 10, + "body_name": "A" + } + }, + { + "command": "solid.cylinder", + "params": { + "radius": 10, + "height": 10, + "base": [ + 10, + 0, + 0 + ], + "body_name": "B" + } + }, + { + "command": "solid.boundary_fill", + "params": { + "tools": [ + "A", + "B" + ], + "cells": [ + [ + 5, + 0, + 5 + ] + ], + "remove_tools": true + } + } + ] +} diff --git a/tests/kernel-cases/booleans/cov-boundary-fill-point-outside-every-tool-refused/expected.json b/tests/kernel-cases/booleans/cov-boundary-fill-point-outside-every-tool-refused/expected.json new file mode 100644 index 000000000..344fe9ebd --- /dev/null +++ b/tests/kernel-cases/booleans/cov-boundary-fill-point-outside-every-tool-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "a cell point outside every tool encloses nothing: refused", + "source": "analytic", + "method": "(50,50,5) is in neither cylinder: no cell there, a clean refusal", + "outcome": "refused", + "refusal": "outside every tool" +} diff --git a/tests/kernel-cases/booleans/cov-boundary-fill-point-outside-every-tool-refused/recipe.json b/tests/kernel-cases/booleans/cov-boundary-fill-point-outside-every-tool-refused/recipe.json new file mode 100644 index 000000000..400ceaf39 --- /dev/null +++ b/tests/kernel-cases/booleans/cov-boundary-fill-point-outside-every-tool-refused/recipe.json @@ -0,0 +1,41 @@ +{ + "commands": [ + { + "command": "solid.cylinder", + "params": { + "radius": 10, + "height": 10, + "body_name": "A" + } + }, + { + "command": "solid.cylinder", + "params": { + "radius": 10, + "height": 10, + "base": [ + 10, + 0, + 0 + ], + "body_name": "B" + } + }, + { + "command": "solid.boundary_fill", + "params": { + "tools": [ + "A", + "B" + ], + "cells": [ + [ + 50, + 50, + 5 + ] + ] + } + } + ] +} From f0eac58a2c1ce998e48dfff3cfd63950d24d3247 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:50:20 -0400 Subject: [PATCH 028/108] Kernel rig: align cases, face onto face as a move, a side face turned onto a top face, and a face onto an offset plane along its normal Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 25 +++++++++++ .../recipe.json | 45 +++++++++++++++++++ .../expected.json | 20 +++++++++ .../recipe.json | 43 ++++++++++++++++++ .../expected.json | 25 +++++++++++ .../recipe.json | 45 +++++++++++++++++++ 6 files changed, 203 insertions(+) create mode 100644 tests/kernel-cases/solids/cov-align-bottom-face-onto-top-face/expected.json create mode 100644 tests/kernel-cases/solids/cov-align-bottom-face-onto-top-face/recipe.json create mode 100644 tests/kernel-cases/solids/cov-align-face-onto-offset-plane/expected.json create mode 100644 tests/kernel-cases/solids/cov-align-face-onto-offset-plane/recipe.json create mode 100644 tests/kernel-cases/solids/cov-align-side-face-turns-onto-top-face/expected.json create mode 100644 tests/kernel-cases/solids/cov-align-side-face-turns-onto-top-face/recipe.json diff --git a/tests/kernel-cases/solids/cov-align-bottom-face-onto-top-face/expected.json b/tests/kernel-cases/solids/cov-align-bottom-face-onto-top-face/expected.json new file mode 100644 index 000000000..78e72fc96 --- /dev/null +++ b/tests/kernel-cases/solids/cov-align-bottom-face-onto-top-face/expected.json @@ -0,0 +1,25 @@ +{ + "sources": [], + "what": "a cube's bottom face aligned onto a plate's top face (normals already opposite: a pure move)", + "source": "analytic", + "method": "the faces' normals are -Z and +Z: no turn; the picked point (105,5,0) goes to (20,20,10): the cube moves by (-85,15,10) to x 15..25, y 15..25, z 10..20. COM z = (16000*5 + 1000*15)/17000", + "body_count": 2, + "volume_mm3": 17000.0, + "center_of_mass": [ + 20, + 20, + 5.588235294117647 + ], + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 40, + 40, + 20 + ] + } +} diff --git a/tests/kernel-cases/solids/cov-align-bottom-face-onto-top-face/recipe.json b/tests/kernel-cases/solids/cov-align-bottom-face-onto-top-face/recipe.json new file mode 100644 index 000000000..3666f0c26 --- /dev/null +++ b/tests/kernel-cases/solids/cov-align-bottom-face-onto-top-face/recipe.json @@ -0,0 +1,45 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 40, + "height": 10, + "body_name": "Base" + } + }, + { + "command": "solid.box", + "params": { + "length": 10, + "width": 10, + "height": 10, + "corner": [ + 100, + 0, + 0 + ], + "body_name": "Block" + } + }, + { + "command": "solid.align", + "params": { + "bodies": [ + "Block" + ], + "from_face": [ + 105, + 5, + 0 + ], + "to_face": [ + 20, + 20, + 10 + ] + } + } + ] +} diff --git a/tests/kernel-cases/solids/cov-align-face-onto-offset-plane/expected.json b/tests/kernel-cases/solids/cov-align-face-onto-offset-plane/expected.json new file mode 100644 index 000000000..b8885dd3f --- /dev/null +++ b/tests/kernel-cases/solids/cov-align-face-onto-offset-plane/expected.json @@ -0,0 +1,20 @@ +{ + "sources": [], + "what": "a post's bottom face aligned onto a plane z=50 away from the picked point in X and Y: it moves along the plane's normal only", + "source": "analytic", + "method": "onto a plane the point moves along its normal: (0,0,50); the bottom faces -Z, the plane +Z: no turn. The post goes to z 50..70, x and y unchanged", + "body_count": 1, + "volume_mm3": 2000.0, + "bbox": { + "min": [ + 100, + 0, + 50 + ], + "max": [ + 110, + 10, + 70 + ] + } +} diff --git a/tests/kernel-cases/solids/cov-align-face-onto-offset-plane/recipe.json b/tests/kernel-cases/solids/cov-align-face-onto-offset-plane/recipe.json new file mode 100644 index 000000000..44122140d --- /dev/null +++ b/tests/kernel-cases/solids/cov-align-face-onto-offset-plane/recipe.json @@ -0,0 +1,43 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 10, + "width": 10, + "height": 20, + "corner": [ + 100, + 0, + 0 + ], + "body_name": "Post" + } + }, + { + "command": "solid.align", + "params": { + "bodies": [ + "Post" + ], + "from_face": [ + 105, + 5, + 0 + ], + "to_plane": { + "origin": [ + 0, + 0, + 50 + ], + "normal": [ + 0, + 0, + 1 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/solids/cov-align-side-face-turns-onto-top-face/expected.json b/tests/kernel-cases/solids/cov-align-side-face-turns-onto-top-face/expected.json new file mode 100644 index 000000000..6f3432214 --- /dev/null +++ b/tests/kernel-cases/solids/cov-align-side-face-turns-onto-top-face/expected.json @@ -0,0 +1,25 @@ +{ + "sources": [], + "what": "a 10x10x20 post's side face (+X) aligned onto a plate's top face: the post turns 90 deg to lie flat", + "source": "analytic", + "method": "+X turns onto -Z: 90 deg about +Y through (110,5,10), the post becomes 20 along X, 10 along Z (x 100..120, z 10..20); the point then moves to (20,20,10): x 10..30, y 15..25, z 10..20. Unturned it would reach z 30. COM z = (16000*5 + 2000*15)/18000", + "body_count": 2, + "volume_mm3": 18000.0, + "center_of_mass": [ + 20, + 20, + 6.111111111111111 + ], + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 40, + 40, + 20 + ] + } +} diff --git a/tests/kernel-cases/solids/cov-align-side-face-turns-onto-top-face/recipe.json b/tests/kernel-cases/solids/cov-align-side-face-turns-onto-top-face/recipe.json new file mode 100644 index 000000000..3c182ec00 --- /dev/null +++ b/tests/kernel-cases/solids/cov-align-side-face-turns-onto-top-face/recipe.json @@ -0,0 +1,45 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 40, + "height": 10, + "body_name": "Base" + } + }, + { + "command": "solid.box", + "params": { + "length": 10, + "width": 10, + "height": 20, + "corner": [ + 100, + 0, + 0 + ], + "body_name": "Post" + } + }, + { + "command": "solid.align", + "params": { + "bodies": [ + "Post" + ], + "from_face": [ + 110, + 5, + 10 + ], + "to_face": [ + 20, + 20, + 10 + ] + } + } + ] +} From 1e9cefe1e86ce91561667102eb2a20131bbb8930 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:50:20 -0400 Subject: [PATCH 029/108] Kernel rig: web cases, two gussets in a channel's corners and two walls grown along the sketch normal Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 20 +++ .../recipe.json | 97 ++++++++++++++ .../expected.json | 20 +++ .../recipe.json | 119 ++++++++++++++++++ 4 files changed, 256 insertions(+) create mode 100644 tests/kernel-cases/sweeps/cov-web-normal-two-walls-reach-the-block/expected.json create mode 100644 tests/kernel-cases/sweeps/cov-web-normal-two-walls-reach-the-block/recipe.json create mode 100644 tests/kernel-cases/sweeps/cov-web-two-gussets-in-a-channel/expected.json create mode 100644 tests/kernel-cases/sweeps/cov-web-two-gussets-in-a-channel/recipe.json diff --git a/tests/kernel-cases/sweeps/cov-web-normal-two-walls-reach-the-block/expected.json b/tests/kernel-cases/sweeps/cov-web-normal-two-walls-reach-the-block/expected.json new file mode 100644 index 000000000..99b57a6e8 --- /dev/null +++ b/tests/kernel-cases/sweeps/cov-web-normal-two-walls-reach-the-block/expected.json @@ -0,0 +1,20 @@ +{ + "sources": [], + "what": "a web along the sketch normal: two 10 mm lines on a plane 20 mm in front of a block, each a wall grown to the block", + "source": "analytic", + "method": "each wall runs along +Y from y=-20 to the block face y=0: 10 long, 2 thick in the plane, 20 deep: 400 each; V = 24000 + 800", + "body_count": 1, + "volume_mm3": 24800.0, + "bbox": { + "min": [ + 0, + -20, + 0 + ], + "max": [ + 60, + 40, + 10 + ] + } +} diff --git a/tests/kernel-cases/sweeps/cov-web-normal-two-walls-reach-the-block/recipe.json b/tests/kernel-cases/sweeps/cov-web-normal-two-walls-reach-the-block/recipe.json new file mode 100644 index 000000000..d6a39180f --- /dev/null +++ b/tests/kernel-cases/sweeps/cov-web-normal-two-walls-reach-the-block/recipe.json @@ -0,0 +1,97 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 60, + "width": 40, + "height": 10, + "corner": [ + 0, + 0, + 0 + ], + "body_name": "Block" + } + }, + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0.0, + -20.0, + 0.0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 0, + 1 + ] + }, + "name": "WebS" + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 10, + 5 + ], + [ + 20, + 5 + ] + ], + "ids": [ + "w1" + ], + "infer": false + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 40, + 5 + ], + [ + 50, + 5 + ] + ], + "ids": [ + "w2" + ], + "infer": false + } + }, + { + "command": "sketch.finish", + "params": { + "sketch": "WebS" + } + }, + { + "command": "solid.web", + "params": { + "sketch": "WebS", + "curves": [ + "w1", + "w2" + ], + "thickness": 2, + "direction": "normal" + } + } + ] +} diff --git a/tests/kernel-cases/sweeps/cov-web-two-gussets-in-a-channel/expected.json b/tests/kernel-cases/sweeps/cov-web-two-gussets-in-a-channel/expected.json new file mode 100644 index 000000000..3d69f8bd6 --- /dev/null +++ b/tests/kernel-cases/sweeps/cov-web-two-gussets-in-a-channel/expected.json @@ -0,0 +1,20 @@ +{ + "sources": [], + "what": "a web of two lines, one wall each, across the two inside corners of a U channel", + "source": "analytic", + "method": "channel: base 60x40x5 + two walls 5x40x35 = 26000; each line closes a right triangle of legs 15 with its wall and the base: 2 * 112.5 * 2 thick = 450", + "body_count": 1, + "volume_mm3": 26450.0, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 60, + 40, + 40 + ] + } +} diff --git a/tests/kernel-cases/sweeps/cov-web-two-gussets-in-a-channel/recipe.json b/tests/kernel-cases/sweeps/cov-web-two-gussets-in-a-channel/recipe.json new file mode 100644 index 000000000..e90984050 --- /dev/null +++ b/tests/kernel-cases/sweeps/cov-web-two-gussets-in-a-channel/recipe.json @@ -0,0 +1,119 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 60, + "width": 40, + "height": 5, + "body_name": "Bracket" + } + }, + { + "command": "solid.box", + "params": { + "length": 5, + "width": 40, + "height": 40, + "corner": [ + 0, + 0, + 0 + ], + "operation": "join" + } + }, + { + "command": "solid.box", + "params": { + "length": 5, + "width": 40, + "height": 40, + "corner": [ + 55, + 0, + 0 + ], + "operation": "join" + } + }, + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 20, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 0, + 1 + ] + }, + "name": "Gussets" + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 5, + 20 + ], + [ + 20, + 5 + ] + ], + "ids": [ + "g1" + ], + "infer": false + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 40, + 5 + ], + [ + 55, + 20 + ] + ], + "ids": [ + "g2" + ], + "infer": false + } + }, + { + "command": "sketch.finish", + "params": { + "sketch": "Gussets" + } + }, + { + "command": "solid.web", + "params": { + "sketch": "Gussets", + "curves": [ + "g1", + "g2" + ], + "thickness": 2 + } + } + ] +} From 4e7810659b4f1272f15183c2fa5cf651604bc3f7 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:50:20 -0400 Subject: [PATCH 030/108] Kernel rig: frames area, frame member and inserted profile cases with their exact sections, placements and a too-thick wall refused Co-Authored-By: Claude Opus 5.5 --- tests/kernel-cases/README.md | 2 + tests/kernel-cases/frames/KNOWN_FAILING | 4 ++ tests/kernel-cases/frames/PATHS | 9 +++ .../expected.json | 22 +++++++ .../cov-frame-member-bar-along-x/recipe.json | 47 +++++++++++++ .../expected.json | 21 ++++++ .../recipe.json | 66 +++++++++++++++++++ .../expected.json | 8 +++ .../recipe.json | 48 ++++++++++++++ .../expected.json | 20 ++++++ .../recipe.json | 65 ++++++++++++++++++ .../expected.json | 21 ++++++ .../recipe.json | 44 +++++++++++++ .../expected.json | 21 ++++++ .../recipe.json | 37 +++++++++++ 15 files changed, 435 insertions(+) create mode 100644 tests/kernel-cases/frames/KNOWN_FAILING create mode 100644 tests/kernel-cases/frames/PATHS create mode 100644 tests/kernel-cases/frames/cov-frame-member-bar-along-x/expected.json create mode 100644 tests/kernel-cases/frames/cov-frame-member-bar-along-x/recipe.json create mode 100644 tests/kernel-cases/frames/cov-frame-member-tube-post-at-its-corner/expected.json create mode 100644 tests/kernel-cases/frames/cov-frame-member-tube-post-at-its-corner/recipe.json create mode 100644 tests/kernel-cases/frames/cov-frame-member-tube-wall-too-thick-refused/expected.json create mode 100644 tests/kernel-cases/frames/cov-frame-member-tube-wall-too-thick-refused/recipe.json create mode 100644 tests/kernel-cases/frames/cov-frame-member-two-lines-two-bodies/expected.json create mode 100644 tests/kernel-cases/frames/cov-frame-member-two-lines-two-bodies/recipe.json create mode 100644 tests/kernel-cases/frames/cov-frame-profile-insert-channel-anchored-and-turned/expected.json create mode 100644 tests/kernel-cases/frames/cov-frame-profile-insert-channel-anchored-and-turned/recipe.json create mode 100644 tests/kernel-cases/frames/cov-frame-profile-insert-i-beam-extruded/expected.json create mode 100644 tests/kernel-cases/frames/cov-frame-profile-insert-i-beam-extruded/recipe.json diff --git a/tests/kernel-cases/README.md b/tests/kernel-cases/README.md index 709ec90c0..aeb550246 100644 --- a/tests/kernel-cases/README.md +++ b/tests/kernel-cases/README.md @@ -37,6 +37,8 @@ One directory per area, one per case: `tests/kernel-cases///`. | `crashes` (crashes and hangs inside kernel operations) | booleans/shell/import/crash rig | | `fillets`, `sweeps`, `threads`, `sheet-metal`, `tessellation` | history rig | | `continuity` (designed seams of known order, G0 to G4, that prove the continuity measurement itself) | history rig | +| `solids` (cones, scale, align, bounding solids) | tool coverage | +| `frames` (frame members, inserted profiles) | tool coverage | Each area also has its gate files: `KNOWN_FAILING` and `PATHS` (see [the gate](#the-kernel-rig-gate)). diff --git a/tests/kernel-cases/frames/KNOWN_FAILING b/tests/kernel-cases/frames/KNOWN_FAILING new file mode 100644 index 000000000..f1ab5c3aa --- /dev/null +++ b/tests/kernel-cases/frames/KNOWN_FAILING @@ -0,0 +1,4 @@ +# The frames cases that fail today, one a line: ` `. Sorted. A run with +# `--known-failing` fails on a case that fails and is not listed here, and on a listed case that +# passes: a fix removes its line in the same pull request. +# Baseline: rig-cases-solids-frames 45f69c0e5 with SMLib 60b1c6a, aarch64 Linux. diff --git a/tests/kernel-cases/frames/PATHS b/tests/kernel-cases/frames/PATHS new file mode 100644 index 000000000..f09de15ae --- /dev/null +++ b/tests/kernel-cases/frames/PATHS @@ -0,0 +1,9 @@ +# Source files whose change must rerun the frames area (frame members, inserted profiles). +apps/solidcraft-cli/src/kernel_cases.rs +crates/doc/src/eval_frame.rs +crates/doc/src/frame.rs +crates/engine/src/cmd/frame.rs +crates/engine/src/cmd/sketch.rs +crates/kernel/src/** +crates/smlib/** +tests/kernel-cases/frames/** diff --git a/tests/kernel-cases/frames/cov-frame-member-bar-along-x/expected.json b/tests/kernel-cases/frames/cov-frame-member-bar-along-x/expected.json new file mode 100644 index 000000000..1ad1fdad0 --- /dev/null +++ b/tests/kernel-cases/frames/cov-frame-member-bar-along-x/expected.json @@ -0,0 +1,22 @@ +{ + "sources": [], + "what": "a 20x10 bar member along a 100 mm line on X", + "source": "analytic", + "method": "along +X the profile's y is world up (Z) and x = y x d = world Y; centred on the line (anchor origin = the bar's centre): x 0..100, y -10..10, z -5..5; V = 20000, A = 2(2000+1000+200)", + "body_count": 1, + "faces": 6, + "volume_mm3": 20000.0, + "area_mm2": 6400.0, + "bbox": { + "min": [ + 0, + -10, + -5 + ], + "max": [ + 100, + 10, + 5 + ] + } +} diff --git a/tests/kernel-cases/frames/cov-frame-member-bar-along-x/recipe.json b/tests/kernel-cases/frames/cov-frame-member-bar-along-x/recipe.json new file mode 100644 index 000000000..92e9fa692 --- /dev/null +++ b/tests/kernel-cases/frames/cov-frame-member-bar-along-x/recipe.json @@ -0,0 +1,47 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Frame" + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 0, + 0 + ], + [ + 100, + 0 + ] + ], + "ids": [ + "l1" + ], + "infer": false + } + }, + { + "command": "sketch.finish", + "params": { + "sketch": "Frame" + } + }, + { + "command": "frame.member", + "params": { + "sketch": "Frame", + "profile": { + "kind": "bar", + "width": 20, + "height": 10 + } + } + } + ] +} diff --git a/tests/kernel-cases/frames/cov-frame-member-tube-post-at-its-corner/expected.json b/tests/kernel-cases/frames/cov-frame-member-tube-post-at-its-corner/expected.json new file mode 100644 index 000000000..796064730 --- /dev/null +++ b/tests/kernel-cases/frames/cov-frame-member-tube-post-at-its-corner/expected.json @@ -0,0 +1,21 @@ +{ + "sources": [], + "what": "a vertical rectangular tube 40x30x3 (sharp corners) on a 50 mm line, anchored at the profile's bottom left corner", + "source": "analytic", + "method": "a vertical member's x is world X, y = d x X = world Y; the bottom left corner on the line: x 0..40, y 0..30, z 0..50; section 40*30 - 34*24 = 384, V = 19200; faces 4 outside + 4 inside + 2 ends", + "body_count": 1, + "faces": 10, + "volume_mm3": 19200.0, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 40, + 30, + 50 + ] + } +} diff --git a/tests/kernel-cases/frames/cov-frame-member-tube-post-at-its-corner/recipe.json b/tests/kernel-cases/frames/cov-frame-member-tube-post-at-its-corner/recipe.json new file mode 100644 index 000000000..bb1f4333b --- /dev/null +++ b/tests/kernel-cases/frames/cov-frame-member-tube-post-at-its-corner/recipe.json @@ -0,0 +1,66 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 0, + 1 + ] + }, + "name": "Post" + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 0, + 0 + ], + [ + 0, + 50 + ] + ], + "ids": [ + "l1" + ], + "infer": false + } + }, + { + "command": "sketch.finish", + "params": { + "sketch": "Post" + } + }, + { + "command": "frame.member", + "params": { + "sketch": "Post", + "profile": { + "kind": "rect_tube", + "width": 40, + "height": 30, + "wall": 3, + "outer_radius": 0 + }, + "anchor": "bottom_left" + } + } + ] +} diff --git a/tests/kernel-cases/frames/cov-frame-member-tube-wall-too-thick-refused/expected.json b/tests/kernel-cases/frames/cov-frame-member-tube-wall-too-thick-refused/expected.json new file mode 100644 index 000000000..3d775625d --- /dev/null +++ b/tests/kernel-cases/frames/cov-frame-member-tube-wall-too-thick-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "a 40x40 tube with a 20 mm wall has no hole: refused", + "source": "analytic", + "method": "the wall must be under half the smaller side (20): a clean refusal naming it", + "outcome": "refused", + "refusal": "must be less than half the smaller side" +} diff --git a/tests/kernel-cases/frames/cov-frame-member-tube-wall-too-thick-refused/recipe.json b/tests/kernel-cases/frames/cov-frame-member-tube-wall-too-thick-refused/recipe.json new file mode 100644 index 000000000..0da9066ce --- /dev/null +++ b/tests/kernel-cases/frames/cov-frame-member-tube-wall-too-thick-refused/recipe.json @@ -0,0 +1,48 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Frame" + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 0, + 0 + ], + [ + 100, + 0 + ] + ], + "ids": [ + "l1" + ], + "infer": false + } + }, + { + "command": "sketch.finish", + "params": { + "sketch": "Frame" + } + }, + { + "command": "frame.member", + "params": { + "sketch": "Frame", + "profile": { + "kind": "rect_tube", + "width": 40, + "height": 40, + "wall": 20 + } + } + } + ] +} diff --git a/tests/kernel-cases/frames/cov-frame-member-two-lines-two-bodies/expected.json b/tests/kernel-cases/frames/cov-frame-member-two-lines-two-bodies/expected.json new file mode 100644 index 000000000..1a7ec0eff --- /dev/null +++ b/tests/kernel-cases/frames/cov-frame-member-two-lines-two-bodies/expected.json @@ -0,0 +1,20 @@ +{ + "sources": [], + "what": "round bar members d10 on two lines meeting at a corner: one body per line", + "source": "analytic", + "method": "each member a cylinder r5 the line's length: 25 pi (100 + 50); two bodies (they overlap at the corner, kept apart)", + "body_count": 2, + "volume_mm3": 11780.972450961724, + "bbox": { + "min": [ + -5, + -5, + -5 + ], + "max": [ + 100, + 50, + 5 + ] + } +} diff --git a/tests/kernel-cases/frames/cov-frame-member-two-lines-two-bodies/recipe.json b/tests/kernel-cases/frames/cov-frame-member-two-lines-two-bodies/recipe.json new file mode 100644 index 000000000..ce4e42bf2 --- /dev/null +++ b/tests/kernel-cases/frames/cov-frame-member-two-lines-two-bodies/recipe.json @@ -0,0 +1,65 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Frame" + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 0, + 0 + ], + [ + 100, + 0 + ] + ], + "ids": [ + "l1" + ], + "infer": false + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 0, + 0 + ], + [ + 0, + 50 + ] + ], + "ids": [ + "l2" + ], + "infer": false + } + }, + { + "command": "sketch.finish", + "params": { + "sketch": "Frame" + } + }, + { + "command": "frame.member", + "params": { + "sketch": "Frame", + "profile": { + "kind": "round_bar", + "diameter": 10 + } + } + } + ] +} diff --git a/tests/kernel-cases/frames/cov-frame-profile-insert-channel-anchored-and-turned/expected.json b/tests/kernel-cases/frames/cov-frame-profile-insert-channel-anchored-and-turned/expected.json new file mode 100644 index 000000000..26fe9f9df --- /dev/null +++ b/tests/kernel-cases/frames/cov-frame-profile-insert-channel-anchored-and-turned/expected.json @@ -0,0 +1,21 @@ +{ + "sources": [], + "what": "a channel profile 60x30 (web 5, flanges 6, sharp) inserted at (10,10) by its bottom left corner and turned 90 deg", + "source": "analytic", + "method": "section 2*30*6 + 5*48 = 600, V = 12000 at 20 deep; bounding box 30 wide, 60 high from its corner, turned 90 deg ccw about it: x 10-60..10, y 10..40", + "body_count": 1, + "faces": 10, + "volume_mm3": 12000.0, + "bbox": { + "min": [ + -50, + 10, + 0 + ], + "max": [ + 10, + 40, + 20 + ] + } +} diff --git a/tests/kernel-cases/frames/cov-frame-profile-insert-channel-anchored-and-turned/recipe.json b/tests/kernel-cases/frames/cov-frame-profile-insert-channel-anchored-and-turned/recipe.json new file mode 100644 index 000000000..912be5bd3 --- /dev/null +++ b/tests/kernel-cases/frames/cov-frame-profile-insert-channel-anchored-and-turned/recipe.json @@ -0,0 +1,44 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Section" + } + }, + { + "command": "frame.profile.insert", + "params": { + "profile": { + "kind": "channel", + "height": 60, + "width": 30, + "web": 5, + "flange": 6, + "root_radius": 0, + "toe_radius": 0 + }, + "at": [ + 10, + 10 + ], + "anchor": "bottom_left", + "angle": 1.5707963267948966 + } + }, + { + "command": "sketch.finish", + "params": { + "sketch": "Section" + } + }, + { + "command": "solid.extrude", + "params": { + "sketch": "Section", + "distance": 20 + } + } + ] +} diff --git a/tests/kernel-cases/frames/cov-frame-profile-insert-i-beam-extruded/expected.json b/tests/kernel-cases/frames/cov-frame-profile-insert-i-beam-extruded/expected.json new file mode 100644 index 000000000..79c717bd1 --- /dev/null +++ b/tests/kernel-cases/frames/cov-frame-profile-insert-i-beam-extruded/expected.json @@ -0,0 +1,21 @@ +{ + "sources": [], + "what": "an I-beam profile (100x50, web 4.5, flanges 7, sharp roots) inserted into a sketch and extruded 100", + "source": "analytic", + "method": "section 2*50*7 + 4.5*(100-14) = 1087, centred on the origin: V = 108700; faces 12 sides + 2 ends", + "body_count": 1, + "faces": 14, + "volume_mm3": 108700.0, + "bbox": { + "min": [ + -25, + -50, + 0 + ], + "max": [ + 25, + 50, + 100 + ] + } +} diff --git a/tests/kernel-cases/frames/cov-frame-profile-insert-i-beam-extruded/recipe.json b/tests/kernel-cases/frames/cov-frame-profile-insert-i-beam-extruded/recipe.json new file mode 100644 index 000000000..b206d837f --- /dev/null +++ b/tests/kernel-cases/frames/cov-frame-profile-insert-i-beam-extruded/recipe.json @@ -0,0 +1,37 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Section" + } + }, + { + "command": "frame.profile.insert", + "params": { + "profile": { + "kind": "i_beam", + "height": 100, + "width": 50, + "web": 4.5, + "flange": 7, + "root_radius": 0 + } + } + }, + { + "command": "sketch.finish", + "params": { + "sketch": "Section" + } + }, + { + "command": "solid.extrude", + "params": { + "sketch": "Section", + "distance": 100 + } + } + ] +} From 815711421e9361d3f28c55942a4ee29add22ce73 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:50:20 -0400 Subject: [PATCH 031/108] Kernel rig: second cases for draft (two adjacent faces), rib (in plane), press pull (an edge), split face (sketch and tool face) and sketch projection (a face loop and a silhouette) Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 21 +++++ .../recipe.json | 32 +++++++ .../expected.json | 9 ++ .../cov-press-pull-edge-rounds-it/recipe.json | 26 ++++++ .../expected.json | 20 +++++ .../recipe.json | 48 +++++++++++ .../expected.json | 20 +++++ .../recipe.json | 43 ++++++++++ .../expected.json | 10 +++ .../recipe.json | 50 +++++++++++ .../expected.json | 9 ++ .../recipe.json | 47 ++++++++++ .../expected.json | 20 +++++ .../recipe.json | 85 +++++++++++++++++++ 14 files changed, 440 insertions(+) create mode 100644 tests/kernel-cases/booleans/cov-draft-two-adjacent-faces-meet-at-a-corner/expected.json create mode 100644 tests/kernel-cases/booleans/cov-draft-two-adjacent-faces-meet-at-a-corner/recipe.json create mode 100644 tests/kernel-cases/booleans/cov-press-pull-edge-rounds-it/expected.json create mode 100644 tests/kernel-cases/booleans/cov-press-pull-edge-rounds-it/recipe.json create mode 100644 tests/kernel-cases/booleans/cov-project-face-loop-then-extrude/expected.json create mode 100644 tests/kernel-cases/booleans/cov-project-face-loop-then-extrude/recipe.json create mode 100644 tests/kernel-cases/booleans/cov-project-sphere-silhouette-then-extrude/expected.json create mode 100644 tests/kernel-cases/booleans/cov-project-sphere-silhouette-then-extrude/recipe.json create mode 100644 tests/kernel-cases/booleans/cov-split-face-by-a-sketch-circle/expected.json create mode 100644 tests/kernel-cases/booleans/cov-split-face-by-a-sketch-circle/recipe.json create mode 100644 tests/kernel-cases/booleans/cov-split-face-by-another-bodys-face/expected.json create mode 100644 tests/kernel-cases/booleans/cov-split-face-by-another-bodys-face/recipe.json create mode 100644 tests/kernel-cases/sweeps/cov-rib-in-plane-gusset-in-a-corner/expected.json create mode 100644 tests/kernel-cases/sweeps/cov-rib-in-plane-gusset-in-a-corner/recipe.json diff --git a/tests/kernel-cases/booleans/cov-draft-two-adjacent-faces-meet-at-a-corner/expected.json b/tests/kernel-cases/booleans/cov-draft-two-adjacent-faces-meet-at-a-corner/expected.json new file mode 100644 index 000000000..0c81154e9 --- /dev/null +++ b/tests/kernel-cases/booleans/cov-draft-two-adjacent-faces-meet-at-a-corner/expected.json @@ -0,0 +1,21 @@ +{ + "sources": [], + "what": "two adjacent sides of a block (front and right) drafted 10 deg from the base: the drafted faces meet along a new slanted edge", + "source": "analytic", + "method": "the section at height z is (40 - z tan10)(30 - z tan10); V = int_0^20 = 24000 - 70 tan10 * 200 + tan10^2 * 8000/3; still 6 faces", + "body_count": 1, + "faces": 6, + "volume_mm3": 21614.332147750192, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 40, + 30, + 20 + ] + } +} diff --git a/tests/kernel-cases/booleans/cov-draft-two-adjacent-faces-meet-at-a-corner/recipe.json b/tests/kernel-cases/booleans/cov-draft-two-adjacent-faces-meet-at-a-corner/recipe.json new file mode 100644 index 000000000..e08acda0b --- /dev/null +++ b/tests/kernel-cases/booleans/cov-draft-two-adjacent-faces-meet-at-a-corner/recipe.json @@ -0,0 +1,32 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 20, + "body_name": "Block" + } + }, + { + "command": "solid.draft", + "params": { + "faces": [ + [ + 20, + 0, + 10 + ], + [ + 40, + 15, + 10 + ] + ], + "angle": "10 deg", + "neutral": "XY" + } + } + ] +} diff --git a/tests/kernel-cases/booleans/cov-press-pull-edge-rounds-it/expected.json b/tests/kernel-cases/booleans/cov-press-pull-edge-rounds-it/expected.json new file mode 100644 index 000000000..08330da63 --- /dev/null +++ b/tests/kernel-cases/booleans/cov-press-pull-edge-rounds-it/expected.json @@ -0,0 +1,9 @@ +{ + "sources": [], + "what": "Press Pull on an edge (its fillet mode): the block's top front edge rounded r2", + "source": "analytic", + "method": "a round r2 along 40 mm removes (1 - pi/4) r^2 * 40; faces 6 + 1", + "body_count": 1, + "faces": 7, + "volume_mm3": 11965.663706143592 +} diff --git a/tests/kernel-cases/booleans/cov-press-pull-edge-rounds-it/recipe.json b/tests/kernel-cases/booleans/cov-press-pull-edge-rounds-it/recipe.json new file mode 100644 index 000000000..aa79e1d5a --- /dev/null +++ b/tests/kernel-cases/booleans/cov-press-pull-edge-rounds-it/recipe.json @@ -0,0 +1,26 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 10, + "body_name": "Block" + } + }, + { + "command": "solid.press_pull", + "params": { + "edges": [ + [ + 20, + 0, + 10 + ] + ], + "distance": 2 + } + } + ] +} diff --git a/tests/kernel-cases/booleans/cov-project-face-loop-then-extrude/expected.json b/tests/kernel-cases/booleans/cov-project-face-loop-then-extrude/expected.json new file mode 100644 index 000000000..c3d5e9ad9 --- /dev/null +++ b/tests/kernel-cases/booleans/cov-project-face-loop-then-extrude/expected.json @@ -0,0 +1,20 @@ +{ + "sources": [], + "what": "a cylinder's top face projected onto a sketch 10 mm above it and extruded: the projected circle is the profile", + "source": "analytic", + "method": "the top's loop is the circle r10: extruded 5 from z=20, a second cylinder 500 pi beside the first 1000 pi", + "body_count": 2, + "volume_mm3": 4712.38898038469, + "bbox": { + "min": [ + -10, + -10, + 0 + ], + "max": [ + 10, + 10, + 25 + ] + } +} diff --git a/tests/kernel-cases/booleans/cov-project-face-loop-then-extrude/recipe.json b/tests/kernel-cases/booleans/cov-project-face-loop-then-extrude/recipe.json new file mode 100644 index 000000000..29aaa5df0 --- /dev/null +++ b/tests/kernel-cases/booleans/cov-project-face-loop-then-extrude/recipe.json @@ -0,0 +1,48 @@ +{ + "commands": [ + { + "command": "solid.cylinder", + "params": { + "radius": 10, + "height": 10, + "body_name": "Post" + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "offset": 20, + "name": "Above" + } + }, + { + "command": "sketch.project", + "params": { + "refs": [ + { + "face": [ + 0, + 0, + 10 + ] + } + ] + } + }, + { + "command": "sketch.finish", + "params": { + "sketch": "Above" + } + }, + { + "command": "solid.extrude", + "params": { + "sketch": "Above", + "distance": 5, + "operation": "new" + } + } + ] +} diff --git a/tests/kernel-cases/booleans/cov-project-sphere-silhouette-then-extrude/expected.json b/tests/kernel-cases/booleans/cov-project-sphere-silhouette-then-extrude/expected.json new file mode 100644 index 000000000..1fcabd707 --- /dev/null +++ b/tests/kernel-cases/booleans/cov-project-sphere-silhouette-then-extrude/expected.json @@ -0,0 +1,20 @@ +{ + "sources": [], + "what": "a sphere's silhouette projected onto a plane below it and extruded: the outline is its equator circle, exactly", + "source": "analytic", + "method": "the silhouette of a sphere r8 seen along Z is the circle r8: extruded 5 down from z=-10, 320 pi beside the sphere 4/3 pi 512", + "body_count": 2, + "volume_mm3": 3149.9702339993655, + "bbox": { + "min": [ + -8, + -8, + -15 + ], + "max": [ + 8, + 8, + 8 + ] + } +} diff --git a/tests/kernel-cases/booleans/cov-project-sphere-silhouette-then-extrude/recipe.json b/tests/kernel-cases/booleans/cov-project-sphere-silhouette-then-extrude/recipe.json new file mode 100644 index 000000000..108d6be86 --- /dev/null +++ b/tests/kernel-cases/booleans/cov-project-sphere-silhouette-then-extrude/recipe.json @@ -0,0 +1,43 @@ +{ + "commands": [ + { + "command": "solid.sphere", + "params": { + "radius": 8, + "body_name": "Ball" + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "offset": -10, + "name": "Below" + } + }, + { + "command": "sketch.project", + "params": { + "refs": [ + { + "body": "Ball" + } + ] + } + }, + { + "command": "sketch.finish", + "params": { + "sketch": "Below" + } + }, + { + "command": "solid.extrude", + "params": { + "sketch": "Below", + "distance": -5, + "operation": "new" + } + } + ] +} diff --git a/tests/kernel-cases/booleans/cov-split-face-by-a-sketch-circle/expected.json b/tests/kernel-cases/booleans/cov-split-face-by-a-sketch-circle/expected.json new file mode 100644 index 000000000..a930a5de5 --- /dev/null +++ b/tests/kernel-cases/booleans/cov-split-face-by-a-sketch-circle/expected.json @@ -0,0 +1,10 @@ +{ + "sources": [], + "what": "a block's top face split by a sketch circle on it: a disc face and the face around it", + "source": "analytic", + "method": "the shape is unchanged (V 12000, A 3800); the top becomes two faces: 7", + "body_count": 1, + "faces": 7, + "volume_mm3": 12000.0, + "area_mm2": 3800.0 +} diff --git a/tests/kernel-cases/booleans/cov-split-face-by-a-sketch-circle/recipe.json b/tests/kernel-cases/booleans/cov-split-face-by-a-sketch-circle/recipe.json new file mode 100644 index 000000000..bc928a049 --- /dev/null +++ b/tests/kernel-cases/booleans/cov-split-face-by-a-sketch-circle/recipe.json @@ -0,0 +1,50 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 10, + "body_name": "Block" + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "offset": 10, + "name": "Ring" + } + }, + { + "command": "sketch.circle.center", + "params": { + "center": [ + 20, + 15 + ], + "radius": 5 + } + }, + { + "command": "sketch.finish", + "params": { + "sketch": "Ring" + } + }, + { + "command": "solid.split_face", + "params": { + "faces": [ + [ + 5, + 5, + 10 + ] + ], + "sketch": "Ring" + } + } + ] +} diff --git a/tests/kernel-cases/booleans/cov-split-face-by-another-bodys-face/expected.json b/tests/kernel-cases/booleans/cov-split-face-by-another-bodys-face/expected.json new file mode 100644 index 000000000..84ef73a68 --- /dev/null +++ b/tests/kernel-cases/booleans/cov-split-face-by-another-bodys-face/expected.json @@ -0,0 +1,9 @@ +{ + "sources": [], + "what": "a block's top face split by the side of a cylinder standing on it (the tool face's surface extended)", + "source": "analytic", + "method": "the cylinder's side meets the top in the circle r5: the top becomes two faces (7); the block keeps V 12000, the cylinder 250 pi and its 3 faces", + "body_count": 2, + "faces": 10, + "volume_mm3": 12785.398163397449 +} diff --git a/tests/kernel-cases/booleans/cov-split-face-by-another-bodys-face/recipe.json b/tests/kernel-cases/booleans/cov-split-face-by-another-bodys-face/recipe.json new file mode 100644 index 000000000..0a5f426b8 --- /dev/null +++ b/tests/kernel-cases/booleans/cov-split-face-by-another-bodys-face/recipe.json @@ -0,0 +1,47 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 10, + "body_name": "Block" + } + }, + { + "command": "solid.cylinder", + "params": { + "base": [ + 20, + 15, + 10 + ], + "radius": 5, + "height": 10, + "body_name": "Cutter" + } + }, + { + "command": "solid.split_face", + "params": { + "faces": [ + [ + 5, + 5, + 10 + ] + ], + "body": "Block", + "tool": { + "body": "Cutter", + "point": [ + 25, + 15, + 15 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/sweeps/cov-rib-in-plane-gusset-in-a-corner/expected.json b/tests/kernel-cases/sweeps/cov-rib-in-plane-gusset-in-a-corner/expected.json new file mode 100644 index 000000000..8560d334e --- /dev/null +++ b/tests/kernel-cases/sweeps/cov-rib-in-plane-gusset-in-a-corner/expected.json @@ -0,0 +1,20 @@ +{ + "sources": [], + "what": "an in-plane rib (the default direction): a diagonal line across the inside corner of an L bracket fills to the two faces", + "source": "analytic", + "method": "L bracket: base 60x40x5 + wall 5x40x35 above it = 19000; the line (5,25)-(25,5) in the plane y=20 closes with the wall x=5 and the base top z=5 a right triangle of legs 20: 200 mm^2, 2 thick across the plane: + 400", + "body_count": 1, + "volume_mm3": 19400.0, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 60, + 40, + 40 + ] + } +} diff --git a/tests/kernel-cases/sweeps/cov-rib-in-plane-gusset-in-a-corner/recipe.json b/tests/kernel-cases/sweeps/cov-rib-in-plane-gusset-in-a-corner/recipe.json new file mode 100644 index 000000000..f3ff6cdfd --- /dev/null +++ b/tests/kernel-cases/sweeps/cov-rib-in-plane-gusset-in-a-corner/recipe.json @@ -0,0 +1,85 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 60, + "width": 40, + "height": 5, + "body_name": "Bracket" + } + }, + { + "command": "solid.box", + "params": { + "length": 5, + "width": 40, + "height": 40, + "corner": [ + 0, + 0, + 0 + ], + "operation": "join" + } + }, + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 20, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 0, + 1 + ] + }, + "name": "Gussets" + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 5, + 25 + ], + [ + 25, + 5 + ] + ], + "ids": [ + "g1" + ], + "infer": false + } + }, + { + "command": "sketch.finish", + "params": { + "sketch": "Gussets" + } + }, + { + "command": "solid.rib", + "params": { + "sketch": "Gussets", + "curves": [ + "g1" + ], + "thickness": 2 + } + } + ] +} From acd7bb066dd788be115c3e97464ac7cadf7aebcb Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:58:07 -0400 Subject: [PATCH 032/108] Kernel rig: the boundary-fill crescent ends at the cusps, x = 5 Co-Authored-By: Claude Opus 5.5 --- .../cov-boundary-fill-crescent-inside-one-tool/expected.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/kernel-cases/booleans/cov-boundary-fill-crescent-inside-one-tool/expected.json b/tests/kernel-cases/booleans/cov-boundary-fill-crescent-inside-one-tool/expected.json index 5e1c18404..cd0c84a10 100644 --- a/tests/kernel-cases/booleans/cov-boundary-fill-crescent-inside-one-tool/expected.json +++ b/tests/kernel-cases/booleans/cov-boundary-fill-crescent-inside-one-tool/expected.json @@ -2,7 +2,7 @@ "sources": [], "what": "Boundary Fill of the cell inside one cylinder and outside the other: the crescent", "source": "analytic", - "method": "A minus the lens: 1000 pi - 1228.370; faces: bottom, top, A's outer arc, B's inner arc = 4", + "method": "A minus the lens: 1000 pi - 1228.370; faces: bottom, top, A's outer arc, B's inner arc = 4; A's arc with x > 5 lies inside B (|p - (10,0)|^2 = 200 - 200 cos t < 100 when cos t > 1/2), so the crescent ends at the cusps x = 5, y = \u00b15\u221a3: bbox max x = 5", "body_count": 1, "faces": 4, "volume_mm3": 1913.222954981036, @@ -13,7 +13,7 @@ 0 ], "max": [ - 10, + 5, 10, 10 ] From 45c95532621d563b4610d1b74fa6f7c2e8f03826 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:51:50 -0400 Subject: [PATCH 033/108] Kernel rig: a case can check the files it writes and the commands' answers A case's expected.json may name files written to $OUT (json, csv rows, or a DXF's entity counts and curve lengths per layer) and a command's answer by step, each matched as a part of what was made. Co-Authored-By: Claude Opus 5.5 --- apps/solidcraft-cli/src/kernel_cases.rs | 279 +++++++++++++++++++++++- 1 file changed, 275 insertions(+), 4 deletions(-) diff --git a/apps/solidcraft-cli/src/kernel_cases.rs b/apps/solidcraft-cli/src/kernel_cases.rs index 4ee445c7f..ba2e69fa8 100644 --- a/apps/solidcraft-cli/src/kernel_cases.rs +++ b/apps/solidcraft-cli/src/kernel_cases.rs @@ -258,6 +258,192 @@ fn continuity_order( Ok((got, ok)) } +/// Where `got` differs from `want`, a part of it: every key of a `want` object in `got` and +/// matching, an array element by element and as long, a whole number exactly, any other number +/// within `rel` of it (relative, at least 1 absolute), anything else equal. `None` where it +/// matches; else the path to the first difference with both values. +fn json_mismatch(got: &Value, want: &Value, rel: f64, path: &str) -> Option { + let differ = || Some(format!("{path}: got {got}, want {want}")); + match (got, want) { + (_, Value::Object(w)) => { + let Value::Object(g) = got else { return differ() }; + w.iter().find_map(|(k, wv)| match g.get(k) { + Some(gv) => json_mismatch(gv, wv, rel, &format!("{path}.{k}")), + None => Some(format!("{path}.{k}: missing, want {wv}")), + }) + } + (_, Value::Array(w)) => { + let Value::Array(g) = got else { return differ() }; + if g.len() != w.len() { + return Some(format!("{path}: {} items, want {}", g.len(), w.len())); + } + g.iter().zip(w).enumerate().find_map(|(i, (gv, wv))| json_mismatch(gv, wv, rel, &format!("{path}[{i}]"))) + } + (_, Value::Number(w)) if w.is_i64() || w.is_u64() => (got.as_f64() != w.as_f64()).then(differ).flatten(), + (_, Value::Number(w)) => { + let (g, w) = (got.as_f64(), w.as_f64().unwrap_or(f64::NAN)); + (!g.is_some_and(|g| g.is_finite() && (g - w).abs() <= rel * w.abs().max(1.0))).then(differ).flatten() + } + _ => (got != want).then(differ).flatten(), + } +} + +/// The rows of a CSV text (RFC 4180: quoted fields may hold commas, quotes and line breaks) as +/// objects keyed by the header row; a field that reads as a number is one. +fn csv_rows(text: &str) -> Vec { + let mut records: Vec> = Vec::new(); + let (mut row, mut field, mut quoted, mut chars) = (Vec::new(), String::new(), false, text.chars().peekable()); + while let Some(c) = chars.next() { + match (c, quoted) { + ('"', true) if chars.peek() == Some(&'"') => { + chars.next(); + field.push('"'); + } + ('"', _) => quoted = !quoted, + (',', false) => row.push(std::mem::take(&mut field)), + ('\r', false) => {} + ('\n', false) => { + row.push(std::mem::take(&mut field)); + records.push(std::mem::take(&mut row)); + } + _ => field.push(c), + } + } + if !field.is_empty() || !row.is_empty() { + row.push(field); + records.push(row); + } + let Some((head, rows)) = records.split_first() else { return Vec::new() }; + rows.iter() + .map(|r| { + let cell = |v: &String| v.parse::().ok().filter(|x| x.is_finite()).map_or_else(|| json!(v), |x| json!(x)); + Value::Object(head.iter().cloned().zip(r.iter().map(cell)).collect()) + }) + .collect() +} + +/// Per layer of a DXF text's ENTITIES section, how many of each entity it has and the total +/// length of its curves (`length_mm`: lines, arcs, circles, ellipses and polylines; a spline makes +/// the layer's length null, as not measured): `{layer: {"LINE": n, …, "length_mm": l}}`. +fn dxf_layers(text: &str) -> Value { + let lines: Vec<&str> = text.lines().map(str::trim).collect(); + let pairs: Vec<(&str, &str)> = lines.chunks(2).filter_map(|p| Some((*p.first()?, *p.get(1)?))).collect(); + let start = pairs.windows(2).position(|w| w[0] == ("0", "SECTION") && w[1] == ("2", "ENTITIES")).map_or(pairs.len(), |i| i + 2); + let mut layers = serde_json::Map::new(); + let mut i = start; + while let Some(&(code, kind)) = pairs.get(i) { + if code != "0" || kind == "ENDSEC" { + break; + } + let end = pairs.get(i + 1..).and_then(|r| r.iter().position(|p| p.0 == "0")).map_or(pairs.len(), |k| i + 1 + k); + let group = pairs.get(i + 1..end).unwrap_or(&[]); + let num = |c: &str| group.iter().find(|p| p.0 == c).and_then(|p| p.1.parse::().ok()).unwrap_or(0.0); + let all = |c: &str| group.iter().filter(|p| p.0 == c).filter_map(|p| p.1.parse::().ok()).collect::>(); + let layer = group.iter().find(|p| p.0 == "8").map_or("0", |p| p.1); + let length = match kind { + "LINE" => Some((num("11") - num("10")).hypot(num("21") - num("20"))), + "CIRCLE" => Some(std::f64::consts::TAU * num("40")), + "ARC" => Some(num("40") * (num("51") - num("50")).rem_euclid(360.0).to_radians()), + "LWPOLYLINE" => { + let mut pts: Vec<(f64, f64)> = all("10").into_iter().zip(all("20")).collect(); + if (num("70") as i64) & 1 == 1 + && let Some(&p) = pts.first() + { + pts.push(p); + } + Some(pts.windows(2).map(|w| (w[1].0 - w[0].0).hypot(w[1].1 - w[0].1)).sum()) + } + "ELLIPSE" => { + // Arc length of c + cos t·major + sin t·ratio·minor, t from 41 to 42, by Simpson's rule. + let (a, b) = (num("11").hypot(num("21")), num("11").hypot(num("21")) * num("40")); + let (t0, t1) = (num("41"), num("42")); + let sweep = if t1 > t0 { t1 - t0 } else { t1 - t0 + std::f64::consts::TAU }; + let n = 4096; + let speed = |t: f64| (a * t.sin()).hypot(b * t.cos()); + let h = sweep / n as f64; + let sum: f64 = (0..=n).map(|k| speed(t0 + k as f64 * h) * if k == 0 || k == n { 1.0 } else if k % 2 == 1 { 4.0 } else { 2.0 }).sum(); + Some(sum * h / 3.0) + } + _ => None, + }; + let entry = layers.entry(layer.to_string()).or_insert_with(|| json!({"length_mm": 0.0})); + entry[kind] = json!(entry[kind].as_u64().unwrap_or(0) + 1); + entry["length_mm"] = match (entry["length_mm"].as_f64(), length) { + (Some(l), Some(more)) => json!(l + more), + _ => Value::Null, + }; + i = end; + } + Value::Object(layers) +} + +/// The `files` check of the files a case wrote to `$OUT` (`out`): each `{path, json | csv | dxf}` +/// read and matched as [`json_mismatch`] does: `json` against the file's JSON, `csv` against its +/// rows ([`csv_rows`]), `dxf` against its layers ([`dxf_layers`]), a count there exact or an +/// inclusive range `[min, max]`. And the `results` check of the commands' own answers: each +/// `{step, json}`, the answer of the `step`th command (from 1) matched against `json`. +fn output_checks(c: &mut Checks, want: &Value, out: &str, results: &[Value], rel: f64) { + for f in want["files"].as_array().into_iter().flatten() { + let path = f["path"].as_str().unwrap_or_default(); + let what = format!("file {path}"); + let text = match std::fs::read_to_string(std::path::Path::new(out).join(path)) { + Ok(t) => t, + Err(e) => { + c.push(&what, json!(e.to_string()), json!("written"), false); + continue; + } + }; + let (got, wanted) = if let Some(w) = f.get("json") { + (serde_json::from_str::(&text).unwrap_or_else(|e| json!(format!("not JSON: {e}"))), w.clone()) + } else if let Some(w) = f.get("csv") { + (Value::Array(csv_rows(&text)), w.clone()) + } else if let Some(w) = f.get("dxf") { + let layers = dxf_layers(&text); + // A count given as a range is in it: compare the count itself with the range's bounds. + let mut w = w.clone(); + let mut ranged = Vec::new(); + for (layer, kinds) in w.as_object_mut().into_iter().flatten() { + for (kind, n) in kinds.as_object_mut().into_iter().flatten() { + if let Some([lo, hi]) = n.as_array().and_then(|r| <[Value; 2]>::try_from(r.clone()).ok()) { + let g = layers[layer.as_str()][kind.as_str()].as_u64().unwrap_or(0); + ranged.push((format!("{layer}.{kind}"), g, lo.clone(), hi.clone())); + *n = json!(g); + } + } + } + for (k, g, lo, hi) in ranged { + let ok = lo.as_u64().is_some_and(|lo| g >= lo) && hi.as_u64().is_some_and(|hi| g <= hi); + c.push(&format!("{what} {k}"), json!(g), json!([lo, hi]), ok); + } + // An entity the case names but the layer lacks counts 0. + let mut got = layers; + for (layer, kinds) in w.as_object().into_iter().flatten() { + for kind in kinds.as_object().into_iter().flatten().map(|(k, _)| k) { + if got[layer.as_str()].get(kind.as_str()).is_none() && kind != "length_mm" { + got[layer.as_str()][kind.as_str()] = json!(0); + } + } + } + (got, w) + } else { + c.push(&what, json!(f), json!("json, csv or dxf"), false); + continue; + }; + let miss = json_mismatch(&got, &wanted, rel, ""); + c.push(&what, json!(miss.clone().unwrap_or_else(|| "matches".into())), wanted, miss.is_none()); + } + for r in want["results"].as_array().into_iter().flatten() { + let step = r["step"].as_u64().unwrap_or(0); + let what = format!("result of step {step}"); + let got = step.checked_sub(1).and_then(|i| results.get(i as usize)); + let miss = match got { + Some(g) => json_mismatch(g, &r["json"], rel, ""), + None => Some(format!("no step {step} of {}", results.len())), + }; + c.push(&what, json!(miss.clone().unwrap_or_else(|| "matches".into())), r["json"].clone(), miss.is_none()); + } +} + fn unsupported(e: &str) -> bool { e.contains("not supported yet") } @@ -292,7 +478,15 @@ fn check_case(dir: &str, dumps: Option<&std::path::Path>) -> Value { out["error"] = json!(missing); return out; } - let commands = match scratch(&area, &name).and_then(|o| read_json(&format!("{dir}/recipe.json")).and_then(|r| script(dir, &o, &r))) { + let scratch_dir = match scratch(&area, &name) { + Ok(o) => o, + Err(e) => { + out["status"] = json!("fail"); + out["error"] = json!(e); + return out; + } + }; + let commands = match read_json(&format!("{dir}/recipe.json")).and_then(|r| script(dir, &scratch_dir, &r)) { Ok(s) => s, Err(e) => { out["status"] = json!("fail"); @@ -328,7 +522,7 @@ fn check_case(dir: &str, dumps: Option<&std::path::Path>) -> Value { let ran = s.run_script(&commands); // The commands' own time, without process start or grading: the ladder's timing golden. out["seconds"] = json!(clock.elapsed().as_secs_f64()); - match (ran, may_refuse) { + let answers = match (ran, may_refuse) { (Err(e), _) if crashed(&e.to_string()) => { out["status"] = json!("crash"); out["error"] = json!(e.to_string()); @@ -364,8 +558,8 @@ fn check_case(dir: &str, dumps: Option<&std::path::Path>) -> Value { out["error"] = json!("succeeded where the case expects a refusal"); return out; } - (Ok(_), _) => {} - } + (Ok(r), _) => r, + }; // Every body in the world, imported components included. let world = match s.world_state() { @@ -504,6 +698,7 @@ fn check_case(dir: &str, dumps: Option<&std::path::Path>) -> Value { c.vec("bbox.min", got.bbox.0, want_bbox.map(|b| b.0), abs); c.vec("bbox.max", got.bbox.1, want_bbox.map(|b| b.1), abs); } + output_checks(&mut c, &want, &scratch_dir, &answers, rel); out["status"] = json!(if c.pass { "pass" } else { "fail" }); out["checks"] = json!(c.list); out @@ -555,6 +750,8 @@ pub fn run(args: &[String]) -> Result<(), String> { #[cfg(test)] mod tests { + use std::f64::consts::PI; + use super::*; fn case_dir(root: &std::path::Path, name: &str, recipe: &Value) -> String { @@ -581,6 +778,80 @@ mod tests { let _ = std::fs::remove_dir_all(&root); } + #[test] + fn json_parts_match_within_tolerance_and_whole_numbers_exactly() { + let got = json!({"bends": [{"angle_deg": 90.00001, "direction": "up", "count": 3}], "extra": 1}); + assert_eq!(json_mismatch(&got, &json!({"bends": [{"angle_deg": 90.0, "direction": "up"}]}), 1e-3, ""), None); + assert!(json_mismatch(&got, &json!({"bends": [{"count": 4}]}), 1e-3, "").is_some_and(|m| m.contains(".bends[0].count"))); + assert!(json_mismatch(&got, &json!({"bends": []}), 1e-3, "").is_some_and(|m| m.contains("1 items, want 0"))); + assert!(json_mismatch(&got, &json!({"missing": 1}), 1e-3, "").is_some_and(|m| m.contains("missing"))); + assert!(json_mismatch(&got, &json!({"bends": [{"direction": "down"}]}), 1e-3, "").is_some()); + } + + #[test] + fn csv_rows_are_keyed_by_the_header_and_read_quoted_fields() { + let rows = csv_rows("body,angle_deg,note\r\n\"a, \"\"b\"\"\",90.5,x\r\n\"c\",180,\r\n"); + assert_eq!(rows, vec![json!({"body": "a, \"b\"", "angle_deg": 90.5, "note": "x"}), json!({"body": "c", "angle_deg": 180.0, "note": ""})]); + } + + #[test] + fn dxf_layers_count_entities_and_measure_their_length() { + let pair = |c: &str, v: &str| format!("{c}\n{v}\n"); + let mut t = String::new(); + // A circle in the BLOCKS section is not an entity of the drawing. + for (c, v) in [("0", "SECTION"), ("2", "BLOCKS"), ("0", "CIRCLE"), ("8", "CUT"), ("40", "9"), ("0", "ENDSEC")] { + t += &pair(c, v); + } + t += &pair("0", "SECTION"); + t += &pair("2", "ENTITIES"); + for e in [ + vec![("0", "LINE"), ("8", "OUTLINE"), ("10", "0"), ("20", "0"), ("11", "3"), ("21", "4")], + vec![("0", "ARC"), ("8", "OUTLINE"), ("10", "0"), ("20", "0"), ("40", "2"), ("50", "270"), ("51", "0")], + vec![("0", "CIRCLE"), ("8", "CUT"), ("10", "5"), ("20", "5"), ("40", "1")], + vec![("0", "LWPOLYLINE"), ("8", "BEND_UP"), ("90", "2"), ("70", "128"), ("10", "0"), ("20", "1"), ("10", "10"), ("20", "1")], + vec![("0", "ELLIPSE"), ("8", "CUT"), ("10", "0"), ("20", "0"), ("11", "10"), ("21", "0"), ("40", "1"), ("41", "0"), ("42", "6.283185307179586")], + ] { + for (c, v) in e { + t += &pair(c, v); + } + } + t += &pair("0", "ENDSEC"); + t += &pair("0", "EOF"); + let l = dxf_layers(&t); + assert_eq!(l["OUTLINE"]["LINE"], 1); + assert_eq!(l["OUTLINE"]["ARC"], 1); + assert!((l["OUTLINE"]["length_mm"].as_f64().unwrap() - (5.0 + PI)).abs() < 1e-9, "{l}"); + assert_eq!(l["CUT"]["CIRCLE"], 1); + assert_eq!(l["CUT"]["ELLIPSE"], 1); + // A circle of radius 1 and an ellipse of ratio 1 (a circle of radius 10). + assert!((l["CUT"]["length_mm"].as_f64().unwrap() - 22.0 * PI).abs() < 1e-6, "{l}"); + assert!((l["BEND_UP"]["length_mm"].as_f64().unwrap() - 10.0).abs() < 1e-9, "{l}"); + } + + #[test] + fn output_checks_read_the_files_and_answers_a_case_names() { + let out = std::env::temp_dir().join(format!("kernel-cases-files-{}", std::process::id())); + std::fs::create_dir_all(&out).unwrap(); + std::fs::write(out.join("t.json"), r#"{"bends": [{"angle_deg": 90}]}"#).unwrap(); + std::fs::write(out.join("t.csv"), "bend,angle_deg\r\n1,90\r\n").unwrap(); + std::fs::write(out.join("t.dxf"), "0\nSECTION\n2\nENTITIES\n0\nLINE\n8\nOUTLINE\n10\n0\n20\n0\n11\n1\n21\n0\n0\nENDSEC\n").unwrap(); + let dir = out.to_string_lossy().to_string(); + let run = |want: Value| { + let mut c = Checks { list: Vec::new(), pass: true }; + output_checks(&mut c, &want, &dir, &[json!({"count": 3})], 1e-3); + c.pass + }; + assert!(run(json!({"files": [{"path": "t.json", "json": {"bends": [{"angle_deg": 90.0}]}}]}))); + assert!(run(json!({"files": [{"path": "t.csv", "csv": [{"bend": 1, "angle_deg": 90.0}]}]}))); + assert!(run(json!({"files": [{"path": "t.dxf", "dxf": {"OUTLINE": {"LINE": [1, 8], "ARC": 0, "length_mm": 1.0}}}]}))); + assert!(!run(json!({"files": [{"path": "t.dxf", "dxf": {"OUTLINE": {"LINE": [2, 8]}}}]}))); + assert!(!run(json!({"files": [{"path": "t.dxf", "dxf": {"CUT": {"CIRCLE": 1}}}]}))); + assert!(!run(json!({"files": [{"path": "none.json", "json": {}}]}))); + assert!(run(json!({"results": [{"step": 1, "json": {"count": 3}}]}))); + assert!(!run(json!({"results": [{"step": 2, "json": {}}]}))); + let _ = std::fs::remove_dir_all(&out); + } + #[test] fn a_base_cycle_is_an_error_not_a_hang() { let root = std::env::temp_dir().join(format!("kernel-cases-cycle-{}", std::process::id())); From 2edf649528cdc9032e8860d6282beb6d518e0ba8 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:51:50 -0400 Subject: [PATCH 034/108] Kernel rig: hem cases, closed on a top and a bottom edge, open and flipped, on a flange, and one too short Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 21 ++++++ .../recipe.json | 58 +++++++++++++++ .../expected.json | 21 ++++++ .../cov-hem-closed-on-a-top-edge/recipe.json | 58 +++++++++++++++ .../expected.json | 20 ++++++ .../cov-hem-on-a-flanges-far-edge/recipe.json | 72 +++++++++++++++++++ .../expected.json | 21 ++++++ .../recipe.json | 60 ++++++++++++++++ .../expected.json | 8 +++ .../recipe.json | 58 +++++++++++++++ 10 files changed, 397 insertions(+) create mode 100644 tests/kernel-cases/sheet-metal/cov-hem-closed-on-a-bottom-edge/expected.json create mode 100644 tests/kernel-cases/sheet-metal/cov-hem-closed-on-a-bottom-edge/recipe.json create mode 100644 tests/kernel-cases/sheet-metal/cov-hem-closed-on-a-top-edge/expected.json create mode 100644 tests/kernel-cases/sheet-metal/cov-hem-closed-on-a-top-edge/recipe.json create mode 100644 tests/kernel-cases/sheet-metal/cov-hem-on-a-flanges-far-edge/expected.json create mode 100644 tests/kernel-cases/sheet-metal/cov-hem-on-a-flanges-far-edge/recipe.json create mode 100644 tests/kernel-cases/sheet-metal/cov-hem-open-with-a-gap-flipped/expected.json create mode 100644 tests/kernel-cases/sheet-metal/cov-hem-open-with-a-gap-flipped/recipe.json create mode 100644 tests/kernel-cases/sheet-metal/cov-hem-shorter-than-its-bend-refused/expected.json create mode 100644 tests/kernel-cases/sheet-metal/cov-hem-shorter-than-its-bend-refused/recipe.json diff --git a/tests/kernel-cases/sheet-metal/cov-hem-closed-on-a-bottom-edge/expected.json b/tests/kernel-cases/sheet-metal/cov-hem-closed-on-a-bottom-edge/expected.json new file mode 100644 index 000000000..2592d6f46 --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-hem-closed-on-a-bottom-edge/expected.json @@ -0,0 +1,21 @@ +{ + "sources": [], + "what": "sheet.hem on the bottom edge of a 100 x 60 x 2 base: the hem folds over the top face", + "source": "analytic", + "method": "as cov-hem-closed-on-a-top-edge, but a bottom-edge pick folds toward the top face: bend axis at (y 0, z T + g), the leg at z T + 2g .. 2T + 2g = 2.02 .. 4.02. V = 100*60*2 + (pi/2)(2.01^2 - 0.01^2)*100 + 5.99*100*2 = 13832.601716", + "body_count": 1, + "volume_mm3": 13832.601716025138, + "faces": 10, + "bbox": { + "min": [ + 0, + -2.01, + 0 + ], + "max": [ + 100, + 60, + 4.02 + ] + } +} diff --git a/tests/kernel-cases/sheet-metal/cov-hem-closed-on-a-bottom-edge/recipe.json b/tests/kernel-cases/sheet-metal/cov-hem-closed-on-a-bottom-edge/recipe.json new file mode 100644 index 000000000..46714048c --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-hem-closed-on-a-bottom-edge/recipe.json @@ -0,0 +1,58 @@ +{ + "commands": [ + { + "command": "sheet.manage_rules", + "params": { + "name": "Steel 2", + "thickness": "2 mm", + "active": true, + "bend_radius": "2 mm", + "k_factor": 0.5 + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Base" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 100, + 60 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "sheet.flange", + "params": { + "type": "base", + "sketch": "Base" + } + }, + { + "command": "sheet.hem", + "params": { + "edges": [ + [ + 50, + 0, + 0 + ] + ], + "length": 8 + } + } + ] +} diff --git a/tests/kernel-cases/sheet-metal/cov-hem-closed-on-a-top-edge/expected.json b/tests/kernel-cases/sheet-metal/cov-hem-closed-on-a-top-edge/expected.json new file mode 100644 index 000000000..abb71c215 --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-hem-closed-on-a-top-edge/expected.json @@ -0,0 +1,21 @@ +{ + "sources": [], + "what": "sheet.hem on the top edge of a 100 x 60 x 2 base, 8 long, the rule's hem gap (0.01 mm): a closed hem folded under the sheet", + "source": "analytic", + "method": "T = 2, hem gap g = 0.01 (the rule's default) is the inner radius of a 180 degree bend that starts at the edge (y = 0) and turns down (a top-edge pick folds toward the bottom face): bend axis at (y 0, z -g), outer radius g + T = 2.01, so the bend reaches y = -2.01; the leg, 8 - (g + T) = 5.99 long, lies under the base at z -2g - T .. -2g = -2.02 .. -0.02. V = 100*60*2 + (pi/2)((g+T)^2 - g^2)*100 + 5.99*100*2 = 13832.601716. Faces: the section's 8 sides (top, end, bottom, inner arc, leg inner, leg end, leg outer, outer arc) and its 2 end caps", + "body_count": 1, + "volume_mm3": 13832.601716025138, + "faces": 10, + "bbox": { + "min": [ + 0, + -2.01, + -2.02 + ], + "max": [ + 100, + 60, + 2 + ] + } +} diff --git a/tests/kernel-cases/sheet-metal/cov-hem-closed-on-a-top-edge/recipe.json b/tests/kernel-cases/sheet-metal/cov-hem-closed-on-a-top-edge/recipe.json new file mode 100644 index 000000000..c301bd161 --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-hem-closed-on-a-top-edge/recipe.json @@ -0,0 +1,58 @@ +{ + "commands": [ + { + "command": "sheet.manage_rules", + "params": { + "name": "Steel 2", + "thickness": "2 mm", + "active": true, + "bend_radius": "2 mm", + "k_factor": 0.5 + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Base" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 100, + 60 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "sheet.flange", + "params": { + "type": "base", + "sketch": "Base" + } + }, + { + "command": "sheet.hem", + "params": { + "edges": [ + [ + 50, + 0, + 2 + ] + ], + "length": 8 + } + } + ] +} diff --git a/tests/kernel-cases/sheet-metal/cov-hem-on-a-flanges-far-edge/expected.json b/tests/kernel-cases/sheet-metal/cov-hem-on-a-flanges-far-edge/expected.json new file mode 100644 index 000000000..9f76d7e57 --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-hem-on-a-flanges-far-edge/expected.json @@ -0,0 +1,20 @@ +{ + "sources": [], + "what": "sheet.hem on the far edge of a 20 mm edge flange (its outer face's edge), 8 long: the hem turns in over the flange's inner face", + "source": "analytic", + "method": "T = 2, R = 2, K = 0.5: the flange's 90 degree bend sets the base back R + T = 4 (100 x 56), its bend (pi/2)((R+T)^2 - R^2)/2*100 = 942.477796, its panel 20 - 4 = 16 high to z 20 (its outer face y = 0). The hem's 180 degree bend (inner radius 0.01) starts at z 20 and reaches z 20 + 2.01; its leg, 8 - 2.01 = 5.99, hangs inside the wall. V = 100*56*2 + 942.477796 + 16*100*2 + (pi/2)(2.01^2 - 0.01^2)*100 + 5.99*100*2 = 17175.079512", + "body_count": 1, + "volume_mm3": 17175.07951210208, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 100, + 60, + 22.01 + ] + } +} diff --git a/tests/kernel-cases/sheet-metal/cov-hem-on-a-flanges-far-edge/recipe.json b/tests/kernel-cases/sheet-metal/cov-hem-on-a-flanges-far-edge/recipe.json new file mode 100644 index 000000000..dccaa19c5 --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-hem-on-a-flanges-far-edge/recipe.json @@ -0,0 +1,72 @@ +{ + "commands": [ + { + "command": "sheet.manage_rules", + "params": { + "name": "Steel 2", + "thickness": "2 mm", + "active": true, + "bend_radius": "2 mm", + "k_factor": 0.5 + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Base" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 100, + 60 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "sheet.flange", + "params": { + "type": "base", + "sketch": "Base" + } + }, + { + "command": "sheet.flange", + "params": { + "type": "edge", + "edges": [ + [ + 50, + 0, + 2 + ] + ], + "height": 20 + } + }, + { + "command": "sheet.hem", + "params": { + "edges": [ + [ + 50, + 0, + 20 + ] + ], + "length": 8 + } + } + ] +} diff --git a/tests/kernel-cases/sheet-metal/cov-hem-open-with-a-gap-flipped/expected.json b/tests/kernel-cases/sheet-metal/cov-hem-open-with-a-gap-flipped/expected.json new file mode 100644 index 000000000..b8f11e8b2 --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-hem-open-with-a-gap-flipped/expected.json @@ -0,0 +1,21 @@ +{ + "sources": [], + "what": "sheet.hem with its own gap of 1 mm (an open hem), flipped, on the top edge of a 100 x 60 x 2 base, 10 long", + "source": "analytic", + "method": "gap g = 1 is the inner radius; flip turns a top-edge hem over the top face: bend axis at (y 0, z T + g = 3), outer radius g + T = 3 (to y = -3), the leg 10 - 3 = 7 long at z T + 2g .. 2T + 2g = 4 .. 6. V = 100*60*2 + (pi/2)(3^2 - 1^2)*100 + 7*100*2 = 14656.637061", + "body_count": 1, + "volume_mm3": 14656.637061435917, + "faces": 10, + "bbox": { + "min": [ + 0, + -3, + 0 + ], + "max": [ + 100, + 60, + 6 + ] + } +} diff --git a/tests/kernel-cases/sheet-metal/cov-hem-open-with-a-gap-flipped/recipe.json b/tests/kernel-cases/sheet-metal/cov-hem-open-with-a-gap-flipped/recipe.json new file mode 100644 index 000000000..a213e05e8 --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-hem-open-with-a-gap-flipped/recipe.json @@ -0,0 +1,60 @@ +{ + "commands": [ + { + "command": "sheet.manage_rules", + "params": { + "name": "Steel 2", + "thickness": "2 mm", + "active": true, + "bend_radius": "2 mm", + "k_factor": 0.5 + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Base" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 100, + 60 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "sheet.flange", + "params": { + "type": "base", + "sketch": "Base" + } + }, + { + "command": "sheet.hem", + "params": { + "edges": [ + [ + 50, + 0, + 2 + ] + ], + "length": 10, + "gap": 1, + "flip": true + } + } + ] +} diff --git a/tests/kernel-cases/sheet-metal/cov-hem-shorter-than-its-bend-refused/expected.json b/tests/kernel-cases/sheet-metal/cov-hem-shorter-than-its-bend-refused/expected.json new file mode 100644 index 000000000..2971c4fd1 --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-hem-shorter-than-its-bend-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "sheet.hem 2 long on a 2 mm sheet: shorter than its own 180 degree bend (gap + T = 2.01)", + "source": "invariants", + "method": "the hem's length runs to its outer face, so it must be at least the bend's g + T = 2.01; a leg of 2 - 2.01 < 0 is no hem: a clean refusal", + "outcome": "refused", + "refusal": "the hem is shorter than its bend" +} diff --git a/tests/kernel-cases/sheet-metal/cov-hem-shorter-than-its-bend-refused/recipe.json b/tests/kernel-cases/sheet-metal/cov-hem-shorter-than-its-bend-refused/recipe.json new file mode 100644 index 000000000..14022dd51 --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-hem-shorter-than-its-bend-refused/recipe.json @@ -0,0 +1,58 @@ +{ + "commands": [ + { + "command": "sheet.manage_rules", + "params": { + "name": "Steel 2", + "thickness": "2 mm", + "active": true, + "bend_radius": "2 mm", + "k_factor": 0.5 + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Base" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 100, + 60 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "sheet.flange", + "params": { + "type": "base", + "sketch": "Base" + } + }, + { + "command": "sheet.hem", + "params": { + "edges": [ + [ + 50, + 0, + 2 + ] + ], + "length": 2 + } + } + ] +} From c60bcb55e1f9bc49a5782606a8189d06ea539b55 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:51:50 -0400 Subject: [PATCH 035/108] Kernel rig: path flange cases, a Z section, one line at 45 degrees down, and a path straight on refused Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 22 ++++ .../recipe.json | 108 +++++++++++++++++ .../expected.json | 8 ++ .../recipe.json | 104 ++++++++++++++++ .../expected.json | 39 ++++++ .../recipe.json | 114 ++++++++++++++++++ 6 files changed, 395 insertions(+) create mode 100644 tests/kernel-cases/sheet-metal/cov-path-flange-one-line-down-at-45-degrees/expected.json create mode 100644 tests/kernel-cases/sheet-metal/cov-path-flange-one-line-down-at-45-degrees/recipe.json create mode 100644 tests/kernel-cases/sheet-metal/cov-path-flange-straight-on-from-the-sheet-refused/expected.json create mode 100644 tests/kernel-cases/sheet-metal/cov-path-flange-straight-on-from-the-sheet-refused/recipe.json create mode 100644 tests/kernel-cases/sheet-metal/cov-path-flange-wall-and-an-outward-lip/expected.json create mode 100644 tests/kernel-cases/sheet-metal/cov-path-flange-wall-and-an-outward-lip/recipe.json diff --git a/tests/kernel-cases/sheet-metal/cov-path-flange-one-line-down-at-45-degrees/expected.json b/tests/kernel-cases/sheet-metal/cov-path-flange-one-line-down-at-45-degrees/expected.json new file mode 100644 index 000000000..f0552828c --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-path-flange-one-line-down-at-45-degrees/expected.json @@ -0,0 +1,22 @@ +{ + "sources": [], + "what": "sheet.path_flange along one line drawn 45 degrees down and out from the top edge of a 100 x 60 x 2 base, 20 long: a single bend down", + "source": "analytic", + "method": "T = 2, R = 2, K = 0.5. One line, one 45 degree bend, turning down (the path heads below the sheet): setback (R + T)tan(22.5 deg) = 1.656854 off the base and off the flange's 20 (to its outer face from the virtual sharp). V = 2*100*((60 - s) + (20 - s)) + (pi/4)((R+T)^2 - R^2)/2*100 = 15808.497198", + "body_count": 1, + "volume_mm3": 15808.497198241515, + "results": [ + { + "step": 10, + "json": { + "bends": [ + { + "angle_deg": 45.0, + "direction": "down", + "radius": 2.0 + } + ] + } + } + ] +} diff --git a/tests/kernel-cases/sheet-metal/cov-path-flange-one-line-down-at-45-degrees/recipe.json b/tests/kernel-cases/sheet-metal/cov-path-flange-one-line-down-at-45-degrees/recipe.json new file mode 100644 index 000000000..2c9c25722 --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-path-flange-one-line-down-at-45-degrees/recipe.json @@ -0,0 +1,108 @@ +{ + "commands": [ + { + "command": "sheet.manage_rules", + "params": { + "name": "Steel 2", + "thickness": "2 mm", + "active": true, + "bend_radius": "2 mm", + "k_factor": 0.5 + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Base" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 100, + 60 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "sheet.flange", + "params": { + "type": "base", + "sketch": "Base" + } + }, + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 50, + 0, + 0 + ], + "x_dir": [ + 0, + -1, + 0 + ], + "y_dir": [ + 0, + 0, + 1 + ] + }, + "name": "Path" + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 0, + 2 + ], + [ + 14.14213562373095, + -12.14213562373095 + ] + ], + "ids": [ + "p1" + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "sheet.path_flange", + "params": { + "edge": [ + 50, + 0, + 2 + ], + "sketch": "Path", + "curves": [ + "p1" + ] + } + }, + { + "command": "sheet.flat_pattern", + "params": {} + } + ] +} diff --git a/tests/kernel-cases/sheet-metal/cov-path-flange-straight-on-from-the-sheet-refused/expected.json b/tests/kernel-cases/sheet-metal/cov-path-flange-straight-on-from-the-sheet-refused/expected.json new file mode 100644 index 000000000..2f54857fc --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-path-flange-straight-on-from-the-sheet-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "sheet.path_flange along a line that runs straight on from the sheet (in its own plane): no bend to make", + "source": "invariants", + "method": "the first line's angle to the sheet makes the first bend; a line at 0 degrees to it makes none, so the path is refused with the line it is about", + "outcome": "refused", + "refusal": "line 1 of the path flange's path runs straight on from the sheet" +} diff --git a/tests/kernel-cases/sheet-metal/cov-path-flange-straight-on-from-the-sheet-refused/recipe.json b/tests/kernel-cases/sheet-metal/cov-path-flange-straight-on-from-the-sheet-refused/recipe.json new file mode 100644 index 000000000..5a73307a1 --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-path-flange-straight-on-from-the-sheet-refused/recipe.json @@ -0,0 +1,104 @@ +{ + "commands": [ + { + "command": "sheet.manage_rules", + "params": { + "name": "Steel 2", + "thickness": "2 mm", + "active": true, + "bend_radius": "2 mm", + "k_factor": 0.5 + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Base" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 100, + 60 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "sheet.flange", + "params": { + "type": "base", + "sketch": "Base" + } + }, + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 50, + 0, + 0 + ], + "x_dir": [ + 0, + -1, + 0 + ], + "y_dir": [ + 0, + 0, + 1 + ] + }, + "name": "Path" + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 0, + 2 + ], + [ + 20, + 2 + ] + ], + "ids": [ + "p1" + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "sheet.path_flange", + "params": { + "edge": [ + 50, + 0, + 2 + ], + "sketch": "Path", + "curves": [ + "p1" + ] + } + } + ] +} diff --git a/tests/kernel-cases/sheet-metal/cov-path-flange-wall-and-an-outward-lip/expected.json b/tests/kernel-cases/sheet-metal/cov-path-flange-wall-and-an-outward-lip/expected.json new file mode 100644 index 000000000..6caf252b5 --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-path-flange-wall-and-an-outward-lip/expected.json @@ -0,0 +1,39 @@ +{ + "sources": [], + "what": "sheet.path_flange along a two-line path across the y = 0 edge of a 100 x 60 x 2 base: 20 up, then 10 out away from the base (a Z section)", + "source": "analytic", + "method": "T = 2, R = 2, K = 0.5, setback R + T = 4 at each 90 degree bend. Line 1 (up, 20) is a wall 20 to its outer face (y = 0): straight 20 - 4 - 4 = 12; line 2 turns away from the sheet (a bend down), a lip 10 to its outer face from the virtual sharp at (y 2, z 20): straight 10 - 4 = 6, its far edge at y = 2 - 10 = -8, its top face at z 20. Base 100 x 56. V = 2*100*(56 + 12 + 6) + 2*(pi/2)((R+T)^2 - R^2)/2*100 = 16684.955592; the bends turn up, then down", + "body_count": 1, + "volume_mm3": 16684.955592153878, + "bbox": { + "min": [ + 0, + -8, + 0 + ], + "max": [ + 100, + 60, + 20 + ] + }, + "results": [ + { + "step": 10, + "json": { + "bends": [ + { + "angle_deg": 90.0, + "direction": "up", + "radius": 2.0 + }, + { + "angle_deg": 90.0, + "direction": "down", + "radius": 2.0 + } + ] + } + } + ] +} diff --git a/tests/kernel-cases/sheet-metal/cov-path-flange-wall-and-an-outward-lip/recipe.json b/tests/kernel-cases/sheet-metal/cov-path-flange-wall-and-an-outward-lip/recipe.json new file mode 100644 index 000000000..a81c006c6 --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-path-flange-wall-and-an-outward-lip/recipe.json @@ -0,0 +1,114 @@ +{ + "commands": [ + { + "command": "sheet.manage_rules", + "params": { + "name": "Steel 2", + "thickness": "2 mm", + "active": true, + "bend_radius": "2 mm", + "k_factor": 0.5 + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Base" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 100, + 60 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "sheet.flange", + "params": { + "type": "base", + "sketch": "Base" + } + }, + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 50, + 0, + 0 + ], + "x_dir": [ + 0, + -1, + 0 + ], + "y_dir": [ + 0, + 0, + 1 + ] + }, + "name": "Path" + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 0, + 2 + ], + [ + 0, + 22 + ], + [ + 10, + 22 + ] + ], + "ids": [ + "p1", + "p2" + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "sheet.path_flange", + "params": { + "edge": [ + 50, + 0, + 2 + ], + "sketch": "Path", + "curves": [ + "p1", + "p2" + ] + } + }, + { + "command": "sheet.flat_pattern", + "params": {} + } + ] +} From fce8e4a2625ed31fb32309b81b966e0f111553d8 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:52:54 -0400 Subject: [PATCH 036/108] Kernel rig: perforation cases, square and staggered fields counted hole by hole, a field kept clear of a bend zone, and a pitch refused Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 20 ++++++ .../recipe.json | 72 +++++++++++++++++++ .../expected.json | 8 +++ .../recipe.json | 53 ++++++++++++++ .../expected.json | 26 +++++++ .../recipe.json | 58 +++++++++++++++ .../expected.json | 38 ++++++++++ .../recipe.json | 63 ++++++++++++++++ 8 files changed, 338 insertions(+) create mode 100644 tests/kernel-cases/sheet-metal/cov-perforate-keeps-clear-of-a-bend-zone/expected.json create mode 100644 tests/kernel-cases/sheet-metal/cov-perforate-keeps-clear-of-a-bend-zone/recipe.json create mode 100644 tests/kernel-cases/sheet-metal/cov-perforate-pitch-no-larger-than-the-hole-refused/expected.json create mode 100644 tests/kernel-cases/sheet-metal/cov-perforate-pitch-no-larger-than-the-hole-refused/recipe.json create mode 100644 tests/kernel-cases/sheet-metal/cov-perforate-square-field-on-a-plate/expected.json create mode 100644 tests/kernel-cases/sheet-metal/cov-perforate-square-field-on-a-plate/recipe.json create mode 100644 tests/kernel-cases/sheet-metal/cov-perforate-staggered-field-on-a-plate/expected.json create mode 100644 tests/kernel-cases/sheet-metal/cov-perforate-staggered-field-on-a-plate/recipe.json diff --git a/tests/kernel-cases/sheet-metal/cov-perforate-keeps-clear-of-a-bend-zone/expected.json b/tests/kernel-cases/sheet-metal/cov-perforate-keeps-clear-of-a-bend-zone/expected.json new file mode 100644 index 000000000..079f05b50 --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-perforate-keeps-clear-of-a-bend-zone/expected.json @@ -0,0 +1,20 @@ +{ + "sources": [], + "what": "sheet.perforate, a square field over a 40 x 20 x 1 base with a 10 mm flange on its x = 40 edge: no hole within the margin of the bend zone", + "source": "analytic", + "method": "T = 1, R = 1, K = 0.5: the flange sets the base back R + T = 2 (flat x 0..38), its bend zone is BA = (pi/2)(R + K*T) = 2.356194 wide (x 38..40.356194), its leg 10 - 2 = 8 (to x 48.356194). 1 mm holes, pitch 4, margin 1 (clear 1.5): rows y 1.5, 5.5, 9.5, 13.5, 17.5 (5); per row x 1.5, 5.5, ..., 45.5 (<= 46.8562) less those within 1.5 of the zone (37.5 and 41.5): 9 on the base, 1 on the flange (45.5): 50 holes", + "body_count": 1, + "results": [ + { + "step": 8, + "json": { + "perforations": [ + { + "count": 50, + "pattern": "square" + } + ] + } + } + ] +} diff --git a/tests/kernel-cases/sheet-metal/cov-perforate-keeps-clear-of-a-bend-zone/recipe.json b/tests/kernel-cases/sheet-metal/cov-perforate-keeps-clear-of-a-bend-zone/recipe.json new file mode 100644 index 000000000..6bb2a1247 --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-perforate-keeps-clear-of-a-bend-zone/recipe.json @@ -0,0 +1,72 @@ +{ + "commands": [ + { + "command": "sheet.manage_rules", + "params": { + "name": "Steel 1", + "thickness": "1 mm", + "active": true, + "bend_radius": "1 mm", + "k_factor": 0.5 + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Base" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 40, + 20 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "sheet.flange", + "params": { + "type": "base", + "sketch": "Base" + } + }, + { + "command": "sheet.flange", + "params": { + "type": "edge", + "edges": [ + [ + 40, + 10, + 1 + ] + ], + "height": 10 + } + }, + { + "command": "sheet.perforate", + "params": { + "diameter": "1", + "pitch": "4", + "margin": "1", + "pattern": "square" + } + }, + { + "command": "sheet.flat_pattern", + "params": {} + } + ] +} diff --git a/tests/kernel-cases/sheet-metal/cov-perforate-pitch-no-larger-than-the-hole-refused/expected.json b/tests/kernel-cases/sheet-metal/cov-perforate-pitch-no-larger-than-the-hole-refused/expected.json new file mode 100644 index 000000000..279761d4f --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-perforate-pitch-no-larger-than-the-hole-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "sheet.perforate with a pitch equal to the hole's diameter: the holes would touch", + "source": "invariants", + "method": "holes 2 mm across at a 2 mm pitch leave no web between them; the documented rule is pitch > diameter, so the field is refused", + "outcome": "refused", + "refusal": "pitch > diameter" +} diff --git a/tests/kernel-cases/sheet-metal/cov-perforate-pitch-no-larger-than-the-hole-refused/recipe.json b/tests/kernel-cases/sheet-metal/cov-perforate-pitch-no-larger-than-the-hole-refused/recipe.json new file mode 100644 index 000000000..6fca88785 --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-perforate-pitch-no-larger-than-the-hole-refused/recipe.json @@ -0,0 +1,53 @@ +{ + "commands": [ + { + "command": "sheet.manage_rules", + "params": { + "name": "Steel 1", + "thickness": "1 mm", + "active": true, + "bend_radius": "1 mm", + "k_factor": 0.5 + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Base" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 30, + 20 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "sheet.flange", + "params": { + "type": "base", + "sketch": "Base" + } + }, + { + "command": "sheet.perforate", + "params": { + "diameter": "2", + "pitch": "2", + "margin": "1" + } + } + ] +} diff --git a/tests/kernel-cases/sheet-metal/cov-perforate-square-field-on-a-plate/expected.json b/tests/kernel-cases/sheet-metal/cov-perforate-square-field-on-a-plate/expected.json new file mode 100644 index 000000000..65b797030 --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-perforate-square-field-on-a-plate/expected.json @@ -0,0 +1,26 @@ +{ + "sources": [], + "what": "sheet.perforate, a square field of 2 mm holes at 5 mm pitch, 1 mm margin, over a 30 x 20 x 1 plate", + "source": "analytic", + "method": "holes start at margin + radius = 2 from the flat's lower-left corner and step 5: x 2, 7, ..., 27 (6, each <= 30 - 2), y 2, 7, 12, 17 (4): 24 holes, open area 24*pi*1^2. The field is stored, not cut into the B-rep: the body stays the 30 x 20 x 1 plate, V = 600, 6 faces", + "body_count": 1, + "volume_mm3": 600.0, + "faces": 6, + "results": [ + { + "step": 7, + "json": { + "perforations": [ + { + "count": 24, + "pattern": "square", + "diameter": 2.0, + "pitch": 5.0, + "margin": 1.0, + "open_area_mm2": 75.39822368615503 + } + ] + } + } + ] +} diff --git a/tests/kernel-cases/sheet-metal/cov-perforate-square-field-on-a-plate/recipe.json b/tests/kernel-cases/sheet-metal/cov-perforate-square-field-on-a-plate/recipe.json new file mode 100644 index 000000000..d0b798eaf --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-perforate-square-field-on-a-plate/recipe.json @@ -0,0 +1,58 @@ +{ + "commands": [ + { + "command": "sheet.manage_rules", + "params": { + "name": "Steel 1", + "thickness": "1 mm", + "active": true, + "bend_radius": "1 mm", + "k_factor": 0.5 + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Base" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 30, + 20 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "sheet.flange", + "params": { + "type": "base", + "sketch": "Base" + } + }, + { + "command": "sheet.perforate", + "params": { + "diameter": "2", + "pitch": "5", + "margin": "1", + "pattern": "square" + } + }, + { + "command": "sheet.flat_pattern", + "params": {} + } + ] +} diff --git a/tests/kernel-cases/sheet-metal/cov-perforate-staggered-field-on-a-plate/expected.json b/tests/kernel-cases/sheet-metal/cov-perforate-staggered-field-on-a-plate/expected.json new file mode 100644 index 000000000..c1eee3e7e --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-perforate-staggered-field-on-a-plate/expected.json @@ -0,0 +1,38 @@ +{ + "sources": [], + "what": "sheet.perforate, a staggered (60 degree) field of 1 mm holes at 3 mm pitch, 1 mm margin, over a 20 x 10 x 1 plate, exported to DXF", + "source": "analytic", + "method": "clear = radius + margin = 1.5; rows every 3*sqrt(3)/2 = 2.598 from y 1.5: y 1.5, 4.098, 6.696 (9.294 > 8.5); even rows x 1.5, 4.5, ..., 16.5 (6), the odd row shifted 1.5: x 3, ..., 18 (6): 18 holes. In the DXF, 18 circles on layer PERFORATION, length 18*pi*1; the plate's outline 4 lines, 60 long. The B-rep is not cut: V = 200", + "body_count": 1, + "volume_mm3": 200.0, + "faces": 6, + "results": [ + { + "step": 7, + "json": { + "perforations": [ + { + "count": 18, + "pattern": "staggered", + "open_area_mm2": 14.137166941154069 + } + ] + } + } + ], + "files": [ + { + "path": "flat.dxf", + "dxf": { + "PERFORATION": { + "CIRCLE": 18, + "length_mm": 56.548667764616276 + }, + "OUTLINE": { + "LINE": 4, + "length_mm": 60.0 + } + } + } + ] +} diff --git a/tests/kernel-cases/sheet-metal/cov-perforate-staggered-field-on-a-plate/recipe.json b/tests/kernel-cases/sheet-metal/cov-perforate-staggered-field-on-a-plate/recipe.json new file mode 100644 index 000000000..a2b02cd51 --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-perforate-staggered-field-on-a-plate/recipe.json @@ -0,0 +1,63 @@ +{ + "commands": [ + { + "command": "sheet.manage_rules", + "params": { + "name": "Steel 1", + "thickness": "1 mm", + "active": true, + "bend_radius": "1 mm", + "k_factor": 0.5 + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Base" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 20, + 10 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "sheet.flange", + "params": { + "type": "base", + "sketch": "Base" + } + }, + { + "command": "sheet.perforate", + "params": { + "diameter": "1", + "pitch": "3", + "margin": "1" + } + }, + { + "command": "sheet.flat_pattern", + "params": {} + }, + { + "command": "sheet.export_dxf", + "params": { + "path": "$OUT/flat.dxf" + } + } + ] +} From c114e6c35b51472e104416794f95f8218e0deb53 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:52:54 -0400 Subject: [PATCH 037/108] Kernel rig: flat DXF cases, outline, cut and bend line lengths, an ellipse exact and as arcs, and no sheet refused Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 23 +++++ .../recipe.json | 86 +++++++++++++++++++ .../expected.json | 25 ++++++ .../cov-export-dxf-ellipse-exact/recipe.json | 85 ++++++++++++++++++ .../expected.json | 41 +++++++++ .../recipe.json | 81 +++++++++++++++++ .../expected.json | 8 ++ .../recipe.json | 18 ++++ 8 files changed, 367 insertions(+) create mode 100644 tests/kernel-cases/sheet-metal/cov-export-dxf-ellipse-as-arcs/expected.json create mode 100644 tests/kernel-cases/sheet-metal/cov-export-dxf-ellipse-as-arcs/recipe.json create mode 100644 tests/kernel-cases/sheet-metal/cov-export-dxf-ellipse-exact/expected.json create mode 100644 tests/kernel-cases/sheet-metal/cov-export-dxf-ellipse-exact/recipe.json create mode 100644 tests/kernel-cases/sheet-metal/cov-export-dxf-flange-and-hole/expected.json create mode 100644 tests/kernel-cases/sheet-metal/cov-export-dxf-flange-and-hole/recipe.json create mode 100644 tests/kernel-cases/sheet-metal/cov-export-dxf-without-a-sheet-refused/expected.json create mode 100644 tests/kernel-cases/sheet-metal/cov-export-dxf-without-a-sheet-refused/recipe.json diff --git a/tests/kernel-cases/sheet-metal/cov-export-dxf-ellipse-as-arcs/expected.json b/tests/kernel-cases/sheet-metal/cov-export-dxf-ellipse-as-arcs/expected.json new file mode 100644 index 000000000..daa5ec2ff --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-export-dxf-ellipse-as-arcs/expected.json @@ -0,0 +1,23 @@ +{ + "sources": [], + "what": "sheet.export_dxf with curves: arcs of a 100 x 60 x 2 plate with a 20 x 12 elliptical cut-out: the ellipse becomes tangent arcs", + "source": "analytic", + "method": "curves: arcs writes the ellipse as tangent arcs and lines within 0.001 mm, for machines that read only those: on layer CUT no ELLIPSE and no SPLINE, and their length is the ellipse's perimeter 51.053998 (within 0.001 mm of the curve, the length to 1e-3 relative)", + "body_count": 1, + "files": [ + { + "path": "flat.dxf", + "dxf": { + "CUT": { + "ELLIPSE": 0, + "SPLINE": 0, + "length_mm": 51.053997725577524 + }, + "OUTLINE": { + "LINE": 4, + "length_mm": 320.0 + } + } + } + ] +} diff --git a/tests/kernel-cases/sheet-metal/cov-export-dxf-ellipse-as-arcs/recipe.json b/tests/kernel-cases/sheet-metal/cov-export-dxf-ellipse-as-arcs/recipe.json new file mode 100644 index 000000000..c8214a1ad --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-export-dxf-ellipse-as-arcs/recipe.json @@ -0,0 +1,86 @@ +{ + "commands": [ + { + "command": "sheet.manage_rules", + "params": { + "name": "Steel 2", + "thickness": "2 mm", + "active": true, + "bend_radius": "2 mm", + "k_factor": 0.5 + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Base" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 100, + 60 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "sheet.flange", + "params": { + "type": "base", + "sketch": "Base" + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Ellipse" + } + }, + { + "command": "sketch.ellipse", + "params": { + "center": [ + 50, + 30 + ], + "major": [ + 60, + 30 + ], + "minor_radius": 6 + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "solid.extrude", + "params": { + "sketch": "Ellipse", + "through_all": true, + "direction": "symmetric", + "operation": "cut" + } + }, + { + "command": "sheet.export_dxf", + "params": { + "path": "$OUT/flat.dxf", + "curves": "arcs" + } + } + ] +} diff --git a/tests/kernel-cases/sheet-metal/cov-export-dxf-ellipse-exact/expected.json b/tests/kernel-cases/sheet-metal/cov-export-dxf-ellipse-exact/expected.json new file mode 100644 index 000000000..205363bbc --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-export-dxf-ellipse-exact/expected.json @@ -0,0 +1,25 @@ +{ + "sources": [], + "what": "sheet.export_dxf of a 100 x 60 x 2 plate with a 20 x 12 elliptical cut-out, curves exact (the default): the cut-out is one ELLIPSE", + "source": "analytic", + "method": "the cut-out is an ellipse, semi-axes 10 and 6: written exactly, one ELLIPSE on layer CUT, no arcs or splines; its perimeter (Ramanujan's second formula, exact to 1e-9 here) 51.053998. OUTLINE: 4 lines, 320 long", + "body_count": 1, + "volume_mm3": 11623.008881569225, + "files": [ + { + "path": "flat.dxf", + "dxf": { + "CUT": { + "ELLIPSE": 1, + "ARC": 0, + "SPLINE": 0, + "length_mm": 51.053997725577524 + }, + "OUTLINE": { + "LINE": 4, + "length_mm": 320.0 + } + } + } + ] +} diff --git a/tests/kernel-cases/sheet-metal/cov-export-dxf-ellipse-exact/recipe.json b/tests/kernel-cases/sheet-metal/cov-export-dxf-ellipse-exact/recipe.json new file mode 100644 index 000000000..3893d9d56 --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-export-dxf-ellipse-exact/recipe.json @@ -0,0 +1,85 @@ +{ + "commands": [ + { + "command": "sheet.manage_rules", + "params": { + "name": "Steel 2", + "thickness": "2 mm", + "active": true, + "bend_radius": "2 mm", + "k_factor": 0.5 + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Base" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 100, + 60 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "sheet.flange", + "params": { + "type": "base", + "sketch": "Base" + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Ellipse" + } + }, + { + "command": "sketch.ellipse", + "params": { + "center": [ + 50, + 30 + ], + "major": [ + 60, + 30 + ], + "minor_radius": 6 + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "solid.extrude", + "params": { + "sketch": "Ellipse", + "through_all": true, + "direction": "symmetric", + "operation": "cut" + } + }, + { + "command": "sheet.export_dxf", + "params": { + "path": "$OUT/flat.dxf" + } + } + ] +} diff --git a/tests/kernel-cases/sheet-metal/cov-export-dxf-flange-and-hole/expected.json b/tests/kernel-cases/sheet-metal/cov-export-dxf-flange-and-hole/expected.json new file mode 100644 index 000000000..9680c7492 --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-export-dxf-flange-and-hole/expected.json @@ -0,0 +1,41 @@ +{ + "sources": [], + "what": "sheet.export_dxf of an 80 x 40 x 2 base with a 20 mm flange on its y = 0 edge and a 10 mm hole: outline, cut and bend line", + "source": "analytic", + "method": "T = 2, R = 2, K = 0.5: flat = base 80 x (40 - 4) + bend zone BA = (pi/2)(R + K*T) = 4.712389 + leg 20 - 4 = 16: 80 x 56.712389. OUTLINE: its 4 sides (each may be split where the zone meets the panels: 4 to 8 lines), length 2*(80 + 56.712389); CUT: the hole, 1 circle, length 10*pi; BEND_UP: the flange's bend line (it bends up), 80 long; no BEND_DOWN, no arcs", + "body_count": 1, + "results": [ + { + "step": 8, + "json": { + "bends": 1 + } + } + ], + "files": [ + { + "path": "flat.dxf", + "dxf": { + "OUTLINE": { + "LINE": [ + 4, + 8 + ], + "ARC": 0, + "length_mm": 273.42477796076935 + }, + "CUT": { + "CIRCLE": 1, + "length_mm": 31.41592653589793 + }, + "BEND_UP": { + "length_mm": 80.0 + }, + "BEND_DOWN": { + "LINE": 0, + "LWPOLYLINE": 0 + } + } + } + ] +} diff --git a/tests/kernel-cases/sheet-metal/cov-export-dxf-flange-and-hole/recipe.json b/tests/kernel-cases/sheet-metal/cov-export-dxf-flange-and-hole/recipe.json new file mode 100644 index 000000000..7a1bfcbca --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-export-dxf-flange-and-hole/recipe.json @@ -0,0 +1,81 @@ +{ + "commands": [ + { + "command": "sheet.manage_rules", + "params": { + "name": "Steel 2", + "thickness": "2 mm", + "active": true, + "bend_radius": "2 mm", + "k_factor": 0.5 + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Base" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 80, + 40 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "sheet.flange", + "params": { + "type": "base", + "sketch": "Base" + } + }, + { + "command": "sheet.flange", + "params": { + "type": "edge", + "edges": [ + [ + 40, + 0, + 2 + ] + ], + "height": 20 + } + }, + { + "command": "solid.hole", + "params": { + "position": [ + 40, + 25, + 0 + ], + "direction": [ + 0, + 0, + 1 + ], + "diameter": 10 + } + }, + { + "command": "sheet.export_dxf", + "params": { + "path": "$OUT/flat.dxf" + } + } + ] +} diff --git a/tests/kernel-cases/sheet-metal/cov-export-dxf-without-a-sheet-refused/expected.json b/tests/kernel-cases/sheet-metal/cov-export-dxf-without-a-sheet-refused/expected.json new file mode 100644 index 000000000..05ce3dcf4 --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-export-dxf-without-a-sheet-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "sheet.export_dxf in a design with a box and no sheet metal body", + "source": "invariants", + "method": "there is no flat pattern to write: a clean refusal that says how to start a sheet", + "outcome": "refused", + "refusal": "there is no sheet metal body" +} diff --git a/tests/kernel-cases/sheet-metal/cov-export-dxf-without-a-sheet-refused/recipe.json b/tests/kernel-cases/sheet-metal/cov-export-dxf-without-a-sheet-refused/recipe.json new file mode 100644 index 000000000..d10795bfb --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-export-dxf-without-a-sheet-refused/recipe.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 10, + "height": 2 + } + }, + { + "command": "sheet.export_dxf", + "params": { + "path": "$OUT/flat.dxf" + } + } + ] +} From 67dd8892f1efb0670a8203452a5c4a029396987c Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:52:54 -0400 Subject: [PATCH 038/108] Kernel rig: bend table cases, JSON and CSV rows with angles, radii and K-factor allowances, and an unknown format refused Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 40 ++++++++++ .../recipe.json | 79 +++++++++++++++++++ .../expected.json | 33 ++++++++ .../recipe.json | 66 ++++++++++++++++ .../expected.json | 8 ++ .../recipe.json | 66 ++++++++++++++++ 6 files changed, 292 insertions(+) create mode 100644 tests/kernel-cases/sheet-metal/cov-export-bend-table-csv-flange-and-hem/expected.json create mode 100644 tests/kernel-cases/sheet-metal/cov-export-bend-table-csv-flange-and-hem/recipe.json create mode 100644 tests/kernel-cases/sheet-metal/cov-export-bend-table-json-one-flange/expected.json create mode 100644 tests/kernel-cases/sheet-metal/cov-export-bend-table-json-one-flange/recipe.json create mode 100644 tests/kernel-cases/sheet-metal/cov-export-bend-table-unknown-format-refused/expected.json create mode 100644 tests/kernel-cases/sheet-metal/cov-export-bend-table-unknown-format-refused/recipe.json diff --git a/tests/kernel-cases/sheet-metal/cov-export-bend-table-csv-flange-and-hem/expected.json b/tests/kernel-cases/sheet-metal/cov-export-bend-table-csv-flange-and-hem/expected.json new file mode 100644 index 000000000..b8899b816 --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-export-bend-table-csv-flange-and-hem/expected.json @@ -0,0 +1,40 @@ +{ + "sources": [], + "what": "sheet.export_bend_table as CSV of an 80 x 40 x 2 base with a 60 degree flange on one long edge and a hem on the other", + "source": "analytic", + "method": "T = 2, K = 0.5. Bend 1, the flange: 60 degrees up (included 120), R 2, BA = (pi/3)(2 + 1) = 3.141592654, 80 long. Bend 2, the hem on the top edge: 180 degrees down (included 0), its radius the rule's hem gap 0.01, BA = pi(0.01 + 1) = 3.173008580, 80 long", + "body_count": 1, + "files": [ + { + "path": "bends.csv", + "csv": [ + { + "body": "Body1", + "rule": "Steel 2", + "thickness_mm": 2.0, + "k_factor": 0.5, + "bend": 1, + "angle_deg": 60.0, + "direction": "up", + "radius_mm": 2.0, + "allowance_mm": 3.141592653589793, + "length_mm": 80.0, + "included_angle_deg": 120.0 + }, + { + "body": "Body1", + "rule": "Steel 2", + "thickness_mm": 2.0, + "k_factor": 0.5, + "bend": 2, + "angle_deg": 180.0, + "direction": "down", + "radius_mm": 0.01, + "allowance_mm": 3.173008580125691, + "length_mm": 80.0, + "included_angle_deg": 0.0 + } + ] + } + ] +} diff --git a/tests/kernel-cases/sheet-metal/cov-export-bend-table-csv-flange-and-hem/recipe.json b/tests/kernel-cases/sheet-metal/cov-export-bend-table-csv-flange-and-hem/recipe.json new file mode 100644 index 000000000..7db31f7f8 --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-export-bend-table-csv-flange-and-hem/recipe.json @@ -0,0 +1,79 @@ +{ + "commands": [ + { + "command": "sheet.manage_rules", + "params": { + "name": "Steel 2", + "thickness": "2 mm", + "active": true, + "bend_radius": "2 mm", + "k_factor": 0.5 + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Base" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 80, + 40 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "sheet.flange", + "params": { + "type": "base", + "sketch": "Base" + } + }, + { + "command": "sheet.flange", + "params": { + "type": "edge", + "edges": [ + [ + 40, + 0, + 2 + ] + ], + "height": 20, + "angle": "60 deg" + } + }, + { + "command": "sheet.hem", + "params": { + "edges": [ + [ + 40, + 40, + 2 + ] + ], + "length": 8 + } + }, + { + "command": "sheet.export_bend_table", + "params": { + "path": "$OUT/bends.csv" + } + } + ] +} diff --git a/tests/kernel-cases/sheet-metal/cov-export-bend-table-json-one-flange/expected.json b/tests/kernel-cases/sheet-metal/cov-export-bend-table-json-one-flange/expected.json new file mode 100644 index 000000000..473d8ea4f --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-export-bend-table-json-one-flange/expected.json @@ -0,0 +1,33 @@ +{ + "sources": [], + "what": "sheet.export_bend_table as JSON of an 80 x 40 x 2 base with one 90 degree flange 20 high", + "source": "analytic", + "method": "the rule: T = 2, K = 0.5, R = 2. One bend: 90 degrees (included 180 - 90 = 90), up, radius 2, allowance BA = theta(R + K*T) = (pi/2)(2 + 1) = 4.712388980, as long as the edge, 80; flat 80 x 56.712389 x 2", + "body_count": 1, + "files": [ + { + "path": "bends.json", + "json": { + "rule": "Steel 2", + "thickness": 2.0, + "k_factor": 0.5, + "flat_size_mm": [ + 80.0, + 56.71238898038469, + 2.0 + ], + "bends": [ + { + "bend": 1, + "angle_deg": 90.0, + "included_angle_deg": 90.0, + "radius": 2.0, + "direction": "up", + "allowance": 4.71238898038469, + "length": 80.0 + } + ] + } + } + ] +} diff --git a/tests/kernel-cases/sheet-metal/cov-export-bend-table-json-one-flange/recipe.json b/tests/kernel-cases/sheet-metal/cov-export-bend-table-json-one-flange/recipe.json new file mode 100644 index 000000000..28ca05b57 --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-export-bend-table-json-one-flange/recipe.json @@ -0,0 +1,66 @@ +{ + "commands": [ + { + "command": "sheet.manage_rules", + "params": { + "name": "Steel 2", + "thickness": "2 mm", + "active": true, + "bend_radius": "2 mm", + "k_factor": 0.5 + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Base" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 80, + 40 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "sheet.flange", + "params": { + "type": "base", + "sketch": "Base" + } + }, + { + "command": "sheet.flange", + "params": { + "type": "edge", + "edges": [ + [ + 40, + 0, + 2 + ] + ], + "height": 20 + } + }, + { + "command": "sheet.export_bend_table", + "params": { + "format": "json", + "path": "$OUT/bends.json" + } + } + ] +} diff --git a/tests/kernel-cases/sheet-metal/cov-export-bend-table-unknown-format-refused/expected.json b/tests/kernel-cases/sheet-metal/cov-export-bend-table-unknown-format-refused/expected.json new file mode 100644 index 000000000..c046f2393 --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-export-bend-table-unknown-format-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "sheet.export_bend_table asked for a format it does not write (xlsx)", + "source": "invariants", + "method": "the table is written as csv or json only: any other format is refused, naming the two", + "outcome": "refused", + "refusal": "`format` must be csv or json" +} diff --git a/tests/kernel-cases/sheet-metal/cov-export-bend-table-unknown-format-refused/recipe.json b/tests/kernel-cases/sheet-metal/cov-export-bend-table-unknown-format-refused/recipe.json new file mode 100644 index 000000000..de8ab8474 --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-export-bend-table-unknown-format-refused/recipe.json @@ -0,0 +1,66 @@ +{ + "commands": [ + { + "command": "sheet.manage_rules", + "params": { + "name": "Steel 2", + "thickness": "2 mm", + "active": true, + "bend_radius": "2 mm", + "k_factor": 0.5 + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Base" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 80, + 40 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "sheet.flange", + "params": { + "type": "base", + "sketch": "Base" + } + }, + { + "command": "sheet.flange", + "params": { + "type": "edge", + "edges": [ + [ + 40, + 0, + 2 + ] + ], + "height": 20 + } + }, + { + "command": "sheet.export_bend_table", + "params": { + "format": "xlsx", + "path": "$OUT/bends.xlsx" + } + } + ] +} From 235645db5048e7a4935becc73dc921ed6876c427 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:59:59 -0400 Subject: [PATCH 039/108] Kernel rig: the ellipse length's Simpson weights as a named step Co-Authored-By: Claude Opus 5.5 --- apps/solidcraft-cli/src/kernel_cases.rs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/apps/solidcraft-cli/src/kernel_cases.rs b/apps/solidcraft-cli/src/kernel_cases.rs index ba2e69fa8..d5bdde80a 100644 --- a/apps/solidcraft-cli/src/kernel_cases.rs +++ b/apps/solidcraft-cli/src/kernel_cases.rs @@ -361,7 +361,13 @@ fn dxf_layers(text: &str) -> Value { let n = 4096; let speed = |t: f64| (a * t.sin()).hypot(b * t.cos()); let h = sweep / n as f64; - let sum: f64 = (0..=n).map(|k| speed(t0 + k as f64 * h) * if k == 0 || k == n { 1.0 } else if k % 2 == 1 { 4.0 } else { 2.0 }).sum(); + let weight = |k: usize| match k { + 0 => 1.0, + k if k == n => 1.0, + k if k % 2 == 1 => 4.0, + _ => 2.0, + }; + let sum: f64 = (0..=n).map(|k| speed(t0 + k as f64 * h) * weight(k)).sum(); Some(sum * h / 3.0) } _ => None, @@ -809,7 +815,17 @@ mod tests { vec![("0", "ARC"), ("8", "OUTLINE"), ("10", "0"), ("20", "0"), ("40", "2"), ("50", "270"), ("51", "0")], vec![("0", "CIRCLE"), ("8", "CUT"), ("10", "5"), ("20", "5"), ("40", "1")], vec![("0", "LWPOLYLINE"), ("8", "BEND_UP"), ("90", "2"), ("70", "128"), ("10", "0"), ("20", "1"), ("10", "10"), ("20", "1")], - vec![("0", "ELLIPSE"), ("8", "CUT"), ("10", "0"), ("20", "0"), ("11", "10"), ("21", "0"), ("40", "1"), ("41", "0"), ("42", "6.283185307179586")], + vec![ + ("0", "ELLIPSE"), + ("8", "CUT"), + ("10", "0"), + ("20", "0"), + ("11", "10"), + ("21", "0"), + ("40", "1"), + ("41", "0"), + ("42", "6.283185307179586"), + ], ] { for (c, v) in e { t += &pair(c, v); From 5ba60bd9d384c8e2f1225f28019b04c8e59850cb Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:59:59 -0400 Subject: [PATCH 040/108] Kernel rig: plastic cases, bosses, lips and grooves, rests, a snap fit edge case and the plastic rules, each with its answer A new plastic area with its KNOWN_FAILING (empty: every case passes) and the sources whose change reruns it; the README lists the area and the new files and results fields. Co-Authored-By: Claude Opus 5.5 --- tests/kernel-cases/README.md | 3 ++ tests/kernel-cases/plastic/KNOWN_FAILING | 4 ++ tests/kernel-cases/plastic/PATHS | 20 ++++++++ .../expected.json | 8 +++ .../recipe.json | 26 ++++++++++ .../expected.json | 21 ++++++++ .../cov-boss-straight-with-a-hole/recipe.json | 26 ++++++++++ .../cov-boss-with-four-ribs/expected.json | 20 ++++++++ .../cov-boss-with-four-ribs/recipe.json | 29 +++++++++++ .../expected.json | 20 ++++++++ .../recipe.json | 47 ++++++++++++++++++ .../expected.json | 20 ++++++++ .../recipe.json | 38 ++++++++++++++ .../expected.json | 8 +++ .../recipe.json | 38 ++++++++++++++ .../expected.json | 20 ++++++++ .../recipe.json | 42 ++++++++++++++++ .../expected.json | 8 +++ .../recipe.json | 48 ++++++++++++++++++ .../expected.json | 8 +++ .../recipe.json | 22 +++++++++ .../expected.json | 16 ++++++ .../recipe.json | 46 +++++++++++++++++ .../expected.json | 8 +++ .../recipe.json | 11 +++++ .../expected.json | 31 ++++++++++++ .../recipe.json | 34 +++++++++++++ .../expected.json | 49 +++++++++++++++++++ .../recipe.json | 33 +++++++++++++ .../cov-rest-rectangular/expected.json | 21 ++++++++ .../plastic/cov-rest-rectangular/recipe.json | 31 ++++++++++++ .../expected.json | 20 ++++++++ .../cov-rest-round-hollow-drafted/recipe.json | 27 ++++++++++ .../expected.json | 8 +++ .../recipe.json | 26 ++++++++++ .../expected.json | 20 ++++++++ .../recipe.json | 34 +++++++++++++ .../expected.json | 8 +++ .../recipe.json | 33 +++++++++++++ 39 files changed, 932 insertions(+) create mode 100644 tests/kernel-cases/plastic/KNOWN_FAILING create mode 100644 tests/kernel-cases/plastic/PATHS create mode 100644 tests/kernel-cases/plastic/cov-boss-draft-closing-before-its-top-refused/expected.json create mode 100644 tests/kernel-cases/plastic/cov-boss-draft-closing-before-its-top-refused/recipe.json create mode 100644 tests/kernel-cases/plastic/cov-boss-straight-with-a-hole/expected.json create mode 100644 tests/kernel-cases/plastic/cov-boss-straight-with-a-hole/recipe.json create mode 100644 tests/kernel-cases/plastic/cov-boss-with-four-ribs/expected.json create mode 100644 tests/kernel-cases/plastic/cov-boss-with-four-ribs/recipe.json create mode 100644 tests/kernel-cases/plastic/cov-groove-outside-takes-the-rules-clearance/expected.json create mode 100644 tests/kernel-cases/plastic/cov-groove-outside-takes-the-rules-clearance/recipe.json create mode 100644 tests/kernel-cases/plastic/cov-lip-inside-on-a-shelled-box/expected.json create mode 100644 tests/kernel-cases/plastic/cov-lip-inside-on-a-shelled-box/recipe.json create mode 100644 tests/kernel-cases/plastic/cov-lip-on-a-face-without-an-opening-refused/expected.json create mode 100644 tests/kernel-cases/plastic/cov-lip-on-a-face-without-an-opening-refused/recipe.json create mode 100644 tests/kernel-cases/plastic/cov-plastic-assign-rule-drafts-the-boss/expected.json create mode 100644 tests/kernel-cases/plastic/cov-plastic-assign-rule-drafts-the-boss/recipe.json create mode 100644 tests/kernel-cases/plastic/cov-plastic-assign-rule-overrides-the-active-rule/expected.json create mode 100644 tests/kernel-cases/plastic/cov-plastic-assign-rule-overrides-the-active-rule/recipe.json create mode 100644 tests/kernel-cases/plastic/cov-plastic-assign-unknown-rule-refused/expected.json create mode 100644 tests/kernel-cases/plastic/cov-plastic-assign-unknown-rule-refused/recipe.json create mode 100644 tests/kernel-cases/plastic/cov-plastic-manage-rules-deleted-rule-leaves-no-draft/expected.json create mode 100644 tests/kernel-cases/plastic/cov-plastic-manage-rules-deleted-rule-leaves-no-draft/recipe.json create mode 100644 tests/kernel-cases/plastic/cov-plastic-manage-rules-from-an-unknown-rule-refused/expected.json create mode 100644 tests/kernel-cases/plastic/cov-plastic-manage-rules-from-an-unknown-rule-refused/recipe.json create mode 100644 tests/kernel-cases/plastic/cov-plastic-manage-rules-new-active-rule-sets-the-draft/expected.json create mode 100644 tests/kernel-cases/plastic/cov-plastic-manage-rules-new-active-rule-sets-the-draft/recipe.json create mode 100644 tests/kernel-cases/plastic/cov-plastic-rules-lists-library-design-and-assigned/expected.json create mode 100644 tests/kernel-cases/plastic/cov-plastic-rules-lists-library-design-and-assigned/recipe.json create mode 100644 tests/kernel-cases/plastic/cov-rest-rectangular/expected.json create mode 100644 tests/kernel-cases/plastic/cov-rest-rectangular/recipe.json create mode 100644 tests/kernel-cases/plastic/cov-rest-round-hollow-drafted/expected.json create mode 100644 tests/kernel-cases/plastic/cov-rest-round-hollow-drafted/recipe.json create mode 100644 tests/kernel-cases/plastic/cov-rest-wall-as-thick-as-half-its-width-refused/expected.json create mode 100644 tests/kernel-cases/plastic/cov-rest-wall-as-thick-as-half-its-width-refused/recipe.json create mode 100644 tests/kernel-cases/plastic/cov-snap-fit-base-below-the-face-is-absorbed/expected.json create mode 100644 tests/kernel-cases/plastic/cov-snap-fit-base-below-the-face-is-absorbed/recipe.json create mode 100644 tests/kernel-cases/plastic/cov-snap-fit-catch-as-long-as-its-arm-refused/expected.json create mode 100644 tests/kernel-cases/plastic/cov-snap-fit-catch-as-long-as-its-arm-refused/recipe.json diff --git a/tests/kernel-cases/README.md b/tests/kernel-cases/README.md index aeb550246..bac661f82 100644 --- a/tests/kernel-cases/README.md +++ b/tests/kernel-cases/README.md @@ -39,6 +39,7 @@ One directory per area, one per case: `tests/kernel-cases///`. | `continuity` (designed seams of known order, G0 to G4, that prove the continuity measurement itself) | history rig | | `solids` (cones, scale, align, bounding solids) | tool coverage | | `frames` (frame members, inserted profiles) | tool coverage | +| `plastic` (boss, lip and groove, rest, snap fit, plastic rules) | tool coverage rig | Each area also has its gate files: `KNOWN_FAILING` and `PATHS` (see [the gate](#the-kernel-rig-gate)). @@ -99,6 +100,8 @@ the frozen truck-geometry PRs, a `kernel-paused` PR), for the report's coverage | `watertight` | `true`: each body's display mesh (chord tolerance `tolerance.mesh_mm`, default 0.01 mm) has no open and no over-shared edges, with vertices closer than `tolerance.weld_mm` (default 1e-4 mm) taken as one. | | `timeout_s` | A longer timeout for this case than the run's (at most 1800 s), for cases that are slow by nature. A case that only needs it on a loaded machine shouldn't set it. | | `tolerance` | Optional overrides: `rel`, `abs_mm`, `mesh_mm`, `weld_mm`. | +| `files` | The files the case wrote to `$OUT`, each `{path, json \| csv \| dxf}`, matched as a part of what is there: every key the case gives, an array item by item and as long, a whole number exactly, any other number within `rel`. `json`: the file's JSON; `csv`: its rows, as objects keyed by the header row; `dxf`: per layer of its ENTITIES section, how many of each entity (`{"CUT": {"CIRCLE": 1, "ELLIPSE": 0, "length_mm": 31.416}}`; a count may be a range `[min, max]`) and `length_mm`, the total length of its lines, arcs, circles, ellipses and polylines. | +| `results` | The commands' own answers, each `{step, json}`: the answer of the `step`th command (from 1) matched as `files` matches JSON (a flat pattern's bends, a rule's values). | | `missing` | A capability SolidCraft has no command or parameter for yet (`"solid.thread has no start count"`): the case is reported **not supported yet** without running, so the gap stays visible. | ## The kernel rig gate diff --git a/tests/kernel-cases/plastic/KNOWN_FAILING b/tests/kernel-cases/plastic/KNOWN_FAILING new file mode 100644 index 000000000..0b1e0a4fe --- /dev/null +++ b/tests/kernel-cases/plastic/KNOWN_FAILING @@ -0,0 +1,4 @@ +# The plastic cases that fail today, one a line: ` `. Sorted. A gate on +# this area fails on a case that fails and is not listed here, and on a listed case that passes: +# a fix removes its line in the same pull request. +# Baseline: rig-cases-sheet-plastic 45f69c0e5 with SMLib 60b1c6a, aarch64 Linux: every case passes. diff --git a/tests/kernel-cases/plastic/PATHS b/tests/kernel-cases/plastic/PATHS new file mode 100644 index 000000000..47435b15c --- /dev/null +++ b/tests/kernel-cases/plastic/PATHS @@ -0,0 +1,20 @@ +# The sources whose change must rerun the plastic cases (git pathspec globs, one a line). +# The commands and their rules. +crates/engine/src/cmd/plastic.rs +crates/doc/src/plastic.rs +# The features' evaluation (plastic_eval and its helpers) and the join and cut they apply. +crates/doc/src/eval_more.rs +crates/doc/src/eval.rs +# The kernel operations they build with: extrude, tapered extrude, the lip's raised band and the +# groove's rim band, booleans (ops) and the shell the lip cases +# start from, and SMLib underneath. +crates/kernel/src/build.rs +crates/kernel/src/lip.rs +crates/kernel/src/ops.rs +crates/kernel/src/boolean_record.rs +crates/kernel/src/native.rs +crates/kernel/src/shell_groups.rs +crates/smlib/** +# The cases and the rig itself. +tests/kernel-cases/plastic/** +apps/solidcraft-cli/src/kernel_cases.rs diff --git a/tests/kernel-cases/plastic/cov-boss-draft-closing-before-its-top-refused/expected.json b/tests/kernel-cases/plastic/cov-boss-draft-closing-before-its-top-refused/expected.json new file mode 100644 index 000000000..b912bb4ee --- /dev/null +++ b/tests/kernel-cases/plastic/cov-boss-draft-closing-before-its-top-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "plastic.boss 2 across and 12 high with a 5 degree draft: the taper closes the post before its top", + "source": "invariants", + "method": "top radius r0 - h tan(draft) = 1 - 12 tan 5 deg = -0.049864 < 0: no post, a clean refusal", + "outcome": "refused", + "refusal": "the draft closes the boss before its top" +} diff --git a/tests/kernel-cases/plastic/cov-boss-draft-closing-before-its-top-refused/recipe.json b/tests/kernel-cases/plastic/cov-boss-draft-closing-before-its-top-refused/recipe.json new file mode 100644 index 000000000..7ce5b4245 --- /dev/null +++ b/tests/kernel-cases/plastic/cov-boss-draft-closing-before-its-top-refused/recipe.json @@ -0,0 +1,26 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 60, + "width": 60, + "height": 3, + "body_name": "Plate" + } + }, + { + "command": "plastic.boss", + "params": { + "position": [ + 30, + 30, + 3 + ], + "diameter": 2, + "height": 12, + "draft": "5 deg" + } + } + ] +} diff --git a/tests/kernel-cases/plastic/cov-boss-straight-with-a-hole/expected.json b/tests/kernel-cases/plastic/cov-boss-straight-with-a-hole/expected.json new file mode 100644 index 000000000..083051404 --- /dev/null +++ b/tests/kernel-cases/plastic/cov-boss-straight-with-a-hole/expected.json @@ -0,0 +1,21 @@ +{ + "sources": [], + "what": "plastic.boss 10 across and 12 high with a 4 mm hole, on a 60 x 60 x 3 plate with no plastic rule (no draft)", + "source": "analytic", + "method": "no rule, no draft: a cylinder r 5, h 12 standing on the face, its hole r 2 from the top down to the face (hole_depth defaults to the height). V = 60*60*3 + pi*5^2*12 - pi*2^2*12 = 11591.681349. Faces: the plate's 6 (the top with the post's foot in it), the post's side, its top ring, the hole's wall and its floor (a disc on the plate's plane, inside the post, apart from the plate's top)", + "body_count": 1, + "volume_mm3": 11591.68134870463, + "faces": 10, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 60, + 60, + 15 + ] + } +} diff --git a/tests/kernel-cases/plastic/cov-boss-straight-with-a-hole/recipe.json b/tests/kernel-cases/plastic/cov-boss-straight-with-a-hole/recipe.json new file mode 100644 index 000000000..fe05d4adb --- /dev/null +++ b/tests/kernel-cases/plastic/cov-boss-straight-with-a-hole/recipe.json @@ -0,0 +1,26 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 60, + "width": 60, + "height": 3, + "body_name": "Plate" + } + }, + { + "command": "plastic.boss", + "params": { + "position": [ + 30, + 30, + 3 + ], + "diameter": 10, + "height": 12, + "hole_diameter": 4 + } + } + ] +} diff --git a/tests/kernel-cases/plastic/cov-boss-with-four-ribs/expected.json b/tests/kernel-cases/plastic/cov-boss-with-four-ribs/expected.json new file mode 100644 index 000000000..1d43b3844 --- /dev/null +++ b/tests/kernel-cases/plastic/cov-boss-with-four-ribs/expected.json @@ -0,0 +1,20 @@ +{ + "sources": [], + "what": "plastic.boss 10 across and 12 high with 4 ribs 1.5 thick, 6 out from the wall, 2 below the top, on a 60 x 60 x 3 plate", + "source": "analytic", + "method": "each rib is a 1.5-wide strip from r0/2 = 2.5 to r0 + 6 = 11 from the axis, 12 - 2 = 10 high from the face; outside the post (r0 = 5) its section is t(r0 + l) - [(t/2)sqrt(r0^2 - t^2/4) + r0^2 asin(t/(2 r0))] = 9.028220693 (the strip less the circle's part of it). V = 60*60*3 + pi*5^2*12 + 4*9.028220693*10 = 12103.606624", + "body_count": 1, + "volume_mm3": 12103.606623800613, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 60, + 60, + 15 + ] + } +} diff --git a/tests/kernel-cases/plastic/cov-boss-with-four-ribs/recipe.json b/tests/kernel-cases/plastic/cov-boss-with-four-ribs/recipe.json new file mode 100644 index 000000000..ff3674e6f --- /dev/null +++ b/tests/kernel-cases/plastic/cov-boss-with-four-ribs/recipe.json @@ -0,0 +1,29 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 60, + "width": 60, + "height": 3, + "body_name": "Plate" + } + }, + { + "command": "plastic.boss", + "params": { + "position": [ + 30, + 30, + 3 + ], + "diameter": 10, + "height": 12, + "ribs": 4, + "rib_thickness": 1.5, + "rib_length": 6, + "rib_offset": 2 + } + } + ] +} diff --git a/tests/kernel-cases/plastic/cov-groove-outside-takes-the-rules-clearance/expected.json b/tests/kernel-cases/plastic/cov-groove-outside-takes-the-rules-clearance/expected.json new file mode 100644 index 000000000..6cf99a660 --- /dev/null +++ b/tests/kernel-cases/plastic/cov-groove-outside-takes-the-rules-clearance/expected.json @@ -0,0 +1,20 @@ +{ + "sources": [], + "what": "plastic.lip type groove, 1 wide and 2 deep along the outside edge of the shelled box's rim, with the ABS (1.5mm) rule active and no gap given", + "source": "analytic", + "method": "a groove's gap defaults to the body's rule's clearance: ABS (1.5mm), 0.1 mm. The groove is the band along the outer edge (80 x 50) w + gap = 1.1 wide, cut h + gap = 2.1 deep: (80*50 - 77.8*47.8)*2.1 = 590.436000. V = 22112 - that = 21521.564000; the height stays 30", + "body_count": 1, + "volume_mm3": 21521.564, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 80, + 50, + 30 + ] + } +} diff --git a/tests/kernel-cases/plastic/cov-groove-outside-takes-the-rules-clearance/recipe.json b/tests/kernel-cases/plastic/cov-groove-outside-takes-the-rules-clearance/recipe.json new file mode 100644 index 000000000..2021e982c --- /dev/null +++ b/tests/kernel-cases/plastic/cov-groove-outside-takes-the-rules-clearance/recipe.json @@ -0,0 +1,47 @@ +{ + "commands": [ + { + "command": "plastic.manage_rules", + "params": { + "name": "ABS (1.5mm)", + "active": true + } + }, + { + "command": "solid.box", + "params": { + "length": 80, + "width": 50, + "height": 30, + "body_name": "Case" + } + }, + { + "command": "solid.shell", + "params": { + "faces": [ + [ + 40, + 25, + 30 + ] + ], + "thickness": 2 + } + }, + { + "command": "plastic.lip", + "params": { + "face": [ + 1, + 25, + 30 + ], + "width": 1, + "height": 2, + "type": "groove", + "side": "outside" + } + } + ] +} diff --git a/tests/kernel-cases/plastic/cov-lip-inside-on-a-shelled-box/expected.json b/tests/kernel-cases/plastic/cov-lip-inside-on-a-shelled-box/expected.json new file mode 100644 index 000000000..4281bae07 --- /dev/null +++ b/tests/kernel-cases/plastic/cov-lip-inside-on-a-shelled-box/expected.json @@ -0,0 +1,20 @@ +{ + "sources": [], + "what": "plastic.lip 1 wide and 2 high along the inside edge of the rim of an 80 x 50 x 30 box shelled 2 mm open at the top", + "source": "analytic", + "method": "shelled: 80*50*30 - 76*46*28 = 22112; the lip is the band along the rim's inner edge (76 x 46), 1 wide (to 78 x 48), raised 2: (78*48 - 76*46)*2 = 496. V = 22608; the top rises to 32", + "body_count": 1, + "volume_mm3": 22608.0, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 80, + 50, + 32 + ] + } +} diff --git a/tests/kernel-cases/plastic/cov-lip-inside-on-a-shelled-box/recipe.json b/tests/kernel-cases/plastic/cov-lip-inside-on-a-shelled-box/recipe.json new file mode 100644 index 000000000..53accaafd --- /dev/null +++ b/tests/kernel-cases/plastic/cov-lip-inside-on-a-shelled-box/recipe.json @@ -0,0 +1,38 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 80, + "width": 50, + "height": 30, + "body_name": "Case" + } + }, + { + "command": "solid.shell", + "params": { + "faces": [ + [ + 40, + 25, + 30 + ] + ], + "thickness": 2 + } + }, + { + "command": "plastic.lip", + "params": { + "face": [ + 1, + 25, + 30 + ], + "width": 1, + "height": 2 + } + } + ] +} diff --git a/tests/kernel-cases/plastic/cov-lip-on-a-face-without-an-opening-refused/expected.json b/tests/kernel-cases/plastic/cov-lip-on-a-face-without-an-opening-refused/expected.json new file mode 100644 index 000000000..93f610bd4 --- /dev/null +++ b/tests/kernel-cases/plastic/cov-lip-on-a-face-without-an-opening-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "plastic.lip on the bottom face of the shelled box: a face with one edge, no rim", + "source": "invariants", + "method": "a lip runs round the opening of a rim face (an inner and an outer edge); the closed bottom has only its outer edge, so it is refused and says what to pick", + "outcome": "refused", + "refusal": "pick the rim face of a shelled body" +} diff --git a/tests/kernel-cases/plastic/cov-lip-on-a-face-without-an-opening-refused/recipe.json b/tests/kernel-cases/plastic/cov-lip-on-a-face-without-an-opening-refused/recipe.json new file mode 100644 index 000000000..b6454bc3b --- /dev/null +++ b/tests/kernel-cases/plastic/cov-lip-on-a-face-without-an-opening-refused/recipe.json @@ -0,0 +1,38 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 80, + "width": 50, + "height": 30, + "body_name": "Case" + } + }, + { + "command": "solid.shell", + "params": { + "faces": [ + [ + 40, + 25, + 30 + ] + ], + "thickness": 2 + } + }, + { + "command": "plastic.lip", + "params": { + "face": [ + 40, + 25, + 0 + ], + "width": 1, + "height": 2 + } + } + ] +} diff --git a/tests/kernel-cases/plastic/cov-plastic-assign-rule-drafts-the-boss/expected.json b/tests/kernel-cases/plastic/cov-plastic-assign-rule-drafts-the-boss/expected.json new file mode 100644 index 000000000..7fa6d9359 --- /dev/null +++ b/tests/kernel-cases/plastic/cov-plastic-assign-rule-drafts-the-boss/expected.json @@ -0,0 +1,20 @@ +{ + "sources": [], + "what": "plastic.assign_rule gives the plate a 3 degree rule; a boss on it with no draft of its own takes it", + "source": "analytic", + "method": "the boss takes the draft of its body's rule: a cone frustum r 5 to 5 - 12 tan 3 deg = 4.371106649, 12 high, less its straight hole r 2, 12 deep (inside the top's radius). V = 60*60*3 + (pi*12/3)(5^2 + 5 r1 + r1^2) - pi*2^2*12 = 11478.107830", + "body_count": 1, + "volume_mm3": 11478.107830371639, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 60, + 60, + 15 + ] + } +} diff --git a/tests/kernel-cases/plastic/cov-plastic-assign-rule-drafts-the-boss/recipe.json b/tests/kernel-cases/plastic/cov-plastic-assign-rule-drafts-the-boss/recipe.json new file mode 100644 index 000000000..24fe4a35d --- /dev/null +++ b/tests/kernel-cases/plastic/cov-plastic-assign-rule-drafts-the-boss/recipe.json @@ -0,0 +1,42 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 60, + "width": 60, + "height": 3, + "body_name": "Plate" + } + }, + { + "command": "plastic.manage_rules", + "params": { + "name": "Housing", + "draft": "3 deg" + } + }, + { + "command": "plastic.assign_rule", + "params": { + "bodies": [ + "Plate" + ], + "rule": "Housing" + } + }, + { + "command": "plastic.boss", + "params": { + "position": [ + 30, + 30, + 3 + ], + "diameter": 10, + "height": 12, + "hole_diameter": 4 + } + } + ] +} diff --git a/tests/kernel-cases/plastic/cov-plastic-assign-rule-overrides-the-active-rule/expected.json b/tests/kernel-cases/plastic/cov-plastic-assign-rule-overrides-the-active-rule/expected.json new file mode 100644 index 000000000..bd98ece46 --- /dev/null +++ b/tests/kernel-cases/plastic/cov-plastic-assign-rule-overrides-the-active-rule/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "the active rule drafts 2 degrees (ABS (1.5mm)), the plate's assigned rule 4 degrees: a round rest on the plate takes the assigned 4", + "source": "analytic", + "method": "a body's assigned rule comes before the active one: the rest (round, 10 across, 5 high, solid) is drafted 4 deg: V = 60*40*3 + (pi*5/3)(5^2 + 5 r1 + r1^2), r1 = 5 - 5 tan 4 deg, = 7565.878955 (with the active 2 deg it would be 7579.145355)", + "body_count": 1, + "volume_mm3": 7565.878954822472 +} diff --git a/tests/kernel-cases/plastic/cov-plastic-assign-rule-overrides-the-active-rule/recipe.json b/tests/kernel-cases/plastic/cov-plastic-assign-rule-overrides-the-active-rule/recipe.json new file mode 100644 index 000000000..8bf28edb9 --- /dev/null +++ b/tests/kernel-cases/plastic/cov-plastic-assign-rule-overrides-the-active-rule/recipe.json @@ -0,0 +1,48 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 60, + "width": 40, + "height": 3, + "body_name": "Plate" + } + }, + { + "command": "plastic.manage_rules", + "params": { + "name": "ABS (1.5mm)", + "active": true + } + }, + { + "command": "plastic.manage_rules", + "params": { + "name": "Steep", + "draft": "4 deg" + } + }, + { + "command": "plastic.assign_rule", + "params": { + "bodies": [ + "Plate" + ], + "rule": "Steep" + } + }, + { + "command": "plastic.rest", + "params": { + "position": [ + 30, + 20, + 3 + ], + "width": 10, + "height": 5 + } + } + ] +} diff --git a/tests/kernel-cases/plastic/cov-plastic-assign-unknown-rule-refused/expected.json b/tests/kernel-cases/plastic/cov-plastic-assign-unknown-rule-refused/expected.json new file mode 100644 index 000000000..fc5996f79 --- /dev/null +++ b/tests/kernel-cases/plastic/cov-plastic-assign-unknown-rule-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "plastic.assign_rule with a rule name that is neither a library nor a design rule", + "source": "invariants", + "method": "only an existing rule can be assigned: a clean refusal that names the rule", + "outcome": "refused", + "refusal": "no plastic rule `Nope`" +} diff --git a/tests/kernel-cases/plastic/cov-plastic-assign-unknown-rule-refused/recipe.json b/tests/kernel-cases/plastic/cov-plastic-assign-unknown-rule-refused/recipe.json new file mode 100644 index 000000000..3ccd1209f --- /dev/null +++ b/tests/kernel-cases/plastic/cov-plastic-assign-unknown-rule-refused/recipe.json @@ -0,0 +1,22 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 60, + "width": 40, + "height": 3, + "body_name": "Plate" + } + }, + { + "command": "plastic.assign_rule", + "params": { + "bodies": [ + "Plate" + ], + "rule": "Nope" + } + } + ] +} diff --git a/tests/kernel-cases/plastic/cov-plastic-manage-rules-deleted-rule-leaves-no-draft/expected.json b/tests/kernel-cases/plastic/cov-plastic-manage-rules-deleted-rule-leaves-no-draft/expected.json new file mode 100644 index 000000000..9bbec0dbc --- /dev/null +++ b/tests/kernel-cases/plastic/cov-plastic-manage-rules-deleted-rule-leaves-no-draft/expected.json @@ -0,0 +1,16 @@ +{ + "sources": [], + "what": "plastic.manage_rules makes an active 5 degree rule, then deletes it; a rest after that has no rule and no draft", + "source": "analytic", + "method": "deleting a design rule also clears it as the active rule, so the rest (16 x 10 x 3, no draft of its own) is straight: V = 60*40*3 + 16*10*3 = 7680", + "body_count": 1, + "volume_mm3": 7680.0, + "results": [ + { + "step": 3, + "json": { + "deleted": "Steep" + } + } + ] +} diff --git a/tests/kernel-cases/plastic/cov-plastic-manage-rules-deleted-rule-leaves-no-draft/recipe.json b/tests/kernel-cases/plastic/cov-plastic-manage-rules-deleted-rule-leaves-no-draft/recipe.json new file mode 100644 index 000000000..e718ffeab --- /dev/null +++ b/tests/kernel-cases/plastic/cov-plastic-manage-rules-deleted-rule-leaves-no-draft/recipe.json @@ -0,0 +1,46 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 60, + "width": 40, + "height": 3, + "body_name": "Plate" + } + }, + { + "command": "plastic.manage_rules", + "params": { + "name": "Steep", + "draft": "5 deg", + "active": true + } + }, + { + "command": "plastic.manage_rules", + "params": { + "name": "Steep", + "delete": true + } + }, + { + "command": "plastic.rest", + "params": { + "position": [ + 30, + 20, + 3 + ], + "width": 10, + "length": 16, + "along": [ + 1, + 0, + 0 + ], + "height": 3 + } + } + ] +} diff --git a/tests/kernel-cases/plastic/cov-plastic-manage-rules-from-an-unknown-rule-refused/expected.json b/tests/kernel-cases/plastic/cov-plastic-manage-rules-from-an-unknown-rule-refused/expected.json new file mode 100644 index 000000000..c179e63ad --- /dev/null +++ b/tests/kernel-cases/plastic/cov-plastic-manage-rules-from-an-unknown-rule-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "plastic.manage_rules asked to start a new rule from a rule that does not exist", + "source": "invariants", + "method": "a new rule copies the values of `from`; with no such rule there is nothing to copy, a clean refusal naming it", + "outcome": "refused", + "refusal": "no plastic rule `No Such Rule` to start from" +} diff --git a/tests/kernel-cases/plastic/cov-plastic-manage-rules-from-an-unknown-rule-refused/recipe.json b/tests/kernel-cases/plastic/cov-plastic-manage-rules-from-an-unknown-rule-refused/recipe.json new file mode 100644 index 000000000..1425f5280 --- /dev/null +++ b/tests/kernel-cases/plastic/cov-plastic-manage-rules-from-an-unknown-rule-refused/recipe.json @@ -0,0 +1,11 @@ +{ + "commands": [ + { + "command": "plastic.manage_rules", + "params": { + "name": "Mine", + "from": "No Such Rule" + } + } + ] +} diff --git a/tests/kernel-cases/plastic/cov-plastic-manage-rules-new-active-rule-sets-the-draft/expected.json b/tests/kernel-cases/plastic/cov-plastic-manage-rules-new-active-rule-sets-the-draft/expected.json new file mode 100644 index 000000000..d121d2d91 --- /dev/null +++ b/tests/kernel-cases/plastic/cov-plastic-manage-rules-new-active-rule-sets-the-draft/expected.json @@ -0,0 +1,31 @@ +{ + "sources": [], + "what": "plastic.manage_rules makes a rule from the Polypropylene library rule with a 1 degree draft and makes it active; a round rest with no draft of its own takes it", + "source": "analytic", + "method": "the new rule starts from Polypropylene (PP) (3 mm): thickness 3, nominal radius 0.5*Thickness = 1.5, thickness variation 0.15*Thickness = 0.45, clearance 0.1, min/max 0.8/3.8, its draft set to 1 deg. A solid round rest 10 across and 5 high drafted 1 deg: V = 60*40*3 + (pi*5/3)(5^2 + 5 r1 + r1^2), r1 = 5 - 5 tan 1 deg, = 7585.884376", + "body_count": 1, + "volume_mm3": 7585.884376156436, + "results": [ + { + "step": 2, + "json": { + "active": "PP draft 1", + "rule": { + "name": "PP draft 1", + "material": "Polypropylene", + "library": false, + "values": { + "thickness": 3.0, + "nominal_radius": 1.5, + "thickness_variation": 0.45, + "clearance": 0.1, + "draft_deg": 1.0, + "min_thickness": 0.8, + "max_thickness": 3.8, + "min_draft_deg": 0.5 + } + } + } + } + ] +} diff --git a/tests/kernel-cases/plastic/cov-plastic-manage-rules-new-active-rule-sets-the-draft/recipe.json b/tests/kernel-cases/plastic/cov-plastic-manage-rules-new-active-rule-sets-the-draft/recipe.json new file mode 100644 index 000000000..9f7b51424 --- /dev/null +++ b/tests/kernel-cases/plastic/cov-plastic-manage-rules-new-active-rule-sets-the-draft/recipe.json @@ -0,0 +1,34 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 60, + "width": 40, + "height": 3, + "body_name": "Plate" + } + }, + { + "command": "plastic.manage_rules", + "params": { + "name": "PP draft 1", + "from": "Polypropylene (PP) (3 mm)", + "draft": "1 deg", + "active": true + } + }, + { + "command": "plastic.rest", + "params": { + "position": [ + 30, + 20, + 3 + ], + "width": 10, + "height": 5 + } + } + ] +} diff --git a/tests/kernel-cases/plastic/cov-plastic-rules-lists-library-design-and-assigned/expected.json b/tests/kernel-cases/plastic/cov-plastic-rules-lists-library-design-and-assigned/expected.json new file mode 100644 index 000000000..64c23b182 --- /dev/null +++ b/tests/kernel-cases/plastic/cov-plastic-rules-lists-library-design-and-assigned/expected.json @@ -0,0 +1,49 @@ +{ + "sources": [], + "what": "plastic.rules after a design rule is made and assigned to a body: the six library rules, then the design's own, the active one and the assignment", + "source": "analytic", + "method": "the list is the library as the design has it (6 rules, ABS (1.5mm) first) and then the design's own (Housing, from ABS with a 3 deg draft: thickness 1.5, nominal radius 0.75); no rule was made active; Plate is assigned Housing. The plate is unchanged: V = 60*40*3", + "body_count": 1, + "volume_mm3": 7200.0, + "results": [ + { + "step": 4, + "json": { + "active": null, + "assigned": { + "Plate": "Housing" + }, + "rules": [ + { + "name": "ABS (1.5mm)", + "library": true + }, + { + "library": true + }, + { + "library": true + }, + { + "library": true + }, + { + "library": true + }, + { + "library": true + }, + { + "name": "Housing", + "library": false, + "values": { + "thickness": 1.5, + "nominal_radius": 0.75, + "draft_deg": 3.0 + } + } + ] + } + } + ] +} diff --git a/tests/kernel-cases/plastic/cov-plastic-rules-lists-library-design-and-assigned/recipe.json b/tests/kernel-cases/plastic/cov-plastic-rules-lists-library-design-and-assigned/recipe.json new file mode 100644 index 000000000..3d5444642 --- /dev/null +++ b/tests/kernel-cases/plastic/cov-plastic-rules-lists-library-design-and-assigned/recipe.json @@ -0,0 +1,33 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 60, + "width": 40, + "height": 3, + "body_name": "Plate" + } + }, + { + "command": "plastic.manage_rules", + "params": { + "name": "Housing", + "draft": "3 deg" + } + }, + { + "command": "plastic.assign_rule", + "params": { + "bodies": [ + "Plate" + ], + "rule": "Housing" + } + }, + { + "command": "plastic.rules", + "params": {} + } + ] +} diff --git a/tests/kernel-cases/plastic/cov-rest-rectangular/expected.json b/tests/kernel-cases/plastic/cov-rest-rectangular/expected.json new file mode 100644 index 000000000..c161ca0e8 --- /dev/null +++ b/tests/kernel-cases/plastic/cov-rest-rectangular/expected.json @@ -0,0 +1,21 @@ +{ + "sources": [], + "what": "plastic.rest, a solid rectangle 16 along x by 10 across and 3 high, on a 60 x 40 x 3 plate with no rule (no draft)", + "source": "analytic", + "method": "no rule, no draft: a 16 x 10 x 3 block joined on the face, wholly inside it. V = 60*40*3 + 16*10*3 = 7680. Faces: the plate's 6 and the rest's 4 sides and top", + "body_count": 1, + "volume_mm3": 7680.0, + "faces": 11, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 60, + 40, + 6 + ] + } +} diff --git a/tests/kernel-cases/plastic/cov-rest-rectangular/recipe.json b/tests/kernel-cases/plastic/cov-rest-rectangular/recipe.json new file mode 100644 index 000000000..dcd913dbc --- /dev/null +++ b/tests/kernel-cases/plastic/cov-rest-rectangular/recipe.json @@ -0,0 +1,31 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 60, + "width": 40, + "height": 3, + "body_name": "Plate" + } + }, + { + "command": "plastic.rest", + "params": { + "position": [ + 30, + 20, + 3 + ], + "width": 10, + "length": 16, + "along": [ + 1, + 0, + 0 + ], + "height": 3 + } + } + ] +} diff --git a/tests/kernel-cases/plastic/cov-rest-round-hollow-drafted/expected.json b/tests/kernel-cases/plastic/cov-rest-round-hollow-drafted/expected.json new file mode 100644 index 000000000..bebcfa9e3 --- /dev/null +++ b/tests/kernel-cases/plastic/cov-rest-round-hollow-drafted/expected.json @@ -0,0 +1,20 @@ +{ + "sources": [], + "what": "plastic.rest, round, 12 across, 4 high, a hollow ring with a 1.5 mm wall, drafted 2 degrees, on a 60 x 40 x 3 plate", + "source": "analytic", + "method": "sized at the face; the draft takes s = h tan 2 deg = 0.139683078 off each side of the wall by the top (the outer radius 6 to 6 - s, the bore 4.5 to 4.5 + s). V = 60*40*3 + (pi h/3)(R0^2 + R0 R1 + R1^2) for the outer minus that of the bore = 7379.489589", + "body_count": 1, + "volume_mm3": 7379.489589250136, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 60, + 40, + 7 + ] + } +} diff --git a/tests/kernel-cases/plastic/cov-rest-round-hollow-drafted/recipe.json b/tests/kernel-cases/plastic/cov-rest-round-hollow-drafted/recipe.json new file mode 100644 index 000000000..674c6a614 --- /dev/null +++ b/tests/kernel-cases/plastic/cov-rest-round-hollow-drafted/recipe.json @@ -0,0 +1,27 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 60, + "width": 40, + "height": 3, + "body_name": "Plate" + } + }, + { + "command": "plastic.rest", + "params": { + "position": [ + 30, + 20, + 3 + ], + "width": 12, + "height": 4, + "thickness": 1.5, + "draft": "2 deg" + } + } + ] +} diff --git a/tests/kernel-cases/plastic/cov-rest-wall-as-thick-as-half-its-width-refused/expected.json b/tests/kernel-cases/plastic/cov-rest-wall-as-thick-as-half-its-width-refused/expected.json new file mode 100644 index 000000000..87c09610a --- /dev/null +++ b/tests/kernel-cases/plastic/cov-rest-wall-as-thick-as-half-its-width-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "plastic.rest, round, 12 across with a 6 mm wall: the wall would fill it", + "source": "invariants", + "method": "a hollow rest's wall must be thinner than half its width (6 here): a 6 mm wall leaves no bore, a clean refusal", + "outcome": "refused", + "refusal": "the rest's wall must be thinner than half its width" +} diff --git a/tests/kernel-cases/plastic/cov-rest-wall-as-thick-as-half-its-width-refused/recipe.json b/tests/kernel-cases/plastic/cov-rest-wall-as-thick-as-half-its-width-refused/recipe.json new file mode 100644 index 000000000..7a76d75b5 --- /dev/null +++ b/tests/kernel-cases/plastic/cov-rest-wall-as-thick-as-half-its-width-refused/recipe.json @@ -0,0 +1,26 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 60, + "width": 40, + "height": 3, + "body_name": "Plate" + } + }, + { + "command": "plastic.rest", + "params": { + "position": [ + 30, + 20, + 3 + ], + "width": 12, + "height": 4, + "thickness": 6 + } + } + ] +} diff --git a/tests/kernel-cases/plastic/cov-snap-fit-base-below-the-face-is-absorbed/expected.json b/tests/kernel-cases/plastic/cov-snap-fit-base-below-the-face-is-absorbed/expected.json new file mode 100644 index 000000000..8a86d079b --- /dev/null +++ b/tests/kernel-cases/plastic/cov-snap-fit-base-below-the-face-is-absorbed/expected.json @@ -0,0 +1,20 @@ +{ + "sources": [], + "what": "plastic.snap_fit 15 long, 2 thick, 6 wide with a 1 x 3 catch and its base reaching 2 below the face, joined to a 40 x 40 x 4 box", + "source": "analytic", + "method": "the arm's side profile is t x (l + base_height) plus the catch's triangle cd*cl/2; joined, the 2 mm below the face lies inside the box and adds nothing: V = 40*40*4 + (2*15 + 1*3/2)*6 = 6589.0. The arm stands from x 20 - 2 to the catch at 20 + 1 (hook +x), its top at z 4 + 15", + "body_count": 1, + "volume_mm3": 6589.0, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 40, + 40, + 19 + ] + } +} diff --git a/tests/kernel-cases/plastic/cov-snap-fit-base-below-the-face-is-absorbed/recipe.json b/tests/kernel-cases/plastic/cov-snap-fit-base-below-the-face-is-absorbed/recipe.json new file mode 100644 index 000000000..75dbf5d6f --- /dev/null +++ b/tests/kernel-cases/plastic/cov-snap-fit-base-below-the-face-is-absorbed/recipe.json @@ -0,0 +1,34 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 40, + "height": 4, + "body_name": "Box" + } + }, + { + "command": "plastic.snap_fit", + "params": { + "position": [ + 20, + 20, + 4 + ], + "hook": [ + 1, + 0, + 0 + ], + "length": 15, + "thickness": 2, + "width": 6, + "catch_depth": 1, + "catch_length": 3, + "base_height": 2 + } + } + ] +} diff --git a/tests/kernel-cases/plastic/cov-snap-fit-catch-as-long-as-its-arm-refused/expected.json b/tests/kernel-cases/plastic/cov-snap-fit-catch-as-long-as-its-arm-refused/expected.json new file mode 100644 index 000000000..d75c9a41e --- /dev/null +++ b/tests/kernel-cases/plastic/cov-snap-fit-catch-as-long-as-its-arm-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "plastic.snap_fit whose catch is as long as its arm (15)", + "source": "invariants", + "method": "the catch sits at the arm's end and must be shorter than it (catch_length < length); a catch the whole arm long leaves no arm: a clean refusal", + "outcome": "refused", + "refusal": "the snap fit's catch must be shorter than its arm" +} diff --git a/tests/kernel-cases/plastic/cov-snap-fit-catch-as-long-as-its-arm-refused/recipe.json b/tests/kernel-cases/plastic/cov-snap-fit-catch-as-long-as-its-arm-refused/recipe.json new file mode 100644 index 000000000..1ead73b60 --- /dev/null +++ b/tests/kernel-cases/plastic/cov-snap-fit-catch-as-long-as-its-arm-refused/recipe.json @@ -0,0 +1,33 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 40, + "height": 4, + "body_name": "Box" + } + }, + { + "command": "plastic.snap_fit", + "params": { + "position": [ + 20, + 20, + 4 + ], + "hook": [ + 1, + 0, + 0 + ], + "length": 15, + "thickness": 2, + "width": 6, + "catch_depth": 1, + "catch_length": 15 + } + } + ] +} From bc3c9185cdee0a421d53db5949f6744543d43f7c 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 041/108] Kernel rig: grade the kinds of a result's surfaces, its B-spline degrees and spans, and its free edges Co-Authored-By: Claude Opus 5.5 --- apps/solidcraft-cli/src/kernel_cases.rs | 117 ++++++++++++++++++++++++ 1 file changed, 117 insertions(+) diff --git a/apps/solidcraft-cli/src/kernel_cases.rs b/apps/solidcraft-cli/src/kernel_cases.rs index d5bdde80a..2b6921b88 100644 --- a/apps/solidcraft-cli/src/kernel_cases.rs +++ b/apps/solidcraft-cli/src/kernel_cases.rs @@ -450,6 +450,70 @@ fn output_checks(c: &mut Checks, want: &Value, out: &str, results: &[Value], rel } } +/// The word a `surface_types` check names a face's surface by, as the record holds it: an +/// analytic kind, `bspline` (a B-spline or NURBS surface) or `revolution` (a revolved curve). +fn surface_word(s: &solidcraft_engine::geom::brep::Surface) -> &'static str { + use solidcraft_engine::geom::brep::Surface as S; + match s { + S::Plane { .. } | S::PlaneThrough { .. } => "plane", + S::Cylinder { .. } => "cylinder", + S::Cone { .. } => "cone", + S::Sphere { .. } => "sphere", + S::Torus { .. } => "torus", + S::Spline { .. } | S::RationalSpline { .. } => "bspline", + S::PlacedRevolution { .. } => "revolution", + } +} + +/// A B-spline face's two directions as `[degree, spans]` (spans: the distinct knot intervals of +/// the modelled range), the lower first, so a surface parameterised the other way round reads the +/// same. `None` for a surface that is not a B-spline. +fn spline_shape(s: &solidcraft_engine::geom::brep::Surface) -> Option<[[u64; 2]; 2]> { + use solidcraft_engine::geom::brep::Surface as S; + let (u, v, nu, nv) = match s { + S::Spline { u_knots, v_knots, points } => (u_knots, v_knots, points.len(), points.first().map_or(0, Vec::len)), + S::RationalSpline { u_knots, v_knots, homogeneous } => (u_knots, v_knots, homogeneous.len(), homogeneous.first().map_or(0, Vec::len)), + _ => return None, + }; + let dir = |k: &[f64], n: usize| -> Option<[u64; 2]> { + let p = k.len().checked_sub(n + 1)?; + let inner = k.get(p..=n)?; + let spans = inner.windows(2).filter(|w| w[1] > w[0]).count(); + Some([p as u64, spans as u64]) + }; + let (a, b) = (dir(u, nu)?, dir(v, nv)?); + Some(if a <= b { [a, b] } else { [b, a] }) +} + +/// The `splines` check: every B-spline face of the bodies matches one entry of `want` and every +/// entry one face (`{degree: [p, q], spans?: [m, n]}`, in either order of directions; without +/// `spans` only the degrees are graded). `Ok(got)` with what the faces are, `ok` when they match. +fn splines_match(faces: &[[[u64; 2]; 2]], want: &Value) -> Result<(Value, bool), String> { + let list = want.as_array().ok_or("`splines` must be a list of {degree: [p, q], spans?: [m, n]}")?; + let pair = |v: &Value| -> Option<[u64; 2]> { Some([v.get(0)?.as_u64()?, v.get(1)?.as_u64()?]) }; + let mut left: Vec<[[u64; 2]; 2]> = faces.to_vec(); + let mut ok = true; + for w in list { + let degree = w.get("degree").and_then(pair).ok_or("each `splines` entry needs `degree: [p, q]`")?; + let spans = match w.get("spans").filter(|s| !s.is_null()) { + Some(s) => Some(pair(s).ok_or("`spans` must be [m, n]")?), + None => None, + }; + let fits = |f: &[[u64; 2]; 2]| { + let mine = |d: [u64; 2], s: Option<[u64; 2]>| f[0][0] == d[0] && f[1][0] == d[1] && s.is_none_or(|s| f[0][1] == s[0] && f[1][1] == s[1]); + mine(degree, spans) || mine([degree[1], degree[0]], spans.map(|s| [s[1], s[0]])) + }; + match left.iter().position(fits) { + Some(i) => { + left.remove(i); + } + None => ok = false, + } + } + let got: Vec = faces.iter().map(|f| json!({"degree": [f[0][0], f[1][0]], "spans": [f[0][1], f[1][1]]})).collect(); + Ok((json!(got), ok && left.is_empty())) +} + fn unsupported(e: &str) -> bool { e.contains("not supported yet") } @@ -583,6 +647,17 @@ fn check_case(dir: &str, dumps: Option<&std::path::Path>) -> Value { // body), else one per body. let want_shells = want["shells"].as_u64(); let mut shells = 0u64; + // What the faces lie on and the edges only one face uses, over every body, as the records + // hold them: for `surface_types`, `splines` and `boundary_edges`. + let (mut kinds, mut spline_faces, mut boundary) = (std::collections::BTreeSet::new(), Vec::new(), 0u64); + for b in &world.bodies { + let record = b.body.record(); + for f in &record.faces { + kinds.insert(surface_word(&f.surface)); + spline_faces.extend(spline_shape(&f.surface)); + } + boundary += record.edges.iter().filter(|e| e.uses.len() == 1).count() as u64; + } for b in &world.bodies { let m = match solidcraft_engine::kernel::measure(&b.body) { Ok(m) => m, @@ -705,6 +780,19 @@ fn check_case(dir: &str, dumps: Option<&std::path::Path>) -> Value { c.vec("bbox.max", got.bbox.1, want_bbox.map(|b| b.1), abs); } output_checks(&mut c, &want, &scratch_dir, &answers, rel); + count(&mut c, "boundary_edges", boundary); + if has("surface_types") { + // The set of surface kinds the faces lie on, exactly: none missing, none extra. + let want_kinds: std::collections::BTreeSet<&str> = want["surface_types"].as_array().into_iter().flatten().filter_map(Value::as_str).collect(); + let ok = want_kinds == kinds.iter().copied().collect(); + c.push("surface_types", json!(kinds), want["surface_types"].clone(), ok); + } + if has("splines") { + match splines_match(&spline_faces, &want["splines"]) { + Ok((got, ok)) => c.push("splines", got, want["splines"].clone(), ok), + Err(e) => c.push("splines", json!(e), want["splines"].clone(), false), + } + } out["status"] = json!(if c.pass { "pass" } else { "fail" }); out["checks"] = json!(c.list); out @@ -784,6 +872,35 @@ mod tests { let _ = std::fs::remove_dir_all(&root); } + /// A bicubic face of 4 × 3 spans and a bilinear one of one span: degrees and spans graded in + /// either order of directions, spans only where given, and every face must be accounted for. + #[test] + fn splines_match_degrees_and_spans_in_either_order() { + use solidcraft_engine::geom::brep::Surface; + let knots = |p: usize, spans: usize| -> Vec { + let mut k = vec![0.0; p + 1]; + k.extend((1..spans).map(|i| i as f64)); + k.extend(vec![spans as f64; p + 1]); + k + }; + let face = |pu: usize, su: usize, pv: usize, sv: usize| Surface::Spline { + u_knots: knots(pu, su), + v_knots: knots(pv, sv), + points: vec![vec![[0.0; 3]; pv + sv]; pu + su], + }; + let faces: Vec<_> = [face(3, 4, 3, 3), face(1, 1, 1, 1)].iter().filter_map(spline_shape).collect(); + assert_eq!(faces[0], [[3, 3], [3, 4]]); + let ok = |w: Value| splines_match(&faces, &w).unwrap().1; + assert!(ok(json!([{"degree": [1, 1], "spans": [1, 1]}, {"degree": [3, 3], "spans": [4, 3]}]))); + assert!(ok(json!([{"degree": [3, 3]}, {"degree": [1, 1]}]))); + assert!(!ok(json!([{"degree": [3, 3], "spans": [4, 4]}, {"degree": [1, 1]}])), "wrong spans"); + assert!(!ok(json!([{"degree": [3, 3]}])), "a face left over"); + assert!(!ok(json!([{"degree": [3, 3]}, {"degree": [1, 1]}, {"degree": [1, 1]}])), "an entry with no face"); + assert!(splines_match(&faces, &json!([{"spans": [1, 1]}])).is_err()); + assert_eq!(spline_shape(&Surface::Plane { origin: [0.0; 3], u_axis: [1.0, 0.0, 0.0], v_axis: [0.0, 1.0, 0.0] }), None); + assert_eq!(surface_word(&face(1, 1, 1, 1)), "bspline"); + } + #[test] fn json_parts_match_within_tolerance_and_whole_numbers_exactly() { let got = json!({"bends": [{"angle_deg": 90.00001, "direction": "up", "count": 3}], "extra": 1}); From 657c5af5792dfc16886ff39a4d09a41d626373c8 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 042/108] Kernel rig: surfaces area; an offset plane, cylinder and sphere land exactly where the distance puts them, and faces across a sharp edge part Co-Authored-By: Claude Opus 5.5 --- tests/kernel-cases/README.md | 4 ++ tests/kernel-cases/surfaces/KNOWN_FAILING | 5 +++ tests/kernel-cases/surfaces/PATHS | 32 +++++++++++++++ .../cov-offset-box-top-face-up/expected.json | 26 ++++++++++++ .../cov-offset-box-top-face-up/recipe.json | 35 ++++++++++++++++ .../expected.json | 26 ++++++++++++ .../cov-offset-cylinder-side-out/recipe.json | 34 ++++++++++++++++ .../expected.json | 22 ++++++++++ .../recipe.json | 34 ++++++++++++++++ .../expected.json | 8 ++++ .../recipe.json | 27 +++++++++++++ .../expected.json | 27 +++++++++++++ .../recipe.json | 40 +++++++++++++++++++ tests/kernel-cases/surfaces/skipped.json | 3 ++ 14 files changed, 323 insertions(+) create mode 100644 tests/kernel-cases/surfaces/KNOWN_FAILING create mode 100644 tests/kernel-cases/surfaces/PATHS create mode 100644 tests/kernel-cases/surfaces/cov-offset-box-top-face-up/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-offset-box-top-face-up/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-offset-cylinder-side-out/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-offset-cylinder-side-out/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-offset-sphere-inward-closes-a-solid/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-offset-sphere-inward-closes-a-solid/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-offset-tolerance-out-of-range-refused/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-offset-tolerance-out-of-range-refused/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-offset-two-faces-across-a-sharp-edge-come-apart/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-offset-two-faces-across-a-sharp-edge-come-apart/recipe.json create mode 100644 tests/kernel-cases/surfaces/skipped.json diff --git a/tests/kernel-cases/README.md b/tests/kernel-cases/README.md index bac661f82..fdcb2824d 100644 --- a/tests/kernel-cases/README.md +++ b/tests/kernel-cases/README.md @@ -40,6 +40,7 @@ One directory per area, one per case: `tests/kernel-cases///`. | `solids` (cones, scale, align, bounding solids) | tool coverage | | `frames` (frame members, inserted profiles) | tool coverage | | `plastic` (boss, lip and groove, rest, snap fit, plastic rules) | tool coverage rig | +| `surfaces` (every `surface.*` tool: offset, ruled, untrim, unstitch, reverse normal, boundary, blend, match, fair, and a normal and an edge case of each of the others) | surfaces rig | Each area also has its gate files: `KNOWN_FAILING` and `PATHS` (see [the gate](#the-kernel-rig-gate)). @@ -97,6 +98,9 @@ the frozen truck-geometry PRs, a `kernel-paused` PR), for the report's coverage | `faces`, `edges`, `vertices`, `shells`, `body_count` as `[min, max]` | An inclusive range, where the geometry only bounds a count (a modelled thread's faces). | | `continuity` | `{order, edges}`: every seam `edges` names reaches `order` (`g0` … `g4`), as Continuity Analysis (`inspect.continuity`) measures it: from the faces' exact surfaces, at its default 33 stations a seam and its default tolerances (1 µm, 1°, 0.01 / mm, 0.001 / mm², 0.0001 / mm³), never loosened per case. A failure names the worst seam (lowest order; of those, the one furthest past the next order's tolerance), its faces, the order it reaches and that next order's worst value. `edges`: `blend` (default), every seam of a face a fillet or chamfer made (a round, a chamfer face or a corner patch) with the faces either side of the edge it replaced, and every seam of a corner patch with the rounds it joins: what the blend is built to meet (not where a round runs into an end face, nor where two rounds meet without a patch: that seam is the input's, tangent only where the rounded edges were); `corner`, those of them on a corner patch (a blend made from several replaced edges); or a list of points `[[x,y,z], …]`, the edges nearest them, as Continuity Analysis picks them. `exact: true`: every seam reaches `order` and not the next (a case built to an order proves the measurement reads that order, no more and no less). A constant round meets its faces G1 (curvature jumps by 1 / r), a `curvature` round G2, a chamfer G0; a `corner: g2` patch is built G2 to the rounds and faces round it. | | `continuity` (older form) | `{near, within_mm, clear_mm, curvature_jump_per_mm}`: over every tangent seam lying wholly within `within_mm` of `near` (a corner's patch and its neighbours), the curvature jump across it (the faces' normal curvatures square to the seam, from their exact surfaces, at 65 stations a seam) is at most `curvature_jump_per_mm` at every station at least `clear_mm` along the seam from a vertex where two of those seams turn (where a neighbour's own G1 seam ends, which no surface is G2 to both sides of). A rolling ball's corner jumps 1 / r everywhere. | +| `surface_types` | The set of kinds the faces' surfaces are, over every body, as the records hold them: `plane`, `cylinder`, `cone`, `sphere`, `torus`, `bspline` (a B-spline or NURBS surface) or `revolution` (a revolved curve). Exact: none missing, none extra. | +| `splines` | `[{degree: [p, q], spans?: [m, n]}, …]`: one entry per B-spline face, each matching one face (directions in either order); `spans`, the distinct knot intervals each way, only where the construction fixes them. | +| `boundary_edges` | The edges only one face uses (a sheet's free boundary), over every body, as the records hold them; exact or `[min, max]`. | | `watertight` | `true`: each body's display mesh (chord tolerance `tolerance.mesh_mm`, default 0.01 mm) has no open and no over-shared edges, with vertices closer than `tolerance.weld_mm` (default 1e-4 mm) taken as one. | | `timeout_s` | A longer timeout for this case than the run's (at most 1800 s), for cases that are slow by nature. A case that only needs it on a loaded machine shouldn't set it. | | `tolerance` | Optional overrides: `rel`, `abs_mm`, `mesh_mm`, `weld_mm`. | diff --git a/tests/kernel-cases/surfaces/KNOWN_FAILING b/tests/kernel-cases/surfaces/KNOWN_FAILING new file mode 100644 index 000000000..fe07e824c --- /dev/null +++ b/tests/kernel-cases/surfaces/KNOWN_FAILING @@ -0,0 +1,5 @@ +# The surfaces cases that fail today, one a line: ` `. Sorted. Run as a +# regression gate (`cargo xtask kernel-cases --area surfaces --known-failing `), a case +# that fails and is not listed fails it, and so does a listed case that passes: a fix removes its +# line in the same pull request. +# Baseline: rig-cases-surfaces 45f69c0e5 with SMLib 60b1c6a, aarch64 Linux. diff --git a/tests/kernel-cases/surfaces/PATHS b/tests/kernel-cases/surfaces/PATHS new file mode 100644 index 000000000..c9f751bb6 --- /dev/null +++ b/tests/kernel-cases/surfaces/PATHS @@ -0,0 +1,32 @@ +# The sources whose change must rerun the surfaces area: one git pathspec glob a line. +# The commands. +crates/engine/src/cmd/surface.rs +crates/engine/src/cmd/surface_boundary.rs +crates/engine/src/cmd/surface_match.rs +crates/engine/src/params.rs +# Their evaluation. +crates/doc/src/eval_surface.rs +crates/doc/src/eval.rs +# The kernel code they call. +crates/kernel/src/boundary.rs +crates/kernel/src/boundary_network.rs +crates/kernel/src/bridge.rs +crates/kernel/src/fair.rs +crates/kernel/src/fill*.rs +crates/kernel/src/loft*.rs +crates/kernel/src/matchsurf.rs +crates/kernel/src/native.rs +crates/kernel/src/surface_extend.rs +crates/kernel/src/surface_offset.rs +crates/kernel/src/surface_ruled.rs +crates/kernel/src/surface_trim.rs +crates/kernel/src/surface_untrim.rs +crates/kernel/src/surfaces.rs +crates/kernel/src/sweep*.rs +crates/kernel/src/smlib_sweeps.rs +crates/geom/src/fill*.rs +crates/geom/src/network*.rs +# SMLib and the rig itself. +crates/smlib/** +apps/solidcraft-cli/src/kernel_cases.rs +tests/kernel-cases/surfaces/** diff --git a/tests/kernel-cases/surfaces/cov-offset-box-top-face-up/expected.json b/tests/kernel-cases/surfaces/cov-offset-box-top-face-up/expected.json new file mode 100644 index 000000000..121a935ce --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-offset-box-top-face-up/expected.json @@ -0,0 +1,26 @@ +{ + "sources": [], + "what": "the top face of a 20 x 10 x 10 box offset 5 up: a plane moves exactly", + "source": "analytic", + "method": "the top (z = 10) along its outward normal +z by 5: the square 20 x 10 at z = 15, area 200, one plane face with its 4 edges free; the box is removed so only the offset is graded", + "valid": false, + "body_count": 1, + "faces": 1, + "boundary_edges": 4, + "area_mm2": 200.0, + "surface_types": [ + "plane" + ], + "bbox": { + "min": [ + 0, + 0, + 15 + ], + "max": [ + 20, + 10, + 15 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-offset-box-top-face-up/recipe.json b/tests/kernel-cases/surfaces/cov-offset-box-top-face-up/recipe.json new file mode 100644 index 000000000..5f1c7c61b --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-offset-box-top-face-up/recipe.json @@ -0,0 +1,35 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 10, + "height": 10, + "body_name": "Box" + } + }, + { + "command": "surface.offset", + "params": { + "faces": [ + [ + 10, + 5, + 10 + ] + ], + "distance": 5, + "body_name": "Lid" + } + }, + { + "command": "solid.remove", + "params": { + "bodies": [ + "Box" + ] + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-offset-cylinder-side-out/expected.json b/tests/kernel-cases/surfaces/cov-offset-cylinder-side-out/expected.json new file mode 100644 index 000000000..877034a22 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-offset-cylinder-side-out/expected.json @@ -0,0 +1,26 @@ +{ + "sources": [], + "what": "the side of a cylinder r 10, 20 high, offset 2 outward: the cylinder r 12", + "source": "analytic", + "method": "a cylinder's offset along its outward normal is the coaxial cylinder r + d = 12: A = 2 pi 12 20 = 1507.96; one face closed on its seam, its two circles free", + "valid": false, + "body_count": 1, + "faces": 1, + "boundary_edges": 2, + "area_mm2": 1507.9644737231006, + "surface_types": [ + "cylinder" + ], + "bbox": { + "min": [ + -12, + -12, + 0 + ], + "max": [ + 12, + 12, + 20 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-offset-cylinder-side-out/recipe.json b/tests/kernel-cases/surfaces/cov-offset-cylinder-side-out/recipe.json new file mode 100644 index 000000000..5be009491 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-offset-cylinder-side-out/recipe.json @@ -0,0 +1,34 @@ +{ + "commands": [ + { + "command": "solid.cylinder", + "params": { + "radius": 10, + "height": 20, + "body_name": "Post" + } + }, + { + "command": "surface.offset", + "params": { + "faces": [ + [ + 10, + 0, + 10 + ] + ], + "distance": 2, + "body_name": "Sleeve" + } + }, + { + "command": "solid.remove", + "params": { + "bodies": [ + "Post" + ] + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-offset-sphere-inward-closes-a-solid/expected.json b/tests/kernel-cases/surfaces/cov-offset-sphere-inward-closes-a-solid/expected.json new file mode 100644 index 000000000..ebe0d3b66 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-offset-sphere-inward-closes-a-solid/expected.json @@ -0,0 +1,22 @@ +{ + "sources": [], + "what": "every face of a sphere r 10 (its smooth chain) offset 4 inward: the sphere r 6, closed, so a solid", + "source": "analytic", + "method": "the offset of a sphere by -4 along its outward normal is the concentric sphere r 6: A = 4 pi 36 = 452.389, V = 4/3 pi 216 = 904.779; its faces meet smoothly, so their offsets still share every edge and close up into a solid", + "body_count": 1, + "area_mm2": 452.3893421169302, + "volume_mm3": 904.7786842338603, + "boundary_edges": 0, + "bbox": { + "min": [ + -6, + -6, + -6 + ], + "max": [ + 6, + 6, + 6 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-offset-sphere-inward-closes-a-solid/recipe.json b/tests/kernel-cases/surfaces/cov-offset-sphere-inward-closes-a-solid/recipe.json new file mode 100644 index 000000000..ff309038d --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-offset-sphere-inward-closes-a-solid/recipe.json @@ -0,0 +1,34 @@ +{ + "commands": [ + { + "command": "solid.sphere", + "params": { + "radius": 10, + "body_name": "Ball" + } + }, + { + "command": "surface.offset", + "params": { + "faces": [ + [ + 10, + 0, + 0 + ] + ], + "chain": true, + "distance": -4, + "body_name": "Core" + } + }, + { + "command": "solid.remove", + "params": { + "bodies": [ + "Ball" + ] + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-offset-tolerance-out-of-range-refused/expected.json b/tests/kernel-cases/surfaces/cov-offset-tolerance-out-of-range-refused/expected.json new file mode 100644 index 000000000..3985fc2a1 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-offset-tolerance-out-of-range-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "an offset asked to fit within 20 mm: refused, the tolerance is 0.000001 to 10 mm", + "source": "invariants", + "method": "the fitting tolerance has a range; outside it the command refuses with that range rather than building", + "outcome": "refused", + "refusal": "the offset tolerance must be 0.000001…10 mm" +} diff --git a/tests/kernel-cases/surfaces/cov-offset-tolerance-out-of-range-refused/recipe.json b/tests/kernel-cases/surfaces/cov-offset-tolerance-out-of-range-refused/recipe.json new file mode 100644 index 000000000..34f182c95 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-offset-tolerance-out-of-range-refused/recipe.json @@ -0,0 +1,27 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 10, + "height": 10, + "body_name": "Box" + } + }, + { + "command": "surface.offset", + "params": { + "faces": [ + [ + 10, + 5, + 10 + ] + ], + "distance": 5, + "tolerance": 20 + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-offset-two-faces-across-a-sharp-edge-come-apart/expected.json b/tests/kernel-cases/surfaces/cov-offset-two-faces-across-a-sharp-edge-come-apart/expected.json new file mode 100644 index 000000000..c7a0b445b --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-offset-two-faces-across-a-sharp-edge-come-apart/expected.json @@ -0,0 +1,27 @@ +{ + "sources": [], + "what": "the top and the front of a box offset 1 together: across their sharp edge the offsets part, so one body of two separate faces", + "source": "analytic", + "method": "top (z = 10, 20 x 10) to z = 11, front (y = 0, 20 x 10) to y = -1: the two planes no longer meet (their edges are 1.41 apart), so two open shells of 4 free edges each; area 200 + 200", + "valid": false, + "body_count": 1, + "shells": 2, + "faces": 2, + "boundary_edges": 8, + "area_mm2": 400.0, + "surface_types": [ + "plane" + ], + "bbox": { + "min": [ + 0, + -1, + 0 + ], + "max": [ + 20, + 10, + 11 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-offset-two-faces-across-a-sharp-edge-come-apart/recipe.json b/tests/kernel-cases/surfaces/cov-offset-two-faces-across-a-sharp-edge-come-apart/recipe.json new file mode 100644 index 000000000..affad4f63 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-offset-two-faces-across-a-sharp-edge-come-apart/recipe.json @@ -0,0 +1,40 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 10, + "height": 10, + "body_name": "Box" + } + }, + { + "command": "surface.offset", + "params": { + "faces": [ + [ + 10, + 5, + 10 + ], + [ + 10, + 0, + 5 + ] + ], + "distance": 1, + "body_name": "Pair" + } + }, + { + "command": "solid.remove", + "params": { + "bodies": [ + "Box" + ] + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/skipped.json b/tests/kernel-cases/surfaces/skipped.json new file mode 100644 index 000000000..7f3f350d2 --- /dev/null +++ b/tests/kernel-cases/surfaces/skipped.json @@ -0,0 +1,3 @@ +[ + {"source": "surface.fillet", "why": "planned (#769): registered, not built yet; no geometry to grade until it is"} +] From 476b04ed33ef56240ad632c07a6d6e3d922e8a98 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 043/108] Kernel rig: ruled strips along a normal, at 45 degrees and tangent are the exact plane, cone and flat ring, and a closed chain mitres into a frame Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 26 +++++++++ .../recipe.json | 41 +++++++++++++ .../expected.json | 29 ++++++++++ .../recipe.json | 57 +++++++++++++++++++ .../expected.json | 26 +++++++++ .../recipe.json | 42 ++++++++++++++ .../expected.json | 26 +++++++++ .../recipe.json | 41 +++++++++++++ .../expected.json | 8 +++ .../recipe.json | 32 +++++++++++ 10 files changed, 328 insertions(+) create mode 100644 tests/kernel-cases/surfaces/cov-ruled-box-edge-along-the-top-normal/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-ruled-box-edge-along-the-top-normal/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-ruled-closed-top-chain-tangent-mitred-frame/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-ruled-closed-top-chain-tangent-mitred-frame/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-ruled-cylinder-rim-at-45-degrees-is-a-cone/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-ruled-cylinder-rim-at-45-degrees-is-a-cone/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-ruled-cylinder-rim-tangent-to-the-top-is-a-flat-ring/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-ruled-cylinder-rim-tangent-to-the-top-is-a-flat-ring/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-ruled-zero-distance-refused/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-ruled-zero-distance-refused/recipe.json diff --git a/tests/kernel-cases/surfaces/cov-ruled-box-edge-along-the-top-normal/expected.json b/tests/kernel-cases/surfaces/cov-ruled-box-edge-along-the-top-normal/expected.json new file mode 100644 index 000000000..89906571f --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-ruled-box-edge-along-the-top-normal/expected.json @@ -0,0 +1,26 @@ +{ + "sources": [], + "what": "a ruled strip 5 wide off the box's top front edge, along the top face's normal", + "source": "analytic", + "method": "edge (0..20, 0, 10), rulings +z (the top's normal), constant: the plane y = 0, x 0..20, z 10..15: area 100, one plane face with 4 free edges", + "valid": false, + "body_count": 1, + "faces": 1, + "boundary_edges": 4, + "area_mm2": 100.0, + "surface_types": [ + "plane" + ], + "bbox": { + "min": [ + 0, + 0, + 10 + ], + "max": [ + 20, + 0, + 15 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-ruled-box-edge-along-the-top-normal/recipe.json b/tests/kernel-cases/surfaces/cov-ruled-box-edge-along-the-top-normal/recipe.json new file mode 100644 index 000000000..a2997bad5 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-ruled-box-edge-along-the-top-normal/recipe.json @@ -0,0 +1,41 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 10, + "height": 10, + "body_name": "Box" + } + }, + { + "command": "surface.ruled", + "params": { + "body": "Box", + "edges": [ + [ + 10, + 0, + 10 + ] + ], + "face": [ + 10, + 5, + 10 + ], + "distance": 5, + "body_name": "Strip" + } + }, + { + "command": "solid.remove", + "params": { + "bodies": [ + "Box" + ] + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-ruled-closed-top-chain-tangent-mitred-frame/expected.json b/tests/kernel-cases/surfaces/cov-ruled-closed-top-chain-tangent-mitred-frame/expected.json new file mode 100644 index 000000000..5e1ba4473 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-ruled-closed-top-chain-tangent-mitred-frame/expected.json @@ -0,0 +1,29 @@ +{ + "sources": [], + "what": "ruled strips 5 wide off all four top edges of a box, continuing the top: mitred at the corners into a flat frame", + "source": "analytic", + "method": "each strip continues the top (z = 10) outward 5; mitred corners close the frame 30 x 20 round the 20 x 10 top: area 600 - 200 = 400, all in z = 10; 4 strips (coplanar, counted [1, 4]), 8 free edges (4 inner, 4 outer)", + "valid": false, + "body_count": 1, + "faces": [ + 1, + 4 + ], + "boundary_edges": 8, + "area_mm2": 400.0, + "surface_types": [ + "plane" + ], + "bbox": { + "min": [ + -5, + -5, + 10 + ], + "max": [ + 25, + 15, + 10 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-ruled-closed-top-chain-tangent-mitred-frame/recipe.json b/tests/kernel-cases/surfaces/cov-ruled-closed-top-chain-tangent-mitred-frame/recipe.json new file mode 100644 index 000000000..957bf77a0 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-ruled-closed-top-chain-tangent-mitred-frame/recipe.json @@ -0,0 +1,57 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 10, + "height": 10, + "body_name": "Box" + } + }, + { + "command": "surface.ruled", + "params": { + "body": "Box", + "edges": [ + [ + 10, + 0, + 10 + ], + [ + 20, + 5, + 10 + ], + [ + 10, + 10, + 10 + ], + [ + 0, + 5, + 10 + ] + ], + "face": [ + 10, + 5, + 10 + ], + "mode": "tangent", + "distance": 5, + "body_name": "Frame" + } + }, + { + "command": "solid.remove", + "params": { + "bodies": [ + "Box" + ] + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-ruled-cylinder-rim-at-45-degrees-is-a-cone/expected.json b/tests/kernel-cases/surfaces/cov-ruled-cylinder-rim-at-45-degrees-is-a-cone/expected.json new file mode 100644 index 000000000..f04789d90 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-ruled-cylinder-rim-at-45-degrees-is-a-cone/expected.json @@ -0,0 +1,26 @@ +{ + "sources": [], + "what": "a ruled strip off a cylinder's top rim at 45 degrees from the top face's normal, turned away from it: an exact cone frustum", + "source": "analytic", + "method": "rulings at 45 deg from +z, leaning out (away from the top face), keep their angle to the arc's axis: a cone. r 10 at z 10 to r 10 + 5/sqrt2 = 13.536 at z 10 + 5/sqrt2 = 13.536; lateral area pi (r1 + r2) slant = pi 23.536 5 = 369.69; one face, two free circles", + "valid": false, + "body_count": 1, + "faces": 1, + "boundary_edges": 2, + "area_mm2": 369.69530208595893, + "surface_types": [ + "cone" + ], + "bbox": { + "min": [ + -13.535533905932738, + -13.535533905932738, + 10 + ], + "max": [ + 13.535533905932738, + 13.535533905932738, + 13.535533905932738 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-ruled-cylinder-rim-at-45-degrees-is-a-cone/recipe.json b/tests/kernel-cases/surfaces/cov-ruled-cylinder-rim-at-45-degrees-is-a-cone/recipe.json new file mode 100644 index 000000000..4de116f0a --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-ruled-cylinder-rim-at-45-degrees-is-a-cone/recipe.json @@ -0,0 +1,42 @@ +{ + "commands": [ + { + "command": "solid.cylinder", + "params": { + "radius": 10, + "height": 10, + "body_name": "Post" + } + }, + { + "command": "surface.ruled", + "params": { + "body": "Post", + "edges": [ + [ + 10, + 0, + 10 + ] + ], + "face": [ + 0, + 0, + 10 + ], + "mode": "angle", + "angle": "45 deg", + "distance": 5, + "body_name": "Flare" + } + }, + { + "command": "solid.remove", + "params": { + "bodies": [ + "Post" + ] + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-ruled-cylinder-rim-tangent-to-the-top-is-a-flat-ring/expected.json b/tests/kernel-cases/surfaces/cov-ruled-cylinder-rim-tangent-to-the-top-is-a-flat-ring/expected.json new file mode 100644 index 000000000..9f4c1853e --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-ruled-cylinder-rim-tangent-to-the-top-is-a-flat-ring/expected.json @@ -0,0 +1,26 @@ +{ + "sources": [], + "what": "a ruled strip off a cylinder's top rim continuing the top face: the flat ring r 10..15", + "source": "analytic", + "method": "tangent rulings continue the top (z = 10) square to the rim, outward: the plane annulus r 10..15, area pi (225 - 100) = 392.70; one plane face, two free circles", + "valid": false, + "body_count": 1, + "faces": 1, + "boundary_edges": 2, + "area_mm2": 392.6990816987241, + "surface_types": [ + "plane" + ], + "bbox": { + "min": [ + -15, + -15, + 10 + ], + "max": [ + 15, + 15, + 10 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-ruled-cylinder-rim-tangent-to-the-top-is-a-flat-ring/recipe.json b/tests/kernel-cases/surfaces/cov-ruled-cylinder-rim-tangent-to-the-top-is-a-flat-ring/recipe.json new file mode 100644 index 000000000..6198c9219 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-ruled-cylinder-rim-tangent-to-the-top-is-a-flat-ring/recipe.json @@ -0,0 +1,41 @@ +{ + "commands": [ + { + "command": "solid.cylinder", + "params": { + "radius": 10, + "height": 10, + "body_name": "Post" + } + }, + { + "command": "surface.ruled", + "params": { + "body": "Post", + "edges": [ + [ + 10, + 0, + 10 + ] + ], + "face": [ + 0, + 0, + 10 + ], + "mode": "tangent", + "distance": 5, + "body_name": "Brim" + } + }, + { + "command": "solid.remove", + "params": { + "bodies": [ + "Post" + ] + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-ruled-zero-distance-refused/expected.json b/tests/kernel-cases/surfaces/cov-ruled-zero-distance-refused/expected.json new file mode 100644 index 000000000..d4e265a50 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-ruled-zero-distance-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "a ruled strip of width 0: refused, it would have no area", + "source": "invariants", + "method": "a strip needs a positive width", + "outcome": "refused", + "refusal": "the ruled surface distance must be positive and finite" +} diff --git a/tests/kernel-cases/surfaces/cov-ruled-zero-distance-refused/recipe.json b/tests/kernel-cases/surfaces/cov-ruled-zero-distance-refused/recipe.json new file mode 100644 index 000000000..fc19a936c --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-ruled-zero-distance-refused/recipe.json @@ -0,0 +1,32 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 10, + "height": 10, + "body_name": "Box" + } + }, + { + "command": "surface.ruled", + "params": { + "body": "Box", + "edges": [ + [ + 10, + 0, + 10 + ] + ], + "face": [ + 10, + 5, + 10 + ], + "distance": 0 + } + } + ] +} From a01d82f3042aeee2a4b56fbf74b58625825ad9ca 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 044/108] Kernel rig: untrim removes holes from a sheet, a cylinder sheet and a solid's face, and refuses a face with none Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 26 ++++ .../recipe.json | 128 ++++++++++++++++++ .../expected.json | 8 ++ .../recipe.json | 66 +++++++++ .../expected.json | 26 ++++ .../recipe.json | 84 ++++++++++++ .../expected.json | 26 ++++ .../recipe.json | 51 +++++++ 8 files changed, 415 insertions(+) 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-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" + ] + } + } + ] +} From b2cc77094c87957d39eeee7ff6a78935c786a2d2 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 045/108] 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 --- .../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 +++++++++++++++++++ 8 files changed, 184 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 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" + } + } + ] +} From 7ac95e47e8b5940a113c1bc5f046d399b77d9074 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 046/108] Kernel rig: a reversed normal sends a later thicken to the other side, and a solid is refused Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 21 +++++ .../recipe.json | 88 +++++++++++++++++++ .../expected.json | 8 ++ .../recipe.json | 19 ++++ .../expected.json | 21 +++++ .../recipe.json | 76 ++++++++++++++++ 6 files changed, 233 insertions(+) create mode 100644 tests/kernel-cases/surfaces/cov-reverse-normal-l-sheet-swaps-the-thicken-side/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-reverse-normal-l-sheet-swaps-the-thicken-side/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-reverse-normal-of-a-solid-refused/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-reverse-normal-of-a-solid-refused/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-reverse-normal-then-thicken-goes-down/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-reverse-normal-then-thicken-goes-down/recipe.json diff --git a/tests/kernel-cases/surfaces/cov-reverse-normal-l-sheet-swaps-the-thicken-side/expected.json b/tests/kernel-cases/surfaces/cov-reverse-normal-l-sheet-swaps-the-thicken-side/expected.json new file mode 100644 index 000000000..81dcf4c2a --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-reverse-normal-l-sheet-swaps-the-thicken-side/expected.json @@ -0,0 +1,21 @@ +{ + "sources": [], + "what": "the L sheet of two walls (30 and 20, 20 deep) turned over, then thickened +2: the side -2 took before, into the inside corner", + "source": "analytic", + "method": "kernel-cases/shell/5326: -2 is the inside of this sheet's corner; with every normal reversed +2 is. Each wall offset 2 toward the other, the slabs overlap in 2 x 2: V = (30*2 + 20*2 - 2*2) 20 = 1920, an L prism of 8 faces", + "body_count": 1, + "faces": 8, + "volume_mm3": 1920.0, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 30, + 20, + 20 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-reverse-normal-l-sheet-swaps-the-thicken-side/recipe.json b/tests/kernel-cases/surfaces/cov-reverse-normal-l-sheet-swaps-the-thicken-side/recipe.json new file mode 100644 index 000000000..6c23cd636 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-reverse-normal-l-sheet-swaps-the-thicken-side/recipe.json @@ -0,0 +1,88 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "S" + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 0, + 0 + ], + [ + 30, + 0 + ], + [ + 30, + 20 + ] + ], + "infer": false + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.extrude", + "params": { + "sketch": "S", + "curves": [ + "l1", + "l2" + ], + "distance": 20, + "body_name": "L" + } + }, + { + "command": "surface.reverse_normal", + "params": { + "body": "L" + } + }, + { + "command": "surface.thicken", + "params": { + "bodies": [ + "L" + ], + "thickness": 2, + "operation": "new", + "body_name": "Wall" + } + }, + { + "command": "solid.remove", + "params": { + "bodies": [ + "L" + ] + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-reverse-normal-of-a-solid-refused/expected.json b/tests/kernel-cases/surfaces/cov-reverse-normal-of-a-solid-refused/expected.json new file mode 100644 index 000000000..6e8eef7f7 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-reverse-normal-of-a-solid-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "reverse normal on a solid: refused, its faces face out", + "source": "invariants", + "method": "a closed solid's orientation is fixed by its material; only a surface may be turned over", + "outcome": "refused", + "refusal": "a solid's faces face out" +} diff --git a/tests/kernel-cases/surfaces/cov-reverse-normal-of-a-solid-refused/recipe.json b/tests/kernel-cases/surfaces/cov-reverse-normal-of-a-solid-refused/recipe.json new file mode 100644 index 000000000..99102ab20 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-reverse-normal-of-a-solid-refused/recipe.json @@ -0,0 +1,19 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 10, + "height": 10, + "body_name": "Box" + } + }, + { + "command": "surface.reverse_normal", + "params": { + "body": "Box" + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-reverse-normal-then-thicken-goes-down/expected.json b/tests/kernel-cases/surfaces/cov-reverse-normal-then-thicken-goes-down/expected.json new file mode 100644 index 000000000..7c6f6e9ad --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-reverse-normal-then-thicken-goes-down/expected.json @@ -0,0 +1,21 @@ +{ + "sources": [], + "what": "a 10 x 10 sheet patched on XY (normal +z) turned over, then thickened 2 along its normal: the slab lies below it", + "source": "analytic", + "method": "the patch of an XY sketch faces +z; reversed it faces -z, and a positive thickness goes along the normal: the box 10 x 10 x 2 at z -2..0, V = 200, 6 faces; the sheet is removed so only the slab is graded", + "body_count": 1, + "faces": 6, + "volume_mm3": 200.0, + "bbox": { + "min": [ + 0, + 0, + -2 + ], + "max": [ + 10, + 10, + 0 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-reverse-normal-then-thicken-goes-down/recipe.json b/tests/kernel-cases/surfaces/cov-reverse-normal-then-thicken-goes-down/recipe.json new file mode 100644 index 000000000..dda1d201c --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-reverse-normal-then-thicken-goes-down/recipe.json @@ -0,0 +1,76 @@ +{ + "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.reverse_normal", + "params": { + "body": "Sheet" + } + }, + { + "command": "surface.thicken", + "params": { + "bodies": [ + "Sheet" + ], + "thickness": 2, + "operation": "new", + "body_name": "Slab" + } + }, + { + "command": "solid.remove", + "params": { + "bodies": [ + "Sheet" + ] + } + } + ] +} From 680f2ee5cb1081fd7b6436a4905defc6962c5acf 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 047/108] Kernel rig: boundary surfaces through a square, a triangle and a network of four lines have their exact areas; five curves are refused Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 8 + .../recipe.json | 76 +++++++ .../expected.json | 23 ++ .../recipe.json | 57 +++++ .../expected.json | 23 ++ .../recipe.json | 210 ++++++++++++++++++ .../expected.json | 26 +++ .../recipe.json | 67 ++++++ 8 files changed, 490 insertions(+) create mode 100644 tests/kernel-cases/surfaces/cov-boundary-five-curves-refused/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-boundary-five-curves-refused/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-boundary-four-lines-flat-square/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-boundary-four-lines-flat-square/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-boundary-network-of-four-lines-hyperbolic-paraboloid/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-boundary-network-of-four-lines-hyperbolic-paraboloid/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-boundary-three-lines-triangle/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-boundary-three-lines-triangle/recipe.json diff --git a/tests/kernel-cases/surfaces/cov-boundary-five-curves-refused/expected.json b/tests/kernel-cases/surfaces/cov-boundary-five-curves-refused/expected.json new file mode 100644 index 000000000..b094cf659 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-boundary-five-curves-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "a boundary loop of five curves: refused, a loop patch takes 2 to 4", + "source": "invariants", + "method": "the loop patch is a Coons patch of opposite pairs (or a bridge of two); five sides have no pairing", + "outcome": "refused", + "refusal": "`curves` must list 2 to 4 sketch curves in loop order" +} diff --git a/tests/kernel-cases/surfaces/cov-boundary-five-curves-refused/recipe.json b/tests/kernel-cases/surfaces/cov-boundary-five-curves-refused/recipe.json new file mode 100644 index 000000000..1ff190762 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-boundary-five-curves-refused/recipe.json @@ -0,0 +1,76 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "Pent" + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 0, + 0 + ], + [ + 10, + 0 + ], + [ + 14, + 8 + ], + [ + 5, + 14 + ], + [ + -4, + 8 + ], + [ + 0, + 0 + ] + ], + "infer": false + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.boundary", + "params": { + "sketch": "Pent", + "curves": [ + "l1", + "l2", + "l3", + "l4", + "l5" + ] + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-boundary-four-lines-flat-square/expected.json b/tests/kernel-cases/surfaces/cov-boundary-four-lines-flat-square/expected.json new file mode 100644 index 000000000..3aa6f1fb5 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-boundary-four-lines-flat-square/expected.json @@ -0,0 +1,23 @@ +{ + "sources": [], + "what": "a boundary surface through the four sides of a 20 x 20 square: the flat square", + "source": "analytic", + "method": "the Coons patch of a planar loop of four lines is the bilinear patch of its corners, here the square itself: area 400 in z = 0, one face with 4 free edges", + "valid": false, + "body_count": 1, + "faces": 1, + "boundary_edges": 4, + "area_mm2": 400.0, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 20, + 20, + 0 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-boundary-four-lines-flat-square/recipe.json b/tests/kernel-cases/surfaces/cov-boundary-four-lines-flat-square/recipe.json new file mode 100644 index 000000000..3adf94a64 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-boundary-four-lines-flat-square/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": "Square" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 20, + 20 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.boundary", + "params": { + "sketch": "Square", + "curves": [ + "l1", + "l2", + "l3", + "l4" + ], + "body_name": "Patch" + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-boundary-network-of-four-lines-hyperbolic-paraboloid/expected.json b/tests/kernel-cases/surfaces/cov-boundary-network-of-four-lines-hyperbolic-paraboloid/expected.json new file mode 100644 index 000000000..14e3db1c8 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-boundary-network-of-four-lines-hyperbolic-paraboloid/expected.json @@ -0,0 +1,23 @@ +{ + "sources": [], + "what": "a curve network of four straight lines in two directions, corners (0,0,0), (20,0,0), (20,20,0), (0,20,10): the Coons patch, a hyperbolic paraboloid", + "source": "analytic", + "method": "the Coons patch of four lines is bilinear: P(s,t) = (20s, 20t, 10(1-s)t); |Ps x Pt| = 200 sqrt(4 + t^2 + (1-s)^2); A = 200 * double integral over the unit square = 431.6148 (Gauss-Legendre 48 x 48); one face, 4 free edges", + "valid": false, + "body_count": 1, + "faces": 1, + "boundary_edges": 4, + "area_mm2": 431.6148065766132, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 20, + 20, + 10 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-boundary-network-of-four-lines-hyperbolic-paraboloid/recipe.json b/tests/kernel-cases/surfaces/cov-boundary-network-of-four-lines-hyperbolic-paraboloid/recipe.json new file mode 100644 index 000000000..52cf8646e --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-boundary-network-of-four-lines-hyperbolic-paraboloid/recipe.json @@ -0,0 +1,210 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "U0" + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 0, + 0 + ], + [ + 20, + 0 + ] + ], + "infer": false + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 20, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 0, + 1 + ] + }, + "name": "U1" + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 0, + 10 + ], + [ + 20, + 0 + ] + ], + "infer": false + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 0, + 1, + 0 + ], + "y_dir": [ + 0, + 0, + 1 + ] + }, + "name": "V0" + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 0, + 0 + ], + [ + 20, + 10 + ] + ], + "infer": false + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "V1" + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 20, + 0 + ], + [ + 20, + 20 + ] + ], + "infer": false + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.boundary", + "params": { + "u": [ + { + "sketch": "U0", + "curves": [ + "l1" + ] + }, + { + "sketch": "U1", + "curves": [ + "l1" + ] + } + ], + "v": [ + { + "sketch": "V0", + "curves": [ + "l1" + ] + }, + { + "sketch": "V1", + "curves": [ + "l1" + ] + } + ], + "body_name": "Saddle" + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-boundary-three-lines-triangle/expected.json b/tests/kernel-cases/surfaces/cov-boundary-three-lines-triangle/expected.json new file mode 100644 index 000000000..4c9adf24a --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-boundary-three-lines-triangle/expected.json @@ -0,0 +1,26 @@ +{ + "sources": [], + "what": "a boundary surface through three lines of a right triangle: the flat triangle", + "source": "analytic", + "method": "three curves: the side opposite the first collapses to the corner the other two share; the patch is the planar triangle (0,0), (20,0), (0,20): area 200; free edges the 3 sides (a collapsed side may stay as a degenerate edge: [3, 4])", + "valid": false, + "body_count": 1, + "faces": 1, + "boundary_edges": [ + 3, + 4 + ], + "area_mm2": 200.0, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 20, + 20, + 0 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-boundary-three-lines-triangle/recipe.json b/tests/kernel-cases/surfaces/cov-boundary-three-lines-triangle/recipe.json new file mode 100644 index 000000000..bdb7f30d5 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-boundary-three-lines-triangle/recipe.json @@ -0,0 +1,67 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "Tri" + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 0, + 0 + ], + [ + 20, + 0 + ], + [ + 0, + 20 + ], + [ + 0, + 0 + ] + ], + "infer": false + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.boundary", + "params": { + "sketch": "Tri", + "curves": [ + "l1", + "l2", + "l3" + ], + "body_name": "Patch" + } + } + ] +} From 425c8ed42149d8eef103522db3bef9af795e26c5 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 048/108] Kernel rig: a blend between coplanar sheets is flat, a step blend meets both sheets at the order asked, and unchained edges are refused Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 40 ++++++ .../recipe.json | 125 +++++++++++++++++ .../expected.json | 8 ++ .../recipe.json | 128 +++++++++++++++++ .../expected.json | 24 ++++ .../recipe.json | 129 ++++++++++++++++++ .../expected.json | 24 ++++ .../recipe.json | 129 ++++++++++++++++++ .../expected.json | 24 ++++ .../recipe.json | 129 ++++++++++++++++++ 10 files changed, 760 insertions(+) create mode 100644 tests/kernel-cases/surfaces/cov-blend-between-coplanar-sheets-is-flat/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-blend-between-coplanar-sheets-is-flat/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-blend-from-edges-that-do-not-chain-refused/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-blend-from-edges-that-do-not-chain-refused/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-blend-step-between-offset-sheets-g1/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-blend-step-between-offset-sheets-g1/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-blend-step-between-offset-sheets-g2/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-blend-step-between-offset-sheets-g2/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-blend-step-between-offset-sheets-g3/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-blend-step-between-offset-sheets-g3/recipe.json diff --git a/tests/kernel-cases/surfaces/cov-blend-between-coplanar-sheets-is-flat/expected.json b/tests/kernel-cases/surfaces/cov-blend-between-coplanar-sheets-is-flat/expected.json new file mode 100644 index 000000000..3555d3b30 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-blend-between-coplanar-sheets-is-flat/expected.json @@ -0,0 +1,40 @@ +{ + "sources": [], + "what": "a G1 blend across the 10 mm gap between two coplanar sheets, stitched to both: flat, filling the gap exactly", + "source": "analytic", + "method": "both ends' tangent planes are z = 0 and the edges face each other along x: every cross-section's Hermite lies in z = 0 from x = 10 to x = 20, so the blend is the 10 x 20 strip; stitched: one body, area 200 + 200 + 200 = 600, 6 free edges round the 30 x 20 outline (the blend's own sides counted, [6, 8]); seams at x = 10 and 20 at least G1", + "valid": false, + "body_count": 1, + "area_mm2": 600.0, + "boundary_edges": [ + 6, + 8 + ], + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 30, + 20, + 0 + ] + }, + "continuity": { + "order": "g1", + "edges": [ + [ + 10, + 10, + 0 + ], + [ + 20, + 10, + 0 + ] + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-blend-between-coplanar-sheets-is-flat/recipe.json b/tests/kernel-cases/surfaces/cov-blend-between-coplanar-sheets-is-flat/recipe.json new file mode 100644 index 000000000..ddef4b424 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-blend-between-coplanar-sheets-is-flat/recipe.json @@ -0,0 +1,125 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "A sketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 10, + 20 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.patch", + "params": { + "sketch": "A sketch", + "body_name": "A" + } + }, + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "B sketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 20, + 0 + ], + "p1": [ + 30, + 20 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.patch", + "params": { + "sketch": "B sketch", + "body_name": "B" + } + }, + { + "command": "surface.blend", + "params": { + "from": { + "body": "A", + "edges": [ + [ + 10, + 10, + 0 + ] + ] + }, + "to": { + "body": "B", + "edges": [ + [ + 20, + 10, + 0 + ] + ] + }, + "stitch": true, + "body_name": "Bridge" + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-blend-from-edges-that-do-not-chain-refused/expected.json b/tests/kernel-cases/surfaces/cov-blend-from-edges-that-do-not-chain-refused/expected.json new file mode 100644 index 000000000..e1a4902e1 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-blend-from-edges-that-do-not-chain-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "a blend from two opposite sides of a sheet: they share no vertex, so they are no chain; refused", + "source": "invariants", + "method": "an end of a blend is one chain of edges, each running on from the last", + "outcome": "refused", + "refusal": "the picked edges do not run on from one another" +} diff --git a/tests/kernel-cases/surfaces/cov-blend-from-edges-that-do-not-chain-refused/recipe.json b/tests/kernel-cases/surfaces/cov-blend-from-edges-that-do-not-chain-refused/recipe.json new file mode 100644 index 000000000..3c2d6023e --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-blend-from-edges-that-do-not-chain-refused/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": "A sketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 10, + 20 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.patch", + "params": { + "sketch": "A sketch", + "body_name": "A" + } + }, + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "B sketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 20, + 0 + ], + "p1": [ + 30, + 20 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.patch", + "params": { + "sketch": "B sketch", + "body_name": "B" + } + }, + { + "command": "surface.blend", + "params": { + "from": { + "body": "A", + "edges": [ + [ + 0, + 10, + 0 + ], + [ + 10, + 10, + 0 + ] + ] + }, + "to": { + "body": "B", + "edges": [ + [ + 20, + 10, + 0 + ] + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-blend-step-between-offset-sheets-g1/expected.json b/tests/kernel-cases/surfaces/cov-blend-step-between-offset-sheets-g1/expected.json new file mode 100644 index 000000000..00c1719d7 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-blend-step-between-offset-sheets-g1/expected.json @@ -0,0 +1,24 @@ +{ + "sources": [], + "what": "a G1 blend bridging a 10 mm step between two parallel sheets (z = 0 and z = 10), stitched to both: it meets each at G1", + "source": "invariants", + "method": "sheets x 0..10 at z = 0 and x 20..30 at z = 10, 20 wide; the blend leaves each edge in its sheet's tangent plane (and curvature, rate) as asked. Graded: the order at both seams as Continuity Analysis measures it, one body of 3 faces (each a different surface, so none merge)", + "valid": false, + "body_count": 1, + "faces": 3, + "continuity": { + "order": "g1", + "edges": [ + [ + 10, + 10, + 0 + ], + [ + 20, + 10, + 10 + ] + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-blend-step-between-offset-sheets-g1/recipe.json b/tests/kernel-cases/surfaces/cov-blend-step-between-offset-sheets-g1/recipe.json new file mode 100644 index 000000000..7d7495ebb --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-blend-step-between-offset-sheets-g1/recipe.json @@ -0,0 +1,129 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "A sketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 10, + 20 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.patch", + "params": { + "sketch": "A sketch", + "body_name": "A" + } + }, + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 10 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "Bs" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 20, + 0 + ], + "p1": [ + 30, + 20 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.patch", + "params": { + "sketch": "Bs", + "body_name": "B" + } + }, + { + "command": "surface.blend", + "params": { + "from": { + "body": "A", + "edges": [ + [ + 10, + 10, + 0 + ] + ] + }, + "to": { + "body": "B", + "edges": [ + [ + 20, + 10, + 10 + ] + ] + }, + "continuity": [ + "g1", + "g1" + ], + "stitch": true, + "body_name": "Bridge" + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-blend-step-between-offset-sheets-g2/expected.json b/tests/kernel-cases/surfaces/cov-blend-step-between-offset-sheets-g2/expected.json new file mode 100644 index 000000000..ca0733547 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-blend-step-between-offset-sheets-g2/expected.json @@ -0,0 +1,24 @@ +{ + "sources": [], + "what": "a G2 blend bridging a 10 mm step between two parallel sheets (z = 0 and z = 10), stitched to both: it meets each at G2", + "source": "invariants", + "method": "sheets x 0..10 at z = 0 and x 20..30 at z = 10, 20 wide; the blend leaves each edge in its sheet's tangent plane (and curvature, rate) as asked. Graded: the order at both seams as Continuity Analysis measures it, one body of 3 faces (each a different surface, so none merge)", + "valid": false, + "body_count": 1, + "faces": 3, + "continuity": { + "order": "g2", + "edges": [ + [ + 10, + 10, + 0 + ], + [ + 20, + 10, + 10 + ] + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-blend-step-between-offset-sheets-g2/recipe.json b/tests/kernel-cases/surfaces/cov-blend-step-between-offset-sheets-g2/recipe.json new file mode 100644 index 000000000..0b1e82e2c --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-blend-step-between-offset-sheets-g2/recipe.json @@ -0,0 +1,129 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "A sketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 10, + 20 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.patch", + "params": { + "sketch": "A sketch", + "body_name": "A" + } + }, + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 10 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "Bs" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 20, + 0 + ], + "p1": [ + 30, + 20 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.patch", + "params": { + "sketch": "Bs", + "body_name": "B" + } + }, + { + "command": "surface.blend", + "params": { + "from": { + "body": "A", + "edges": [ + [ + 10, + 10, + 0 + ] + ] + }, + "to": { + "body": "B", + "edges": [ + [ + 20, + 10, + 10 + ] + ] + }, + "continuity": [ + "g2", + "g2" + ], + "stitch": true, + "body_name": "Bridge" + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-blend-step-between-offset-sheets-g3/expected.json b/tests/kernel-cases/surfaces/cov-blend-step-between-offset-sheets-g3/expected.json new file mode 100644 index 000000000..b701a91ca --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-blend-step-between-offset-sheets-g3/expected.json @@ -0,0 +1,24 @@ +{ + "sources": [], + "what": "a G3 blend bridging a 10 mm step between two parallel sheets (z = 0 and z = 10), stitched to both: it meets each at G3", + "source": "invariants", + "method": "sheets x 0..10 at z = 0 and x 20..30 at z = 10, 20 wide; the blend leaves each edge in its sheet's tangent plane (and curvature, rate) as asked. Graded: the order at both seams as Continuity Analysis measures it, one body of 3 faces (each a different surface, so none merge)", + "valid": false, + "body_count": 1, + "faces": 3, + "continuity": { + "order": "g3", + "edges": [ + [ + 10, + 10, + 0 + ], + [ + 20, + 10, + 10 + ] + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-blend-step-between-offset-sheets-g3/recipe.json b/tests/kernel-cases/surfaces/cov-blend-step-between-offset-sheets-g3/recipe.json new file mode 100644 index 000000000..167e2b25d --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-blend-step-between-offset-sheets-g3/recipe.json @@ -0,0 +1,129 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "A sketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 10, + 20 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.patch", + "params": { + "sketch": "A sketch", + "body_name": "A" + } + }, + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 10 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "Bs" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 20, + 0 + ], + "p1": [ + 30, + 20 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.patch", + "params": { + "sketch": "Bs", + "body_name": "B" + } + }, + { + "command": "surface.blend", + "params": { + "from": { + "body": "A", + "edges": [ + [ + 10, + 10, + 0 + ] + ] + }, + "to": { + "body": "B", + "edges": [ + [ + 20, + 10, + 10 + ] + ] + }, + "continuity": [ + "g3", + "g3" + ], + "stitch": true, + "body_name": "Bridge" + } + } + ] +} From f861f44e1d96d085dc581577c79487e58a8b7af6 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 049/108] Kernel rig: a matched sheet meets its target's edge at the order asked, flat where both are flat, and a solid is refused Co-Authored-By: Claude Opus 5.5 --- .../cov-match-a-solid-refused/expected.json | 8 ++ .../cov-match-a-solid-refused/recipe.json | 79 ++++++++++++ .../expected.json | 39 ++++++ .../recipe.json | 122 ++++++++++++++++++ .../expected.json | 19 +++ .../recipe.json | 122 ++++++++++++++++++ .../expected.json | 19 +++ .../recipe.json | 122 ++++++++++++++++++ 8 files changed, 530 insertions(+) create mode 100644 tests/kernel-cases/surfaces/cov-match-a-solid-refused/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-match-a-solid-refused/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-match-coplanar-sheet-onto-the-near-edge/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-match-coplanar-sheet-onto-the-near-edge/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-match-raised-sheet-down-onto-the-edge-g1/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-match-raised-sheet-down-onto-the-edge-g1/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-match-raised-sheet-down-onto-the-edge-g3/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-match-raised-sheet-down-onto-the-edge-g3/recipe.json diff --git a/tests/kernel-cases/surfaces/cov-match-a-solid-refused/expected.json b/tests/kernel-cases/surfaces/cov-match-a-solid-refused/expected.json new file mode 100644 index 000000000..cb90a12e9 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-match-a-solid-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "match on a closed solid: refused, a match rebuilds a surface", + "source": "invariants", + "method": "rebuilding one face of a solid would open it", + "outcome": "refused", + "refusal": "match rebuilds a surface body: this one is closed" +} diff --git a/tests/kernel-cases/surfaces/cov-match-a-solid-refused/recipe.json b/tests/kernel-cases/surfaces/cov-match-a-solid-refused/recipe.json new file mode 100644 index 000000000..8da4ee6c1 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-match-a-solid-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": "Target sketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 10, + 20 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.patch", + "params": { + "sketch": "Target sketch", + "body_name": "Target" + } + }, + { + "command": "solid.box", + "params": { + "length": 8, + "width": 20, + "height": 5, + "corner": [ + 12, + 0, + 0 + ], + "body_name": "Block" + } + }, + { + "command": "surface.match", + "params": { + "body": "Block", + "target": "Target", + "edges": [ + [ + 10, + 10, + 0 + ] + ] + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-match-coplanar-sheet-onto-the-near-edge/expected.json b/tests/kernel-cases/surfaces/cov-match-coplanar-sheet-onto-the-near-edge/expected.json new file mode 100644 index 000000000..f102f07f4 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-match-coplanar-sheet-onto-the-near-edge/expected.json @@ -0,0 +1,39 @@ +{ + "sources": [], + "what": "a sheet 2 mm short of a coplanar sheet's edge, matched G2 onto it and stitched: flat, x 10..20", + "source": "analytic", + "method": "target x 0..10, skirt x 12..20, both in z = 0; the skirt's near boundary (x = 12) moves to the picked edge x = 10 repeating the plane's tangent and zero curvature, the far one (x = 20) stays with its plane: every condition is in z = 0, so the rebuilt face is the flat 10 x 20 strip; stitched: area 200 + 200 = 400, 4 to 6 free edges round the 20 x 20 outline, the seam at least G2", + "valid": false, + "body_count": 1, + "faces": [ + 1, + 2 + ], + "area_mm2": 400.0, + "boundary_edges": [ + 4, + 6 + ], + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 20, + 20, + 0 + ] + }, + "continuity": { + "order": "g2", + "edges": [ + [ + 10, + 10, + 0 + ] + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-match-coplanar-sheet-onto-the-near-edge/recipe.json b/tests/kernel-cases/surfaces/cov-match-coplanar-sheet-onto-the-near-edge/recipe.json new file mode 100644 index 000000000..c40f2c2ec --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-match-coplanar-sheet-onto-the-near-edge/recipe.json @@ -0,0 +1,122 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "Target sketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 10, + 20 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.patch", + "params": { + "sketch": "Target sketch", + "body_name": "Target" + } + }, + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "Skirt sketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 12, + 0 + ], + "p1": [ + 20, + 20 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.patch", + "params": { + "sketch": "Skirt sketch", + "body_name": "Skirt" + } + }, + { + "command": "surface.match", + "params": { + "body": "Skirt", + "target": "Target", + "edges": [ + [ + 10, + 10, + 0 + ] + ], + "order": "g2" + } + }, + { + "command": "surface.stitch", + "params": { + "bodies": [ + "Target", + "Skirt" + ] + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-match-raised-sheet-down-onto-the-edge-g1/expected.json b/tests/kernel-cases/surfaces/cov-match-raised-sheet-down-onto-the-edge-g1/expected.json new file mode 100644 index 000000000..0401a02ea --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-match-raised-sheet-down-onto-the-edge-g1/expected.json @@ -0,0 +1,19 @@ +{ + "sources": [], + "what": "a sheet 2 above and 2 short of a sheet's edge, matched G1 down onto it and stitched: the seam holds G1", + "source": "invariants", + "method": "target x 0..10 at z = 0, skirt x 12..20 at z = 2; the near boundary moves onto x = 10, z = 0 repeating the target's plane to G1, the far boundary stays at x = 20, z = 2. Graded: the seam's order as Continuity Analysis measures it, one body of 2 faces", + "valid": false, + "body_count": 1, + "faces": 2, + "continuity": { + "order": "g1", + "edges": [ + [ + 10, + 10, + 0 + ] + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-match-raised-sheet-down-onto-the-edge-g1/recipe.json b/tests/kernel-cases/surfaces/cov-match-raised-sheet-down-onto-the-edge-g1/recipe.json new file mode 100644 index 000000000..c9a5a8062 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-match-raised-sheet-down-onto-the-edge-g1/recipe.json @@ -0,0 +1,122 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "Target sketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 10, + 20 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.patch", + "params": { + "sketch": "Target sketch", + "body_name": "Target" + } + }, + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 2 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "Raised" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 12, + 0 + ], + "p1": [ + 20, + 20 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.patch", + "params": { + "sketch": "Raised", + "body_name": "Skirt" + } + }, + { + "command": "surface.match", + "params": { + "body": "Skirt", + "target": "Target", + "edges": [ + [ + 10, + 10, + 0 + ] + ], + "order": "g1" + } + }, + { + "command": "surface.stitch", + "params": { + "bodies": [ + "Target", + "Skirt" + ] + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-match-raised-sheet-down-onto-the-edge-g3/expected.json b/tests/kernel-cases/surfaces/cov-match-raised-sheet-down-onto-the-edge-g3/expected.json new file mode 100644 index 000000000..470990699 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-match-raised-sheet-down-onto-the-edge-g3/expected.json @@ -0,0 +1,19 @@ +{ + "sources": [], + "what": "a sheet 2 above and 2 short of a sheet's edge, matched G3 down onto it and stitched: the seam holds G3", + "source": "invariants", + "method": "target x 0..10 at z = 0, skirt x 12..20 at z = 2; the near boundary moves onto x = 10, z = 0 repeating the target's plane to G3, the far boundary stays at x = 20, z = 2. Graded: the seam's order as Continuity Analysis measures it, one body of 2 faces", + "valid": false, + "body_count": 1, + "faces": 2, + "continuity": { + "order": "g3", + "edges": [ + [ + 10, + 10, + 0 + ] + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-match-raised-sheet-down-onto-the-edge-g3/recipe.json b/tests/kernel-cases/surfaces/cov-match-raised-sheet-down-onto-the-edge-g3/recipe.json new file mode 100644 index 000000000..57da8243d --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-match-raised-sheet-down-onto-the-edge-g3/recipe.json @@ -0,0 +1,122 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "Target sketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 10, + 20 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.patch", + "params": { + "sketch": "Target sketch", + "body_name": "Target" + } + }, + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 2 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "Raised" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 12, + 0 + ], + "p1": [ + 20, + 20 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.patch", + "params": { + "sketch": "Raised", + "body_name": "Skirt" + } + }, + { + "command": "surface.match", + "params": { + "body": "Skirt", + "target": "Target", + "edges": [ + [ + 10, + 10, + 0 + ] + ], + "order": "g3" + } + }, + { + "command": "surface.stitch", + "params": { + "bodies": [ + "Target", + "Skirt" + ] + } + } + ] +} From 3d080e96a39883685e516411ca03daeedbd07eb4 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 050/108] Kernel rig: fairing leaves a flat patch flat and a face with no free control rows as it was; zero strength is refused Co-Authored-By: Claude Opus 5.5 --- tests/kernel-cases/surfaces/KNOWN_FAILING | 1 + .../expected.json | 23 ++++++ .../recipe.json | 65 +++++++++++++++++ .../expected.json | 26 +++++++ .../recipe.json | 72 +++++++++++++++++++ .../expected.json | 8 +++ .../recipe.json | 72 +++++++++++++++++++ 7 files changed, 267 insertions(+) create mode 100644 tests/kernel-cases/surfaces/cov-fair-flat-patch-stays-flat/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-fair-flat-patch-stays-flat/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-fair-single-span-face-has-nothing-free-to-move/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-fair-single-span-face-has-nothing-free-to-move/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-fair-zero-strength-refused/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-fair-zero-strength-refused/recipe.json diff --git a/tests/kernel-cases/surfaces/KNOWN_FAILING b/tests/kernel-cases/surfaces/KNOWN_FAILING index fe07e824c..a514c68f3 100644 --- a/tests/kernel-cases/surfaces/KNOWN_FAILING +++ b/tests/kernel-cases/surfaces/KNOWN_FAILING @@ -3,3 +3,4 @@ # that fails and is not listed fails it, and so does a listed case that passes: a fix removes its # 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 diff --git a/tests/kernel-cases/surfaces/cov-fair-flat-patch-stays-flat/expected.json b/tests/kernel-cases/surfaces/cov-fair-flat-patch-stays-flat/expected.json new file mode 100644 index 000000000..ec976528f --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-fair-flat-patch-stays-flat/expected.json @@ -0,0 +1,23 @@ +{ + "sources": [], + "what": "fair on a flat boundary patch, with its edges free: a plane has no curvature to even out, so it stays the flat square", + "source": "analytic", + "method": "the Coons patch of the 20 x 20 square lies in z = 0; fairing moves control points to flatten curvature variation, of which a plane has none, and never past the tolerance: area 400, box z 0..0, 4 free edges", + "valid": false, + "body_count": 1, + "faces": 1, + "boundary_edges": 4, + "area_mm2": 400.0, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 20, + 20, + 0 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-fair-flat-patch-stays-flat/recipe.json b/tests/kernel-cases/surfaces/cov-fair-flat-patch-stays-flat/recipe.json new file mode 100644 index 000000000..f65846329 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-fair-flat-patch-stays-flat/recipe.json @@ -0,0 +1,65 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "Square" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 20, + 20 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.boundary", + "params": { + "sketch": "Square", + "curves": [ + "l1", + "l2", + "l3", + "l4" + ], + "body_name": "Patch" + } + }, + { + "command": "surface.fair", + "params": { + "body": "Patch", + "iterations": 20, + "keep_edges": false + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-fair-single-span-face-has-nothing-free-to-move/expected.json b/tests/kernel-cases/surfaces/cov-fair-single-span-face-has-nothing-free-to-move/expected.json new file mode 100644 index 000000000..212c47363 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-fair-single-span-face-has-nothing-free-to-move/expected.json @@ -0,0 +1,26 @@ +{ + "sources": [], + "what": "fair on a single-span cubic extrusion holding its edges: every control row is a boundary row or the one next to it, so nothing moves", + "source": "analytic", + "method": "the face: the Bezier (0,0), (13,8), (27,-8), (40,0) on XZ extruded 20 along -y or +y, B-spline degree (3, 1), one span each way. keep_edges holds the two boundary rows each side and the rows next to them: across the cubic that is all 4 rows, so the surface is unchanged: area = curve length 41.3983 (Gauss-Legendre 64) x 20 = 827.966", + "valid": false, + "body_count": 1, + "faces": 1, + "boundary_edges": 4, + "area_mm2": 827.9663653036151, + "surface_types": [ + "bspline" + ], + "splines": [ + { + "degree": [ + 3, + 1 + ], + "spans": [ + 1, + 1 + ] + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-fair-single-span-face-has-nothing-free-to-move/recipe.json b/tests/kernel-cases/surfaces/cov-fair-single-span-face-has-nothing-free-to-move/recipe.json new file mode 100644 index 000000000..24099e120 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-fair-single-span-face-has-nothing-free-to-move/recipe.json @@ -0,0 +1,72 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 0, + 1 + ] + }, + "name": "Wave" + } + }, + { + "command": "sketch.spline.control_point", + "params": { + "points": [ + [ + 0, + 0 + ], + [ + 13, + 8 + ], + [ + 27, + -8 + ], + [ + 40, + 0 + ] + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.extrude", + "params": { + "sketch": "Wave", + "curves": [ + "s1" + ], + "distance": 20, + "body_name": "Wave" + } + }, + { + "command": "surface.fair", + "params": { + "body": "Wave", + "iterations": 10 + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-fair-zero-strength-refused/expected.json b/tests/kernel-cases/surfaces/cov-fair-zero-strength-refused/expected.json new file mode 100644 index 000000000..7d910395c --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-fair-zero-strength-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "fair with strength 0: refused, a step of nothing", + "source": "invariants", + "method": "strength is the fraction of the fairing step, greater than 0 and at most 1", + "outcome": "refused", + "refusal": "`strength` must be greater than 0 and at most 1" +} diff --git a/tests/kernel-cases/surfaces/cov-fair-zero-strength-refused/recipe.json b/tests/kernel-cases/surfaces/cov-fair-zero-strength-refused/recipe.json new file mode 100644 index 000000000..cb966d29d --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-fair-zero-strength-refused/recipe.json @@ -0,0 +1,72 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 0, + 1 + ] + }, + "name": "Wave" + } + }, + { + "command": "sketch.spline.control_point", + "params": { + "points": [ + [ + 0, + 0 + ], + [ + 13, + 8 + ], + [ + 27, + -8 + ], + [ + 40, + 0 + ] + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.extrude", + "params": { + "sketch": "Wave", + "curves": [ + "s1" + ], + "distance": 20, + "body_name": "Wave" + } + }, + { + "command": "surface.fair", + "params": { + "body": "Wave", + "strength": 0 + } + } + ] +} From 75353cb042c9f4997c2762ba3a5ad39e8da5560f 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 051/108] Kernel rig: extend, extrude, loft, patch, revolve, stitch and sweep surfaces, a normal case and an edge case each, with their exact areas and surface kinds Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 26 ++++ .../recipe.json | 73 +++++++++ .../expected.json | 26 ++++ .../recipe.json | 65 ++++++++ .../expected.json | 8 + .../recipe.json | 66 ++++++++ .../expected.json | 26 ++++ .../recipe.json | 60 ++++++++ .../cov-extrude-line-symmetric/expected.json | 26 ++++ .../cov-extrude-line-symmetric/recipe.json | 59 ++++++++ .../expected.json | 26 ++++ .../recipe.json | 59 ++++++++ .../expected.json | 23 +++ .../recipe.json | 141 ++++++++++++++++++ .../expected.json | 23 +++ .../recipe.json | 98 ++++++++++++ .../expected.json | 25 ++++ .../recipe.json | 73 +++++++++ .../expected.json | 26 ++++ .../recipe.json | 69 +++++++++ .../expected.json | 26 ++++ .../recipe.json | 61 ++++++++ .../expected.json | 17 +++ .../recipe.json | 60 ++++++++ .../expected.json | 17 +++ .../recipe.json | 107 +++++++++++++ .../expected.json | 11 ++ .../recipe.json | 36 +++++ .../expected.json | 23 +++ .../recipe.json | 99 ++++++++++++ .../expected.json | 26 ++++ .../recipe.json | 104 +++++++++++++ 32 files changed, 1585 insertions(+) create mode 100644 tests/kernel-cases/surfaces/cov-extend-quarter-cylinder-along-its-axis/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-extend-quarter-cylinder-along-its-axis/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-extend-square-sheet-edge-natural/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-extend-square-sheet-edge-natural/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-extend-tangent-to-bounds-refused/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-extend-tangent-to-bounds-refused/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-extrude-line-symmetric-total-distance/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-extrude-line-symmetric-total-distance/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-extrude-line-symmetric/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-extrude-line-symmetric/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-extrude-quarter-arc-is-a-cylinder/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-extrude-quarter-arc-is-a-cylinder/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-loft-three-equal-circles-is-a-cylinder/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-loft-three-equal-circles-is-a-cylinder/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-loft-two-circles-ruled-frustum/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-loft-two-circles-ruled-frustum/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-patch-open-box-rim-and-stitch-closes-it/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-patch-open-box-rim-and-stitch-closes-it/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-patch-sketch-region-with-a-hole/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-patch-sketch-region-with-a-hole/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-revolve-line-full-turn-cylinder/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-revolve-line-full-turn-cylinder/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-revolve-quarter-arc-half-turn-sphere/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-revolve-quarter-arc-half-turn-sphere/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-stitch-two-squares-along-a-shared-edge/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-stitch-two-squares-along-a-shared-edge/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-stitch-unstitched-top-back-into-a-solid/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-stitch-unstitched-top-back-into-a-solid/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-sweep-circle-scaled-half-is-a-frustum/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-sweep-circle-scaled-half-is-a-frustum/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-sweep-line-along-a-line-plane/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-sweep-line-along-a-line-plane/recipe.json diff --git a/tests/kernel-cases/surfaces/cov-extend-quarter-cylinder-along-its-axis/expected.json b/tests/kernel-cases/surfaces/cov-extend-quarter-cylinder-along-its-axis/expected.json new file mode 100644 index 000000000..d04e6d92e --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-extend-quarter-cylinder-along-its-axis/expected.json @@ -0,0 +1,26 @@ +{ + "sources": [], + "what": "a quarter-cylinder sheet r 10, 20 high, its top arc extended naturally by 5: the cylinder continued to 25 high", + "source": "analytic", + "method": "natural extension keeps a surface of revolution on itself: the top arc moves 5 along the rulings: A = (pi/2) 10 25 = 392.70, one cylinder face, 4 free edges", + "valid": false, + "body_count": 1, + "faces": 1, + "boundary_edges": 4, + "area_mm2": 392.6990816987241, + "surface_types": [ + "cylinder" + ], + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 10, + 10, + 25 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-extend-quarter-cylinder-along-its-axis/recipe.json b/tests/kernel-cases/surfaces/cov-extend-quarter-cylinder-along-its-axis/recipe.json new file mode 100644 index 000000000..a461e96f7 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-extend-quarter-cylinder-along-its-axis/recipe.json @@ -0,0 +1,73 @@ +{ + "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": "surface.extend", + "params": { + "body": "Quarter", + "edges": [ + [ + 9.84807753012208, + 1.7364817766693033, + 20 + ] + ], + "distance": 5 + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-extend-square-sheet-edge-natural/expected.json b/tests/kernel-cases/surfaces/cov-extend-square-sheet-edge-natural/expected.json new file mode 100644 index 000000000..f1283b24d --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-extend-square-sheet-edge-natural/expected.json @@ -0,0 +1,26 @@ +{ + "sources": [], + "what": "a 10 x 10 sheet's edge x = 10 extended naturally by 5: the plane continued to 15 x 10", + "source": "analytic", + "method": "a natural extension keeps a plane on itself: the face becomes x 0..15, y 0..10, area 150, one plane face, 4 free edges", + "valid": false, + "body_count": 1, + "faces": 1, + "boundary_edges": 4, + "area_mm2": 150.0, + "surface_types": [ + "plane" + ], + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 15, + 10, + 0 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-extend-square-sheet-edge-natural/recipe.json b/tests/kernel-cases/surfaces/cov-extend-square-sheet-edge-natural/recipe.json new file mode 100644 index 000000000..e06e8f41b --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-extend-square-sheet-edge-natural/recipe.json @@ -0,0 +1,65 @@ +{ + "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.extend", + "params": { + "body": "Sheet", + "edges": [ + [ + 10, + 5, + 0 + ] + ], + "distance": 5 + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-extend-tangent-to-bounds-refused/expected.json b/tests/kernel-cases/surfaces/cov-extend-tangent-to-bounds-refused/expected.json new file mode 100644 index 000000000..11256e890 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-extend-tangent-to-bounds-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "a tangent extension back to the surface's bounds: refused, only a natural one goes there", + "source": "invariants", + "method": "the bounds are the surface's own; a tangent continuation leaves the surface", + "outcome": "refused", + "refusal": "only a natural extension goes back to the surface's bounds" +} diff --git a/tests/kernel-cases/surfaces/cov-extend-tangent-to-bounds-refused/recipe.json b/tests/kernel-cases/surfaces/cov-extend-tangent-to-bounds-refused/recipe.json new file mode 100644 index 000000000..92df89539 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-extend-tangent-to-bounds-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.extend", + "params": { + "body": "Sheet", + "edges": [ + [ + 10, + 5, + 0 + ] + ], + "up_to": "bounds", + "mode": "tangent" + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-extrude-line-symmetric-total-distance/expected.json b/tests/kernel-cases/surfaces/cov-extrude-line-symmetric-total-distance/expected.json new file mode 100644 index 000000000..c104ad482 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-extrude-line-symmetric-total-distance/expected.json @@ -0,0 +1,26 @@ +{ + "sources": [], + "what": "a line extruded symmetric 10 as a surface with the total-distance convention: 5 each side of the sketch plane", + "source": "analytic", + "method": "total distance 10 split evenly: the plane y = 0, x 0..10, z -5..5, area 100, 4 free edges", + "valid": false, + "body_count": 1, + "faces": 1, + "boundary_edges": 4, + "area_mm2": 100.0, + "surface_types": [ + "plane" + ], + "bbox": { + "min": [ + 0, + 0, + -5 + ], + "max": [ + 10, + 0, + 5 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-extrude-line-symmetric-total-distance/recipe.json b/tests/kernel-cases/surfaces/cov-extrude-line-symmetric-total-distance/recipe.json new file mode 100644 index 000000000..0b9a8f310 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-extrude-line-symmetric-total-distance/recipe.json @@ -0,0 +1,60 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "S" + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 0, + 0 + ], + [ + 10, + 0 + ] + ], + "infer": false + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.extrude", + "params": { + "sketch": "S", + "curves": [ + "l1" + ], + "distance": 10, + "direction": "symmetric", + "convention": "total_distance", + "body_name": "Wall" + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-extrude-line-symmetric/expected.json b/tests/kernel-cases/surfaces/cov-extrude-line-symmetric/expected.json new file mode 100644 index 000000000..4538a7ab6 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-extrude-line-symmetric/expected.json @@ -0,0 +1,26 @@ +{ + "sources": [], + "what": "a line extruded symmetric 10 as a surface: surface.extrude's distance is per side (its legacy convention, kept by default), so 10 each way", + "source": "analytic", + "method": "surface.extrude without `convention` keeps legacy_per_side (crates/engine/src/cmd/features.rs, extrude_convention_tests): the plane y = 0, x 0..10, z -10..10, area 200, 4 free edges", + "valid": false, + "body_count": 1, + "faces": 1, + "boundary_edges": 4, + "area_mm2": 200.0, + "surface_types": [ + "plane" + ], + "bbox": { + "min": [ + 0, + 0, + -10 + ], + "max": [ + 10, + 0, + 10 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-extrude-line-symmetric/recipe.json b/tests/kernel-cases/surfaces/cov-extrude-line-symmetric/recipe.json new file mode 100644 index 000000000..22f83e68a --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-extrude-line-symmetric/recipe.json @@ -0,0 +1,59 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "S" + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 0, + 0 + ], + [ + 10, + 0 + ] + ], + "infer": false + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.extrude", + "params": { + "sketch": "S", + "curves": [ + "l1" + ], + "distance": 10, + "direction": "symmetric", + "body_name": "Wall" + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-extrude-quarter-arc-is-a-cylinder/expected.json b/tests/kernel-cases/surfaces/cov-extrude-quarter-arc-is-a-cylinder/expected.json new file mode 100644 index 000000000..7761299fd --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-extrude-quarter-arc-is-a-cylinder/expected.json @@ -0,0 +1,26 @@ +{ + "sources": [], + "what": "a quarter arc r 10 extruded 20 as a surface: a quarter cylinder", + "source": "analytic", + "method": "A = (pi/2) 10 20 = 314.16; one cylinder face; its 4 edges free", + "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-extrude-quarter-arc-is-a-cylinder/recipe.json b/tests/kernel-cases/surfaces/cov-extrude-quarter-arc-is-a-cylinder/recipe.json new file mode 100644 index 000000000..95b432aaa --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-extrude-quarter-arc-is-a-cylinder/recipe.json @@ -0,0 +1,59 @@ +{ + "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" + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-loft-three-equal-circles-is-a-cylinder/expected.json b/tests/kernel-cases/surfaces/cov-loft-three-equal-circles-is-a-cylinder/expected.json new file mode 100644 index 000000000..ab515a79a --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-loft-three-equal-circles-is-a-cylinder/expected.json @@ -0,0 +1,23 @@ +{ + "sources": [], + "what": "a smooth surface loft through three equal coaxial circles r 10 at z 0, 10, 20: the cylinder", + "source": "analytic", + "method": "every section is the same circle moved along z, so the interpolation through them is that circle swept straight: A = 2 pi 10 20 = 1256.64, bbox r 10, z 0..20", + "valid": false, + "body_count": 1, + "faces": 1, + "boundary_edges": 2, + "area_mm2": 1256.6370614359173, + "bbox": { + "min": [ + -10, + -10, + 0 + ], + "max": [ + 10, + 10, + 20 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-loft-three-equal-circles-is-a-cylinder/recipe.json b/tests/kernel-cases/surfaces/cov-loft-three-equal-circles-is-a-cylinder/recipe.json new file mode 100644 index 000000000..ea059dfa2 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-loft-three-equal-circles-is-a-cylinder/recipe.json @@ -0,0 +1,141 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "C0" + } + }, + { + "command": "sketch.circle.center", + "params": { + "center": [ + 0, + 0 + ], + "radius": 10 + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 10 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "C1" + } + }, + { + "command": "sketch.circle.center", + "params": { + "center": [ + 0, + 0 + ], + "radius": 10 + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 20 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "C2" + } + }, + { + "command": "sketch.circle.center", + "params": { + "center": [ + 0, + 0 + ], + "radius": 10 + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.loft", + "params": { + "sections": [ + { + "sketch": "C0", + "curves": [ + "c1" + ] + }, + { + "sketch": "C1", + "curves": [ + "c1" + ] + }, + { + "sketch": "C2", + "curves": [ + "c1" + ] + } + ], + "body_name": "Tube" + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-loft-two-circles-ruled-frustum/expected.json b/tests/kernel-cases/surfaces/cov-loft-two-circles-ruled-frustum/expected.json new file mode 100644 index 000000000..80053a5c6 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-loft-two-circles-ruled-frustum/expected.json @@ -0,0 +1,23 @@ +{ + "sources": [], + "what": "a surface loft between a circle r 10 at z 0 and a circle r 5 at z 10: ruled between two sections, a cone frustum", + "source": "analytic", + "method": "two sections loft ruled: corresponding points joined by lines, which for coaxial circles is the frustum; A = pi (10 + 5) sqrt(5^2 + 10^2) = 526.861; one face, 2 free circles", + "valid": false, + "body_count": 1, + "faces": 1, + "boundary_edges": 2, + "area_mm2": 526.8611048280544, + "bbox": { + "min": [ + -10, + -10, + 0 + ], + "max": [ + 10, + 10, + 10 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-loft-two-circles-ruled-frustum/recipe.json b/tests/kernel-cases/surfaces/cov-loft-two-circles-ruled-frustum/recipe.json new file mode 100644 index 000000000..fce26e43a --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-loft-two-circles-ruled-frustum/recipe.json @@ -0,0 +1,98 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "Low" + } + }, + { + "command": "sketch.circle.center", + "params": { + "center": [ + 0, + 0 + ], + "radius": 10 + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 10 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "High" + } + }, + { + "command": "sketch.circle.center", + "params": { + "center": [ + 0, + 0 + ], + "radius": 5 + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.loft", + "params": { + "sections": [ + { + "sketch": "Low", + "curves": [ + "c1" + ] + }, + { + "sketch": "High", + "curves": [ + "c1" + ] + } + ], + "body_name": "Funnel" + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-patch-open-box-rim-and-stitch-closes-it/expected.json b/tests/kernel-cases/surfaces/cov-patch-open-box-rim-and-stitch-closes-it/expected.json new file mode 100644 index 000000000..95c248227 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-patch-open-box-rim-and-stitch-closes-it/expected.json @@ -0,0 +1,25 @@ +{ + "sources": [], + "what": "a box with its top taken away, the rim patched (g0) and stitched in: the box again", + "source": "analytic", + "method": "the rim is a planar loop and the patch g0, so it is the exact plane z = 10, 20 x 10; stitched, the closed box 20 x 10 x 10: V = 2000, A = 1000, 6 faces", + "body_count": 1, + "faces": 6, + "volume_mm3": 2000.0, + "area_mm2": 1000.0, + "surface_types": [ + "plane" + ], + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 20, + 10, + 10 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-patch-open-box-rim-and-stitch-closes-it/recipe.json b/tests/kernel-cases/surfaces/cov-patch-open-box-rim-and-stitch-closes-it/recipe.json new file mode 100644 index 000000000..3ee5b5475 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-patch-open-box-rim-and-stitch-closes-it/recipe.json @@ -0,0 +1,73 @@ +{ + "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" + } + }, + { + "command": "solid.remove", + "params": { + "bodies": [ + "Top" + ] + } + }, + { + "command": "surface.patch", + "params": { + "body": "Box", + "edges": [ + [ + 10, + 0, + 10 + ], + [ + 20, + 5, + 10 + ], + [ + 10, + 10, + 10 + ], + [ + 0, + 5, + 10 + ] + ], + "body_name": "Lid" + } + }, + { + "command": "surface.stitch", + "params": { + "bodies": [ + "Box", + "Lid" + ] + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-patch-sketch-region-with-a-hole/expected.json b/tests/kernel-cases/surfaces/cov-patch-sketch-region-with-a-hole/expected.json new file mode 100644 index 000000000..e030f7f40 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-patch-sketch-region-with-a-hole/expected.json @@ -0,0 +1,26 @@ +{ + "sources": [], + "what": "a planar patch of the region between a 20 x 20 square and a circle r 4 inside it (picked by a point in the ring): a square with a hole", + "source": "analytic", + "method": "A = 400 - 16 pi = 349.73, one plane face, free edges 4 sides + 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-patch-sketch-region-with-a-hole/recipe.json b/tests/kernel-cases/surfaces/cov-patch-sketch-region-with-a-hole/recipe.json new file mode 100644 index 000000000..df7f7a08c --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-patch-sketch-region-with-a-hole/recipe.json @@ -0,0 +1,69 @@ +{ + "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" + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-revolve-line-full-turn-cylinder/expected.json b/tests/kernel-cases/surfaces/cov-revolve-line-full-turn-cylinder/expected.json new file mode 100644 index 000000000..d3953bac9 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-revolve-line-full-turn-cylinder/expected.json @@ -0,0 +1,26 @@ +{ + "sources": [], + "what": "a line parallel to the axis at r 10 revolved a full turn as a surface: the cylinder wall", + "source": "analytic", + "method": "A = 2 pi 10 20 = 1256.64, one cylinder face, the 2 end circles free", + "valid": false, + "body_count": 1, + "faces": 1, + "boundary_edges": 2, + "area_mm2": 1256.6370614359173, + "surface_types": [ + "cylinder" + ], + "bbox": { + "min": [ + -10, + -10, + 0 + ], + "max": [ + 10, + 10, + 20 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-revolve-line-full-turn-cylinder/recipe.json b/tests/kernel-cases/surfaces/cov-revolve-line-full-turn-cylinder/recipe.json new file mode 100644 index 000000000..a854d298f --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-revolve-line-full-turn-cylinder/recipe.json @@ -0,0 +1,61 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 0, + 1 + ] + }, + "name": "P" + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 10, + 0 + ], + [ + 10, + 20 + ] + ], + "infer": false, + "ids": [ + "l1" + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.revolve", + "params": { + "sketch": "P", + "curves": [ + "l1" + ], + "axis": "y", + "body_name": "Tube" + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-revolve-quarter-arc-half-turn-sphere/expected.json b/tests/kernel-cases/surfaces/cov-revolve-quarter-arc-half-turn-sphere/expected.json new file mode 100644 index 000000000..8f74185b7 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-revolve-quarter-arc-half-turn-sphere/expected.json @@ -0,0 +1,17 @@ +{ + "sources": [], + "what": "a quarter arc r 10 about the axis revolved half a turn: half a hemisphere, on the sphere", + "source": "analytic", + "method": "a hemisphere is 2 pi r^2; half a turn of it pi r^2 = 314.16; one sphere face; free edges: the equator half-circle and the two meridian arcs (the pole a point, [3, 4])", + "valid": false, + "body_count": 1, + "faces": 1, + "boundary_edges": [ + 3, + 4 + ], + "area_mm2": 314.1592653589793, + "surface_types": [ + "sphere" + ] +} diff --git a/tests/kernel-cases/surfaces/cov-revolve-quarter-arc-half-turn-sphere/recipe.json b/tests/kernel-cases/surfaces/cov-revolve-quarter-arc-half-turn-sphere/recipe.json new file mode 100644 index 000000000..25520f493 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-revolve-quarter-arc-half-turn-sphere/recipe.json @@ -0,0 +1,60 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 0, + 1 + ] + }, + "name": "P" + } + }, + { + "command": "sketch.arc.center_point", + "params": { + "center": [ + 0, + 0 + ], + "start": [ + 10, + 0 + ], + "end": [ + 0, + 10 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.revolve", + "params": { + "sketch": "P", + "curves": [ + "a1" + ], + "axis": "y", + "angle": "180 deg", + "body_name": "Dome" + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-stitch-two-squares-along-a-shared-edge/expected.json b/tests/kernel-cases/surfaces/cov-stitch-two-squares-along-a-shared-edge/expected.json new file mode 100644 index 000000000..3936b2a97 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-stitch-two-squares-along-a-shared-edge/expected.json @@ -0,0 +1,17 @@ +{ + "sources": [], + "what": "two 10 x 10 sheets sharing the edge x = 10, stitched: one surface body of two faces", + "source": "analytic", + "method": "area 200; the shared edge used by both faces, the outline's 6 edges free; B goes into A", + "valid": false, + "body_count": 1, + "faces": [ + 1, + 2 + ], + "boundary_edges": 6, + "area_mm2": 200.0, + "surface_types": [ + "plane" + ] +} diff --git a/tests/kernel-cases/surfaces/cov-stitch-two-squares-along-a-shared-edge/recipe.json b/tests/kernel-cases/surfaces/cov-stitch-two-squares-along-a-shared-edge/recipe.json new file mode 100644 index 000000000..21cd00455 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-stitch-two-squares-along-a-shared-edge/recipe.json @@ -0,0 +1,107 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "A sketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 10, + 10 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.patch", + "params": { + "sketch": "A sketch", + "body_name": "A" + } + }, + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "B sketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 10, + 0 + ], + "p1": [ + 20, + 10 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.patch", + "params": { + "sketch": "B sketch", + "body_name": "B" + } + }, + { + "command": "surface.stitch", + "params": { + "bodies": [ + "A", + "B" + ] + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-stitch-unstitched-top-back-into-a-solid/expected.json b/tests/kernel-cases/surfaces/cov-stitch-unstitched-top-back-into-a-solid/expected.json new file mode 100644 index 000000000..0521dbc5c --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-stitch-unstitched-top-back-into-a-solid/expected.json @@ -0,0 +1,11 @@ +{ + "sources": [], + "what": "a box's top unstitched and stitched back: the closed box again", + "source": "analytic", + "method": "the six faces close: the solid 20 x 10 x 10, V = 2000, A = 1000, 6 faces, no free edge", + "body_count": 1, + "faces": 6, + "volume_mm3": 2000.0, + "area_mm2": 1000.0, + "boundary_edges": 0 +} diff --git a/tests/kernel-cases/surfaces/cov-stitch-unstitched-top-back-into-a-solid/recipe.json b/tests/kernel-cases/surfaces/cov-stitch-unstitched-top-back-into-a-solid/recipe.json new file mode 100644 index 000000000..3cb4907c7 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-stitch-unstitched-top-back-into-a-solid/recipe.json @@ -0,0 +1,36 @@ +{ + "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" + } + }, + { + "command": "surface.stitch", + "params": { + "bodies": [ + "Box", + "Top" + ] + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-sweep-circle-scaled-half-is-a-frustum/expected.json b/tests/kernel-cases/surfaces/cov-sweep-circle-scaled-half-is-a-frustum/expected.json new file mode 100644 index 000000000..0a49b4d0b --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-sweep-circle-scaled-half-is-a-frustum/expected.json @@ -0,0 +1,23 @@ +{ + "sources": [], + "what": "a circle r 10 swept 20 up a straight path, scaled to half at the end: a cone frustum wall", + "source": "analytic", + "method": "the scale runs linearly along the path: r 10 at z 0 to r 5 at z 20, a frustum: A = pi (10 + 5) sqrt(5^2 + 20^2) = 971.484; one face, 2 free circles", + "valid": false, + "body_count": 1, + "faces": 1, + "boundary_edges": 2, + "area_mm2": 971.4838757561392, + "bbox": { + "min": [ + -10, + -10, + 0 + ], + "max": [ + 10, + 10, + 20 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-sweep-circle-scaled-half-is-a-frustum/recipe.json b/tests/kernel-cases/surfaces/cov-sweep-circle-scaled-half-is-a-frustum/recipe.json new file mode 100644 index 000000000..2886766ba --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-sweep-circle-scaled-half-is-a-frustum/recipe.json @@ -0,0 +1,99 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "C" + } + }, + { + "command": "sketch.circle.center", + "params": { + "center": [ + 0, + 0 + ], + "radius": 10 + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 0, + 1 + ] + }, + "name": "P" + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 0, + 0 + ], + [ + 0, + 20 + ] + ], + "infer": false + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.sweep", + "params": { + "sketch": "C", + "curves": [ + "c1" + ], + "path_sketch": "P", + "path": [ + "l1" + ], + "scale": "1/2", + "body_name": "Cone" + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-sweep-line-along-a-line-plane/expected.json b/tests/kernel-cases/surfaces/cov-sweep-line-along-a-line-plane/expected.json new file mode 100644 index 000000000..53710df06 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-sweep-line-along-a-line-plane/expected.json @@ -0,0 +1,26 @@ +{ + "sources": [], + "what": "a line swept along a straight path square to it: a plane strip", + "source": "analytic", + "method": "the line x 0..10 swept 20 along +z: the plane y = 0, x 0..10, z 0..20, area 200, 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, + 0, + 20 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-sweep-line-along-a-line-plane/recipe.json b/tests/kernel-cases/surfaces/cov-sweep-line-along-a-line-plane/recipe.json new file mode 100644 index 000000000..6f3b516f8 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-sweep-line-along-a-line-plane/recipe.json @@ -0,0 +1,104 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "Prof" + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 0, + 0 + ], + [ + 10, + 0 + ] + ], + "infer": false + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 0, + 1 + ] + }, + "name": "Path" + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 0, + 0 + ], + [ + 0, + 20 + ] + ], + "infer": false + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.sweep", + "params": { + "sketch": "Prof", + "curves": [ + "l1" + ], + "path_sketch": "Path", + "path": [ + "l1" + ], + "body_name": "Wall" + } + } + ] +} From b8c6bb9214ddc6372d72d554979ec5de9bfc7356 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 052/108] Kernel rig: thicken a sheet into a slab and a tube, trim by a plane and by a circle, and refuse a stray keep_with Co-Authored-By: Claude Opus 5.5 --- tests/kernel-cases/surfaces/KNOWN_FAILING | 1 + .../expected.json | 25 +++++ .../recipe.json | 72 +++++++++++++ .../expected.json | 22 ++++ .../recipe.json | 70 ++++++++++++ .../expected.json | 8 ++ .../recipe.json | 79 ++++++++++++++ .../expected.json | 26 +++++ .../recipe.json | 102 ++++++++++++++++++ .../expected.json | 26 +++++ .../recipe.json | 74 +++++++++++++ 11 files changed, 505 insertions(+) create mode 100644 tests/kernel-cases/surfaces/cov-thicken-cylinder-sheet-symmetric-tube/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-thicken-cylinder-sheet-symmetric-tube/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-thicken-square-sheet-into-a-slab/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-thicken-square-sheet-into-a-slab/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-trim-keep-with-without-with-refused/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-trim-keep-with-without-with-refused/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-trim-sheet-by-a-circle-keeps-the-outside/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-trim-sheet-by-a-circle-keeps-the-outside/recipe.json create mode 100644 tests/kernel-cases/surfaces/cov-trim-square-sheet-by-a-plane/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-trim-square-sheet-by-a-plane/recipe.json 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 + ] + } + } + ] +} From 70f695c6ba1d27bea77744c7437af1a66afb2617 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:10:12 -0400 Subject: [PATCH 053/108] Kernel rig: grade construction geometry and the numbers a command replies with A case's construction field names construction points, axes and planes with the point, line or plane each must be, and results reads values out of the commands' own replies by JSON pointer. Co-Authored-By: Claude Opus 5.5 --- apps/solidcraft-cli/src/kernel_cases.rs | 145 +++++++++++++++++++++--- tests/kernel-cases/README.md | 4 + 2 files changed, 135 insertions(+), 14 deletions(-) diff --git a/apps/solidcraft-cli/src/kernel_cases.rs b/apps/solidcraft-cli/src/kernel_cases.rs index 2b6921b88..563294759 100644 --- a/apps/solidcraft-cli/src/kernel_cases.rs +++ b/apps/solidcraft-cli/src/kernel_cases.rs @@ -262,13 +262,13 @@ fn continuity_order( /// matching, an array element by element and as long, a whole number exactly, any other number /// within `rel` of it (relative, at least 1 absolute), anything else equal. `None` where it /// matches; else the path to the first difference with both values. -fn json_mismatch(got: &Value, want: &Value, rel: f64, path: &str) -> Option { +fn json_mismatch(got: &Value, want: &Value, rel: f64, abs: f64, path: &str) -> Option { let differ = || Some(format!("{path}: got {got}, want {want}")); match (got, want) { (_, Value::Object(w)) => { let Value::Object(g) = got else { return differ() }; w.iter().find_map(|(k, wv)| match g.get(k) { - Some(gv) => json_mismatch(gv, wv, rel, &format!("{path}.{k}")), + Some(gv) => json_mismatch(gv, wv, rel, abs, &format!("{path}.{k}")), None => Some(format!("{path}.{k}: missing, want {wv}")), }) } @@ -277,12 +277,12 @@ fn json_mismatch(got: &Value, want: &Value, rel: f64, path: &str) -> Option (got.as_f64() != w.as_f64()).then(differ).flatten(), (_, Value::Number(w)) => { let (g, w) = (got.as_f64(), w.as_f64().unwrap_or(f64::NAN)); - (!g.is_some_and(|g| g.is_finite() && (g - w).abs() <= rel * w.abs().max(1.0))).then(differ).flatten() + (!g.is_some_and(|g| g.is_finite() && (g - w).abs() <= (rel * w.abs().max(1.0)).max(abs))).then(differ).flatten() } _ => (got != want).then(differ).flatten(), } @@ -387,7 +387,9 @@ fn dxf_layers(text: &str) -> Value { /// read and matched as [`json_mismatch`] does: `json` against the file's JSON, `csv` against its /// rows ([`csv_rows`]), `dxf` against its layers ([`dxf_layers`]), a count there exact or an /// inclusive range `[min, max]`. And the `results` check of the commands' own answers: each -/// `{step, json}`, the answer of the `step`th command (from 1) matched against `json`. +/// `{step, pointer?, json, rel?, abs_mm?}`, the answer of the `step`th command (from 1, base +/// commands included), or its part at the JSON `pointer` (RFC 6901), matched against `json`, +/// a number within the entry's `rel` (or the case's) or its `abs_mm`. fn output_checks(c: &mut Checks, want: &Value, out: &str, results: &[Value], rel: f64) { for f in want["files"].as_array().into_iter().flatten() { let path = f["path"].as_str().unwrap_or_default(); @@ -435,15 +437,18 @@ fn output_checks(c: &mut Checks, want: &Value, out: &str, results: &[Value], rel c.push(&what, json!(f), json!("json, csv or dxf"), false); continue; }; - let miss = json_mismatch(&got, &wanted, rel, ""); + let miss = json_mismatch(&got, &wanted, rel, 0.0, ""); c.push(&what, json!(miss.clone().unwrap_or_else(|| "matches".into())), wanted, miss.is_none()); } for r in want["results"].as_array().into_iter().flatten() { let step = r["step"].as_u64().unwrap_or(0); - let what = format!("result of step {step}"); + let pointer = r["pointer"].as_str().unwrap_or(""); + let what = format!("result of step {step}{pointer}"); + let (rel, abs) = (r["rel"].as_f64().unwrap_or(rel), r["abs_mm"].as_f64().unwrap_or(0.0)); let got = step.checked_sub(1).and_then(|i| results.get(i as usize)); - let miss = match got { - Some(g) => json_mismatch(g, &r["json"], rel, ""), + let miss = match got.map(|g| g.pointer(pointer)) { + Some(Some(g)) => json_mismatch(g, &r["json"], rel, abs, ""), + Some(None) => Some(format!("no {pointer} in step {step}'s answer")), None => Some(format!("no step {step} of {}", results.len())), }; c.push(&what, json!(miss.clone().unwrap_or_else(|| "matches".into())), r["json"].clone(), miss.is_none()); @@ -514,6 +519,55 @@ fn splines_match(faces: &[[[u64; 2]; 2]], want: &Value) -> Result<(Value, bool), Ok((json!(got), ok && left.is_empty())) } +/// Largest sine of the angle between a construction's direction (an axis's, a plane's normal) +/// and the case's: either way along it. +const CONSTRUCT_DIR_TOL: f64 = 1e-6; + +/// The `construction` check: each named construction plane, axis or point, as the timeline +/// evaluated it, is the case's: a point within `tol` (mm); an axis whose direction is parallel to +/// `dir` (either way) and whose line passes within `tol` of `through`; a plane whose normal is +/// parallel to `normal` (either way) and which passes within `tol` of `through`. An axis or plane +/// is graded as the line or plane it is, never by the origin it happens to keep. +fn check_construction(s: &solidcraft_engine::Session, want: &Value, tol: f64, c: &mut Checks) { + use solidcraft_engine::geom::Vec3; + use solidcraft_engine::view::{construction_axes, construction_planes, construction_points}; + let Some(named) = want.as_object() else { + c.push("construction", json!("`construction` must map names to {point} | {axis} | {plane}"), json!("an object"), false); + return; + }; + let vec = |v: &Value| v3(v).map(Vec3::from); + let parallel = |a: Vec3, b: Vec3| a.normalized().zip(b.normalized()).is_some_and(|(a, b)| a.cross(b).len() <= CONSTRUCT_DIR_TOL); + for (name, w) in named { + let what = format!("construction {name}"); + let (got, ok) = if let Some(p) = w.get("point").and_then(vec) { + match construction_points(s).into_iter().find(|x| &x.1 == name) { + Some((_, _, q)) => (json!({"point": q}), q.dist(p) <= tol), + None => (json!("no such construction point"), false), + } + } else if let Some((through, dir)) = w.get("axis").and_then(|a| vec(&a["through"]).zip(vec(&a["dir"]))) { + match construction_axes(s).into_iter().find(|x| &x.1 == name) { + Some((_, _, o, d)) => { + let off = d.normalized().map(|u| (through - o) - u * (through - o).dot(u)).map_or(f64::INFINITY, Vec3::len); + (json!({"axis": {"origin": o, "dir": d, "through_off_mm": off}}), parallel(d, dir) && off <= tol) + } + None => (json!("no such construction axis"), false), + } + } else if let Some((through, normal)) = w.get("plane").and_then(|p| vec(&p["through"]).zip(vec(&p["normal"]))) { + match construction_planes(s).into_iter().find(|x| &x.1 == name) { + Some((_, _, pl)) => { + let n = pl.normal(); + let off = n.normalized().map_or(f64::INFINITY, |u| (through - pl.origin).dot(u).abs()); + (json!({"plane": {"origin": pl.origin, "normal": n, "through_off_mm": off}}), parallel(n, normal) && off <= tol) + } + None => (json!("no such construction plane"), false), + } + } else { + (json!("give {point: [x,y,z]}, {axis: {through, dir}} or {plane: {through, normal}}"), false) + }; + c.push(&what, got, w.clone(), ok); + } +} + fn unsupported(e: &str) -> bool { e.contains("not supported yet") } @@ -793,6 +847,11 @@ fn check_case(dir: &str, dumps: Option<&std::path::Path>) -> Value { Err(e) => c.push("splines", json!(e), want["splines"].clone(), false), } } + // With no body and no `bbox` the diagonal is not finite: positions then take ABS_FRAC of 1 mm. + let pos_tol = if abs.is_finite() { abs } else { ABS_FRAC }; + if has("construction") { + check_construction(&s, &want["construction"], pos_tol, &mut c); + } out["status"] = json!(if c.pass { "pass" } else { "fail" }); out["checks"] = json!(c.list); out @@ -904,11 +963,11 @@ mod tests { #[test] fn json_parts_match_within_tolerance_and_whole_numbers_exactly() { let got = json!({"bends": [{"angle_deg": 90.00001, "direction": "up", "count": 3}], "extra": 1}); - assert_eq!(json_mismatch(&got, &json!({"bends": [{"angle_deg": 90.0, "direction": "up"}]}), 1e-3, ""), None); - assert!(json_mismatch(&got, &json!({"bends": [{"count": 4}]}), 1e-3, "").is_some_and(|m| m.contains(".bends[0].count"))); - assert!(json_mismatch(&got, &json!({"bends": []}), 1e-3, "").is_some_and(|m| m.contains("1 items, want 0"))); - assert!(json_mismatch(&got, &json!({"missing": 1}), 1e-3, "").is_some_and(|m| m.contains("missing"))); - assert!(json_mismatch(&got, &json!({"bends": [{"direction": "down"}]}), 1e-3, "").is_some()); + assert_eq!(json_mismatch(&got, &json!({"bends": [{"angle_deg": 90.0, "direction": "up"}]}), 1e-3, 0.0, ""), None); + assert!(json_mismatch(&got, &json!({"bends": [{"count": 4}]}), 1e-3, 0.0, "").is_some_and(|m| m.contains(".bends[0].count"))); + assert!(json_mismatch(&got, &json!({"bends": []}), 1e-3, 0.0, "").is_some_and(|m| m.contains("1 items, want 0"))); + assert!(json_mismatch(&got, &json!({"missing": 1}), 1e-3, 0.0, "").is_some_and(|m| m.contains("missing"))); + assert!(json_mismatch(&got, &json!({"bends": [{"direction": "down"}]}), 1e-3, 0.0, "").is_some()); } #[test] @@ -985,6 +1044,64 @@ mod tests { let _ = std::fs::remove_dir_all(&out); } + #[test] + fn construction_is_graded_as_the_point_line_or_plane_it_is() { + let mut s = solidcraft_engine::Session::default(); + let script = json!({"commands": [ + {"command": "construct.point.three_planes", "params": {"a": "XY", "b": "XZ", "c": "YZ", "name": "Pin"}}, + {"command": "construct.axis.two_planes", "params": {"a": "XZ", "b": "YZ", "name": "Spine"}}, + {"command": "construct.plane.offset", "params": {"base": "XY", "offset": "5 mm", "name": "Shelf"}}, + ]}); + s.run_script(&script).unwrap(); + let grade = |want: Value| { + let mut c = Checks { list: Vec::new(), pass: true }; + check_construction(&s, &want, 1e-3, &mut c); + c.pass + }; + // An axis is its line, either way along it, through any point of it; a plane likewise. + assert!(grade(json!({ + "Pin": {"point": [0, 0, 0]}, + "Spine": {"axis": {"through": [0, 0, 40], "dir": [0, 0, -1]}}, + "Shelf": {"plane": {"through": [7, -3, 5], "normal": [0, 0, 2]}}, + }))); + assert!(!grade(json!({"Pin": {"point": [0, 0, 0.01]}}))); + assert!(!grade(json!({"Spine": {"axis": {"through": [0.01, 0, 0], "dir": [0, 0, 1]}}}))); + assert!(!grade(json!({"Spine": {"axis": {"through": [0, 0, 0], "dir": [0, 0.01, 1]}}}))); + assert!(!grade(json!({"Shelf": {"plane": {"through": [0, 0, 5.01], "normal": [0, 0, 1]}}}))); + assert!(!grade(json!({"Shelf": {"plane": {"through": [0, 0, 5], "normal": [1, 0, 0]}}}))); + // A name the timeline has not got, or of another kind, fails. + assert!(!grade(json!({"Pin": {"plane": {"through": [0, 0, 0], "normal": [0, 0, 1]}}}))); + assert!(!grade(json!({"Nothing": {"point": [0, 0, 0]}}))); + assert!(!grade(json!({"Pin": {"centre": [0, 0, 0]}}))); + } + + #[test] + fn results_are_read_from_each_commands_reply() { + let replies = [json!({"center": [1.0, 2.0, 3.0], "volume": 24000.0}), json!({"summary": {"worst": "g1"}, "count": 1})]; + let grade = |results: Value| { + let mut c = Checks { list: Vec::new(), pass: true }; + output_checks(&mut c, &json!({ "results": results }), "", &replies, 1e-3); + c.pass + }; + assert!(grade(json!([ + {"step": 1, "pointer": "/center", "json": [1.0, 2.0, 3.0]}, + {"step": 1, "pointer": "/volume", "json": 24010.0}, + {"step": 2, "pointer": "/summary/worst", "json": "g1"}, + {"step": 2, "json": {"count": 1}}, + ]))); + assert!(!grade(json!([{"step": 1, "pointer": "/volume", "json": 24100.0}]))); + assert!(grade(json!([{"step": 1, "pointer": "/volume", "json": 24100.0, "rel": 0.01}]))); + assert!(!grade(json!([{"step": 1, "pointer": "/center", "json": [1.0, 2.0, 3.01]}]))); + assert!(grade(json!([{"step": 1, "pointer": "/center", "json": [1.0, 2.0, 3.01], "abs_mm": 0.02}]))); + assert!(!grade(json!([{"step": 2, "pointer": "/summary/worst", "json": "g2"}]))); + // A whole number is exact: a count. + assert!(!grade(json!([{"step": 2, "pointer": "/count", "json": 2}]))); + // A step or a part that is not there fails, as does an entry without a step. + assert!(!grade(json!([{"step": 3, "pointer": "/count", "json": 1}]))); + assert!(!grade(json!([{"step": 2, "pointer": "/missing", "json": null}]))); + assert!(!grade(json!([{"pointer": "/count", "json": 1}]))); + } + #[test] fn a_base_cycle_is_an_error_not_a_hang() { let root = std::env::temp_dir().join(format!("kernel-cases-cycle-{}", std::process::id())); diff --git a/tests/kernel-cases/README.md b/tests/kernel-cases/README.md index fdcb2824d..6ffe10fb4 100644 --- a/tests/kernel-cases/README.md +++ b/tests/kernel-cases/README.md @@ -41,6 +41,8 @@ One directory per area, one per case: `tests/kernel-cases///`. | `frames` (frame members, inserted profiles) | tool coverage | | `plastic` (boss, lip and groove, rest, snap fit, plastic rules) | tool coverage rig | | `surfaces` (every `surface.*` tool: offset, ruled, untrim, unstitch, reverse normal, boundary, blend, match, fair, and a normal and an edge case of each of the others) | surfaces rig | +| `construction` (construction planes, axes and points: `construct.*`) | tool coverage rig | +| `inspect` (the inspect commands that return numbers) | tool coverage rig | Each area also has its gate files: `KNOWN_FAILING` and `PATHS` (see [the gate](#the-kernel-rig-gate)). @@ -106,6 +108,8 @@ the frozen truck-geometry PRs, a `kernel-paused` PR), for the report's coverage | `tolerance` | Optional overrides: `rel`, `abs_mm`, `mesh_mm`, `weld_mm`. | | `files` | The files the case wrote to `$OUT`, each `{path, json \| csv \| dxf}`, matched as a part of what is there: every key the case gives, an array item by item and as long, a whole number exactly, any other number within `rel`. `json`: the file's JSON; `csv`: its rows, as objects keyed by the header row; `dxf`: per layer of its ENTITIES section, how many of each entity (`{"CUT": {"CIRCLE": 1, "ELLIPSE": 0, "length_mm": 31.416}}`; a count may be a range `[min, max]`) and `length_mm`, the total length of its lines, arcs, circles, ellipses and polylines. | | `results` | The commands' own answers, each `{step, json}`: the answer of the `step`th command (from 1) matched as `files` matches JSON (a flat pattern's bends, a rule's values). | +| `construction` | `{name: spec}`, a spec being `{point: [x,y,z]}`, `{axis: {through, dir}}` or `{plane: {through, normal}}`: each named construction point, axis or plane as the timeline evaluated it. A point within the position tolerance (`tolerance.abs_mm`, else 1e-3 of the box diagonal, of 1 mm where there is no body); an axis whose direction is parallel to `dir` (either way, sine of the angle at most 1e-6) and whose line passes within it of `through`; a plane likewise with `normal`. An axis or plane is graded as the line or plane it is, not by the origin it keeps. | +| `results` | `[{command, pointer, value, rel?, abs_mm?}]`: values in the commands' own replies (an inspect command's numbers). The reply of the script's `command`-th command (from 0, base commands included), at the JSON `pointer`, is `value`: a number within the relative tolerance, `[x, y, z]` within the position tolerance, anything else (a string, a bool, null, a list) equal. | | `missing` | A capability SolidCraft has no command or parameter for yet (`"solid.thread has no start count"`): the case is reported **not supported yet** without running, so the gap stays visible. | ## The kernel rig gate From 5c0db8e82509e90a93d8b0974f8a75bfc1a23d49 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:10:12 -0400 Subject: [PATCH 054/108] Kernel rig: the construction area, with what reruns it Co-Authored-By: Claude Opus 5.5 --- tests/kernel-cases/construction/KNOWN_FAILING | 4 ++++ tests/kernel-cases/construction/PATHS | 10 ++++++++++ 2 files changed, 14 insertions(+) create mode 100644 tests/kernel-cases/construction/KNOWN_FAILING create mode 100644 tests/kernel-cases/construction/PATHS diff --git a/tests/kernel-cases/construction/KNOWN_FAILING b/tests/kernel-cases/construction/KNOWN_FAILING new file mode 100644 index 000000000..1a34c42e7 --- /dev/null +++ b/tests/kernel-cases/construction/KNOWN_FAILING @@ -0,0 +1,4 @@ +# The construction cases that fail today, one a line: ` `. Sorted. A run +# with --known-failing fails on a case that fails and is not listed here, and on a listed case +# that passes: a fix removes its line in the same pull request. +# Baseline: rig-cases-construction-inspect 45f69c0e5 with SMLib 60b1c6a, aarch64 Linux. diff --git a/tests/kernel-cases/construction/PATHS b/tests/kernel-cases/construction/PATHS new file mode 100644 index 000000000..cf0265725 --- /dev/null +++ b/tests/kernel-cases/construction/PATHS @@ -0,0 +1,10 @@ +# Source files whose change must rerun the construction area: one git pathspec glob a line. +# The construct.* commands (the plane at an angle and offset plane live in features.rs). +crates/engine/src/cmd/construct.rs +crates/engine/src/cmd/features.rs +# How a construction reference resolves, and the planes the document resolves. +crates/doc/src/construct.rs +crates/doc/src/document.rs +# The constructions as evaluated, which the grader reads. +crates/engine/src/view.rs +tests/kernel-cases/construction/** From ffd3d5fb18437a1d3ec0bd2b720e7008ef3dec5c Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:10:12 -0400 Subject: [PATCH 055/108] Kernel rig: construction cases, an axis on a straight box edge, and a circular edge refused Co-Authored-By: Claude Opus 5.5 --- .../cov-axis-edge-on-a-box-edge/expected.json | 22 +++++++++++++ .../cov-axis-edge-on-a-box-edge/recipe.json | 26 ++++++++++++++++ .../expected.json | 8 +++++ .../recipe.json | 31 +++++++++++++++++++ 4 files changed, 87 insertions(+) create mode 100644 tests/kernel-cases/construction/cov-axis-edge-on-a-box-edge/expected.json create mode 100644 tests/kernel-cases/construction/cov-axis-edge-on-a-box-edge/recipe.json create mode 100644 tests/kernel-cases/construction/cov-axis-edge-refuses-a-circular-edge/expected.json create mode 100644 tests/kernel-cases/construction/cov-axis-edge-refuses-a-circular-edge/recipe.json diff --git a/tests/kernel-cases/construction/cov-axis-edge-on-a-box-edge/expected.json b/tests/kernel-cases/construction/cov-axis-edge-on-a-box-edge/expected.json new file mode 100644 index 000000000..b61cb9349 --- /dev/null +++ b/tests/kernel-cases/construction/cov-axis-edge-on-a-box-edge/expected.json @@ -0,0 +1,22 @@ +{ + "sources": [], + "what": "an axis on the straight top-back edge of a box", + "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 edge at y 30, z 20 runs along X: the line through (0,30,20) along X", + "construction": { + "A": { + "axis": { + "through": [ + 0, + 30, + 20 + ], + "dir": [ + 1, + 0, + 0 + ] + } + } + } +} diff --git a/tests/kernel-cases/construction/cov-axis-edge-on-a-box-edge/recipe.json b/tests/kernel-cases/construction/cov-axis-edge-on-a-box-edge/recipe.json new file mode 100644 index 000000000..56cc1c75d --- /dev/null +++ b/tests/kernel-cases/construction/cov-axis-edge-on-a-box-edge/recipe.json @@ -0,0 +1,26 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 20, + "body_name": "Box" + } + }, + { + "command": "construct.axis.edge", + "params": { + "edge": { + "edge": [ + 20, + 30, + 20 + ] + }, + "name": "A" + } + } + ] +} diff --git a/tests/kernel-cases/construction/cov-axis-edge-refuses-a-circular-edge/expected.json b/tests/kernel-cases/construction/cov-axis-edge-refuses-a-circular-edge/expected.json new file mode 100644 index 000000000..24177397e --- /dev/null +++ b/tests/kernel-cases/construction/cov-axis-edge-refuses-a-circular-edge/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "an axis on a circular edge, which is not straight", + "source": "analytic", + "method": "cylinder r 5, h 10 on (60,0,0) along +Z: its top edge is a circle, no line: refused", + "outcome": "refused", + "refusal": "the edge is not straight" +} diff --git a/tests/kernel-cases/construction/cov-axis-edge-refuses-a-circular-edge/recipe.json b/tests/kernel-cases/construction/cov-axis-edge-refuses-a-circular-edge/recipe.json new file mode 100644 index 000000000..fd4d3c507 --- /dev/null +++ b/tests/kernel-cases/construction/cov-axis-edge-refuses-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.edge", + "params": { + "edge": { + "edge": [ + 65, + 0, + 10 + ] + }, + "name": "A" + } + } + ] +} From 776d979ce115cb74ea619dad855f1303978e8b4b Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:10:12 -0400 Subject: [PATCH 056/108] Kernel rig: construction cases, an axis square to a flat face and to a cylinder through a point, and a point on the axis refused Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 8 ++++ .../recipe.json | 38 +++++++++++++++++++ .../expected.json | 22 +++++++++++ .../recipe.json | 38 +++++++++++++++++++ .../expected.json | 22 +++++++++++ .../recipe.json | 33 ++++++++++++++++ 6 files changed, 161 insertions(+) create mode 100644 tests/kernel-cases/construction/cov-axis-normal-to-a-cylinder-refuses-a-point-on-its-axis/expected.json create mode 100644 tests/kernel-cases/construction/cov-axis-normal-to-a-cylinder-refuses-a-point-on-its-axis/recipe.json create mode 100644 tests/kernel-cases/construction/cov-axis-normal-to-a-cylinder-through-an-outside-point/expected.json create mode 100644 tests/kernel-cases/construction/cov-axis-normal-to-a-cylinder-through-an-outside-point/recipe.json create mode 100644 tests/kernel-cases/construction/cov-axis-normal-to-a-flat-face/expected.json create mode 100644 tests/kernel-cases/construction/cov-axis-normal-to-a-flat-face/recipe.json 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 000000000..37d549807 --- /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 000000000..4b16354ba --- /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 000000000..874e1a597 --- /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 000000000..d242a4a99 --- /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 000000000..5014fa9ca --- /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 000000000..bfee23e78 --- /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" + } + } + ] +} From 84a326f1661753d16aec12240c123fa9f1c655da Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:10:12 -0400 Subject: [PATCH 057/108] Kernel rig: construction cases, the axis of a cylinder, a torus and a circular edge, and a flat face refused Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 22 +++++++++++++ .../recipe.json | 31 +++++++++++++++++++ .../cov-axis-through-a-cylinder/expected.json | 22 +++++++++++++ .../cov-axis-through-a-cylinder/recipe.json | 31 +++++++++++++++++++ .../cov-axis-through-a-torus/expected.json | 22 +++++++++++++ .../cov-axis-through-a-torus/recipe.json | 31 +++++++++++++++++++ .../expected.json | 8 +++++ .../recipe.json | 26 ++++++++++++++++ 8 files changed, 193 insertions(+) create mode 100644 tests/kernel-cases/construction/cov-axis-through-a-circular-edge/expected.json create mode 100644 tests/kernel-cases/construction/cov-axis-through-a-circular-edge/recipe.json create mode 100644 tests/kernel-cases/construction/cov-axis-through-a-cylinder/expected.json create mode 100644 tests/kernel-cases/construction/cov-axis-through-a-cylinder/recipe.json create mode 100644 tests/kernel-cases/construction/cov-axis-through-a-torus/expected.json create mode 100644 tests/kernel-cases/construction/cov-axis-through-a-torus/recipe.json create mode 100644 tests/kernel-cases/construction/cov-axis-through-cylinder-refuses-a-flat-face/expected.json create mode 100644 tests/kernel-cases/construction/cov-axis-through-cylinder-refuses-a-flat-face/recipe.json 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 000000000..a329700ed --- /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 000000000..5f2c5015e --- /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 000000000..cd0d4a3bb --- /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 000000000..016dfd2e0 --- /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 000000000..6bafc9171 --- /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 000000000..5bbf5f1db --- /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 000000000..8e5f5615b --- /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 000000000..2818dbdc8 --- /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" + } + } + ] +} From 17c0aee44835e227b2ad0495049c4d3c80fa2769 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:10:12 -0400 Subject: [PATCH 058/108] Kernel rig: construction cases, the line where two planes meet, square and slanted, and parallel planes refused Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 22 +++++++++++ .../recipe.json | 33 ++++++++++++++++ .../expected.json | 8 ++++ .../recipe.json | 27 +++++++++++++ .../cov-axis-two-planes-slanted/expected.json | 22 +++++++++++ .../cov-axis-two-planes-slanted/recipe.json | 38 +++++++++++++++++++ 6 files changed, 150 insertions(+) create mode 100644 tests/kernel-cases/construction/cov-axis-two-planes-box-top-and-side/expected.json create mode 100644 tests/kernel-cases/construction/cov-axis-two-planes-box-top-and-side/recipe.json create mode 100644 tests/kernel-cases/construction/cov-axis-two-planes-refuses-parallel-planes/expected.json create mode 100644 tests/kernel-cases/construction/cov-axis-two-planes-refuses-parallel-planes/recipe.json create mode 100644 tests/kernel-cases/construction/cov-axis-two-planes-slanted/expected.json create mode 100644 tests/kernel-cases/construction/cov-axis-two-planes-slanted/recipe.json 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 000000000..83f888078 --- /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 000000000..6ed68fc37 --- /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 000000000..adff5fb01 --- /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 000000000..86d4d484f --- /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 000000000..409b8c0da --- /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 000000000..39a4f9c18 --- /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" + } + } + ] +} From f9c53503bd6ae0b166708dd55237936b20d5e451 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:10:12 -0400 Subject: [PATCH 059/108] Kernel rig: construction cases, a plane turned about an axis in it, off it and along its own normal Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 22 +++++++++++++++ .../recipe.json | 13 +++++++++ .../expected.json | 22 +++++++++++++++ .../recipe.json | 28 +++++++++++++++++++ .../expected.json | 22 +++++++++++++++ .../recipe.json | 13 +++++++++ 6 files changed, 120 insertions(+) create mode 100644 tests/kernel-cases/construction/cov-plane-at-angle-about-its-own-normal/expected.json create mode 100644 tests/kernel-cases/construction/cov-plane-at-angle-about-its-own-normal/recipe.json create mode 100644 tests/kernel-cases/construction/cov-plane-at-angle-face-off-the-axis/expected.json create mode 100644 tests/kernel-cases/construction/cov-plane-at-angle-face-off-the-axis/recipe.json create mode 100644 tests/kernel-cases/construction/cov-plane-at-angle-xy-about-x-30/expected.json create mode 100644 tests/kernel-cases/construction/cov-plane-at-angle-xy-about-x-30/recipe.json 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 000000000..9853c7bc7 --- /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 000000000..792827825 --- /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 000000000..78866877d --- /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 000000000..f48a9ef45 --- /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 000000000..d782b770c --- /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 000000000..ca6d54143 --- /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" + } + } + ] +} From e0e3798ae7ff4df57cd29e23a5bb089eb884d290 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:10:12 -0400 Subject: [PATCH 060/108] Kernel rig: construction cases, the midplane of parallel faces, of a corner, and of a plane with itself Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 22 +++++++++++++ .../recipe.json | 27 +++++++++++++++ .../expected.json | 22 +++++++++++++ .../recipe.json | 33 +++++++++++++++++++ .../expected.json | 22 +++++++++++++ .../recipe.json | 12 +++++++ 6 files changed, 138 insertions(+) create mode 100644 tests/kernel-cases/construction/cov-plane-midplane-between-parallel-planes/expected.json create mode 100644 tests/kernel-cases/construction/cov-plane-midplane-between-parallel-planes/recipe.json create mode 100644 tests/kernel-cases/construction/cov-plane-midplane-bisects-a-corner/expected.json create mode 100644 tests/kernel-cases/construction/cov-plane-midplane-bisects-a-corner/recipe.json create mode 100644 tests/kernel-cases/construction/cov-plane-midplane-of-a-plane-with-itself/expected.json create mode 100644 tests/kernel-cases/construction/cov-plane-midplane-of-a-plane-with-itself/recipe.json diff --git a/tests/kernel-cases/construction/cov-plane-midplane-between-parallel-planes/expected.json b/tests/kernel-cases/construction/cov-plane-midplane-between-parallel-planes/expected.json new file mode 100644 index 000000000..16ed5baa5 --- /dev/null +++ b/tests/kernel-cases/construction/cov-plane-midplane-between-parallel-planes/expected.json @@ -0,0 +1,22 @@ +{ + "sources": [], + "what": "the midplane of XY and a box's top", + "source": "analytic", + "method": "box 40 x 30 x 20 with a corner at the origin (x 0..40, y 0..30, z 0..20): halfway between z = 0 and z = 20: z = 10", + "construction": { + "M": { + "plane": { + "through": [ + 5, + 5, + 10 + ], + "normal": [ + 0, + 0, + 1 + ] + } + } + } +} diff --git a/tests/kernel-cases/construction/cov-plane-midplane-between-parallel-planes/recipe.json b/tests/kernel-cases/construction/cov-plane-midplane-between-parallel-planes/recipe.json new file mode 100644 index 000000000..9bf6739be --- /dev/null +++ b/tests/kernel-cases/construction/cov-plane-midplane-between-parallel-planes/recipe.json @@ -0,0 +1,27 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 20, + "body_name": "Box" + } + }, + { + "command": "construct.plane.midplane", + "params": { + "a": "XY", + "b": { + "face": [ + 20, + 15, + 20 + ] + }, + "name": "M" + } + } + ] +} diff --git a/tests/kernel-cases/construction/cov-plane-midplane-bisects-a-corner/expected.json b/tests/kernel-cases/construction/cov-plane-midplane-bisects-a-corner/expected.json new file mode 100644 index 000000000..a80bfa0f8 --- /dev/null +++ b/tests/kernel-cases/construction/cov-plane-midplane-bisects-a-corner/expected.json @@ -0,0 +1,22 @@ +{ + "sources": [], + "what": "the midplane of two box sides meeting at a corner", + "source": "analytic", + "method": "box 40 x 30 x 20 with a corner at the origin (x 0..40, y 0..30, z 0..20): x = 40 and y = 30 meet on the vertical line through (40,30); the plane bisecting the box's 90 deg corner holds (1,1,0) and Z: normal (1,-1,0), through (40,30,0)", + "construction": { + "M": { + "plane": { + "through": [ + 40, + 30, + 0 + ], + "normal": [ + 1, + -1, + 0 + ] + } + } + } +} diff --git a/tests/kernel-cases/construction/cov-plane-midplane-bisects-a-corner/recipe.json b/tests/kernel-cases/construction/cov-plane-midplane-bisects-a-corner/recipe.json new file mode 100644 index 000000000..bc59c6462 --- /dev/null +++ b/tests/kernel-cases/construction/cov-plane-midplane-bisects-a-corner/recipe.json @@ -0,0 +1,33 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 20, + "body_name": "Box" + } + }, + { + "command": "construct.plane.midplane", + "params": { + "a": { + "face": [ + 40, + 15, + 10 + ] + }, + "b": { + "face": [ + 20, + 30, + 10 + ] + }, + "name": "M" + } + } + ] +} diff --git a/tests/kernel-cases/construction/cov-plane-midplane-of-a-plane-with-itself/expected.json b/tests/kernel-cases/construction/cov-plane-midplane-of-a-plane-with-itself/expected.json new file mode 100644 index 000000000..136a388f5 --- /dev/null +++ b/tests/kernel-cases/construction/cov-plane-midplane-of-a-plane-with-itself/expected.json @@ -0,0 +1,22 @@ +{ + "sources": [], + "what": "the midplane of a plane and itself", + "source": "analytic", + "method": "halfway between XY and XY: XY", + "construction": { + "M": { + "plane": { + "through": [ + 0, + 0, + 0 + ], + "normal": [ + 0, + 0, + 1 + ] + } + } + } +} diff --git a/tests/kernel-cases/construction/cov-plane-midplane-of-a-plane-with-itself/recipe.json b/tests/kernel-cases/construction/cov-plane-midplane-of-a-plane-with-itself/recipe.json new file mode 100644 index 000000000..9a0ca7c1d --- /dev/null +++ b/tests/kernel-cases/construction/cov-plane-midplane-of-a-plane-with-itself/recipe.json @@ -0,0 +1,12 @@ +{ + "commands": [ + { + "command": "construct.plane.midplane", + "params": { + "a": "XY", + "b": "XY", + "name": "M" + } + } + ] +} From 3ff1347d90ef64db519a302aea612f3981c683b9 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:10:12 -0400 Subject: [PATCH 061/108] Kernel rig: construction cases, a plane through an edge or axis square to a plane, and a line along the normal refused Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 8 +++++ .../recipe.json | 14 ++++++++ .../expected.json | 22 ++++++++++++ .../recipe.json | 27 +++++++++++++++ .../expected.json | 22 ++++++++++++ .../recipe.json | 34 +++++++++++++++++++ 6 files changed, 127 insertions(+) create mode 100644 tests/kernel-cases/construction/cov-plane-perpendicular-refuses-a-line-square-to-the-plane/expected.json create mode 100644 tests/kernel-cases/construction/cov-plane-perpendicular-refuses-a-line-square-to-the-plane/recipe.json create mode 100644 tests/kernel-cases/construction/cov-plane-perpendicular-through-a-box-edge/expected.json create mode 100644 tests/kernel-cases/construction/cov-plane-perpendicular-through-a-box-edge/recipe.json create mode 100644 tests/kernel-cases/construction/cov-plane-perpendicular-through-a-diagonal-axis/expected.json create mode 100644 tests/kernel-cases/construction/cov-plane-perpendicular-through-a-diagonal-axis/recipe.json diff --git a/tests/kernel-cases/construction/cov-plane-perpendicular-refuses-a-line-square-to-the-plane/expected.json b/tests/kernel-cases/construction/cov-plane-perpendicular-refuses-a-line-square-to-the-plane/expected.json new file mode 100644 index 000000000..576899222 --- /dev/null +++ b/tests/kernel-cases/construction/cov-plane-perpendicular-refuses-a-line-square-to-the-plane/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "a perpendicular plane through the plane's normal", + "source": "analytic", + "method": "the Z axis is square to XY: every plane holding it is perpendicular, so none is the answer: refused", + "outcome": "refused", + "refusal": "the line is square to the plane" +} diff --git a/tests/kernel-cases/construction/cov-plane-perpendicular-refuses-a-line-square-to-the-plane/recipe.json b/tests/kernel-cases/construction/cov-plane-perpendicular-refuses-a-line-square-to-the-plane/recipe.json new file mode 100644 index 000000000..97dbc0bc7 --- /dev/null +++ b/tests/kernel-cases/construction/cov-plane-perpendicular-refuses-a-line-square-to-the-plane/recipe.json @@ -0,0 +1,14 @@ +{ + "commands": [ + { + "command": "construct.plane.perpendicular", + "params": { + "plane": "XY", + "line": { + "axis": "Z" + }, + "name": "P" + } + } + ] +} diff --git a/tests/kernel-cases/construction/cov-plane-perpendicular-through-a-box-edge/expected.json b/tests/kernel-cases/construction/cov-plane-perpendicular-through-a-box-edge/expected.json new file mode 100644 index 000000000..6cd781841 --- /dev/null +++ b/tests/kernel-cases/construction/cov-plane-perpendicular-through-a-box-edge/expected.json @@ -0,0 +1,22 @@ +{ + "sources": [], + "what": "a plane through a box's bottom-front edge square to XY", + "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 edge y 0, z 0 runs along X; holding it and square to XY: normal X x Z = -Y: y = 0", + "construction": { + "P": { + "plane": { + "through": [ + 7, + 0, + 3 + ], + "normal": [ + 0, + 1, + 0 + ] + } + } + } +} diff --git a/tests/kernel-cases/construction/cov-plane-perpendicular-through-a-box-edge/recipe.json b/tests/kernel-cases/construction/cov-plane-perpendicular-through-a-box-edge/recipe.json new file mode 100644 index 000000000..0cb5468c3 --- /dev/null +++ b/tests/kernel-cases/construction/cov-plane-perpendicular-through-a-box-edge/recipe.json @@ -0,0 +1,27 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 20, + "body_name": "Box" + } + }, + { + "command": "construct.plane.perpendicular", + "params": { + "plane": "XY", + "line": { + "edge": [ + 20, + 0, + 0 + ] + }, + "name": "P" + } + } + ] +} diff --git a/tests/kernel-cases/construction/cov-plane-perpendicular-through-a-diagonal-axis/expected.json b/tests/kernel-cases/construction/cov-plane-perpendicular-through-a-diagonal-axis/expected.json new file mode 100644 index 000000000..7e3423ab9 --- /dev/null +++ b/tests/kernel-cases/construction/cov-plane-perpendicular-through-a-diagonal-axis/expected.json @@ -0,0 +1,22 @@ +{ + "sources": [], + "what": "a plane through a diagonal axis in XY, square to XY", + "source": "analytic", + "method": "the axis from (0,0,0) to (10,10,0); square to XY and holding it: normal (1,1,0) x Z = (1,-1,0), through the origin", + "construction": { + "P": { + "plane": { + "through": [ + 5, + 5, + 7 + ], + "normal": [ + 1, + -1, + 0 + ] + } + } + } +} diff --git a/tests/kernel-cases/construction/cov-plane-perpendicular-through-a-diagonal-axis/recipe.json b/tests/kernel-cases/construction/cov-plane-perpendicular-through-a-diagonal-axis/recipe.json new file mode 100644 index 000000000..a42c360c0 --- /dev/null +++ b/tests/kernel-cases/construction/cov-plane-perpendicular-through-a-diagonal-axis/recipe.json @@ -0,0 +1,34 @@ +{ + "commands": [ + { + "command": "construct.axis.two_points", + "params": { + "a": { + "point": [ + 0, + 0, + 0 + ] + }, + "b": { + "point": [ + 10, + 10, + 0 + ] + }, + "name": "D" + } + }, + { + "command": "construct.plane.perpendicular", + "params": { + "plane": "XY", + "line": { + "axis": "D" + }, + "name": "P" + } + } + ] +} From 6fed4f9963f17e1efb0403ef6e9c000454074656 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:10:12 -0400 Subject: [PATCH 062/108] Kernel rig: construction cases, the tangent plane to a cylinder and a sphere, and a point on the axis refused Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 8 +++++ .../recipe.json | 36 +++++++++++++++++++ .../expected.json | 22 ++++++++++++ .../recipe.json | 36 +++++++++++++++++++ .../expected.json | 22 ++++++++++++ .../cov-plane-tangent-to-a-sphere/recipe.json | 35 ++++++++++++++++++ 6 files changed, 159 insertions(+) create mode 100644 tests/kernel-cases/construction/cov-plane-tangent-refuses-a-point-on-the-axis/expected.json create mode 100644 tests/kernel-cases/construction/cov-plane-tangent-refuses-a-point-on-the-axis/recipe.json create mode 100644 tests/kernel-cases/construction/cov-plane-tangent-to-a-cylinder-at-a-point/expected.json create mode 100644 tests/kernel-cases/construction/cov-plane-tangent-to-a-cylinder-at-a-point/recipe.json create mode 100644 tests/kernel-cases/construction/cov-plane-tangent-to-a-sphere/expected.json create mode 100644 tests/kernel-cases/construction/cov-plane-tangent-to-a-sphere/recipe.json diff --git a/tests/kernel-cases/construction/cov-plane-tangent-refuses-a-point-on-the-axis/expected.json b/tests/kernel-cases/construction/cov-plane-tangent-refuses-a-point-on-the-axis/expected.json new file mode 100644 index 000000000..1cc0669a6 --- /dev/null +++ b/tests/kernel-cases/construction/cov-plane-tangent-refuses-a-point-on-the-axis/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "a tangent plane to a cylinder at a point on its axis", + "source": "analytic", + "method": "cylinder r 5, h 10 on (60,0,0) along +Z: (60,0,5) is on the axis, equally far from every line of the side: refused", + "outcome": "refused", + "refusal": "the point is on the face's axis" +} diff --git a/tests/kernel-cases/construction/cov-plane-tangent-refuses-a-point-on-the-axis/recipe.json b/tests/kernel-cases/construction/cov-plane-tangent-refuses-a-point-on-the-axis/recipe.json new file mode 100644 index 000000000..b00fd5446 --- /dev/null +++ b/tests/kernel-cases/construction/cov-plane-tangent-refuses-a-point-on-the-axis/recipe.json @@ -0,0 +1,36 @@ +{ + "commands": [ + { + "command": "solid.cylinder", + "params": { + "base": [ + 60, + 0, + 0 + ], + "radius": 5, + "height": 10, + "body_name": "Cyl", + "operation": "new" + } + }, + { + "command": "construct.plane.tangent", + "params": { + "face": { + "face": [ + 65, + 0, + 5 + ] + }, + "at": [ + 60, + 0, + 5 + ], + "name": "T" + } + } + ] +} diff --git a/tests/kernel-cases/construction/cov-plane-tangent-to-a-cylinder-at-a-point/expected.json b/tests/kernel-cases/construction/cov-plane-tangent-to-a-cylinder-at-a-point/expected.json new file mode 100644 index 000000000..b5815ebea --- /dev/null +++ b/tests/kernel-cases/construction/cov-plane-tangent-to-a-cylinder-at-a-point/expected.json @@ -0,0 +1,22 @@ +{ + "sources": [], + "what": "the tangent plane to a cylinder where a point projects on it", + "source": "analytic", + "method": "cylinder r 5, h 10 on (60,0,0) along +Z: (66,8,5) lies along (0.6,0.8,0) from the axis: it touches at (63,4,5) with normal (0.6,0.8,0)", + "construction": { + "T": { + "plane": { + "through": [ + 63, + 4, + 5 + ], + "normal": [ + 3, + 4, + 0 + ] + } + } + } +} diff --git a/tests/kernel-cases/construction/cov-plane-tangent-to-a-cylinder-at-a-point/recipe.json b/tests/kernel-cases/construction/cov-plane-tangent-to-a-cylinder-at-a-point/recipe.json new file mode 100644 index 000000000..b87038be5 --- /dev/null +++ b/tests/kernel-cases/construction/cov-plane-tangent-to-a-cylinder-at-a-point/recipe.json @@ -0,0 +1,36 @@ +{ + "commands": [ + { + "command": "solid.cylinder", + "params": { + "base": [ + 60, + 0, + 0 + ], + "radius": 5, + "height": 10, + "body_name": "Cyl", + "operation": "new" + } + }, + { + "command": "construct.plane.tangent", + "params": { + "face": { + "face": [ + 65, + 0, + 5 + ] + }, + "at": [ + 66, + 8, + 5 + ], + "name": "T" + } + } + ] +} diff --git a/tests/kernel-cases/construction/cov-plane-tangent-to-a-sphere/expected.json b/tests/kernel-cases/construction/cov-plane-tangent-to-a-sphere/expected.json new file mode 100644 index 000000000..f2fc25418 --- /dev/null +++ b/tests/kernel-cases/construction/cov-plane-tangent-to-a-sphere/expected.json @@ -0,0 +1,22 @@ +{ + "sources": [], + "what": "the tangent plane to a sphere", + "source": "analytic", + "method": "sphere r 5 on (0,0,60); towards (0,3,64), (0,0.6,0.8) from the centre: it touches at (0,3,64) with normal (0,3,4)", + "construction": { + "T": { + "plane": { + "through": [ + 0, + 3, + 64 + ], + "normal": [ + 0, + 3, + 4 + ] + } + } + } +} diff --git a/tests/kernel-cases/construction/cov-plane-tangent-to-a-sphere/recipe.json b/tests/kernel-cases/construction/cov-plane-tangent-to-a-sphere/recipe.json new file mode 100644 index 000000000..886b44f56 --- /dev/null +++ b/tests/kernel-cases/construction/cov-plane-tangent-to-a-sphere/recipe.json @@ -0,0 +1,35 @@ +{ + "commands": [ + { + "command": "solid.sphere", + "params": { + "center": [ + 0, + 0, + 60 + ], + "radius": 5, + "body_name": "Ball", + "operation": "new" + } + }, + { + "command": "construct.plane.tangent", + "params": { + "face": { + "face": [ + 0, + 0, + 65 + ] + }, + "at": [ + 0, + 3, + 64 + ], + "name": "T" + } + } + ] +} From 8be5341c76eed7785274c8e841f9a9dd3359c77d Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:10:12 -0400 Subject: [PATCH 063/108] Kernel rig: construction cases, the plane through three points or vertices, and collinear points refused Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 22 ++++++++++ .../recipe.json | 40 +++++++++++++++++++ .../expected.json | 8 ++++ .../recipe.json | 31 ++++++++++++++ .../expected.json | 22 ++++++++++ .../recipe.json | 31 ++++++++++++++ 6 files changed, 154 insertions(+) create mode 100644 tests/kernel-cases/construction/cov-plane-three-points-on-vertices/expected.json create mode 100644 tests/kernel-cases/construction/cov-plane-three-points-on-vertices/recipe.json create mode 100644 tests/kernel-cases/construction/cov-plane-three-points-refuses-collinear-points/expected.json create mode 100644 tests/kernel-cases/construction/cov-plane-three-points-refuses-collinear-points/recipe.json create mode 100644 tests/kernel-cases/construction/cov-plane-three-points-slanted/expected.json create mode 100644 tests/kernel-cases/construction/cov-plane-three-points-slanted/recipe.json diff --git a/tests/kernel-cases/construction/cov-plane-three-points-on-vertices/expected.json b/tests/kernel-cases/construction/cov-plane-three-points-on-vertices/expected.json new file mode 100644 index 000000000..40867b98a --- /dev/null +++ b/tests/kernel-cases/construction/cov-plane-three-points-on-vertices/expected.json @@ -0,0 +1,22 @@ +{ + "sources": [], + "what": "the plane through three vertices of a box", + "source": "analytic", + "method": "box 40 x 30 x 20 with a corner at the origin (x 0..40, y 0..30, z 0..20): vertices (40,0,0), (0,30,0), (0,0,20): x/40 + y/30 + z/20 = 1, normal (3,4,6)", + "construction": { + "T": { + "plane": { + "through": [ + 40, + 0, + 0 + ], + "normal": [ + 3, + 4, + 6 + ] + } + } + } +} diff --git a/tests/kernel-cases/construction/cov-plane-three-points-on-vertices/recipe.json b/tests/kernel-cases/construction/cov-plane-three-points-on-vertices/recipe.json new file mode 100644 index 000000000..aba452d25 --- /dev/null +++ b/tests/kernel-cases/construction/cov-plane-three-points-on-vertices/recipe.json @@ -0,0 +1,40 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 20, + "body_name": "Box" + } + }, + { + "command": "construct.plane.three_points", + "params": { + "a": { + "vertex": [ + 40, + 0, + 0 + ] + }, + "b": { + "vertex": [ + 0, + 30, + 0 + ] + }, + "c": { + "vertex": [ + 0, + 0, + 20 + ] + }, + "name": "T" + } + } + ] +} diff --git a/tests/kernel-cases/construction/cov-plane-three-points-refuses-collinear-points/expected.json b/tests/kernel-cases/construction/cov-plane-three-points-refuses-collinear-points/expected.json new file mode 100644 index 000000000..4609948c3 --- /dev/null +++ b/tests/kernel-cases/construction/cov-plane-three-points-refuses-collinear-points/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "a plane through three points on one line", + "source": "analytic", + "method": "(0,0,0), (10,10,10), (20,20,20) are on one line: every plane through it holds them: refused", + "outcome": "refused", + "refusal": "the three points are on one line" +} diff --git a/tests/kernel-cases/construction/cov-plane-three-points-refuses-collinear-points/recipe.json b/tests/kernel-cases/construction/cov-plane-three-points-refuses-collinear-points/recipe.json new file mode 100644 index 000000000..45ee58fb7 --- /dev/null +++ b/tests/kernel-cases/construction/cov-plane-three-points-refuses-collinear-points/recipe.json @@ -0,0 +1,31 @@ +{ + "commands": [ + { + "command": "construct.plane.three_points", + "params": { + "a": { + "point": [ + 0, + 0, + 0 + ] + }, + "b": { + "point": [ + 10, + 10, + 10 + ] + }, + "c": { + "point": [ + 20, + 20, + 20 + ] + }, + "name": "T" + } + } + ] +} diff --git a/tests/kernel-cases/construction/cov-plane-three-points-slanted/expected.json b/tests/kernel-cases/construction/cov-plane-three-points-slanted/expected.json new file mode 100644 index 000000000..e729e6ae6 --- /dev/null +++ b/tests/kernel-cases/construction/cov-plane-three-points-slanted/expected.json @@ -0,0 +1,22 @@ +{ + "sources": [], + "what": "the plane through three box corners", + "source": "analytic", + "method": "(0,0,20), (40,0,20), (40,30,0): (40,0,0) x (40,30,-20) = (0,800,1200): normal (0,2,3) through (0,0,20)", + "construction": { + "T": { + "plane": { + "through": [ + 0, + 30, + 0 + ], + "normal": [ + 0, + 2, + 3 + ] + } + } + } +} diff --git a/tests/kernel-cases/construction/cov-plane-three-points-slanted/recipe.json b/tests/kernel-cases/construction/cov-plane-three-points-slanted/recipe.json new file mode 100644 index 000000000..125a6484a --- /dev/null +++ b/tests/kernel-cases/construction/cov-plane-three-points-slanted/recipe.json @@ -0,0 +1,31 @@ +{ + "commands": [ + { + "command": "construct.plane.three_points", + "params": { + "a": { + "point": [ + 0, + 0, + 20 + ] + }, + "b": { + "point": [ + 40, + 0, + 20 + ] + }, + "c": { + "point": [ + 40, + 30, + 0 + ] + }, + "name": "T" + } + } + ] +} From 02ee36ce94a543abaf6821e75bb3d433f30b82db Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:10:12 -0400 Subject: [PATCH 064/108] Kernel rig: construction cases, the plane through parallel and meeting edges, and skew edges refused Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 22 +++++++++++++ .../recipe.json | 33 +++++++++++++++++++ .../expected.json | 22 +++++++++++++ .../recipe.json | 33 +++++++++++++++++++ .../expected.json | 8 +++++ .../recipe.json | 33 +++++++++++++++++++ 6 files changed, 151 insertions(+) create mode 100644 tests/kernel-cases/construction/cov-plane-two-edges-meeting-at-a-corner/expected.json create mode 100644 tests/kernel-cases/construction/cov-plane-two-edges-meeting-at-a-corner/recipe.json create mode 100644 tests/kernel-cases/construction/cov-plane-two-edges-opposite-box-edges/expected.json create mode 100644 tests/kernel-cases/construction/cov-plane-two-edges-opposite-box-edges/recipe.json create mode 100644 tests/kernel-cases/construction/cov-plane-two-edges-refuses-skew-edges/expected.json create mode 100644 tests/kernel-cases/construction/cov-plane-two-edges-refuses-skew-edges/recipe.json diff --git a/tests/kernel-cases/construction/cov-plane-two-edges-meeting-at-a-corner/expected.json b/tests/kernel-cases/construction/cov-plane-two-edges-meeting-at-a-corner/expected.json new file mode 100644 index 000000000..3893d49b6 --- /dev/null +++ b/tests/kernel-cases/construction/cov-plane-two-edges-meeting-at-a-corner/expected.json @@ -0,0 +1,22 @@ +{ + "sources": [], + "what": "the plane through two box edges that meet at a corner", + "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 edges y 0, z 20 (along X) and x 40, z 20 (along Y) meet at (40,0,20): the top, z = 20", + "construction": { + "E": { + "plane": { + "through": [ + 1, + 1, + 20 + ], + "normal": [ + 0, + 0, + 1 + ] + } + } + } +} diff --git a/tests/kernel-cases/construction/cov-plane-two-edges-meeting-at-a-corner/recipe.json b/tests/kernel-cases/construction/cov-plane-two-edges-meeting-at-a-corner/recipe.json new file mode 100644 index 000000000..d8df250e4 --- /dev/null +++ b/tests/kernel-cases/construction/cov-plane-two-edges-meeting-at-a-corner/recipe.json @@ -0,0 +1,33 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 20, + "body_name": "Box" + } + }, + { + "command": "construct.plane.two_edges", + "params": { + "a": { + "edge": [ + 20, + 0, + 20 + ] + }, + "b": { + "edge": [ + 40, + 15, + 20 + ] + }, + "name": "E" + } + } + ] +} diff --git a/tests/kernel-cases/construction/cov-plane-two-edges-opposite-box-edges/expected.json b/tests/kernel-cases/construction/cov-plane-two-edges-opposite-box-edges/expected.json new file mode 100644 index 000000000..1390d905c --- /dev/null +++ b/tests/kernel-cases/construction/cov-plane-two-edges-opposite-box-edges/expected.json @@ -0,0 +1,22 @@ +{ + "sources": [], + "what": "the plane through a box's bottom-front and top-back edges", + "source": "analytic", + "method": "box 40 x 30 x 20 with a corner at the origin (x 0..40, y 0..30, z 0..20): both run along X, through (0,0,0) and (0,30,20): normal X x (0,30,20) = (0,-20,30): the plane 3z = 2y, normal (0,-2,3)", + "construction": { + "E": { + "plane": { + "through": [ + 5, + 30, + 20 + ], + "normal": [ + 0, + -2, + 3 + ] + } + } + } +} diff --git a/tests/kernel-cases/construction/cov-plane-two-edges-opposite-box-edges/recipe.json b/tests/kernel-cases/construction/cov-plane-two-edges-opposite-box-edges/recipe.json new file mode 100644 index 000000000..835d05243 --- /dev/null +++ b/tests/kernel-cases/construction/cov-plane-two-edges-opposite-box-edges/recipe.json @@ -0,0 +1,33 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 20, + "body_name": "Box" + } + }, + { + "command": "construct.plane.two_edges", + "params": { + "a": { + "edge": [ + 20, + 0, + 0 + ] + }, + "b": { + "edge": [ + 20, + 30, + 20 + ] + }, + "name": "E" + } + } + ] +} diff --git a/tests/kernel-cases/construction/cov-plane-two-edges-refuses-skew-edges/expected.json b/tests/kernel-cases/construction/cov-plane-two-edges-refuses-skew-edges/expected.json new file mode 100644 index 000000000..f061ab249 --- /dev/null +++ b/tests/kernel-cases/construction/cov-plane-two-edges-refuses-skew-edges/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "a plane through two skew box edges", + "source": "analytic", + "method": "box 40 x 30 x 20 with a corner at the origin (x 0..40, y 0..30, z 0..20): y 0, z 0 along X and x 40, z 20 along Y never meet and are not parallel: no plane holds both: refused", + "outcome": "refused", + "refusal": "the edges are not in one plane" +} diff --git a/tests/kernel-cases/construction/cov-plane-two-edges-refuses-skew-edges/recipe.json b/tests/kernel-cases/construction/cov-plane-two-edges-refuses-skew-edges/recipe.json new file mode 100644 index 000000000..ef250537b --- /dev/null +++ b/tests/kernel-cases/construction/cov-plane-two-edges-refuses-skew-edges/recipe.json @@ -0,0 +1,33 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 20, + "body_name": "Box" + } + }, + { + "command": "construct.plane.two_edges", + "params": { + "a": { + "edge": [ + 20, + 0, + 0 + ] + }, + "b": { + "edge": [ + 40, + 15, + 20 + ] + }, + "name": "E" + } + } + ] +} From fbe540b40a089d5e6038b6fbae94b2f7fc864927 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:10:12 -0400 Subject: [PATCH 065/108] Kernel rig: construction cases, a point along a sketch line and arc, and one past the end held at the end Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 15 +++++++ .../recipe.json | 43 +++++++++++++++++++ .../expected.json | 15 +++++++ .../recipe.json | 41 ++++++++++++++++++ .../expected.json | 15 +++++++ .../recipe.json | 41 ++++++++++++++++++ 6 files changed, 170 insertions(+) create mode 100644 tests/kernel-cases/construction/cov-point-along-path-a-third-of-an-arc/expected.json create mode 100644 tests/kernel-cases/construction/cov-point-along-path-a-third-of-an-arc/recipe.json create mode 100644 tests/kernel-cases/construction/cov-point-along-path-past-the-end/expected.json create mode 100644 tests/kernel-cases/construction/cov-point-along-path-past-the-end/recipe.json create mode 100644 tests/kernel-cases/construction/cov-point-along-path-quarter-of-a-line/expected.json create mode 100644 tests/kernel-cases/construction/cov-point-along-path-quarter-of-a-line/recipe.json diff --git a/tests/kernel-cases/construction/cov-point-along-path-a-third-of-an-arc/expected.json b/tests/kernel-cases/construction/cov-point-along-path-a-third-of-an-arc/expected.json new file mode 100644 index 000000000..22389d2aa --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-along-path-a-third-of-an-arc/expected.json @@ -0,0 +1,15 @@ +{ + "sources": [], + "what": "a point a third along a quarter-circle arc", + "source": "analytic", + "method": "the arc r 10 about the origin from (10,0) to (0,10) counter-clockwise: a third of its length is 30 deg round: (10 cos 30, 10 sin 30, 0) = (8.6603, 5, 0)", + "construction": { + "P": { + "point": [ + 8.660254037844386, + 5, + 0 + ] + } + } +} diff --git a/tests/kernel-cases/construction/cov-point-along-path-a-third-of-an-arc/recipe.json b/tests/kernel-cases/construction/cov-point-along-path-a-third-of-an-arc/recipe.json new file mode 100644 index 000000000..9da9dd038 --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-along-path-a-third-of-an-arc/recipe.json @@ -0,0 +1,43 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Path" + } + }, + { + "command": "sketch.arc.center_point", + "params": { + "center": [ + 0, + 0 + ], + "start": [ + 10, + 0 + ], + "end": [ + 0, + 10 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "construct.point.along_path", + "params": { + "path": { + "sketch": "Path", + "curve": "a1" + }, + "t": "1/3", + "name": "P" + } + } + ] +} diff --git a/tests/kernel-cases/construction/cov-point-along-path-past-the-end/expected.json b/tests/kernel-cases/construction/cov-point-along-path-past-the-end/expected.json new file mode 100644 index 000000000..bc40d5224 --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-along-path-past-the-end/expected.json @@ -0,0 +1,15 @@ +{ + "sources": [], + "what": "a point at t 1.5, past the end of a sketch line", + "source": "analytic", + "method": "t runs 0..1 along the path; a point along it can go no further than its end: (40,0,0)", + "construction": { + "P": { + "point": [ + 40, + 0, + 0 + ] + } + } +} diff --git a/tests/kernel-cases/construction/cov-point-along-path-past-the-end/recipe.json b/tests/kernel-cases/construction/cov-point-along-path-past-the-end/recipe.json new file mode 100644 index 000000000..d306d3ddb --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-along-path-past-the-end/recipe.json @@ -0,0 +1,41 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Path" + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 0, + 0 + ], + [ + 40, + 0 + ] + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "construct.point.along_path", + "params": { + "path": { + "sketch": "Path", + "curve": "l1" + }, + "t": 1.5, + "name": "P" + } + } + ] +} diff --git a/tests/kernel-cases/construction/cov-point-along-path-quarter-of-a-line/expected.json b/tests/kernel-cases/construction/cov-point-along-path-quarter-of-a-line/expected.json new file mode 100644 index 000000000..6d5d35143 --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-along-path-quarter-of-a-line/expected.json @@ -0,0 +1,15 @@ +{ + "sources": [], + "what": "a point a quarter along a sketch line", + "source": "analytic", + "method": "the line l1 from (0,0,0) to (40,0,0): t 0.25 is (10,0,0)", + "construction": { + "P": { + "point": [ + 10, + 0, + 0 + ] + } + } +} diff --git a/tests/kernel-cases/construction/cov-point-along-path-quarter-of-a-line/recipe.json b/tests/kernel-cases/construction/cov-point-along-path-quarter-of-a-line/recipe.json new file mode 100644 index 000000000..8485a9ee4 --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-along-path-quarter-of-a-line/recipe.json @@ -0,0 +1,41 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Path" + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 0, + 0 + ], + [ + 40, + 0 + ] + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "construct.point.along_path", + "params": { + "path": { + "sketch": "Path", + "curve": "l1" + }, + "t": 0.25, + "name": "P" + } + } + ] +} From a0bd94f4d879ea3109e1224416118700390d5bbf Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:10:12 -0400 Subject: [PATCH 066/108] Kernel rig: construction cases, the centre of a circular edge, sphere, torus and sketch arc, and a flat face refused Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 15 +++++++ .../recipe.json | 31 ++++++++++++++ .../expected.json | 15 +++++++ .../recipe.json | 42 +++++++++++++++++++ .../expected.json | 15 +++++++ .../cov-point-center-of-a-sphere/recipe.json | 30 +++++++++++++ .../cov-point-center-of-a-torus/expected.json | 15 +++++++ .../cov-point-center-of-a-torus/recipe.json | 31 ++++++++++++++ .../expected.json | 8 ++++ .../recipe.json | 26 ++++++++++++ 10 files changed, 228 insertions(+) create mode 100644 tests/kernel-cases/construction/cov-point-center-of-a-circular-edge/expected.json create mode 100644 tests/kernel-cases/construction/cov-point-center-of-a-circular-edge/recipe.json create mode 100644 tests/kernel-cases/construction/cov-point-center-of-a-sketch-arc/expected.json create mode 100644 tests/kernel-cases/construction/cov-point-center-of-a-sketch-arc/recipe.json create mode 100644 tests/kernel-cases/construction/cov-point-center-of-a-sphere/expected.json create mode 100644 tests/kernel-cases/construction/cov-point-center-of-a-sphere/recipe.json create mode 100644 tests/kernel-cases/construction/cov-point-center-of-a-torus/expected.json create mode 100644 tests/kernel-cases/construction/cov-point-center-of-a-torus/recipe.json create mode 100644 tests/kernel-cases/construction/cov-point-center-refuses-a-flat-face/expected.json create mode 100644 tests/kernel-cases/construction/cov-point-center-refuses-a-flat-face/recipe.json diff --git a/tests/kernel-cases/construction/cov-point-center-of-a-circular-edge/expected.json b/tests/kernel-cases/construction/cov-point-center-of-a-circular-edge/expected.json new file mode 100644 index 000000000..bbf8b272b --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-center-of-a-circular-edge/expected.json @@ -0,0 +1,15 @@ +{ + "sources": [], + "what": "the centre of a cylinder's top edge", + "source": "analytic", + "method": "cylinder r 5, h 10 on (60,0,0) along +Z: its top edge is the circle about (60,0,10)", + "construction": { + "C": { + "point": [ + 60, + 0, + 10 + ] + } + } +} diff --git a/tests/kernel-cases/construction/cov-point-center-of-a-circular-edge/recipe.json b/tests/kernel-cases/construction/cov-point-center-of-a-circular-edge/recipe.json new file mode 100644 index 000000000..e1be1b86e --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-center-of-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.point.center", + "params": { + "of": { + "edge": [ + 65, + 0, + 10 + ] + }, + "name": "C" + } + } + ] +} diff --git a/tests/kernel-cases/construction/cov-point-center-of-a-sketch-arc/expected.json b/tests/kernel-cases/construction/cov-point-center-of-a-sketch-arc/expected.json new file mode 100644 index 000000000..1f8fb4038 --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-center-of-a-sketch-arc/expected.json @@ -0,0 +1,15 @@ +{ + "sources": [], + "what": "the centre of a sketch arc", + "source": "analytic", + "method": "the arc r 10 about the sketch origin on XY", + "construction": { + "C": { + "point": [ + 0, + 0, + 0 + ] + } + } +} diff --git a/tests/kernel-cases/construction/cov-point-center-of-a-sketch-arc/recipe.json b/tests/kernel-cases/construction/cov-point-center-of-a-sketch-arc/recipe.json new file mode 100644 index 000000000..fa61edc8e --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-center-of-a-sketch-arc/recipe.json @@ -0,0 +1,42 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Path" + } + }, + { + "command": "sketch.arc.center_point", + "params": { + "center": [ + 0, + 0 + ], + "start": [ + 10, + 0 + ], + "end": [ + 0, + 10 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "construct.point.center", + "params": { + "of": { + "sketch": "Path", + "curve": "a1" + }, + "name": "C" + } + } + ] +} diff --git a/tests/kernel-cases/construction/cov-point-center-of-a-sphere/expected.json b/tests/kernel-cases/construction/cov-point-center-of-a-sphere/expected.json new file mode 100644 index 000000000..f218862ca --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-center-of-a-sphere/expected.json @@ -0,0 +1,15 @@ +{ + "sources": [], + "what": "the centre of a sphere", + "source": "analytic", + "method": "sphere r 5 on (0,0,60)", + "construction": { + "C": { + "point": [ + 0, + 0, + 60 + ] + } + } +} diff --git a/tests/kernel-cases/construction/cov-point-center-of-a-sphere/recipe.json b/tests/kernel-cases/construction/cov-point-center-of-a-sphere/recipe.json new file mode 100644 index 000000000..4e4fff0eb --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-center-of-a-sphere/recipe.json @@ -0,0 +1,30 @@ +{ + "commands": [ + { + "command": "solid.sphere", + "params": { + "center": [ + 0, + 0, + 60 + ], + "radius": 5, + "body_name": "Ball", + "operation": "new" + } + }, + { + "command": "construct.point.center", + "params": { + "of": { + "face": [ + 5, + 0, + 60 + ] + }, + "name": "C" + } + } + ] +} diff --git a/tests/kernel-cases/construction/cov-point-center-of-a-torus/expected.json b/tests/kernel-cases/construction/cov-point-center-of-a-torus/expected.json new file mode 100644 index 000000000..52b8edc91 --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-center-of-a-torus/expected.json @@ -0,0 +1,15 @@ +{ + "sources": [], + "what": "the centre of a torus", + "source": "analytic", + "method": "torus major 10, minor 2 on (0,60,0)", + "construction": { + "C": { + "point": [ + 0, + 60, + 0 + ] + } + } +} diff --git a/tests/kernel-cases/construction/cov-point-center-of-a-torus/recipe.json b/tests/kernel-cases/construction/cov-point-center-of-a-torus/recipe.json new file mode 100644 index 000000000..038b06c31 --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-center-of-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.point.center", + "params": { + "of": { + "face": [ + 12, + 60, + 0 + ] + }, + "name": "C" + } + } + ] +} diff --git a/tests/kernel-cases/construction/cov-point-center-refuses-a-flat-face/expected.json b/tests/kernel-cases/construction/cov-point-center-refuses-a-flat-face/expected.json new file mode 100644 index 000000000..8540d8fc9 --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-center-refuses-a-flat-face/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "the centre of 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, not a sphere or torus: refused", + "outcome": "refused", + "refusal": "the face is not a sphere or torus" +} diff --git a/tests/kernel-cases/construction/cov-point-center-refuses-a-flat-face/recipe.json b/tests/kernel-cases/construction/cov-point-center-refuses-a-flat-face/recipe.json new file mode 100644 index 000000000..5a67ef954 --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-center-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.point.center", + "params": { + "of": { + "face": [ + 20, + 15, + 20 + ] + }, + "name": "C" + } + } + ] +} From 8a8960f1311abe2033ab3847a5017bbeb1a9667c Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:10:12 -0400 Subject: [PATCH 067/108] Kernel rig: construction cases, where an edge crosses a square and a slanted plane, and a parallel edge refused Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 8 ++++ .../recipe.json | 40 +++++++++++++++++++ .../expected.json | 15 +++++++ .../recipe.json | 40 +++++++++++++++++++ .../expected.json | 15 +++++++ .../recipe.json | 40 +++++++++++++++++++ 6 files changed, 158 insertions(+) create mode 100644 tests/kernel-cases/construction/cov-point-edge-plane-refuses-a-parallel-edge/expected.json create mode 100644 tests/kernel-cases/construction/cov-point-edge-plane-refuses-a-parallel-edge/recipe.json create mode 100644 tests/kernel-cases/construction/cov-point-edge-plane-slanted-plane/expected.json create mode 100644 tests/kernel-cases/construction/cov-point-edge-plane-slanted-plane/recipe.json create mode 100644 tests/kernel-cases/construction/cov-point-edge-plane-square-cut/expected.json create mode 100644 tests/kernel-cases/construction/cov-point-edge-plane-square-cut/recipe.json diff --git a/tests/kernel-cases/construction/cov-point-edge-plane-refuses-a-parallel-edge/expected.json b/tests/kernel-cases/construction/cov-point-edge-plane-refuses-a-parallel-edge/expected.json new file mode 100644 index 000000000..3e1637162 --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-edge-plane-refuses-a-parallel-edge/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "a box edge parallel to the plane", + "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 edge y 0, z 0 along X never crosses y = 10: refused", + "outcome": "refused", + "refusal": "the edge is parallel to the plane" +} diff --git a/tests/kernel-cases/construction/cov-point-edge-plane-refuses-a-parallel-edge/recipe.json b/tests/kernel-cases/construction/cov-point-edge-plane-refuses-a-parallel-edge/recipe.json new file mode 100644 index 000000000..583e098ee --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-edge-plane-refuses-a-parallel-edge/recipe.json @@ -0,0 +1,40 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 20, + "body_name": "Box" + } + }, + { + "command": "construct.point.edge_plane", + "params": { + "edge": { + "edge": [ + 20, + 0, + 0 + ] + }, + "plane": { + "plane": { + "origin": [ + 0, + 10, + 0 + ], + "normal": [ + 0, + 1, + 0 + ] + } + }, + "name": "P" + } + } + ] +} diff --git a/tests/kernel-cases/construction/cov-point-edge-plane-slanted-plane/expected.json b/tests/kernel-cases/construction/cov-point-edge-plane-slanted-plane/expected.json new file mode 100644 index 000000000..a59f3ba13 --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-edge-plane-slanted-plane/expected.json @@ -0,0 +1,15 @@ +{ + "sources": [], + "what": "where a box's vertical edge crosses a slanted plane", + "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 edge x 0, y 0 along Z meets x + z = 15 at (0,0,15)", + "construction": { + "P": { + "point": [ + 0, + 0, + 15 + ] + } + } +} diff --git a/tests/kernel-cases/construction/cov-point-edge-plane-slanted-plane/recipe.json b/tests/kernel-cases/construction/cov-point-edge-plane-slanted-plane/recipe.json new file mode 100644 index 000000000..86187bdc9 --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-edge-plane-slanted-plane/recipe.json @@ -0,0 +1,40 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 20, + "body_name": "Box" + } + }, + { + "command": "construct.point.edge_plane", + "params": { + "edge": { + "edge": [ + 0, + 0, + 10 + ] + }, + "plane": { + "plane": { + "origin": [ + 0, + 0, + 15 + ], + "normal": [ + 1, + 0, + 1 + ] + } + }, + "name": "P" + } + } + ] +} diff --git a/tests/kernel-cases/construction/cov-point-edge-plane-square-cut/expected.json b/tests/kernel-cases/construction/cov-point-edge-plane-square-cut/expected.json new file mode 100644 index 000000000..73dc50567 --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-edge-plane-square-cut/expected.json @@ -0,0 +1,15 @@ +{ + "sources": [], + "what": "where a box edge crosses a plane square to 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 edge y 0, z 0 along X meets x = 12 at (12,0,0)", + "construction": { + "P": { + "point": [ + 12, + 0, + 0 + ] + } + } +} diff --git a/tests/kernel-cases/construction/cov-point-edge-plane-square-cut/recipe.json b/tests/kernel-cases/construction/cov-point-edge-plane-square-cut/recipe.json new file mode 100644 index 000000000..bff7913af --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-edge-plane-square-cut/recipe.json @@ -0,0 +1,40 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 20, + "body_name": "Box" + } + }, + { + "command": "construct.point.edge_plane", + "params": { + "edge": { + "edge": [ + 20, + 0, + 0 + ] + }, + "plane": { + "plane": { + "origin": [ + 12, + 0, + 0 + ], + "normal": [ + 1, + 0, + 0 + ] + } + }, + "name": "P" + } + } + ] +} From 1ac12ba7259892dad30235aea95ae0962505b8d2 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:10:12 -0400 Subject: [PATCH 068/108] Kernel rig: construction cases, where three planes meet, and parallel planes or planes through one line refused Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 15 ++++++ .../recipe.json | 40 ++++++++++++++ .../expected.json | 8 +++ .../recipe.json | 26 ++++++++++ .../expected.json | 8 +++ .../recipe.json | 26 ++++++++++ .../expected.json | 15 ++++++ .../recipe.json | 52 +++++++++++++++++++ 8 files changed, 190 insertions(+) create mode 100644 tests/kernel-cases/construction/cov-point-three-planes-box-corner/expected.json create mode 100644 tests/kernel-cases/construction/cov-point-three-planes-box-corner/recipe.json create mode 100644 tests/kernel-cases/construction/cov-point-three-planes-refuses-planes-through-one-line/expected.json create mode 100644 tests/kernel-cases/construction/cov-point-three-planes-refuses-planes-through-one-line/recipe.json create mode 100644 tests/kernel-cases/construction/cov-point-three-planes-refuses-two-parallel/expected.json create mode 100644 tests/kernel-cases/construction/cov-point-three-planes-refuses-two-parallel/recipe.json create mode 100644 tests/kernel-cases/construction/cov-point-three-planes-slanted/expected.json create mode 100644 tests/kernel-cases/construction/cov-point-three-planes-slanted/recipe.json diff --git a/tests/kernel-cases/construction/cov-point-three-planes-box-corner/expected.json b/tests/kernel-cases/construction/cov-point-three-planes-box-corner/expected.json new file mode 100644 index 000000000..9d4a2d485 --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-three-planes-box-corner/expected.json @@ -0,0 +1,15 @@ +{ + "sources": [], + "what": "the corner where three box faces 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): x = 40, y = 30, z = 20 meet at (40,30,20)", + "construction": { + "P": { + "point": [ + 40, + 30, + 20 + ] + } + } +} diff --git a/tests/kernel-cases/construction/cov-point-three-planes-box-corner/recipe.json b/tests/kernel-cases/construction/cov-point-three-planes-box-corner/recipe.json new file mode 100644 index 000000000..c68c37c7e --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-three-planes-box-corner/recipe.json @@ -0,0 +1,40 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 20, + "body_name": "Box" + } + }, + { + "command": "construct.point.three_planes", + "params": { + "a": { + "face": [ + 40, + 15, + 10 + ] + }, + "b": { + "face": [ + 20, + 30, + 10 + ] + }, + "c": { + "face": [ + 20, + 15, + 20 + ] + }, + "name": "P" + } + } + ] +} diff --git a/tests/kernel-cases/construction/cov-point-three-planes-refuses-planes-through-one-line/expected.json b/tests/kernel-cases/construction/cov-point-three-planes-refuses-planes-through-one-line/expected.json new file mode 100644 index 000000000..0a91a58fb --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-three-planes-refuses-planes-through-one-line/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "three planes sharing one line", + "source": "analytic", + "method": "XZ, YZ and x = y all hold the Z axis: they meet in a line, not a point: refused", + "outcome": "refused", + "refusal": "the planes don't meet in a point" +} diff --git a/tests/kernel-cases/construction/cov-point-three-planes-refuses-planes-through-one-line/recipe.json b/tests/kernel-cases/construction/cov-point-three-planes-refuses-planes-through-one-line/recipe.json new file mode 100644 index 000000000..4a292904d --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-three-planes-refuses-planes-through-one-line/recipe.json @@ -0,0 +1,26 @@ +{ + "commands": [ + { + "command": "construct.point.three_planes", + "params": { + "a": "XZ", + "b": "YZ", + "c": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "normal": [ + 1, + -1, + 0 + ] + } + }, + "name": "P" + } + } + ] +} diff --git a/tests/kernel-cases/construction/cov-point-three-planes-refuses-two-parallel/expected.json b/tests/kernel-cases/construction/cov-point-three-planes-refuses-two-parallel/expected.json new file mode 100644 index 000000000..08cbc8b1d --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-three-planes-refuses-two-parallel/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "three planes, two of them parallel", + "source": "analytic", + "method": "XY and z = 5 are parallel: refused", + "outcome": "refused", + "refusal": "two of the planes are parallel" +} diff --git a/tests/kernel-cases/construction/cov-point-three-planes-refuses-two-parallel/recipe.json b/tests/kernel-cases/construction/cov-point-three-planes-refuses-two-parallel/recipe.json new file mode 100644 index 000000000..e940988a6 --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-three-planes-refuses-two-parallel/recipe.json @@ -0,0 +1,26 @@ +{ + "commands": [ + { + "command": "construct.point.three_planes", + "params": { + "a": "XY", + "b": { + "plane": { + "origin": [ + 0, + 0, + 5 + ], + "normal": [ + 0, + 0, + 1 + ] + } + }, + "c": "YZ", + "name": "P" + } + } + ] +} diff --git a/tests/kernel-cases/construction/cov-point-three-planes-slanted/expected.json b/tests/kernel-cases/construction/cov-point-three-planes-slanted/expected.json new file mode 100644 index 000000000..6310b62e2 --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-three-planes-slanted/expected.json @@ -0,0 +1,15 @@ +{ + "sources": [], + "what": "the point where three slanted planes meet", + "source": "analytic", + "method": "x + y = 10, y + z = 6, x + z = 8: adding, x + y + z = 12, so (6,4,2)", + "construction": { + "P": { + "point": [ + 6, + 4, + 2 + ] + } + } +} diff --git a/tests/kernel-cases/construction/cov-point-three-planes-slanted/recipe.json b/tests/kernel-cases/construction/cov-point-three-planes-slanted/recipe.json new file mode 100644 index 000000000..341c35bdc --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-three-planes-slanted/recipe.json @@ -0,0 +1,52 @@ +{ + "commands": [ + { + "command": "construct.point.three_planes", + "params": { + "a": { + "plane": { + "origin": [ + 10, + 0, + 0 + ], + "normal": [ + 1, + 1, + 0 + ] + } + }, + "b": { + "plane": { + "origin": [ + 0, + 0, + 6 + ], + "normal": [ + 0, + 1, + 1 + ] + } + }, + "c": { + "plane": { + "origin": [ + 0, + 0, + 8 + ], + "normal": [ + 1, + 0, + 1 + ] + } + }, + "name": "P" + } + } + ] +} From f721088956ed11a558110177ba08a66a8d77a29b Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:10:12 -0400 Subject: [PATCH 069/108] Kernel rig: construction cases, where two edges meet or come closest, and parallel edges refused Co-Authored-By: Claude Opus 5.5 --- .../cov-point-two-edges-meeting/expected.json | 15 +++++++++ .../cov-point-two-edges-meeting/recipe.json | 33 +++++++++++++++++++ .../expected.json | 8 +++++ .../recipe.json | 33 +++++++++++++++++++ .../cov-point-two-edges-skew/expected.json | 15 +++++++++ .../cov-point-two-edges-skew/recipe.json | 33 +++++++++++++++++++ 6 files changed, 137 insertions(+) create mode 100644 tests/kernel-cases/construction/cov-point-two-edges-meeting/expected.json create mode 100644 tests/kernel-cases/construction/cov-point-two-edges-meeting/recipe.json create mode 100644 tests/kernel-cases/construction/cov-point-two-edges-refuses-parallel-edges/expected.json create mode 100644 tests/kernel-cases/construction/cov-point-two-edges-refuses-parallel-edges/recipe.json create mode 100644 tests/kernel-cases/construction/cov-point-two-edges-skew/expected.json create mode 100644 tests/kernel-cases/construction/cov-point-two-edges-skew/recipe.json diff --git a/tests/kernel-cases/construction/cov-point-two-edges-meeting/expected.json b/tests/kernel-cases/construction/cov-point-two-edges-meeting/expected.json new file mode 100644 index 000000000..05654a3f5 --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-two-edges-meeting/expected.json @@ -0,0 +1,15 @@ +{ + "sources": [], + "what": "where two box edges 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): y 0, z 0 along X and x 40, z 0 along Y meet at (40,0,0)", + "construction": { + "P": { + "point": [ + 40, + 0, + 0 + ] + } + } +} diff --git a/tests/kernel-cases/construction/cov-point-two-edges-meeting/recipe.json b/tests/kernel-cases/construction/cov-point-two-edges-meeting/recipe.json new file mode 100644 index 000000000..f20ad54c8 --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-two-edges-meeting/recipe.json @@ -0,0 +1,33 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 20, + "body_name": "Box" + } + }, + { + "command": "construct.point.two_edges", + "params": { + "a": { + "edge": [ + 20, + 0, + 0 + ] + }, + "b": { + "edge": [ + 40, + 15, + 0 + ] + }, + "name": "P" + } + } + ] +} diff --git a/tests/kernel-cases/construction/cov-point-two-edges-refuses-parallel-edges/expected.json b/tests/kernel-cases/construction/cov-point-two-edges-refuses-parallel-edges/expected.json new file mode 100644 index 000000000..c24f3e9dc --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-two-edges-refuses-parallel-edges/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "two parallel box edges", + "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 edges y 0, z 0 and y 30, z 0 both run along X: they never meet nor have one closest point: refused", + "outcome": "refused", + "refusal": "the edges are parallel" +} diff --git a/tests/kernel-cases/construction/cov-point-two-edges-refuses-parallel-edges/recipe.json b/tests/kernel-cases/construction/cov-point-two-edges-refuses-parallel-edges/recipe.json new file mode 100644 index 000000000..bae734072 --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-two-edges-refuses-parallel-edges/recipe.json @@ -0,0 +1,33 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 20, + "body_name": "Box" + } + }, + { + "command": "construct.point.two_edges", + "params": { + "a": { + "edge": [ + 20, + 0, + 0 + ] + }, + "b": { + "edge": [ + 20, + 30, + 0 + ] + }, + "name": "P" + } + } + ] +} diff --git a/tests/kernel-cases/construction/cov-point-two-edges-skew/expected.json b/tests/kernel-cases/construction/cov-point-two-edges-skew/expected.json new file mode 100644 index 000000000..a093eabec --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-two-edges-skew/expected.json @@ -0,0 +1,15 @@ +{ + "sources": [], + "what": "where two skew box edges come closest", + "source": "analytic", + "method": "box 40 x 30 x 20 with a corner at the origin (x 0..40, y 0..30, z 0..20): y 0, z 0 along X and x 40, z 20 along Y come closest at (40,0,0) and (40,0,20): the point halfway between, (40,0,10)", + "construction": { + "P": { + "point": [ + 40, + 0, + 10 + ] + } + } +} diff --git a/tests/kernel-cases/construction/cov-point-two-edges-skew/recipe.json b/tests/kernel-cases/construction/cov-point-two-edges-skew/recipe.json new file mode 100644 index 000000000..a49a060e7 --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-two-edges-skew/recipe.json @@ -0,0 +1,33 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 20, + "body_name": "Box" + } + }, + { + "command": "construct.point.two_edges", + "params": { + "a": { + "edge": [ + 20, + 0, + 0 + ] + }, + "b": { + "edge": [ + 40, + 15, + 20 + ] + }, + "name": "P" + } + } + ] +} From 1acbf1e9c0e4ae3ddb64e6220c1baf08c448aec4 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:10:12 -0400 Subject: [PATCH 070/108] Kernel rig: construction cases, a point on a vertex or another construction point, and no body refused Co-Authored-By: Claude Opus 5.5 --- .../cov-point-vertex-box-corner/expected.json | 15 +++++++++++ .../cov-point-vertex-box-corner/recipe.json | 26 +++++++++++++++++++ .../expected.json | 15 +++++++++++ .../recipe.json | 22 ++++++++++++++++ .../expected.json | 8 ++++++ .../recipe.json | 17 ++++++++++++ 6 files changed, 103 insertions(+) create mode 100644 tests/kernel-cases/construction/cov-point-vertex-box-corner/expected.json create mode 100644 tests/kernel-cases/construction/cov-point-vertex-box-corner/recipe.json create mode 100644 tests/kernel-cases/construction/cov-point-vertex-of-a-construction-point/expected.json create mode 100644 tests/kernel-cases/construction/cov-point-vertex-of-a-construction-point/recipe.json create mode 100644 tests/kernel-cases/construction/cov-point-vertex-refuses-with-no-body/expected.json create mode 100644 tests/kernel-cases/construction/cov-point-vertex-refuses-with-no-body/recipe.json diff --git a/tests/kernel-cases/construction/cov-point-vertex-box-corner/expected.json b/tests/kernel-cases/construction/cov-point-vertex-box-corner/expected.json new file mode 100644 index 000000000..56d1000fe --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-vertex-box-corner/expected.json @@ -0,0 +1,15 @@ +{ + "sources": [], + "what": "a point on a box's far corner", + "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 vertex nearest (39,29,19) is (40,30,20)", + "construction": { + "P": { + "point": [ + 40, + 30, + 20 + ] + } + } +} diff --git a/tests/kernel-cases/construction/cov-point-vertex-box-corner/recipe.json b/tests/kernel-cases/construction/cov-point-vertex-box-corner/recipe.json new file mode 100644 index 000000000..7a209b200 --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-vertex-box-corner/recipe.json @@ -0,0 +1,26 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 20, + "body_name": "Box" + } + }, + { + "command": "construct.point.vertex", + "params": { + "point": { + "vertex": [ + 39, + 29, + 19 + ] + }, + "name": "P" + } + } + ] +} diff --git a/tests/kernel-cases/construction/cov-point-vertex-of-a-construction-point/expected.json b/tests/kernel-cases/construction/cov-point-vertex-of-a-construction-point/expected.json new file mode 100644 index 000000000..3c4d9bacc --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-vertex-of-a-construction-point/expected.json @@ -0,0 +1,15 @@ +{ + "sources": [], + "what": "a point on another construction point", + "source": "analytic", + "method": "the point where XY, XZ and YZ meet is the origin; a point on it is too", + "construction": { + "P": { + "point": [ + 0, + 0, + 0 + ] + } + } +} diff --git a/tests/kernel-cases/construction/cov-point-vertex-of-a-construction-point/recipe.json b/tests/kernel-cases/construction/cov-point-vertex-of-a-construction-point/recipe.json new file mode 100644 index 000000000..717ca2223 --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-vertex-of-a-construction-point/recipe.json @@ -0,0 +1,22 @@ +{ + "commands": [ + { + "command": "construct.point.three_planes", + "params": { + "a": "XY", + "b": "XZ", + "c": "YZ", + "name": "Pin" + } + }, + { + "command": "construct.point.vertex", + "params": { + "point": { + "construct_point": "Pin" + }, + "name": "P" + } + } + ] +} diff --git a/tests/kernel-cases/construction/cov-point-vertex-refuses-with-no-body/expected.json b/tests/kernel-cases/construction/cov-point-vertex-refuses-with-no-body/expected.json new file mode 100644 index 000000000..17daa1521 --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-vertex-refuses-with-no-body/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "a point on a vertex where there is no body", + "source": "analytic", + "method": "no body, so no vertex to put it on: refused", + "outcome": "refused", + "refusal": "there is no vertex" +} diff --git a/tests/kernel-cases/construction/cov-point-vertex-refuses-with-no-body/recipe.json b/tests/kernel-cases/construction/cov-point-vertex-refuses-with-no-body/recipe.json new file mode 100644 index 000000000..ee8d56f7e --- /dev/null +++ b/tests/kernel-cases/construction/cov-point-vertex-refuses-with-no-body/recipe.json @@ -0,0 +1,17 @@ +{ + "commands": [ + { + "command": "construct.point.vertex", + "params": { + "point": { + "vertex": [ + 1, + 2, + 3 + ] + }, + "name": "P" + } + } + ] +} From 33e3b6379f8f16f7d486450e4b37d56a40f446da Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:10:20 -0400 Subject: [PATCH 071/108] Kernel rig: the inspect area, what reruns it, and the analyses that only draw Co-Authored-By: Claude Opus 5.5 --- tests/kernel-cases/inspect/KNOWN_FAILING | 6 ++++++ tests/kernel-cases/inspect/PATHS | 20 ++++++++++++++++++ tests/kernel-cases/inspect/skipped.json | 26 ++++++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 tests/kernel-cases/inspect/KNOWN_FAILING create mode 100644 tests/kernel-cases/inspect/PATHS create mode 100644 tests/kernel-cases/inspect/skipped.json diff --git a/tests/kernel-cases/inspect/KNOWN_FAILING b/tests/kernel-cases/inspect/KNOWN_FAILING new file mode 100644 index 000000000..4584f2f89 --- /dev/null +++ b/tests/kernel-cases/inspect/KNOWN_FAILING @@ -0,0 +1,6 @@ +# The inspect cases that fail today, one a line: ` `. Sorted. A run +# with --known-failing fails on a case that fails and is not listed here, and on a listed case +# that passes: a fix removes its line in the same pull request. +# Baseline: rig-cases-construction-inspect 45f69c0e5 with SMLib 60b1c6a, aarch64 Linux. +cov-center-of-mass-box-and-cylinder inspect.center_of_mass measures each body's display mesh (b.mesh().measure()), not its exact faces: the cylinder's volume is its chords' 784.13, not 250 pi = 785.40 (1.6e-3 short) +cov-compare-taller-box inspect.compare integrates a region's volume along sampling lines: the 40 x 30 x 5 slab only B has comes out 5976.49, not 6000 (0.4% short) diff --git a/tests/kernel-cases/inspect/PATHS b/tests/kernel-cases/inspect/PATHS new file mode 100644 index 000000000..faec9db6b --- /dev/null +++ b/tests/kernel-cases/inspect/PATHS @@ -0,0 +1,20 @@ +# Source files whose change must rerun the inspect area: one git pathspec glob a line. +# The commands: center of mass, minimum radius, curvature comb and isocurve; continuity and the +# draw-only analyses; interference (registered in joints.rs), clearance and compare. +crates/engine/src/cmd/sketch_inspect.rs +crates/engine/src/cmd/surface_analysis.rs +crates/engine/src/cmd/interference.rs +crates/engine/src/cmd/joints.rs +crates/engine/src/cmd/clearance.rs +crates/engine/src/cmd/compare.rs +crates/engine/src/cmd/inspect.rs +# What they measure with: the comparison of two surfaces, a face's isocurves, seam continuity, +# body distance and mass properties. +crates/geom/src/compare.rs +crates/doc/src/eval.rs +crates/kernel/src/iso.rs +crates/kernel/src/continuity.rs +crates/kernel/src/continuity_order.rs +crates/kernel/src/distance.rs +crates/kernel/src/measure.rs +tests/kernel-cases/inspect/** diff --git a/tests/kernel-cases/inspect/skipped.json b/tests/kernel-cases/inspect/skipped.json new file mode 100644 index 000000000..5c5ef00d3 --- /dev/null +++ b/tests/kernel-cases/inspect/skipped.json @@ -0,0 +1,26 @@ +[ + { + "source": "inspect.accessibility", + "why": "draws only: shades the faces a tool from one direction can reach; returns the analysis it set, no numbers" + }, + { + "source": "inspect.curvature_map", + "why": "draws only: shades the faces by curvature; returns the analysis it set (its radius), no measurement" + }, + { + "source": "inspect.draft", + "why": "draws only: shades the faces by draft against the pull direction; returns the pull and angle it was given, no face's draft angle" + }, + { + "source": "inspect.environment_map", + "why": "draws only: a reflection shading; returns the analysis it set" + }, + { + "source": "inspect.section", + "why": "draws only: shows the cut on a plane; returns the plane it was given (origin, normal, axis, at), no section area or outline" + }, + { + "source": "inspect.zebra", + "why": "draws only: zebra stripes; returns the analysis it set (its stripe count)" + } +] From cacc394f91b288ed5e3cf01b8a2f53ad9186f11a Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:10:20 -0400 Subject: [PATCH 072/108] Kernel rig: inspect cases, the centre of mass and volume of a box, of a box and cylinder, and an unknown body refused Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 36 +++++++++++++++++++ .../recipe.json | 32 +++++++++++++++++ .../cov-center-of-mass-box/expected.json | 22 ++++++++++++ .../cov-center-of-mass-box/recipe.json | 18 ++++++++++ .../expected.json | 8 +++++ .../recipe.json | 22 ++++++++++++ 6 files changed, 138 insertions(+) create mode 100644 tests/kernel-cases/inspect/cov-center-of-mass-box-and-cylinder/expected.json create mode 100644 tests/kernel-cases/inspect/cov-center-of-mass-box-and-cylinder/recipe.json create mode 100644 tests/kernel-cases/inspect/cov-center-of-mass-box/expected.json create mode 100644 tests/kernel-cases/inspect/cov-center-of-mass-box/recipe.json create mode 100644 tests/kernel-cases/inspect/cov-center-of-mass-refuses-an-unknown-body/expected.json create mode 100644 tests/kernel-cases/inspect/cov-center-of-mass-refuses-an-unknown-body/recipe.json diff --git a/tests/kernel-cases/inspect/cov-center-of-mass-box-and-cylinder/expected.json b/tests/kernel-cases/inspect/cov-center-of-mass-box-and-cylinder/expected.json new file mode 100644 index 000000000..ba0e92e09 --- /dev/null +++ b/tests/kernel-cases/inspect/cov-center-of-mass-box-and-cylinder/expected.json @@ -0,0 +1,36 @@ +{ + "sources": [], + "what": "the centre of mass of a box and a cylinder together", + "source": "analytic", + "method": "box 40 x 30 x 20 with a corner at the origin (V 24000 at (20,15,10)) and a cylinder r 5, h 10 on (60,0,0) (V 250 pi = 785.40 at (60,0,5)): the volume-weighted mean (21.2675, 14.5247, 9.8416), V = 24000 + 250 pi", + "results": [ + { + "command": 2, + "pointer": "/center", + "value": [ + 21.267517524987444, + 14.524680928129708, + 9.84156030937657 + ] + }, + { + "command": 2, + "pointer": "/volume", + "value": 24785.398163397447 + }, + { + "command": 2, + "pointer": "/bodies/1/center", + "value": [ + 60, + 0, + 5 + ] + }, + { + "command": 2, + "pointer": "/bodies/1/volume", + "value": 785.3981633974482 + } + ] +} diff --git a/tests/kernel-cases/inspect/cov-center-of-mass-box-and-cylinder/recipe.json b/tests/kernel-cases/inspect/cov-center-of-mass-box-and-cylinder/recipe.json new file mode 100644 index 000000000..d5c90a511 --- /dev/null +++ b/tests/kernel-cases/inspect/cov-center-of-mass-box-and-cylinder/recipe.json @@ -0,0 +1,32 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 20, + "body_name": "Box", + "operation": "new" + } + }, + { + "command": "solid.cylinder", + "params": { + "base": [ + 60, + 0, + 0 + ], + "radius": 5, + "height": 10, + "body_name": "Cyl", + "operation": "new" + } + }, + { + "command": "inspect.center_of_mass", + "params": {} + } + ] +} diff --git a/tests/kernel-cases/inspect/cov-center-of-mass-box/expected.json b/tests/kernel-cases/inspect/cov-center-of-mass-box/expected.json new file mode 100644 index 000000000..a40b16dd7 --- /dev/null +++ b/tests/kernel-cases/inspect/cov-center-of-mass-box/expected.json @@ -0,0 +1,22 @@ +{ + "sources": [], + "what": "the centre of mass of a box", + "source": "analytic", + "method": "box 40 x 30 x 20 with a corner at the origin: the middle (20,15,10), V = 40 x 30 x 20 = 24000", + "results": [ + { + "command": 1, + "pointer": "/center", + "value": [ + 20, + 15, + 10 + ] + }, + { + "command": 1, + "pointer": "/volume", + "value": 24000.0 + } + ] +} diff --git a/tests/kernel-cases/inspect/cov-center-of-mass-box/recipe.json b/tests/kernel-cases/inspect/cov-center-of-mass-box/recipe.json new file mode 100644 index 000000000..5116cf00a --- /dev/null +++ b/tests/kernel-cases/inspect/cov-center-of-mass-box/recipe.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 20, + "body_name": "Box", + "operation": "new" + } + }, + { + "command": "inspect.center_of_mass", + "params": {} + } + ] +} diff --git a/tests/kernel-cases/inspect/cov-center-of-mass-refuses-an-unknown-body/expected.json b/tests/kernel-cases/inspect/cov-center-of-mass-refuses-an-unknown-body/expected.json new file mode 100644 index 000000000..58a27d57a --- /dev/null +++ b/tests/kernel-cases/inspect/cov-center-of-mass-refuses-an-unknown-body/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "the centre of mass of a body that is not there", + "source": "analytic", + "method": "box 40 x 30 x 20 with a corner at the origin; no body `Nope`: refused", + "outcome": "refused", + "refusal": "no such bodies" +} diff --git a/tests/kernel-cases/inspect/cov-center-of-mass-refuses-an-unknown-body/recipe.json b/tests/kernel-cases/inspect/cov-center-of-mass-refuses-an-unknown-body/recipe.json new file mode 100644 index 000000000..c05c6c794 --- /dev/null +++ b/tests/kernel-cases/inspect/cov-center-of-mass-refuses-an-unknown-body/recipe.json @@ -0,0 +1,22 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 20, + "body_name": "Box", + "operation": "new" + } + }, + { + "command": "inspect.center_of_mass", + "params": { + "bodies": [ + "Nope" + ] + } + } + ] +} From f43a0c7ac6161659162fb3a36308fbab8534edfe Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:10:20 -0400 Subject: [PATCH 073/108] Kernel rig: inspect cases, the smallest radius of a fillet, an ellipse and a circular edge, and none on a box Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 13 +++++++ .../recipe.json | 18 +++++++++ .../expected.json | 13 +++++++ .../recipe.json | 30 +++++++++++++++ .../expected.json | 13 +++++++ .../recipe.json | 31 +++++++++++++++ .../expected.json | 13 +++++++ .../recipe.json | 38 +++++++++++++++++++ 8 files changed, 169 insertions(+) create mode 100644 tests/kernel-cases/inspect/cov-minimum-radius-of-a-box-is-none/expected.json create mode 100644 tests/kernel-cases/inspect/cov-minimum-radius-of-a-box-is-none/recipe.json create mode 100644 tests/kernel-cases/inspect/cov-minimum-radius-of-a-circular-edge/expected.json create mode 100644 tests/kernel-cases/inspect/cov-minimum-radius-of-a-circular-edge/recipe.json create mode 100644 tests/kernel-cases/inspect/cov-minimum-radius-of-a-fillet/expected.json create mode 100644 tests/kernel-cases/inspect/cov-minimum-radius-of-a-fillet/recipe.json create mode 100644 tests/kernel-cases/inspect/cov-minimum-radius-of-an-ellipse/expected.json create mode 100644 tests/kernel-cases/inspect/cov-minimum-radius-of-an-ellipse/recipe.json diff --git a/tests/kernel-cases/inspect/cov-minimum-radius-of-a-box-is-none/expected.json b/tests/kernel-cases/inspect/cov-minimum-radius-of-a-box-is-none/expected.json new file mode 100644 index 000000000..36d5b98c4 --- /dev/null +++ b/tests/kernel-cases/inspect/cov-minimum-radius-of-a-box-is-none/expected.json @@ -0,0 +1,13 @@ +{ + "sources": [], + "what": "the smallest radius of a box, which has no curved face", + "source": "analytic", + "method": "box 40 x 30 x 20 with a corner at the origin: every face is flat: no radius (null)", + "results": [ + { + "command": 1, + "pointer": "/min_radius", + "value": null + } + ] +} diff --git a/tests/kernel-cases/inspect/cov-minimum-radius-of-a-box-is-none/recipe.json b/tests/kernel-cases/inspect/cov-minimum-radius-of-a-box-is-none/recipe.json new file mode 100644 index 000000000..144ba1eeb --- /dev/null +++ b/tests/kernel-cases/inspect/cov-minimum-radius-of-a-box-is-none/recipe.json @@ -0,0 +1,18 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 20, + "body_name": "Box", + "operation": "new" + } + }, + { + "command": "inspect.minimum_radius", + "params": {} + } + ] +} diff --git a/tests/kernel-cases/inspect/cov-minimum-radius-of-a-circular-edge/expected.json b/tests/kernel-cases/inspect/cov-minimum-radius-of-a-circular-edge/expected.json new file mode 100644 index 000000000..c3f5fc8ef --- /dev/null +++ b/tests/kernel-cases/inspect/cov-minimum-radius-of-a-circular-edge/expected.json @@ -0,0 +1,13 @@ +{ + "sources": [], + "what": "the radius of 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", + "results": [ + { + "command": 1, + "pointer": "/min_radius", + "value": 5.0 + } + ] +} diff --git a/tests/kernel-cases/inspect/cov-minimum-radius-of-a-circular-edge/recipe.json b/tests/kernel-cases/inspect/cov-minimum-radius-of-a-circular-edge/recipe.json new file mode 100644 index 000000000..780d1f903 --- /dev/null +++ b/tests/kernel-cases/inspect/cov-minimum-radius-of-a-circular-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.minimum_radius", + "params": { + "edges": [ + [ + 65, + 0, + 10 + ] + ] + } + } + ] +} diff --git a/tests/kernel-cases/inspect/cov-minimum-radius-of-a-fillet/expected.json b/tests/kernel-cases/inspect/cov-minimum-radius-of-a-fillet/expected.json new file mode 100644 index 000000000..72f5a8208 --- /dev/null +++ b/tests/kernel-cases/inspect/cov-minimum-radius-of-a-fillet/expected.json @@ -0,0 +1,13 @@ +{ + "sources": [], + "what": "the smallest radius over every face of a box with one rounded edge", + "source": "analytic", + "method": "box 40 x 30 x 20 with a corner at the origin, its top-front edge (y 0, z 20) rounded r 3: the flat faces have none, the round is a cylinder of r 3: the smallest radius is 3", + "results": [ + { + "command": 2, + "pointer": "/min_radius", + "value": 3.0 + } + ] +} diff --git a/tests/kernel-cases/inspect/cov-minimum-radius-of-a-fillet/recipe.json b/tests/kernel-cases/inspect/cov-minimum-radius-of-a-fillet/recipe.json new file mode 100644 index 000000000..3eef8050a --- /dev/null +++ b/tests/kernel-cases/inspect/cov-minimum-radius-of-a-fillet/recipe.json @@ -0,0 +1,31 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 20, + "body_name": "Box", + "operation": "new" + } + }, + { + "command": "solid.fillet", + "params": { + "edges": [ + [ + 20, + 0, + 20 + ] + ], + "radius": 3 + } + }, + { + "command": "inspect.minimum_radius", + "params": {} + } + ] +} diff --git a/tests/kernel-cases/inspect/cov-minimum-radius-of-an-ellipse/expected.json b/tests/kernel-cases/inspect/cov-minimum-radius-of-an-ellipse/expected.json new file mode 100644 index 000000000..3c8dd17bf --- /dev/null +++ b/tests/kernel-cases/inspect/cov-minimum-radius-of-an-ellipse/expected.json @@ -0,0 +1,13 @@ +{ + "sources": [], + "what": "the smallest radius of a sketch ellipse", + "source": "analytic", + "method": "ellipse a 10, b 4: tightest at the ends of the major axis, b^2 / a = 1.6, at (+-10, 0)", + "results": [ + { + "command": 3, + "pointer": "/min_radius", + "value": 1.6 + } + ] +} diff --git a/tests/kernel-cases/inspect/cov-minimum-radius-of-an-ellipse/recipe.json b/tests/kernel-cases/inspect/cov-minimum-radius-of-an-ellipse/recipe.json new file mode 100644 index 000000000..db95c8624 --- /dev/null +++ b/tests/kernel-cases/inspect/cov-minimum-radius-of-an-ellipse/recipe.json @@ -0,0 +1,38 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "S" + } + }, + { + "command": "sketch.ellipse", + "params": { + "center": [ + 0, + 0 + ], + "major": [ + 10, + 0 + ], + "minor_radius": 4 + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "inspect.minimum_radius", + "params": { + "sketch": "S", + "curves": [ + "e1" + ] + } + } + ] +} From 311b57bb72bca7a8b0774375db318ae751dca496 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:10:20 -0400 Subject: [PATCH 074/108] Kernel rig: inspect cases, a fillet's seams are G1 with a 1/r curvature jump, a box edge is sharp, too few stations refused Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 34 ++++++++++++++ .../recipe.json | 27 +++++++++++ .../expected.json | 43 ++++++++++++++++++ .../recipe.json | 45 +++++++++++++++++++ .../expected.json | 8 ++++ .../recipe.json | 21 +++++++++ 6 files changed, 178 insertions(+) create mode 100644 tests/kernel-cases/inspect/cov-continuity-box-edge-is-sharp/expected.json create mode 100644 tests/kernel-cases/inspect/cov-continuity-box-edge-is-sharp/recipe.json create mode 100644 tests/kernel-cases/inspect/cov-continuity-fillet-seams-are-g1/expected.json create mode 100644 tests/kernel-cases/inspect/cov-continuity-fillet-seams-are-g1/recipe.json create mode 100644 tests/kernel-cases/inspect/cov-continuity-refuses-too-few-samples/expected.json create mode 100644 tests/kernel-cases/inspect/cov-continuity-refuses-too-few-samples/recipe.json diff --git a/tests/kernel-cases/inspect/cov-continuity-box-edge-is-sharp/expected.json b/tests/kernel-cases/inspect/cov-continuity-box-edge-is-sharp/expected.json new file mode 100644 index 000000000..1468968e9 --- /dev/null +++ b/tests/kernel-cases/inspect/cov-continuity-box-edge-is-sharp/expected.json @@ -0,0 +1,34 @@ +{ + "sources": [], + "what": "the order at a box's square edge", + "source": "analytic", + "method": "box 40 x 30 x 20 with a corner at the origin: the faces y = 0 and z = 0 meet at 90 deg along their edge: g0, sharp, normal angle 90", + "results": [ + { + "command": 1, + "pointer": "/summary/edges", + "value": 1 + }, + { + "command": 1, + "pointer": "/bodies/0/edges/0/order", + "value": "g0" + }, + { + "command": 1, + "pointer": "/bodies/0/edges/0/verdict", + "value": "sharp" + }, + { + "command": 1, + "pointer": "/bodies/0/edges/0/normal_angle_deg/value", + "value": 90.0 + }, + { + "command": 1, + "pointer": "/bodies/0/edges/0/gap_mm/value", + "value": 0.0, + "rel": 1e-06 + } + ] +} diff --git a/tests/kernel-cases/inspect/cov-continuity-box-edge-is-sharp/recipe.json b/tests/kernel-cases/inspect/cov-continuity-box-edge-is-sharp/recipe.json new file mode 100644 index 000000000..6e23fd24a --- /dev/null +++ b/tests/kernel-cases/inspect/cov-continuity-box-edge-is-sharp/recipe.json @@ -0,0 +1,27 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 20, + "body_name": "Box", + "operation": "new" + } + }, + { + "command": "inspect.continuity", + "params": { + "body": "Box", + "edges": [ + [ + 20, + 0, + 0 + ] + ] + } + } + ] +} diff --git a/tests/kernel-cases/inspect/cov-continuity-fillet-seams-are-g1/expected.json b/tests/kernel-cases/inspect/cov-continuity-fillet-seams-are-g1/expected.json new file mode 100644 index 000000000..9a93b77dc --- /dev/null +++ b/tests/kernel-cases/inspect/cov-continuity-fillet-seams-are-g1/expected.json @@ -0,0 +1,43 @@ +{ + "sources": [], + "what": "the order where a round meets the faces either side", + "source": "analytic", + "method": "box 40 x 30 x 20 with a corner at the origin, its top-front edge (y 0, z 20) rounded r 3: the round meets the top (at y 3) and the front (at z 17) tangent, curvature jumping 0 to 1/3: g1, jump 1/3 per mm", + "results": [ + { + "command": 2, + "pointer": "/summary/edges", + "value": 2 + }, + { + "command": 2, + "pointer": "/bodies/0/edges/0/order", + "value": "g1" + }, + { + "command": 2, + "pointer": "/bodies/0/edges/1/order", + "value": "g1" + }, + { + "command": 2, + "pointer": "/bodies/0/edges/0/curvature_jump_per_mm/value", + "value": 0.3333333333333333 + }, + { + "command": 2, + "pointer": "/bodies/0/edges/1/curvature_jump_per_mm/value", + "value": 0.3333333333333333 + }, + { + "command": 2, + "pointer": "/bodies/0/edges/0/verdict", + "value": "curvature_jump" + }, + { + "command": 2, + "pointer": "/bodies/0/edges/1/verdict", + "value": "curvature_jump" + } + ] +} diff --git a/tests/kernel-cases/inspect/cov-continuity-fillet-seams-are-g1/recipe.json b/tests/kernel-cases/inspect/cov-continuity-fillet-seams-are-g1/recipe.json new file mode 100644 index 000000000..817d86648 --- /dev/null +++ b/tests/kernel-cases/inspect/cov-continuity-fillet-seams-are-g1/recipe.json @@ -0,0 +1,45 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 20, + "body_name": "Box", + "operation": "new" + } + }, + { + "command": "solid.fillet", + "params": { + "edges": [ + [ + 20, + 0, + 20 + ] + ], + "radius": 3 + } + }, + { + "command": "inspect.continuity", + "params": { + "body": "Box", + "edges": [ + [ + 20, + 3, + 20 + ], + [ + 20, + 0, + 17 + ] + ] + } + } + ] +} diff --git a/tests/kernel-cases/inspect/cov-continuity-refuses-too-few-samples/expected.json b/tests/kernel-cases/inspect/cov-continuity-refuses-too-few-samples/expected.json new file mode 100644 index 000000000..acb8d956e --- /dev/null +++ b/tests/kernel-cases/inspect/cov-continuity-refuses-too-few-samples/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "continuity with 2 stations a seam", + "source": "analytic", + "method": "box 40 x 30 x 20 with a corner at the origin: a seam needs its two ends and one station between: 2 is refused", + "outcome": "refused", + "refusal": "`samples` must be 3\u2026257 stations along each edge" +} diff --git a/tests/kernel-cases/inspect/cov-continuity-refuses-too-few-samples/recipe.json b/tests/kernel-cases/inspect/cov-continuity-refuses-too-few-samples/recipe.json new file mode 100644 index 000000000..073ae40ea --- /dev/null +++ b/tests/kernel-cases/inspect/cov-continuity-refuses-too-few-samples/recipe.json @@ -0,0 +1,21 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 20, + "body_name": "Box", + "operation": "new" + } + }, + { + "command": "inspect.continuity", + "params": { + "body": "Box", + "samples": 2 + } + } + ] +} From 58b384d7d99e46f75914c85c8a0c54341056d3e8 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:10:20 -0400 Subject: [PATCH 075/108] Kernel rig: inspect cases, the overlap volume of two boxes, none where they only touch, a box inside a box Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 27 ++++++++++ .../recipe.json | 33 ++++++++++++ .../expected.json | 18 +++++++ .../recipe.json | 33 ++++++++++++ .../expected.json | 50 +++++++++++++++++++ .../recipe.json | 33 ++++++++++++ 6 files changed, 194 insertions(+) create mode 100644 tests/kernel-cases/inspect/cov-interference-box-inside-a-box/expected.json create mode 100644 tests/kernel-cases/inspect/cov-interference-box-inside-a-box/recipe.json create mode 100644 tests/kernel-cases/inspect/cov-interference-boxes-touching-face-to-face/expected.json create mode 100644 tests/kernel-cases/inspect/cov-interference-boxes-touching-face-to-face/recipe.json create mode 100644 tests/kernel-cases/inspect/cov-interference-overlapping-boxes/expected.json create mode 100644 tests/kernel-cases/inspect/cov-interference-overlapping-boxes/recipe.json diff --git a/tests/kernel-cases/inspect/cov-interference-box-inside-a-box/expected.json b/tests/kernel-cases/inspect/cov-interference-box-inside-a-box/expected.json new file mode 100644 index 000000000..c56e1ed3e --- /dev/null +++ b/tests/kernel-cases/inspect/cov-interference-box-inside-a-box/expected.json @@ -0,0 +1,27 @@ +{ + "sources": [], + "what": "a box wholly inside another", + "source": "analytic", + "method": "box 40 x 30 x 20 with a corner at the origin and a box 10 x 10 x 10 from (5,5,5) inside it: the overlap is the small box: V 1000, centre (10,10,10)", + "results": [ + { + "command": 2, + "pointer": "/count", + "value": 1 + }, + { + "command": 2, + "pointer": "/interferences/0/volume_mm3", + "value": 1000.0 + }, + { + "command": 2, + "pointer": "/interferences/0/center", + "value": [ + 10, + 10, + 10 + ] + } + ] +} diff --git a/tests/kernel-cases/inspect/cov-interference-box-inside-a-box/recipe.json b/tests/kernel-cases/inspect/cov-interference-box-inside-a-box/recipe.json new file mode 100644 index 000000000..800e73ec1 --- /dev/null +++ b/tests/kernel-cases/inspect/cov-interference-box-inside-a-box/recipe.json @@ -0,0 +1,33 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 20, + "body_name": "A", + "operation": "new" + } + }, + { + "command": "solid.box", + "params": { + "length": 10, + "width": 10, + "height": 10, + "body_name": "B", + "operation": "new", + "corner": [ + 5, + 5, + 5 + ] + } + }, + { + "command": "inspect.interference", + "params": {} + } + ] +} diff --git a/tests/kernel-cases/inspect/cov-interference-boxes-touching-face-to-face/expected.json b/tests/kernel-cases/inspect/cov-interference-boxes-touching-face-to-face/expected.json new file mode 100644 index 000000000..07812ac63 --- /dev/null +++ b/tests/kernel-cases/inspect/cov-interference-boxes-touching-face-to-face/expected.json @@ -0,0 +1,18 @@ +{ + "sources": [], + "what": "two boxes that only touch along a face", + "source": "analytic", + "method": "box 40 x 30 x 20 with a corner at the origin and a box 40 x 30 x 20 from (40,0,0): they share the face x = 40 and no volume: no interference", + "results": [ + { + "command": 2, + "pointer": "/count", + "value": 0 + }, + { + "command": 2, + "pointer": "/interferences", + "value": [] + } + ] +} diff --git a/tests/kernel-cases/inspect/cov-interference-boxes-touching-face-to-face/recipe.json b/tests/kernel-cases/inspect/cov-interference-boxes-touching-face-to-face/recipe.json new file mode 100644 index 000000000..69744f365 --- /dev/null +++ b/tests/kernel-cases/inspect/cov-interference-boxes-touching-face-to-face/recipe.json @@ -0,0 +1,33 @@ +{ + "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", + "corner": [ + 40, + 0, + 0 + ] + } + }, + { + "command": "inspect.interference", + "params": {} + } + ] +} diff --git a/tests/kernel-cases/inspect/cov-interference-overlapping-boxes/expected.json b/tests/kernel-cases/inspect/cov-interference-overlapping-boxes/expected.json new file mode 100644 index 000000000..f76118d01 --- /dev/null +++ b/tests/kernel-cases/inspect/cov-interference-overlapping-boxes/expected.json @@ -0,0 +1,50 @@ +{ + "sources": [], + "what": "the overlap of two boxes", + "source": "analytic", + "method": "box 40 x 30 x 20 with a corner at the origin and a box 40 x 30 x 20 from (30,20,10): they share the cube x 30..40, y 20..30, z 10..20: V 1000, A 600, centre (35,25,15)", + "results": [ + { + "command": 2, + "pointer": "/count", + "value": 1 + }, + { + "command": 2, + "pointer": "/interferences/0/volume_mm3", + "value": 1000.0 + }, + { + "command": 2, + "pointer": "/interferences/0/area_mm2", + "value": 600.0 + }, + { + "command": 2, + "pointer": "/interferences/0/center", + "value": [ + 35, + 25, + 15 + ] + }, + { + "command": 2, + "pointer": "/interferences/0/bbox/min", + "value": [ + 30, + 20, + 10 + ] + }, + { + "command": 2, + "pointer": "/interferences/0/bbox/max", + "value": [ + 40, + 30, + 20 + ] + } + ] +} diff --git a/tests/kernel-cases/inspect/cov-interference-overlapping-boxes/recipe.json b/tests/kernel-cases/inspect/cov-interference-overlapping-boxes/recipe.json new file mode 100644 index 000000000..4dfc1aeac --- /dev/null +++ b/tests/kernel-cases/inspect/cov-interference-overlapping-boxes/recipe.json @@ -0,0 +1,33 @@ +{ + "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", + "corner": [ + 30, + 20, + 10 + ] + } + }, + { + "command": "inspect.interference", + "params": {} + } + ] +} From 305c36479bb187c2fba7ecc079620e2750ee33aa Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:10:20 -0400 Subject: [PATCH 076/108] Kernel rig: inspect cases, the gap between two spheres, their lens where they overlap, none past the clearance Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 46 +++++++++++++++++++ .../recipe.json | 36 +++++++++++++++ .../expected.json | 22 +++++++++ .../recipe.json | 34 ++++++++++++++ .../expected.json | 18 ++++++++ .../recipe.json | 36 +++++++++++++++ 6 files changed, 192 insertions(+) create mode 100644 tests/kernel-cases/inspect/cov-clearance-gap-between-two-spheres/expected.json create mode 100644 tests/kernel-cases/inspect/cov-clearance-gap-between-two-spheres/recipe.json create mode 100644 tests/kernel-cases/inspect/cov-clearance-overlapping-spheres/expected.json create mode 100644 tests/kernel-cases/inspect/cov-clearance-overlapping-spheres/recipe.json create mode 100644 tests/kernel-cases/inspect/cov-clearance-spheres-farther-than-the-clearance/expected.json create mode 100644 tests/kernel-cases/inspect/cov-clearance-spheres-farther-than-the-clearance/recipe.json 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 000000000..af414d55b --- /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 000000000..1461bdb5d --- /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 000000000..07c05664d --- /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 000000000..d4886dc8f --- /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 000000000..8f4b8e3af --- /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 000000000..ccf001246 --- /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 + } + } + ] +} From 4355e15df3f3c85473f5f241259b921025e1deaa Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:10:20 -0400 Subject: [PATCH 077/108] Kernel rig: inspect cases, a box against a taller one and an identical one, and a tolerance out of range refused Co-Authored-By: Claude Opus 5.5 --- .../cov-compare-identical-boxes/expected.json | 23 ++++++++ .../cov-compare-identical-boxes/recipe.json | 31 +++++++++++ .../expected.json | 8 +++ .../recipe.json | 32 +++++++++++ .../cov-compare-taller-box/expected.json | 53 +++++++++++++++++++ .../cov-compare-taller-box/recipe.json | 31 +++++++++++ 6 files changed, 178 insertions(+) create mode 100644 tests/kernel-cases/inspect/cov-compare-identical-boxes/expected.json create mode 100644 tests/kernel-cases/inspect/cov-compare-identical-boxes/recipe.json create mode 100644 tests/kernel-cases/inspect/cov-compare-refuses-a-tolerance-out-of-range/expected.json create mode 100644 tests/kernel-cases/inspect/cov-compare-refuses-a-tolerance-out-of-range/recipe.json create mode 100644 tests/kernel-cases/inspect/cov-compare-taller-box/expected.json create mode 100644 tests/kernel-cases/inspect/cov-compare-taller-box/recipe.json 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 000000000..e1d52a15b --- /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 000000000..0d31b1e06 --- /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 000000000..b9545a4ab --- /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 000000000..4a8a6c9bc --- /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 000000000..fb9f6b54a --- /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 000000000..5eb76e184 --- /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" + } + } + ] +} From 7b1fbb57f116ea249a939c2c422f1e9c25fe95e5 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:10:20 -0400 Subject: [PATCH 078/108] Kernel rig: inspect cases, the comb of a sketch circle and line and a cylinder edge, and nothing picked refused Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 28 +++++++++++ .../recipe.json | 50 +++++++++++++++++++ .../expected.json | 18 +++++++ .../recipe.json | 30 +++++++++++ .../expected.json | 8 +++ .../recipe.json | 18 +++++++ 6 files changed, 152 insertions(+) create mode 100644 tests/kernel-cases/inspect/cov-curvature-comb-circle-and-line/expected.json create mode 100644 tests/kernel-cases/inspect/cov-curvature-comb-circle-and-line/recipe.json create mode 100644 tests/kernel-cases/inspect/cov-curvature-comb-cylinder-edge/expected.json create mode 100644 tests/kernel-cases/inspect/cov-curvature-comb-cylinder-edge/recipe.json create mode 100644 tests/kernel-cases/inspect/cov-curvature-comb-refuses-nothing-picked/expected.json create mode 100644 tests/kernel-cases/inspect/cov-curvature-comb-refuses-nothing-picked/recipe.json 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 000000000..285efa83e --- /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 000000000..09a86df83 --- /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 000000000..2af9c42d8 --- /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 000000000..6640bd674 --- /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 000000000..af2f4ee34 --- /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 000000000..22b640b8e --- /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": {} + } + ] +} From 5c80ef4ad8517b47232ffc8245f7582c0be5b73f Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:10:20 -0400 Subject: [PATCH 079/108] Kernel rig: inspect cases, three isocurves each way on a cube's top, and a count of 0 refused Co-Authored-By: Claude Opus 5.5 --- .../cov-isocurve-cube-top/expected.json | 28 +++++++++++++++++++ .../inspect/cov-isocurve-cube-top/recipe.json | 27 ++++++++++++++++++ .../expected.json | 8 ++++++ .../recipe.json | 27 ++++++++++++++++++ 4 files changed, 90 insertions(+) create mode 100644 tests/kernel-cases/inspect/cov-isocurve-cube-top/expected.json create mode 100644 tests/kernel-cases/inspect/cov-isocurve-cube-top/recipe.json create mode 100644 tests/kernel-cases/inspect/cov-isocurve-refuses-zero-curves/expected.json create mode 100644 tests/kernel-cases/inspect/cov-isocurve-refuses-zero-curves/recipe.json 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 000000000..04b6119aa --- /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 000000000..4853108dc --- /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 000000000..5899bdf41 --- /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 000000000..9676dfb67 --- /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 + } + } + ] +} From 74eeda4914e3e85c570c61825b81846c39308648 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:10:09 -0400 Subject: [PATCH 080/108] Kernel rig: history area, timeline cases with each part's exact answer Suppress a hole and the block is whole again; a round moved before the notch runs the whole edge and is cut by it; deleting a sketch takes its cut and deleting the block leaves the round and cut failing; roll to the middle gives the part at that step; edits, compute all and folders, each with a refusal. The new history area has its KNOWN_FAILING (every case passes) and PATHS. Co-Authored-By: Claude Opus 5.5 --- tests/kernel-cases/README.md | 1 + tests/kernel-cases/history/KNOWN_FAILING | 4 + tests/kernel-cases/history/PATHS | 17 ++++ .../expected.json | 16 ++++ .../recipe.json | 73 +++++++++++++++++ .../expected.json | 18 ++++ .../recipe.json | 67 +++++++++++++++ .../expected.json | 9 ++ .../recipe.json | 69 ++++++++++++++++ .../expected.json | 22 +++++ .../recipe.json | 69 ++++++++++++++++ .../expected.json | 9 ++ .../cov-timeline-edit-notch-depth/recipe.json | 57 +++++++++++++ .../expected.json | 9 ++ .../recipe.json | 38 +++++++++ .../expected.json | 8 ++ .../recipe.json | 38 +++++++++ .../expected.json | 19 +++++ .../recipe.json | 73 +++++++++++++++++ .../expected.json | 8 ++ .../recipe.json | 73 +++++++++++++++++ .../expected.json | 9 ++ .../recipe.json | 82 +++++++++++++++++++ .../expected.json | 8 ++ .../recipe.json | 68 +++++++++++++++ .../expected.json | 20 +++++ .../recipe.json | 82 +++++++++++++++++++ .../expected.json | 8 ++ .../recipe.json | 81 ++++++++++++++++++ .../expected.json | 8 ++ .../recipe.json | 55 +++++++++++++ .../expected.json | 21 +++++ .../recipe.json | 70 ++++++++++++++++ .../expected.json | 9 ++ .../recipe.json | 73 +++++++++++++++++ .../expected.json | 8 ++ .../recipe.json | 72 ++++++++++++++++ .../expected.json | 23 ++++++ .../recipe.json | 73 +++++++++++++++++ .../expected.json | 8 ++ .../recipe.json | 35 ++++++++ .../expected.json | 18 ++++ .../recipe.json | 69 ++++++++++++++++ .../expected.json | 30 +++++++ .../recipe.json | 33 ++++++++ .../expected.json | 17 ++++ .../recipe.json | 70 ++++++++++++++++ .../expected.json | 23 ++++++ .../recipe.json | 38 +++++++++ .../expected.json | 8 ++ .../recipe.json | 21 +++++ .../expected.json | 19 +++++ .../recipe.json | 79 ++++++++++++++++++ .../expected.json | 8 ++ .../recipe.json | 20 +++++ 55 files changed, 1963 insertions(+) create mode 100644 tests/kernel-cases/history/KNOWN_FAILING create mode 100644 tests/kernel-cases/history/PATHS create mode 100644 tests/kernel-cases/history/cov-timeline-compute-all-counts-failing-features/expected.json create mode 100644 tests/kernel-cases/history/cov-timeline-compute-all-counts-failing-features/recipe.json create mode 100644 tests/kernel-cases/history/cov-timeline-compute-all-rebuilds-the-same-part/expected.json create mode 100644 tests/kernel-cases/history/cov-timeline-compute-all-rebuilds-the-same-part/recipe.json create mode 100644 tests/kernel-cases/history/cov-timeline-delete-sketch-takes-its-cut/expected.json create mode 100644 tests/kernel-cases/history/cov-timeline-delete-sketch-takes-its-cut/recipe.json create mode 100644 tests/kernel-cases/history/cov-timeline-delete-the-body-its-features-need/expected.json create mode 100644 tests/kernel-cases/history/cov-timeline-delete-the-body-its-features-need/recipe.json create mode 100644 tests/kernel-cases/history/cov-timeline-edit-notch-depth/expected.json create mode 100644 tests/kernel-cases/history/cov-timeline-edit-notch-depth/recipe.json create mode 100644 tests/kernel-cases/history/cov-timeline-edit-round-radius/expected.json create mode 100644 tests/kernel-cases/history/cov-timeline-edit-round-radius/recipe.json create mode 100644 tests/kernel-cases/history/cov-timeline-edit-unknown-field-refused/expected.json create mode 100644 tests/kernel-cases/history/cov-timeline-edit-unknown-field-refused/recipe.json create mode 100644 tests/kernel-cases/history/cov-timeline-group-keeps-the-part/expected.json create mode 100644 tests/kernel-cases/history/cov-timeline-group-keeps-the-part/recipe.json create mode 100644 tests/kernel-cases/history/cov-timeline-group-non-contiguous-refused/expected.json create mode 100644 tests/kernel-cases/history/cov-timeline-group-non-contiguous-refused/recipe.json create mode 100644 tests/kernel-cases/history/cov-timeline-move-many-folder-behind-the-round/expected.json create mode 100644 tests/kernel-cases/history/cov-timeline-move-many-folder-behind-the-round/recipe.json create mode 100644 tests/kernel-cases/history/cov-timeline-move-many-folder-into-itself-refused/expected.json create mode 100644 tests/kernel-cases/history/cov-timeline-move-many-folder-into-itself-refused/recipe.json create mode 100644 tests/kernel-cases/history/cov-timeline-move-to-group-joins-a-folder/expected.json create mode 100644 tests/kernel-cases/history/cov-timeline-move-to-group-joins-a-folder/recipe.json create mode 100644 tests/kernel-cases/history/cov-timeline-move-to-group-non-contiguous-refused/expected.json create mode 100644 tests/kernel-cases/history/cov-timeline-move-to-group-non-contiguous-refused/recipe.json create mode 100644 tests/kernel-cases/history/cov-timeline-reorder-cut-before-its-sketch-refused/expected.json create mode 100644 tests/kernel-cases/history/cov-timeline-reorder-cut-before-its-sketch-refused/recipe.json create mode 100644 tests/kernel-cases/history/cov-timeline-reorder-fillet-before-the-cut/expected.json create mode 100644 tests/kernel-cases/history/cov-timeline-reorder-fillet-before-the-cut/recipe.json create mode 100644 tests/kernel-cases/history/cov-timeline-reorder-many-cut-after-the-fillet/expected.json create mode 100644 tests/kernel-cases/history/cov-timeline-reorder-many-cut-after-the-fillet/recipe.json create mode 100644 tests/kernel-cases/history/cov-timeline-reorder-many-sketch-after-its-cut-refused/expected.json create mode 100644 tests/kernel-cases/history/cov-timeline-reorder-many-sketch-after-its-cut-refused/recipe.json create mode 100644 tests/kernel-cases/history/cov-timeline-roll-to-end-after-rolling-back/expected.json create mode 100644 tests/kernel-cases/history/cov-timeline-roll-to-end-after-rolling-back/recipe.json create mode 100644 tests/kernel-cases/history/cov-timeline-roll-to-negative-position-refused/expected.json create mode 100644 tests/kernel-cases/history/cov-timeline-roll-to-negative-position-refused/recipe.json create mode 100644 tests/kernel-cases/history/cov-timeline-roll-to-the-middle/expected.json create mode 100644 tests/kernel-cases/history/cov-timeline-roll-to-the-middle/recipe.json create mode 100644 tests/kernel-cases/history/cov-timeline-suppress-hole-restores-volume/expected.json create mode 100644 tests/kernel-cases/history/cov-timeline-suppress-hole-restores-volume/recipe.json create mode 100644 tests/kernel-cases/history/cov-timeline-suppress-several-in-one-step/expected.json create mode 100644 tests/kernel-cases/history/cov-timeline-suppress-several-in-one-step/recipe.json create mode 100644 tests/kernel-cases/history/cov-timeline-suppress-toggles-twice/expected.json create mode 100644 tests/kernel-cases/history/cov-timeline-suppress-toggles-twice/recipe.json create mode 100644 tests/kernel-cases/history/cov-timeline-suppress-unknown-feature-refused/expected.json create mode 100644 tests/kernel-cases/history/cov-timeline-suppress-unknown-feature-refused/recipe.json create mode 100644 tests/kernel-cases/history/cov-timeline-ungroup-keeps-the-part/expected.json create mode 100644 tests/kernel-cases/history/cov-timeline-ungroup-keeps-the-part/recipe.json create mode 100644 tests/kernel-cases/history/cov-timeline-ungroup-unknown-folder-refused/expected.json create mode 100644 tests/kernel-cases/history/cov-timeline-ungroup-unknown-folder-refused/recipe.json diff --git a/tests/kernel-cases/README.md b/tests/kernel-cases/README.md index 6ffe10fb4..901cf34cb 100644 --- a/tests/kernel-cases/README.md +++ b/tests/kernel-cases/README.md @@ -43,6 +43,7 @@ One directory per area, one per case: `tests/kernel-cases///`. | `surfaces` (every `surface.*` tool: offset, ruled, untrim, unstitch, reverse normal, boundary, blend, match, fair, and a normal and an edge case of each of the others) | surfaces rig | | `construction` (construction planes, axes and points: `construct.*`) | tool coverage rig | | `inspect` (the inspect commands that return numbers) | tool coverage rig | +| `history` (the timeline's suppress, reorder, delete, roll back, edit and folders; configuration rows, columns and rules; parameters that drive geometry) | tool coverage rig | Each area also has its gate files: `KNOWN_FAILING` and `PATHS` (see [the gate](#the-kernel-rig-gate)). diff --git a/tests/kernel-cases/history/KNOWN_FAILING b/tests/kernel-cases/history/KNOWN_FAILING new file mode 100644 index 000000000..b07847708 --- /dev/null +++ b/tests/kernel-cases/history/KNOWN_FAILING @@ -0,0 +1,4 @@ +# The history cases that fail today, one a line: ` `. Sorted. A gate on +# this area fails on a case that fails and is not listed here, and on a listed case that passes: +# a fix removes its line in the same pull request. +# Baseline: rig-cases-timeline-configurations 45f69c0e5 with SMLib 60b1c6a, aarch64 Linux. diff --git a/tests/kernel-cases/history/PATHS b/tests/kernel-cases/history/PATHS new file mode 100644 index 000000000..786e62457 --- /dev/null +++ b/tests/kernel-cases/history/PATHS @@ -0,0 +1,17 @@ +# The sources whose change must rerun the history cases (git pathspec globs, one a line). +# The timeline, configuration and parameter commands. +crates/engine/src/cmd/edit.rs +crates/engine/src/cmd/config.rs +crates/engine/src/cmd/parameters.rs +# The design's timeline (delete, folders, marker), its configuration table and rules, and its +# parameters and expressions. +crates/doc/src/document.rs +crates/doc/src/config.rs +crates/doc/src/config_rules.rs +crates/doc/src/params.rs +crates/doc/src/expr.rs +# Rebuilding the timeline, and the results it keeps between rebuilds. +crates/doc/src/eval.rs +crates/doc/src/model_cache.rs +# The cases themselves. +tests/kernel-cases/history/** diff --git a/tests/kernel-cases/history/cov-timeline-compute-all-counts-failing-features/expected.json b/tests/kernel-cases/history/cov-timeline-compute-all-counts-failing-features/expected.json new file mode 100644 index 000000000..420c168cd --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-compute-all-counts-failing-features/expected.json @@ -0,0 +1,16 @@ +{ + "sources": [], + "what": "timeline.compute_all after the block is deleted: the round and the cut fail", + "source": "invariants", + "method": "3 features left (Round, the sketch, Notch); Round and Notch have no body: 2 errors; no body", + "body_count": 0, + "results": [ + { + "step": 8, + "json": { + "features": 3, + "errors": 2 + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-timeline-compute-all-counts-failing-features/recipe.json b/tests/kernel-cases/history/cov-timeline-compute-all-counts-failing-features/recipe.json new file mode 100644 index 000000000..777ef0edb --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-compute-all-counts-failing-features/recipe.json @@ -0,0 +1,73 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 10, + "body_name": "Block", + "name": "Block" + } + }, + { + "command": "solid.fillet", + "params": { + "body": "Block", + "edges": [ + [ + 5, + 0, + 10 + ] + ], + "radius": 2, + "name": "Round" + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "offset": 10, + "name": "NotchSketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 15, + 0 + ], + "p1": [ + 25, + 10 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "solid.extrude", + "params": { + "sketch": "NotchSketch", + "distance": -5, + "operation": "cut", + "name": "Notch" + } + }, + { + "command": "timeline.delete", + "params": { + "feature": "Block" + } + }, + { + "command": "timeline.compute_all", + "params": {} + } + ] +} diff --git a/tests/kernel-cases/history/cov-timeline-compute-all-rebuilds-the-same-part/expected.json b/tests/kernel-cases/history/cov-timeline-compute-all-rebuilds-the-same-part/expected.json new file mode 100644 index 000000000..525fbfc18 --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-compute-all-rebuilds-the-same-part/expected.json @@ -0,0 +1,18 @@ +{ + "sources": [], + "what": "timeline.compute_all rebuilds every feature from nothing to the same part", + "method": "the notch first splits the front top edge; the round R2 on the piece at (5,0,10), x 0..15: V = 12000 - 500 - (1-pi/4) 4 15; faces 6 + 4 + 1 round = 11; 4 features, none failing", + "body_count": 1, + "volume_mm3": 11487.123889803846, + "faces": 11, + "results": [ + { + "step": 7, + "json": { + "features": 4, + "errors": 0 + } + } + ], + "source": "analytic" +} diff --git a/tests/kernel-cases/history/cov-timeline-compute-all-rebuilds-the-same-part/recipe.json b/tests/kernel-cases/history/cov-timeline-compute-all-rebuilds-the-same-part/recipe.json new file mode 100644 index 000000000..dc5577d1e --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-compute-all-rebuilds-the-same-part/recipe.json @@ -0,0 +1,67 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 10, + "body_name": "Block", + "name": "Block" + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "offset": 10, + "name": "NotchSketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 15, + 0 + ], + "p1": [ + 25, + 10 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "solid.extrude", + "params": { + "sketch": "NotchSketch", + "distance": -5, + "operation": "cut", + "name": "Notch" + } + }, + { + "command": "solid.fillet", + "params": { + "body": "Block", + "edges": [ + [ + 5, + 0, + 10 + ] + ], + "radius": 2, + "name": "Round" + } + }, + { + "command": "timeline.compute_all", + "params": {} + } + ] +} diff --git a/tests/kernel-cases/history/cov-timeline-delete-sketch-takes-its-cut/expected.json b/tests/kernel-cases/history/cov-timeline-delete-sketch-takes-its-cut/expected.json new file mode 100644 index 000000000..7d9bdb95a --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-delete-sketch-takes-its-cut/expected.json @@ -0,0 +1,9 @@ +{ + "sources": [], + "what": "timeline.delete of a sketch deletes the cut made from it", + "method": "the notch goes with its sketch: 40x30x10 block with its front top edge rounded R2 along 40 mm: V = 12000 - (1-pi/4) 4 40; faces 6 + 1 = 7", + "body_count": 1, + "volume_mm3": 11965.663706143592, + "faces": 7, + "source": "analytic" +} diff --git a/tests/kernel-cases/history/cov-timeline-delete-sketch-takes-its-cut/recipe.json b/tests/kernel-cases/history/cov-timeline-delete-sketch-takes-its-cut/recipe.json new file mode 100644 index 000000000..62ad56496 --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-delete-sketch-takes-its-cut/recipe.json @@ -0,0 +1,69 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 10, + "body_name": "Block", + "name": "Block" + } + }, + { + "command": "solid.fillet", + "params": { + "body": "Block", + "edges": [ + [ + 5, + 0, + 10 + ] + ], + "radius": 2, + "name": "Round" + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "offset": 10, + "name": "NotchSketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 15, + 0 + ], + "p1": [ + 25, + 10 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "solid.extrude", + "params": { + "sketch": "NotchSketch", + "distance": -5, + "operation": "cut", + "name": "Notch" + } + }, + { + "command": "timeline.delete", + "params": { + "feature": "NotchSketch" + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-timeline-delete-the-body-its-features-need/expected.json b/tests/kernel-cases/history/cov-timeline-delete-the-body-its-features-need/expected.json new file mode 100644 index 000000000..56077c2e0 --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-delete-the-body-its-features-need/expected.json @@ -0,0 +1,22 @@ +{ + "sources": [], + "what": "timeline.delete of the block the round and the notch are made on", + "source": "invariants", + "method": "the delete is made (only a sketch takes features with it); the round and the cut have no body now and are reported failing, in timeline order; no body is left", + "body_count": 0, + "results": [ + { + "step": 7, + "json": { + "failing": [ + { + "feature": "Round" + }, + { + "feature": "Notch" + } + ] + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-timeline-delete-the-body-its-features-need/recipe.json b/tests/kernel-cases/history/cov-timeline-delete-the-body-its-features-need/recipe.json new file mode 100644 index 000000000..59aee72c5 --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-delete-the-body-its-features-need/recipe.json @@ -0,0 +1,69 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 10, + "body_name": "Block", + "name": "Block" + } + }, + { + "command": "solid.fillet", + "params": { + "body": "Block", + "edges": [ + [ + 5, + 0, + 10 + ] + ], + "radius": 2, + "name": "Round" + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "offset": 10, + "name": "NotchSketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 15, + 0 + ], + "p1": [ + 25, + 10 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "solid.extrude", + "params": { + "sketch": "NotchSketch", + "distance": -5, + "operation": "cut", + "name": "Notch" + } + }, + { + "command": "timeline.delete", + "params": { + "feature": "Block" + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-timeline-edit-notch-depth/expected.json b/tests/kernel-cases/history/cov-timeline-edit-notch-depth/expected.json new file mode 100644 index 000000000..9b9fe148d --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-edit-notch-depth/expected.json @@ -0,0 +1,9 @@ +{ + "sources": [], + "what": "timeline.edit of a cut's depth from 5 to 8", + "method": "the 10x10 notch 8 deep: V = 12000 - 800; faces 6 + 4 = 10", + "body_count": 1, + "volume_mm3": 11200.0, + "faces": 10, + "source": "analytic" +} diff --git a/tests/kernel-cases/history/cov-timeline-edit-notch-depth/recipe.json b/tests/kernel-cases/history/cov-timeline-edit-notch-depth/recipe.json new file mode 100644 index 000000000..62dfb3434 --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-edit-notch-depth/recipe.json @@ -0,0 +1,57 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 10, + "body_name": "Block", + "name": "Block" + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "offset": 10, + "name": "NotchSketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 15, + 0 + ], + "p1": [ + 25, + 10 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "solid.extrude", + "params": { + "sketch": "NotchSketch", + "distance": -5, + "operation": "cut", + "name": "Notch" + } + }, + { + "command": "timeline.edit", + "params": { + "feature": "Notch", + "set": { + "extent.distance": "-8" + } + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-timeline-edit-round-radius/expected.json b/tests/kernel-cases/history/cov-timeline-edit-round-radius/expected.json new file mode 100644 index 000000000..2e24bd0d7 --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-edit-round-radius/expected.json @@ -0,0 +1,9 @@ +{ + "sources": [], + "what": "timeline.edit of a round's radius from 2 to 4", + "method": "R4 along 40 mm: V = 12000 - (1-pi/4) 16 40; faces 7", + "body_count": 1, + "volume_mm3": 11862.654824574367, + "faces": 7, + "source": "analytic" +} diff --git a/tests/kernel-cases/history/cov-timeline-edit-round-radius/recipe.json b/tests/kernel-cases/history/cov-timeline-edit-round-radius/recipe.json new file mode 100644 index 000000000..a089cf124 --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-edit-round-radius/recipe.json @@ -0,0 +1,38 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 10, + "body_name": "Block", + "name": "Block" + } + }, + { + "command": "solid.fillet", + "params": { + "body": "Block", + "edges": [ + [ + 5, + 0, + 10 + ] + ], + "radius": 2, + "name": "Round" + } + }, + { + "command": "timeline.edit", + "params": { + "feature": "Round", + "set": { + "radius": "4" + } + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-timeline-edit-unknown-field-refused/expected.json b/tests/kernel-cases/history/cov-timeline-edit-unknown-field-refused/expected.json new file mode 100644 index 000000000..6856a5974 --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-edit-unknown-field-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "timeline.edit with a misspelt field", + "source": "invariants", + "method": "a field the round does not have would change nothing: refused, naming it", + "outcome": "refused", + "refusal": "unknown field `radus`" +} diff --git a/tests/kernel-cases/history/cov-timeline-edit-unknown-field-refused/recipe.json b/tests/kernel-cases/history/cov-timeline-edit-unknown-field-refused/recipe.json new file mode 100644 index 000000000..adf6dba0e --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-edit-unknown-field-refused/recipe.json @@ -0,0 +1,38 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 10, + "body_name": "Block", + "name": "Block" + } + }, + { + "command": "solid.fillet", + "params": { + "body": "Block", + "edges": [ + [ + 5, + 0, + 10 + ] + ], + "radius": 2, + "name": "Round" + } + }, + { + "command": "timeline.edit", + "params": { + "feature": "Round", + "set": { + "radus": "4" + } + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-timeline-group-keeps-the-part/expected.json b/tests/kernel-cases/history/cov-timeline-group-keeps-the-part/expected.json new file mode 100644 index 000000000..e46e396ba --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-group-keeps-the-part/expected.json @@ -0,0 +1,19 @@ +{ + "sources": [], + "what": "timeline.group of a sketch and its cut into a folder changes no geometry", + "method": "a folder is only the timeline's: round R2 on the whole 40 mm front top edge, then the 10x10x5 notch through it: V = 12000 - 500 - (1-pi/4) 4 (40-10) (the notch already holds the round's 10 mm in it); faces: 6 block + 4 notch (bottom, two sides, back) + the round in two pieces = 12", + "body_count": 1, + "volume_mm3": 11474.247779607695, + "faces": 12, + "results": [ + { + "step": 7, + "json": { + "group": 5, + "name": "Notch folder", + "parent": null + } + } + ], + "source": "analytic" +} diff --git a/tests/kernel-cases/history/cov-timeline-group-keeps-the-part/recipe.json b/tests/kernel-cases/history/cov-timeline-group-keeps-the-part/recipe.json new file mode 100644 index 000000000..8d5b917e5 --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-group-keeps-the-part/recipe.json @@ -0,0 +1,73 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 10, + "body_name": "Block", + "name": "Block" + } + }, + { + "command": "solid.fillet", + "params": { + "body": "Block", + "edges": [ + [ + 5, + 0, + 10 + ] + ], + "radius": 2, + "name": "Round" + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "offset": 10, + "name": "NotchSketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 15, + 0 + ], + "p1": [ + 25, + 10 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "solid.extrude", + "params": { + "sketch": "NotchSketch", + "distance": -5, + "operation": "cut", + "name": "Notch" + } + }, + { + "command": "timeline.group", + "params": { + "name": "Notch folder", + "features": [ + "NotchSketch", + "Notch" + ] + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-timeline-group-non-contiguous-refused/expected.json b/tests/kernel-cases/history/cov-timeline-group-non-contiguous-refused/expected.json new file mode 100644 index 000000000..74034f870 --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-group-non-contiguous-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "timeline.group of two features with others between them", + "source": "invariants", + "method": "a folder holds one contiguous run of features: Block and Notch have Round and the sketch between them", + "outcome": "refused", + "refusal": "timeline folder `Split` must contain one contiguous run of features" +} diff --git a/tests/kernel-cases/history/cov-timeline-group-non-contiguous-refused/recipe.json b/tests/kernel-cases/history/cov-timeline-group-non-contiguous-refused/recipe.json new file mode 100644 index 000000000..889490e75 --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-group-non-contiguous-refused/recipe.json @@ -0,0 +1,73 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 10, + "body_name": "Block", + "name": "Block" + } + }, + { + "command": "solid.fillet", + "params": { + "body": "Block", + "edges": [ + [ + 5, + 0, + 10 + ] + ], + "radius": 2, + "name": "Round" + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "offset": 10, + "name": "NotchSketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 15, + 0 + ], + "p1": [ + 25, + 10 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "solid.extrude", + "params": { + "sketch": "NotchSketch", + "distance": -5, + "operation": "cut", + "name": "Notch" + } + }, + { + "command": "timeline.group", + "params": { + "name": "Split", + "features": [ + "Block", + "Notch" + ] + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-timeline-move-many-folder-behind-the-round/expected.json b/tests/kernel-cases/history/cov-timeline-move-many-folder-behind-the-round/expected.json new file mode 100644 index 000000000..e89ce89c1 --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-move-many-folder-behind-the-round/expected.json @@ -0,0 +1,9 @@ +{ + "sources": [], + "what": "timeline.move_many of a folder (a sketch and its notch) to behind the round made after it", + "method": "the order becomes Block, Round, sketch, Notch: round R2 on the whole 40 mm front top edge, then the 10x10x5 notch through it: V = 12000 - 500 - (1-pi/4) 4 (40-10) (the notch already holds the round's 10 mm in it); faces: 6 block + 4 notch (bottom, two sides, back) + the round in two pieces = 12", + "body_count": 1, + "volume_mm3": 11474.247779607695, + "faces": 12, + "source": "analytic" +} diff --git a/tests/kernel-cases/history/cov-timeline-move-many-folder-behind-the-round/recipe.json b/tests/kernel-cases/history/cov-timeline-move-many-folder-behind-the-round/recipe.json new file mode 100644 index 000000000..d9dfb7fce --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-move-many-folder-behind-the-round/recipe.json @@ -0,0 +1,82 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 10, + "body_name": "Block", + "name": "Block" + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "offset": 10, + "name": "NotchSketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 15, + 0 + ], + "p1": [ + 25, + 10 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "solid.extrude", + "params": { + "sketch": "NotchSketch", + "distance": -5, + "operation": "cut", + "name": "Notch" + } + }, + { + "command": "solid.fillet", + "params": { + "body": "Block", + "edges": [ + [ + 5, + 0, + 10 + ] + ], + "radius": 2, + "name": "Round" + } + }, + { + "command": "timeline.group", + "params": { + "name": "Notch folder", + "features": [ + "NotchSketch", + "Notch" + ] + } + }, + { + "command": "timeline.move_many", + "params": { + "groups": [ + 5 + ], + "position": 4 + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-timeline-move-many-folder-into-itself-refused/expected.json b/tests/kernel-cases/history/cov-timeline-move-many-folder-into-itself-refused/expected.json new file mode 100644 index 000000000..bd342dbea --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-move-many-folder-into-itself-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "timeline.move_many of a folder into itself", + "source": "invariants", + "method": "a folder cannot hold itself", + "outcome": "refused", + "refusal": "a folder cannot be moved into itself or one of its descendants" +} diff --git a/tests/kernel-cases/history/cov-timeline-move-many-folder-into-itself-refused/recipe.json b/tests/kernel-cases/history/cov-timeline-move-many-folder-into-itself-refused/recipe.json new file mode 100644 index 000000000..a7d183ee2 --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-move-many-folder-into-itself-refused/recipe.json @@ -0,0 +1,68 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 10, + "body_name": "Block", + "name": "Block" + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "offset": 10, + "name": "NotchSketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 15, + 0 + ], + "p1": [ + 25, + 10 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "solid.extrude", + "params": { + "sketch": "NotchSketch", + "distance": -5, + "operation": "cut", + "name": "Notch" + } + }, + { + "command": "timeline.group", + "params": { + "name": "Notch folder", + "features": [ + "NotchSketch", + "Notch" + ] + } + }, + { + "command": "timeline.move_many", + "params": { + "groups": [ + 4 + ], + "group": 4, + "position": 0 + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-timeline-move-to-group-joins-a-folder/expected.json b/tests/kernel-cases/history/cov-timeline-move-to-group-joins-a-folder/expected.json new file mode 100644 index 000000000..2a39813ae --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-move-to-group-joins-a-folder/expected.json @@ -0,0 +1,20 @@ +{ + "sources": [], + "what": "timeline.move_to_group of the round into the folder right after it", + "method": "Round, the sketch and Notch are one contiguous run; no geometry changes: round R2 on the whole 40 mm front top edge, then the 10x10x5 notch through it: V = 12000 - 500 - (1-pi/4) 4 (40-10) (the notch already holds the round's 10 mm in it); faces: 6 block + 4 notch (bottom, two sides, back) + the round in two pieces = 12", + "body_count": 1, + "volume_mm3": 11474.247779607695, + "faces": 12, + "results": [ + { + "step": 8, + "json": { + "features": [ + 2 + ], + "group": 5 + } + } + ], + "source": "analytic" +} diff --git a/tests/kernel-cases/history/cov-timeline-move-to-group-joins-a-folder/recipe.json b/tests/kernel-cases/history/cov-timeline-move-to-group-joins-a-folder/recipe.json new file mode 100644 index 000000000..9db18ca14 --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-move-to-group-joins-a-folder/recipe.json @@ -0,0 +1,82 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 10, + "body_name": "Block", + "name": "Block" + } + }, + { + "command": "solid.fillet", + "params": { + "body": "Block", + "edges": [ + [ + 5, + 0, + 10 + ] + ], + "radius": 2, + "name": "Round" + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "offset": 10, + "name": "NotchSketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 15, + 0 + ], + "p1": [ + 25, + 10 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "solid.extrude", + "params": { + "sketch": "NotchSketch", + "distance": -5, + "operation": "cut", + "name": "Notch" + } + }, + { + "command": "timeline.group", + "params": { + "name": "Notch folder", + "features": [ + "NotchSketch", + "Notch" + ] + } + }, + { + "command": "timeline.move_to_group", + "params": { + "features": [ + "Round" + ], + "group": 5 + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-timeline-move-to-group-non-contiguous-refused/expected.json b/tests/kernel-cases/history/cov-timeline-move-to-group-non-contiguous-refused/expected.json new file mode 100644 index 000000000..51239638f --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-move-to-group-non-contiguous-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "timeline.move_to_group of a cut into a folder its sketch is outside of", + "source": "invariants", + "method": "folder R would hold Round and Notch with the sketch between them: not one contiguous run", + "outcome": "refused", + "refusal": "timeline folder `R` must contain one contiguous run of features" +} diff --git a/tests/kernel-cases/history/cov-timeline-move-to-group-non-contiguous-refused/recipe.json b/tests/kernel-cases/history/cov-timeline-move-to-group-non-contiguous-refused/recipe.json new file mode 100644 index 000000000..2e0f82033 --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-move-to-group-non-contiguous-refused/recipe.json @@ -0,0 +1,81 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 10, + "body_name": "Block", + "name": "Block" + } + }, + { + "command": "solid.fillet", + "params": { + "body": "Block", + "edges": [ + [ + 5, + 0, + 10 + ] + ], + "radius": 2, + "name": "Round" + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "offset": 10, + "name": "NotchSketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 15, + 0 + ], + "p1": [ + 25, + 10 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "solid.extrude", + "params": { + "sketch": "NotchSketch", + "distance": -5, + "operation": "cut", + "name": "Notch" + } + }, + { + "command": "timeline.group", + "params": { + "name": "R", + "features": [ + "Round" + ] + } + }, + { + "command": "timeline.move_to_group", + "params": { + "features": [ + "Notch" + ], + "group": 5 + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-timeline-reorder-cut-before-its-sketch-refused/expected.json b/tests/kernel-cases/history/cov-timeline-reorder-cut-before-its-sketch-refused/expected.json new file mode 100644 index 000000000..4dc9179e9 --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-reorder-cut-before-its-sketch-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "timeline.reorder of a cut to before its own sketch", + "source": "invariants", + "method": "the cut cannot find its sketch there: the move breaks a feature that worked and is refused", + "outcome": "refused", + "refusal": "moving Notch there breaks Notch" +} diff --git a/tests/kernel-cases/history/cov-timeline-reorder-cut-before-its-sketch-refused/recipe.json b/tests/kernel-cases/history/cov-timeline-reorder-cut-before-its-sketch-refused/recipe.json new file mode 100644 index 000000000..14bcafa5f --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-reorder-cut-before-its-sketch-refused/recipe.json @@ -0,0 +1,55 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 10, + "body_name": "Block", + "name": "Block" + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "offset": 10, + "name": "NotchSketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 15, + 0 + ], + "p1": [ + 25, + 10 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "solid.extrude", + "params": { + "sketch": "NotchSketch", + "distance": -5, + "operation": "cut", + "name": "Notch" + } + }, + { + "command": "timeline.reorder", + "params": { + "feature": "Notch", + "position": 0 + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-timeline-reorder-fillet-before-the-cut/expected.json b/tests/kernel-cases/history/cov-timeline-reorder-fillet-before-the-cut/expected.json new file mode 100644 index 000000000..3fce022c9 --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-reorder-fillet-before-the-cut/expected.json @@ -0,0 +1,21 @@ +{ + "sources": [], + "what": "timeline.reorder of a round made after a notch to before it: the round now runs the whole edge and the notch cuts it", + "method": "round R2 on the whole 40 mm front top edge, then the 10x10x5 notch through it: V = 12000 - 500 - (1-pi/4) 4 (40-10) (the notch already holds the round's 10 mm in it); faces: 6 block + 4 notch (bottom, two sides, back) + the round in two pieces = 12", + "body_count": 1, + "volume_mm3": 11474.247779607695, + "faces": 12, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 40, + 30, + 10 + ] + }, + "source": "analytic" +} diff --git a/tests/kernel-cases/history/cov-timeline-reorder-fillet-before-the-cut/recipe.json b/tests/kernel-cases/history/cov-timeline-reorder-fillet-before-the-cut/recipe.json new file mode 100644 index 000000000..dad5ac690 --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-reorder-fillet-before-the-cut/recipe.json @@ -0,0 +1,70 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 10, + "body_name": "Block", + "name": "Block" + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "offset": 10, + "name": "NotchSketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 15, + 0 + ], + "p1": [ + 25, + 10 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "solid.extrude", + "params": { + "sketch": "NotchSketch", + "distance": -5, + "operation": "cut", + "name": "Notch" + } + }, + { + "command": "solid.fillet", + "params": { + "body": "Block", + "edges": [ + [ + 5, + 0, + 10 + ] + ], + "radius": 2, + "name": "Round" + } + }, + { + "command": "timeline.reorder", + "params": { + "feature": "Round", + "position": 1 + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-timeline-reorder-many-cut-after-the-fillet/expected.json b/tests/kernel-cases/history/cov-timeline-reorder-many-cut-after-the-fillet/expected.json new file mode 100644 index 000000000..6f593cf9a --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-reorder-many-cut-after-the-fillet/expected.json @@ -0,0 +1,9 @@ +{ + "sources": [], + "what": "timeline.reorder_many moves a notch's sketch and cut together behind the round", + "method": "round R2 on the whole 40 mm front top edge, then the 10x10x5 notch through it: V = 12000 - 500 - (1-pi/4) 4 (40-10) (the notch already holds the round's 10 mm in it); faces: 6 block + 4 notch (bottom, two sides, back) + the round in two pieces = 12", + "body_count": 1, + "volume_mm3": 11474.247779607695, + "faces": 12, + "source": "analytic" +} diff --git a/tests/kernel-cases/history/cov-timeline-reorder-many-cut-after-the-fillet/recipe.json b/tests/kernel-cases/history/cov-timeline-reorder-many-cut-after-the-fillet/recipe.json new file mode 100644 index 000000000..f580acfd1 --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-reorder-many-cut-after-the-fillet/recipe.json @@ -0,0 +1,73 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 10, + "body_name": "Block", + "name": "Block" + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "offset": 10, + "name": "NotchSketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 15, + 0 + ], + "p1": [ + 25, + 10 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "solid.extrude", + "params": { + "sketch": "NotchSketch", + "distance": -5, + "operation": "cut", + "name": "Notch" + } + }, + { + "command": "solid.fillet", + "params": { + "body": "Block", + "edges": [ + [ + 5, + 0, + 10 + ] + ], + "radius": 2, + "name": "Round" + } + }, + { + "command": "timeline.reorder_many", + "params": { + "features": [ + "NotchSketch", + "Notch" + ], + "position": 4 + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-timeline-reorder-many-sketch-after-its-cut-refused/expected.json b/tests/kernel-cases/history/cov-timeline-reorder-many-sketch-after-its-cut-refused/expected.json new file mode 100644 index 000000000..8f0c09c9b --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-reorder-many-sketch-after-its-cut-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "timeline.reorder_many of a sketch to behind the cut that uses it", + "source": "invariants", + "method": "the cut comes before its sketch: it breaks, so the move is refused", + "outcome": "refused", + "refusal": "moving the selected features there breaks Notch" +} diff --git a/tests/kernel-cases/history/cov-timeline-reorder-many-sketch-after-its-cut-refused/recipe.json b/tests/kernel-cases/history/cov-timeline-reorder-many-sketch-after-its-cut-refused/recipe.json new file mode 100644 index 000000000..e7e9d6750 --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-reorder-many-sketch-after-its-cut-refused/recipe.json @@ -0,0 +1,72 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 10, + "body_name": "Block", + "name": "Block" + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "offset": 10, + "name": "NotchSketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 15, + 0 + ], + "p1": [ + 25, + 10 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "solid.extrude", + "params": { + "sketch": "NotchSketch", + "distance": -5, + "operation": "cut", + "name": "Notch" + } + }, + { + "command": "solid.fillet", + "params": { + "body": "Block", + "edges": [ + [ + 5, + 0, + 10 + ] + ], + "radius": 2, + "name": "Round" + } + }, + { + "command": "timeline.reorder_many", + "params": { + "features": [ + "NotchSketch" + ], + "position": 4 + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-timeline-roll-to-end-after-rolling-back/expected.json b/tests/kernel-cases/history/cov-timeline-roll-to-end-after-rolling-back/expected.json new file mode 100644 index 000000000..addda26fe --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-roll-to-end-after-rolling-back/expected.json @@ -0,0 +1,23 @@ +{ + "sources": [], + "what": "timeline.roll_to the block alone, then to the end: every feature again", + "method": "round R2 on the whole 40 mm front top edge, then the 10x10x5 notch through it: V = 12000 - 500 - (1-pi/4) 4 (40-10) (the notch already holds the round's 10 mm in it); faces: 6 block + 4 notch (bottom, two sides, back) + the round in two pieces = 12", + "body_count": 1, + "volume_mm3": 11474.247779607695, + "faces": 12, + "results": [ + { + "step": 7, + "json": { + "marker": 1 + } + }, + { + "step": 8, + "json": { + "marker": 4 + } + } + ], + "source": "analytic" +} diff --git a/tests/kernel-cases/history/cov-timeline-roll-to-end-after-rolling-back/recipe.json b/tests/kernel-cases/history/cov-timeline-roll-to-end-after-rolling-back/recipe.json new file mode 100644 index 000000000..2b7c31281 --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-roll-to-end-after-rolling-back/recipe.json @@ -0,0 +1,73 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 10, + "body_name": "Block", + "name": "Block" + } + }, + { + "command": "solid.fillet", + "params": { + "body": "Block", + "edges": [ + [ + 5, + 0, + 10 + ] + ], + "radius": 2, + "name": "Round" + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "offset": 10, + "name": "NotchSketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 15, + 0 + ], + "p1": [ + 25, + 10 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "solid.extrude", + "params": { + "sketch": "NotchSketch", + "distance": -5, + "operation": "cut", + "name": "Notch" + } + }, + { + "command": "timeline.roll_to", + "params": { + "position": 1 + } + }, + { + "command": "timeline.roll_to", + "params": {} + } + ] +} diff --git a/tests/kernel-cases/history/cov-timeline-roll-to-negative-position-refused/expected.json b/tests/kernel-cases/history/cov-timeline-roll-to-negative-position-refused/expected.json new file mode 100644 index 000000000..f87766351 --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-roll-to-negative-position-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "timeline.roll_to a negative position", + "source": "invariants", + "method": "a position counts the features to keep active (0 to 2): -1 is refused, not read as 0", + "outcome": "refused", + "refusal": "`position` -1 is negative" +} diff --git a/tests/kernel-cases/history/cov-timeline-roll-to-negative-position-refused/recipe.json b/tests/kernel-cases/history/cov-timeline-roll-to-negative-position-refused/recipe.json new file mode 100644 index 000000000..882b70533 --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-roll-to-negative-position-refused/recipe.json @@ -0,0 +1,35 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 10, + "body_name": "Block", + "name": "Block" + } + }, + { + "command": "solid.fillet", + "params": { + "body": "Block", + "edges": [ + [ + 5, + 0, + 10 + ] + ], + "radius": 2, + "name": "Round" + } + }, + { + "command": "timeline.roll_to", + "params": { + "position": -1 + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-timeline-roll-to-the-middle/expected.json b/tests/kernel-cases/history/cov-timeline-roll-to-the-middle/expected.json new file mode 100644 index 000000000..e122d6dfd --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-roll-to-the-middle/expected.json @@ -0,0 +1,18 @@ +{ + "sources": [], + "what": "timeline.roll_to a feature in the middle: the part is the one at that step", + "method": "marker after Round (2 of 4 features active): 40x30x10 block with its front top edge rounded R2 along 40 mm: V = 12000 - (1-pi/4) 4 40; faces 6 + 1 = 7", + "body_count": 1, + "volume_mm3": 11965.663706143592, + "faces": 7, + "results": [ + { + "step": 7, + "json": { + "marker": 2, + "features": 4 + } + } + ], + "source": "analytic" +} diff --git a/tests/kernel-cases/history/cov-timeline-roll-to-the-middle/recipe.json b/tests/kernel-cases/history/cov-timeline-roll-to-the-middle/recipe.json new file mode 100644 index 000000000..af2e58f30 --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-roll-to-the-middle/recipe.json @@ -0,0 +1,69 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 10, + "body_name": "Block", + "name": "Block" + } + }, + { + "command": "solid.fillet", + "params": { + "body": "Block", + "edges": [ + [ + 5, + 0, + 10 + ] + ], + "radius": 2, + "name": "Round" + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "offset": 10, + "name": "NotchSketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 15, + 0 + ], + "p1": [ + 25, + 10 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "solid.extrude", + "params": { + "sketch": "NotchSketch", + "distance": -5, + "operation": "cut", + "name": "Notch" + } + }, + { + "command": "timeline.roll_to", + "params": { + "feature": "Round" + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-timeline-suppress-hole-restores-volume/expected.json b/tests/kernel-cases/history/cov-timeline-suppress-hole-restores-volume/expected.json new file mode 100644 index 000000000..03223ffdb --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-suppress-hole-restores-volume/expected.json @@ -0,0 +1,30 @@ +{ + "sources": [], + "what": "timeline.suppress on a through hole: the block is whole again", + "method": "40x30x10 block, the hole suppressed: V = 12000; 6 faces", + "body_count": 1, + "volume_mm3": 12000.0, + "faces": 6, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 40, + 30, + 10 + ] + }, + "results": [ + { + "step": 3, + "json": { + "feature": 2, + "suppressed": true + } + } + ], + "source": "analytic" +} diff --git a/tests/kernel-cases/history/cov-timeline-suppress-hole-restores-volume/recipe.json b/tests/kernel-cases/history/cov-timeline-suppress-hole-restores-volume/recipe.json new file mode 100644 index 000000000..1781014d8 --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-suppress-hole-restores-volume/recipe.json @@ -0,0 +1,33 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 10, + "body_name": "Block", + "name": "Block" + } + }, + { + "command": "solid.hole", + "params": { + "position": [ + 20, + 15, + 10 + ], + "diameter": 10, + "name": "Hole" + } + }, + { + "command": "timeline.suppress", + "params": { + "feature": "Hole", + "suppressed": true + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-timeline-suppress-several-in-one-step/expected.json b/tests/kernel-cases/history/cov-timeline-suppress-several-in-one-step/expected.json new file mode 100644 index 000000000..f1e206c94 --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-suppress-several-in-one-step/expected.json @@ -0,0 +1,17 @@ +{ + "sources": [], + "what": "timeline.suppress of a hole and a cut together", + "method": "both suppressed: the plain 40x30x10 block, V = 12000, 6 faces", + "body_count": 1, + "volume_mm3": 12000.0, + "faces": 6, + "results": [ + { + "step": 7, + "json": { + "suppressed": true + } + } + ], + "source": "analytic" +} diff --git a/tests/kernel-cases/history/cov-timeline-suppress-several-in-one-step/recipe.json b/tests/kernel-cases/history/cov-timeline-suppress-several-in-one-step/recipe.json new file mode 100644 index 000000000..8c8de9113 --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-suppress-several-in-one-step/recipe.json @@ -0,0 +1,70 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 10, + "body_name": "Block", + "name": "Block" + } + }, + { + "command": "solid.hole", + "params": { + "position": [ + 32, + 20, + 10 + ], + "diameter": 10, + "name": "Hole" + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "offset": 10, + "name": "NotchSketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 15, + 0 + ], + "p1": [ + 25, + 10 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "solid.extrude", + "params": { + "sketch": "NotchSketch", + "distance": -5, + "operation": "cut", + "name": "Notch" + } + }, + { + "command": "timeline.suppress", + "params": { + "features": [ + "Hole", + "Notch" + ], + "suppressed": true + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-timeline-suppress-toggles-twice/expected.json b/tests/kernel-cases/history/cov-timeline-suppress-toggles-twice/expected.json new file mode 100644 index 000000000..cdef78162 --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-suppress-toggles-twice/expected.json @@ -0,0 +1,23 @@ +{ + "sources": [], + "what": "timeline.suppress with no `suppressed` flips the hole off and back on", + "method": "two toggles leave the hole: V = 12000 - pi 5^2 10; faces 6 + 1 cylinder = 7", + "body_count": 1, + "volume_mm3": 11214.601836602551, + "faces": 7, + "results": [ + { + "step": 3, + "json": { + "suppressed": true + } + }, + { + "step": 4, + "json": { + "suppressed": false + } + } + ], + "source": "analytic" +} diff --git a/tests/kernel-cases/history/cov-timeline-suppress-toggles-twice/recipe.json b/tests/kernel-cases/history/cov-timeline-suppress-toggles-twice/recipe.json new file mode 100644 index 000000000..767659b1b --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-suppress-toggles-twice/recipe.json @@ -0,0 +1,38 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 10, + "body_name": "Block", + "name": "Block" + } + }, + { + "command": "solid.hole", + "params": { + "position": [ + 20, + 15, + 10 + ], + "diameter": 10, + "name": "Hole" + } + }, + { + "command": "timeline.suppress", + "params": { + "feature": "Hole" + } + }, + { + "command": "timeline.suppress", + "params": { + "feature": "Hole" + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-timeline-suppress-unknown-feature-refused/expected.json b/tests/kernel-cases/history/cov-timeline-suppress-unknown-feature-refused/expected.json new file mode 100644 index 000000000..1b50fa66d --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-suppress-unknown-feature-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "timeline.suppress of a feature the design does not have", + "source": "invariants", + "method": "no feature named Nope: a clean refusal naming it", + "outcome": "refused", + "refusal": "no feature `Nope`" +} diff --git a/tests/kernel-cases/history/cov-timeline-suppress-unknown-feature-refused/recipe.json b/tests/kernel-cases/history/cov-timeline-suppress-unknown-feature-refused/recipe.json new file mode 100644 index 000000000..33068b331 --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-suppress-unknown-feature-refused/recipe.json @@ -0,0 +1,21 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 10, + "body_name": "Block", + "name": "Block" + } + }, + { + "command": "timeline.suppress", + "params": { + "feature": "Nope", + "suppressed": true + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-timeline-ungroup-keeps-the-part/expected.json b/tests/kernel-cases/history/cov-timeline-ungroup-keeps-the-part/expected.json new file mode 100644 index 000000000..f9ca99869 --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-ungroup-keeps-the-part/expected.json @@ -0,0 +1,19 @@ +{ + "sources": [], + "what": "timeline.ungroup of a folder leaves its features and the part", + "method": "folders are only the timeline's: round R2 on the whole 40 mm front top edge, then the 10x10x5 notch through it: V = 12000 - 500 - (1-pi/4) 4 (40-10) (the notch already holds the round's 10 mm in it); faces: 6 block + 4 notch (bottom, two sides, back) + the round in two pieces = 12", + "body_count": 1, + "volume_mm3": 11474.247779607695, + "faces": 12, + "results": [ + { + "step": 8, + "json": { + "groups": [ + 5 + ] + } + } + ], + "source": "analytic" +} diff --git a/tests/kernel-cases/history/cov-timeline-ungroup-keeps-the-part/recipe.json b/tests/kernel-cases/history/cov-timeline-ungroup-keeps-the-part/recipe.json new file mode 100644 index 000000000..9abf4d7f2 --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-ungroup-keeps-the-part/recipe.json @@ -0,0 +1,79 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 10, + "body_name": "Block", + "name": "Block" + } + }, + { + "command": "solid.fillet", + "params": { + "body": "Block", + "edges": [ + [ + 5, + 0, + 10 + ] + ], + "radius": 2, + "name": "Round" + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "offset": 10, + "name": "NotchSketch" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 15, + 0 + ], + "p1": [ + 25, + 10 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "solid.extrude", + "params": { + "sketch": "NotchSketch", + "distance": -5, + "operation": "cut", + "name": "Notch" + } + }, + { + "command": "timeline.group", + "params": { + "name": "Notch folder", + "features": [ + "NotchSketch", + "Notch" + ] + } + }, + { + "command": "timeline.ungroup", + "params": { + "group": 5 + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-timeline-ungroup-unknown-folder-refused/expected.json b/tests/kernel-cases/history/cov-timeline-ungroup-unknown-folder-refused/expected.json new file mode 100644 index 000000000..e106a3495 --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-ungroup-unknown-folder-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "timeline.ungroup of a folder that does not exist", + "source": "invariants", + "method": "no folder 99: a clean refusal", + "outcome": "refused", + "refusal": "no timeline folder 99" +} diff --git a/tests/kernel-cases/history/cov-timeline-ungroup-unknown-folder-refused/recipe.json b/tests/kernel-cases/history/cov-timeline-ungroup-unknown-folder-refused/recipe.json new file mode 100644 index 000000000..d08393d4c --- /dev/null +++ b/tests/kernel-cases/history/cov-timeline-ungroup-unknown-folder-refused/recipe.json @@ -0,0 +1,20 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 30, + "height": 10, + "body_name": "Block", + "name": "Block" + } + }, + { + "command": "timeline.ungroup", + "params": { + "group": 99 + } + } + ] +} From d34f7ee17d2f068bbe84b9abf42d2f8ceb7b4627 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:10:09 -0400 Subject: [PATCH 081/108] Kernel rig: configuration cases, one configured block with each row's exact geometry A Default row, a 60 mm row, a row without the hole, a height column and rules that suppress the hole or drive the height, each checked after activation; preview leaves the design; refusals for a row that cannot build, unknown rows, columns and features, and a rule a row breaks. Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 31 ++++++++++ .../recipe.json | 20 ++++++ .../expected.json | 8 +++ .../recipe.json | 20 ++++++ .../expected.json | 9 +++ .../recipe.json | 20 ++++++ .../expected.json | 21 +++++++ .../recipe.json | 26 ++++++++ .../expected.json | 8 +++ .../recipe.json | 11 ++++ .../expected.json | 41 +++++++++++++ .../recipe.json | 26 ++++++++ .../expected.json | 31 ++++++++++ .../recipe.json | 27 ++++++++ .../expected.json | 8 +++ .../recipe.json | 11 ++++ .../expected.json | 43 +++++++++++++ .../recipe.json | 53 ++++++++++++++++ .../expected.json | 8 +++ .../recipe.json | 13 ++++ .../expected.json | 38 ++++++++++++ .../recipe.json | 24 ++++++++ .../expected.json | 8 +++ .../recipe.json | 14 +++++ .../expected.json | 21 +++++++ .../recipe.json | 46 ++++++++++++++ .../expected.json | 8 +++ .../recipe.json | 32 ++++++++++ .../expected.json | 21 +++++++ .../recipe.json | 40 ++++++++++++ .../expected.json | 25 ++++++++ .../recipe.json | 61 +++++++++++++++++++ .../expected.json | 41 +++++++++++++ .../recipe.json | 27 ++++++++ 34 files changed, 841 insertions(+) create mode 100644 tests/kernel-cases/history/cov-config-activate-a-longer-row/expected.json create mode 100644 tests/kernel-cases/history/cov-config-activate-a-longer-row/recipe.json create mode 100644 tests/kernel-cases/history/cov-config-activate-a-row-that-fails-refused/expected.json create mode 100644 tests/kernel-cases/history/cov-config-activate-a-row-that-fails-refused/recipe.json create mode 100644 tests/kernel-cases/history/cov-config-activate-a-row-that-suppresses-the-hole/expected.json create mode 100644 tests/kernel-cases/history/cov-config-activate-a-row-that-suppresses-the-hole/recipe.json create mode 100644 tests/kernel-cases/history/cov-config-activate-back-to-default/expected.json create mode 100644 tests/kernel-cases/history/cov-config-activate-back-to-default/recipe.json create mode 100644 tests/kernel-cases/history/cov-config-activate-unknown-row-refused/expected.json create mode 100644 tests/kernel-cases/history/cov-config-activate-unknown-row-refused/recipe.json create mode 100644 tests/kernel-cases/history/cov-config-column-adds-a-height/expected.json create mode 100644 tests/kernel-cases/history/cov-config-column-adds-a-height/recipe.json create mode 100644 tests/kernel-cases/history/cov-config-column-delete-drops-its-values/expected.json create mode 100644 tests/kernel-cases/history/cov-config-column-delete-drops-its-values/recipe.json create mode 100644 tests/kernel-cases/history/cov-config-column-unknown-parameter-refused/expected.json create mode 100644 tests/kernel-cases/history/cov-config-column-unknown-parameter-refused/recipe.json create mode 100644 tests/kernel-cases/history/cov-config-configure-default-row/expected.json create mode 100644 tests/kernel-cases/history/cov-config-configure-default-row/recipe.json create mode 100644 tests/kernel-cases/history/cov-config-configure-unknown-feature-refused/expected.json create mode 100644 tests/kernel-cases/history/cov-config-configure-unknown-feature-refused/recipe.json create mode 100644 tests/kernel-cases/history/cov-config-preview-leaves-the-design/expected.json create mode 100644 tests/kernel-cases/history/cov-config-preview-leaves-the-design/recipe.json create mode 100644 tests/kernel-cases/history/cov-config-row-unknown-column-refused/expected.json create mode 100644 tests/kernel-cases/history/cov-config-row-unknown-column-refused/recipe.json create mode 100644 tests/kernel-cases/history/cov-config-rule-drives-a-parameter/expected.json create mode 100644 tests/kernel-cases/history/cov-config-rule-drives-a-parameter/recipe.json create mode 100644 tests/kernel-cases/history/cov-config-rule-range-refuses-a-row/expected.json create mode 100644 tests/kernel-cases/history/cov-config-rule-range-refuses-a-row/recipe.json create mode 100644 tests/kernel-cases/history/cov-config-rule-suppresses-the-hole-on-long-rows/expected.json create mode 100644 tests/kernel-cases/history/cov-config-rule-suppresses-the-hole-on-long-rows/recipe.json create mode 100644 tests/kernel-cases/history/cov-config-rules-lists-the-rules/expected.json create mode 100644 tests/kernel-cases/history/cov-config-rules-lists-the-rules/recipe.json create mode 100644 tests/kernel-cases/history/cov-config-table-lists-every-row/expected.json create mode 100644 tests/kernel-cases/history/cov-config-table-lists-every-row/recipe.json diff --git a/tests/kernel-cases/history/cov-config-activate-a-longer-row/expected.json b/tests/kernel-cases/history/cov-config-activate-a-longer-row/expected.json new file mode 100644 index 000000000..02cda5b1c --- /dev/null +++ b/tests/kernel-cases/history/cov-config-activate-a-longer-row/expected.json @@ -0,0 +1,31 @@ +{ + "sources": [], + "what": "config.activate of a row with W = 60", + "method": "60x30x10 with the 10 mm hole: V = 18000 - pi 25 10; faces 7", + "body_count": 1, + "volume_mm3": 17214.601836602553, + "faces": 7, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 60, + 30, + 10 + ] + }, + "results": [ + { + "step": 7, + "json": { + "active": "Long", + "errors": [], + "matches": true + } + } + ], + "source": "analytic" +} diff --git a/tests/kernel-cases/history/cov-config-activate-a-longer-row/recipe.json b/tests/kernel-cases/history/cov-config-activate-a-longer-row/recipe.json new file mode 100644 index 000000000..6a79e35fe --- /dev/null +++ b/tests/kernel-cases/history/cov-config-activate-a-longer-row/recipe.json @@ -0,0 +1,20 @@ +{ + "base": "../cov-config-configure-default-row", + "commands": [ + { + "command": "config.row", + "params": { + "name": "Long", + "values": { + "W": "60 mm" + } + } + }, + { + "command": "config.activate", + "params": { + "row": "Long" + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-config-activate-a-row-that-fails-refused/expected.json b/tests/kernel-cases/history/cov-config-activate-a-row-that-fails-refused/expected.json new file mode 100644 index 000000000..a58ada9bc --- /dev/null +++ b/tests/kernel-cases/history/cov-config-activate-a-row-that-fails-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "config.activate of a row with a block 0 long", + "source": "invariants", + "method": "a 0 mm block cannot be built: the activation is refused and the design kept", + "outcome": "refused", + "refusal": "configuration `Zero` would fail to rebuild" +} diff --git a/tests/kernel-cases/history/cov-config-activate-a-row-that-fails-refused/recipe.json b/tests/kernel-cases/history/cov-config-activate-a-row-that-fails-refused/recipe.json new file mode 100644 index 000000000..b08bbf7b6 --- /dev/null +++ b/tests/kernel-cases/history/cov-config-activate-a-row-that-fails-refused/recipe.json @@ -0,0 +1,20 @@ +{ + "base": "../cov-config-configure-default-row", + "commands": [ + { + "command": "config.row", + "params": { + "name": "Zero", + "values": { + "W": "0 mm" + } + } + }, + { + "command": "config.activate", + "params": { + "row": "Zero" + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-config-activate-a-row-that-suppresses-the-hole/expected.json b/tests/kernel-cases/history/cov-config-activate-a-row-that-suppresses-the-hole/expected.json new file mode 100644 index 000000000..0255609c1 --- /dev/null +++ b/tests/kernel-cases/history/cov-config-activate-a-row-that-suppresses-the-hole/expected.json @@ -0,0 +1,9 @@ +{ + "sources": [], + "what": "config.activate of a row that suppresses the hole", + "method": "the 40x30x10 block without its hole: V = 12000; 6 faces", + "body_count": 1, + "volume_mm3": 12000.0, + "faces": 6, + "source": "analytic" +} diff --git a/tests/kernel-cases/history/cov-config-activate-a-row-that-suppresses-the-hole/recipe.json b/tests/kernel-cases/history/cov-config-activate-a-row-that-suppresses-the-hole/recipe.json new file mode 100644 index 000000000..cfa852ce6 --- /dev/null +++ b/tests/kernel-cases/history/cov-config-activate-a-row-that-suppresses-the-hole/recipe.json @@ -0,0 +1,20 @@ +{ + "base": "../cov-config-configure-default-row", + "commands": [ + { + "command": "config.row", + "params": { + "name": "Plain", + "values": { + "suppress:Hole": true + } + } + }, + { + "command": "config.activate", + "params": { + "row": "Plain" + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-config-activate-back-to-default/expected.json b/tests/kernel-cases/history/cov-config-activate-back-to-default/expected.json new file mode 100644 index 000000000..a58dc1e08 --- /dev/null +++ b/tests/kernel-cases/history/cov-config-activate-back-to-default/expected.json @@ -0,0 +1,21 @@ +{ + "sources": [], + "what": "config.activate of Long and then Default again: the first part back", + "method": "W = 40 again: V = 12000 - pi 25 10; faces 7", + "body_count": 1, + "volume_mm3": 11214.601836602551, + "faces": 7, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 40, + 30, + 10 + ] + }, + "source": "analytic" +} diff --git a/tests/kernel-cases/history/cov-config-activate-back-to-default/recipe.json b/tests/kernel-cases/history/cov-config-activate-back-to-default/recipe.json new file mode 100644 index 000000000..6f99c94a8 --- /dev/null +++ b/tests/kernel-cases/history/cov-config-activate-back-to-default/recipe.json @@ -0,0 +1,26 @@ +{ + "base": "../cov-config-configure-default-row", + "commands": [ + { + "command": "config.row", + "params": { + "name": "Long", + "values": { + "W": "60 mm" + } + } + }, + { + "command": "config.activate", + "params": { + "row": "Long" + } + }, + { + "command": "config.activate", + "params": { + "row": "Default" + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-config-activate-unknown-row-refused/expected.json b/tests/kernel-cases/history/cov-config-activate-unknown-row-refused/expected.json new file mode 100644 index 000000000..90c6fbc1e --- /dev/null +++ b/tests/kernel-cases/history/cov-config-activate-unknown-row-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "config.activate of a row the table does not have", + "source": "invariants", + "method": "no row Nope: a clean refusal naming it", + "outcome": "refused", + "refusal": "configuration `Nope`" +} diff --git a/tests/kernel-cases/history/cov-config-activate-unknown-row-refused/recipe.json b/tests/kernel-cases/history/cov-config-activate-unknown-row-refused/recipe.json new file mode 100644 index 000000000..3c0f1114e --- /dev/null +++ b/tests/kernel-cases/history/cov-config-activate-unknown-row-refused/recipe.json @@ -0,0 +1,11 @@ +{ + "base": "../cov-config-configure-default-row", + "commands": [ + { + "command": "config.activate", + "params": { + "row": "Nope" + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-config-column-adds-a-height/expected.json b/tests/kernel-cases/history/cov-config-column-adds-a-height/expected.json new file mode 100644 index 000000000..6be6899d0 --- /dev/null +++ b/tests/kernel-cases/history/cov-config-column-adds-a-height/expected.json @@ -0,0 +1,41 @@ +{ + "sources": [], + "what": "config.column adds the height H; a row with H = 20 makes the block 20 high", + "method": "40x30x20 with the 10 mm hole through: V = 24000 - pi 25 20; faces 7; the column fills Default with H's 10 mm", + "body_count": 1, + "volume_mm3": 22429.203673205102, + "faces": 7, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 40, + 30, + 20 + ] + }, + "results": [ + { + "step": 6, + "json": { + "columns": [ + "param:W", + "suppress:Hole", + "param:H" + ], + "rows": [ + { + "name": "Default", + "values": { + "param:H": "10 mm" + } + } + ] + } + } + ], + "source": "analytic" +} diff --git a/tests/kernel-cases/history/cov-config-column-adds-a-height/recipe.json b/tests/kernel-cases/history/cov-config-column-adds-a-height/recipe.json new file mode 100644 index 000000000..1d1c302eb --- /dev/null +++ b/tests/kernel-cases/history/cov-config-column-adds-a-height/recipe.json @@ -0,0 +1,26 @@ +{ + "base": "../cov-config-configure-default-row", + "commands": [ + { + "command": "config.column", + "params": { + "param": "H" + } + }, + { + "command": "config.row", + "params": { + "name": "Tall", + "values": { + "H": "20 mm" + } + } + }, + { + "command": "config.activate", + "params": { + "row": "Tall" + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-config-column-delete-drops-its-values/expected.json b/tests/kernel-cases/history/cov-config-column-delete-drops-its-values/expected.json new file mode 100644 index 000000000..2c7c6a5aa --- /dev/null +++ b/tests/kernel-cases/history/cov-config-column-delete-drops-its-values/expected.json @@ -0,0 +1,31 @@ +{ + "sources": [], + "what": "config.column delete of W: Long no longer sets the length", + "method": "the W column and its values go; activating Long sets only the hole (on): W stays 40, V = 12000 - pi 25 10", + "body_count": 1, + "volume_mm3": 11214.601836602551, + "faces": 7, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 40, + 30, + 10 + ] + }, + "results": [ + { + "step": 7, + "json": { + "columns": [ + "suppress:Hole" + ] + } + } + ], + "source": "analytic" +} diff --git a/tests/kernel-cases/history/cov-config-column-delete-drops-its-values/recipe.json b/tests/kernel-cases/history/cov-config-column-delete-drops-its-values/recipe.json new file mode 100644 index 000000000..afa566c9c --- /dev/null +++ b/tests/kernel-cases/history/cov-config-column-delete-drops-its-values/recipe.json @@ -0,0 +1,27 @@ +{ + "base": "../cov-config-configure-default-row", + "commands": [ + { + "command": "config.row", + "params": { + "name": "Long", + "values": { + "W": "60 mm" + } + } + }, + { + "command": "config.column", + "params": { + "param": "W", + "delete": true + } + }, + { + "command": "config.activate", + "params": { + "row": "Long" + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-config-column-unknown-parameter-refused/expected.json b/tests/kernel-cases/history/cov-config-column-unknown-parameter-refused/expected.json new file mode 100644 index 000000000..21aed2eb1 --- /dev/null +++ b/tests/kernel-cases/history/cov-config-column-unknown-parameter-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "config.column of a parameter the design does not have", + "source": "invariants", + "method": "no parameter Depth: refused naming it", + "outcome": "refused", + "refusal": "no parameter `Depth`" +} diff --git a/tests/kernel-cases/history/cov-config-column-unknown-parameter-refused/recipe.json b/tests/kernel-cases/history/cov-config-column-unknown-parameter-refused/recipe.json new file mode 100644 index 000000000..1d68c2796 --- /dev/null +++ b/tests/kernel-cases/history/cov-config-column-unknown-parameter-refused/recipe.json @@ -0,0 +1,11 @@ +{ + "base": "../cov-config-configure-default-row", + "commands": [ + { + "command": "config.column", + "params": { + "param": "Depth" + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-config-configure-default-row/expected.json b/tests/kernel-cases/history/cov-config-configure-default-row/expected.json new file mode 100644 index 000000000..392daf388 --- /dev/null +++ b/tests/kernel-cases/history/cov-config-configure-default-row/expected.json @@ -0,0 +1,43 @@ +{ + "sources": [], + "what": "config.configure of a block's length W and its hole's suppression: a Default row with today's values", + "method": "W = 40, H = 10, the 10 mm hole through: V = 12000 - pi 25 10; faces 7; the Default row holds W's expression and the hole on", + "body_count": 1, + "volume_mm3": 11214.601836602551, + "faces": 7, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 40, + 30, + 10 + ] + }, + "results": [ + { + "step": 5, + "json": { + "active": "Default", + "columns": [ + "param:W", + "suppress:Hole" + ], + "matches": true, + "rows": [ + { + "name": "Default", + "values": { + "param:W": "40 mm", + "suppress:Hole": "false" + } + } + ] + } + } + ], + "source": "analytic" +} diff --git a/tests/kernel-cases/history/cov-config-configure-default-row/recipe.json b/tests/kernel-cases/history/cov-config-configure-default-row/recipe.json new file mode 100644 index 000000000..85e1dc770 --- /dev/null +++ b/tests/kernel-cases/history/cov-config-configure-default-row/recipe.json @@ -0,0 +1,53 @@ +{ + "commands": [ + { + "command": "parameters.add", + "params": { + "name": "W", + "expression": "40 mm", + "unit": "mm" + } + }, + { + "command": "parameters.add", + "params": { + "name": "H", + "expression": "10 mm", + "unit": "mm" + } + }, + { + "command": "solid.box", + "params": { + "length": "W", + "width": 30, + "height": "H", + "body_name": "Block", + "name": "Block" + } + }, + { + "command": "solid.hole", + "params": { + "position": [ + 20, + 15, + 10 + ], + "diameter": 10, + "name": "Hole" + } + }, + { + "command": "config.configure", + "params": { + "params": [ + "W" + ], + "features": [ + "Hole" + ] + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-config-configure-unknown-feature-refused/expected.json b/tests/kernel-cases/history/cov-config-configure-unknown-feature-refused/expected.json new file mode 100644 index 000000000..9676caf7c --- /dev/null +++ b/tests/kernel-cases/history/cov-config-configure-unknown-feature-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "config.configure of a feature the design does not have", + "source": "invariants", + "method": "no feature Nope: refused naming it", + "outcome": "refused", + "refusal": "no feature `Nope`" +} diff --git a/tests/kernel-cases/history/cov-config-configure-unknown-feature-refused/recipe.json b/tests/kernel-cases/history/cov-config-configure-unknown-feature-refused/recipe.json new file mode 100644 index 000000000..30de55fa7 --- /dev/null +++ b/tests/kernel-cases/history/cov-config-configure-unknown-feature-refused/recipe.json @@ -0,0 +1,13 @@ +{ + "base": "../cov-config-configure-default-row", + "commands": [ + { + "command": "config.configure", + "params": { + "features": [ + "Nope" + ] + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-config-preview-leaves-the-design/expected.json b/tests/kernel-cases/history/cov-config-preview-leaves-the-design/expected.json new file mode 100644 index 000000000..1a6aa056f --- /dev/null +++ b/tests/kernel-cases/history/cov-config-preview-leaves-the-design/expected.json @@ -0,0 +1,38 @@ +{ + "sources": [], + "what": "config.preview of Long rebuilds it on the side: the design stays Default", + "method": "the preview answers for Long, the design stays W = 40: V = 12000 - pi 25 10; faces 7", + "body_count": 1, + "volume_mm3": 11214.601836602551, + "faces": 7, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 40, + 30, + 10 + ] + }, + "results": [ + { + "step": 7, + "json": { + "preview": true, + "active": "Long", + "errors": [] + } + }, + { + "step": 8, + "json": { + "active": "Default", + "matches": true + } + } + ], + "source": "analytic" +} diff --git a/tests/kernel-cases/history/cov-config-preview-leaves-the-design/recipe.json b/tests/kernel-cases/history/cov-config-preview-leaves-the-design/recipe.json new file mode 100644 index 000000000..024f7b188 --- /dev/null +++ b/tests/kernel-cases/history/cov-config-preview-leaves-the-design/recipe.json @@ -0,0 +1,24 @@ +{ + "base": "../cov-config-configure-default-row", + "commands": [ + { + "command": "config.row", + "params": { + "name": "Long", + "values": { + "W": "60 mm" + } + } + }, + { + "command": "config.preview", + "params": { + "row": "Long" + } + }, + { + "command": "config.table", + "params": {} + } + ] +} diff --git a/tests/kernel-cases/history/cov-config-row-unknown-column-refused/expected.json b/tests/kernel-cases/history/cov-config-row-unknown-column-refused/expected.json new file mode 100644 index 000000000..4996b1a72 --- /dev/null +++ b/tests/kernel-cases/history/cov-config-row-unknown-column-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "config.row with a value for a column the table does not have", + "source": "invariants", + "method": "Depth is not a column: refused, saying how to add one", + "outcome": "refused", + "refusal": "`Depth` is not a column (config.column adds one)" +} diff --git a/tests/kernel-cases/history/cov-config-row-unknown-column-refused/recipe.json b/tests/kernel-cases/history/cov-config-row-unknown-column-refused/recipe.json new file mode 100644 index 000000000..fae97ddbd --- /dev/null +++ b/tests/kernel-cases/history/cov-config-row-unknown-column-refused/recipe.json @@ -0,0 +1,14 @@ +{ + "base": "../cov-config-configure-default-row", + "commands": [ + { + "command": "config.row", + "params": { + "name": "Deep", + "values": { + "Depth": "5 mm" + } + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-config-rule-drives-a-parameter/expected.json b/tests/kernel-cases/history/cov-config-rule-drives-a-parameter/expected.json new file mode 100644 index 000000000..974b766dc --- /dev/null +++ b/tests/kernel-cases/history/cov-config-rule-drives-a-parameter/expected.json @@ -0,0 +1,21 @@ +{ + "sources": [], + "what": "config.rule drives H to 20 when W is 60 or more", + "method": "Long: W = 60, the rule sets H = 20: V = 60 30 20 - pi 25 20 = 36000 - 500 pi; faces 7", + "body_count": 1, + "volume_mm3": 34429.203673205106, + "faces": 7, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 60, + 30, + 20 + ] + }, + "source": "analytic" +} diff --git a/tests/kernel-cases/history/cov-config-rule-drives-a-parameter/recipe.json b/tests/kernel-cases/history/cov-config-rule-drives-a-parameter/recipe.json new file mode 100644 index 000000000..928c5609d --- /dev/null +++ b/tests/kernel-cases/history/cov-config-rule-drives-a-parameter/recipe.json @@ -0,0 +1,46 @@ +{ + "base": "../cov-config-configure-default-row", + "commands": [ + { + "command": "config.column", + "params": { + "param": "H" + } + }, + { + "command": "config.row", + "params": { + "name": "Long", + "values": { + "W": "60 mm" + } + } + }, + { + "command": "config.rule", + "params": { + "rule": { + "id": "tall", + "name": "Tall when long", + "condition": { + "type": "parameter", + "parameter": "W", + "operator": "ge", + "expression": "60 mm" + }, + "effect": { + "type": "drive_parameter", + "parameter": "H", + "expression": "20 mm" + } + } + } + }, + { + "command": "config.activate", + "params": { + "row": "Long" + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-config-rule-range-refuses-a-row/expected.json b/tests/kernel-cases/history/cov-config-rule-range-refuses-a-row/expected.json new file mode 100644 index 000000000..a58dd7cbd --- /dev/null +++ b/tests/kernel-cases/history/cov-config-rule-range-refuses-a-row/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "config.rule limiting W to 30..50 while the row Long has W = 60", + "source": "invariants", + "method": "every row is checked against the new rule: Long's 60 is outside it, so the rule is refused", + "outcome": "refused", + "refusal": "rule `Range` restricts the final value" +} diff --git a/tests/kernel-cases/history/cov-config-rule-range-refuses-a-row/recipe.json b/tests/kernel-cases/history/cov-config-rule-range-refuses-a-row/recipe.json new file mode 100644 index 000000000..d80011b6c --- /dev/null +++ b/tests/kernel-cases/history/cov-config-rule-range-refuses-a-row/recipe.json @@ -0,0 +1,32 @@ +{ + "base": "../cov-config-configure-default-row", + "commands": [ + { + "command": "config.row", + "params": { + "name": "Long", + "values": { + "W": "60 mm" + } + } + }, + { + "command": "config.rule", + "params": { + "rule": { + "id": "range", + "name": "Range", + "condition": { + "type": "always" + }, + "effect": { + "type": "parameter_range", + "parameter": "W", + "minimum": "30 mm", + "maximum": "50 mm" + } + } + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-config-rule-suppresses-the-hole-on-long-rows/expected.json b/tests/kernel-cases/history/cov-config-rule-suppresses-the-hole-on-long-rows/expected.json new file mode 100644 index 000000000..4953d59e6 --- /dev/null +++ b/tests/kernel-cases/history/cov-config-rule-suppresses-the-hole-on-long-rows/expected.json @@ -0,0 +1,21 @@ +{ + "sources": [], + "what": "config.rule: a block longer than 50 has no hole; activating Long applies it", + "method": "W = 60 > 50: the rule suppresses the hole: V = 60 30 10 = 18000; 6 faces", + "body_count": 1, + "volume_mm3": 18000.0, + "faces": 6, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 60, + 30, + 10 + ] + }, + "source": "analytic" +} diff --git a/tests/kernel-cases/history/cov-config-rule-suppresses-the-hole-on-long-rows/recipe.json b/tests/kernel-cases/history/cov-config-rule-suppresses-the-hole-on-long-rows/recipe.json new file mode 100644 index 000000000..9c7b57ded --- /dev/null +++ b/tests/kernel-cases/history/cov-config-rule-suppresses-the-hole-on-long-rows/recipe.json @@ -0,0 +1,40 @@ +{ + "base": "../cov-config-configure-default-row", + "commands": [ + { + "command": "config.row", + "params": { + "name": "Long", + "values": { + "W": "60 mm" + } + } + }, + { + "command": "config.rule", + "params": { + "rule": { + "id": "big", + "name": "Big", + "condition": { + "type": "parameter", + "parameter": "W", + "operator": "gt", + "expression": "50 mm" + }, + "effect": { + "type": "drive_suppression", + "feature": 2, + "value": true + } + } + } + }, + { + "command": "config.activate", + "params": { + "row": "Long" + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-config-rules-lists-the-rules/expected.json b/tests/kernel-cases/history/cov-config-rules-lists-the-rules/expected.json new file mode 100644 index 000000000..275cd1eec --- /dev/null +++ b/tests/kernel-cases/history/cov-config-rules-lists-the-rules/expected.json @@ -0,0 +1,25 @@ +{ + "sources": [], + "what": "config.rule adds two rules in one step; config.rules lists them in order", + "method": "Long: W = 60 > 50, Big suppresses the hole and Small does not match: V = 18000; 6 faces", + "body_count": 1, + "volume_mm3": 18000.0, + "faces": 6, + "results": [ + { + "step": 9, + "json": { + "active": "Long", + "rules": [ + { + "id": "big" + }, + { + "id": "small" + } + ] + } + } + ], + "source": "analytic" +} diff --git a/tests/kernel-cases/history/cov-config-rules-lists-the-rules/recipe.json b/tests/kernel-cases/history/cov-config-rules-lists-the-rules/recipe.json new file mode 100644 index 000000000..e61a11d95 --- /dev/null +++ b/tests/kernel-cases/history/cov-config-rules-lists-the-rules/recipe.json @@ -0,0 +1,61 @@ +{ + "base": "../cov-config-configure-default-row", + "commands": [ + { + "command": "config.row", + "params": { + "name": "Long", + "values": { + "W": "60 mm" + } + } + }, + { + "command": "config.rule", + "params": { + "rules": [ + { + "id": "big", + "name": "Big", + "condition": { + "type": "parameter", + "parameter": "W", + "operator": "gt", + "expression": "50 mm" + }, + "effect": { + "type": "drive_suppression", + "feature": 2, + "value": true + } + }, + { + "id": "small", + "name": "Small", + "condition": { + "type": "parameter", + "parameter": "W", + "operator": "le", + "expression": "50 mm" + }, + "effect": { + "type": "drive_suppression", + "feature": 2, + "value": false + } + } + ] + } + }, + { + "command": "config.activate", + "params": { + "row": "Long" + } + }, + { + "command": "config.rules", + "params": {} + } + ] +} diff --git a/tests/kernel-cases/history/cov-config-table-lists-every-row/expected.json b/tests/kernel-cases/history/cov-config-table-lists-every-row/expected.json new file mode 100644 index 000000000..d8f1b25cc --- /dev/null +++ b/tests/kernel-cases/history/cov-config-table-lists-every-row/expected.json @@ -0,0 +1,41 @@ +{ + "sources": [], + "what": "config.table lists the three rows, each with its values", + "method": "Default (W 40, hole on), Long (W 60), Plain (hole off); Default stays active: V = 12000 - pi 25 10", + "body_count": 1, + "volume_mm3": 11214.601836602551, + "faces": 7, + "results": [ + { + "step": 8, + "json": { + "active": "Default", + "matches": true, + "rows": [ + { + "name": "Default", + "values": { + "param:W": "40 mm", + "suppress:Hole": "false" + } + }, + { + "name": "Long", + "values": { + "param:W": "60 mm", + "suppress:Hole": "false" + } + }, + { + "name": "Plain", + "values": { + "param:W": "40 mm", + "suppress:Hole": "true" + } + } + ] + } + } + ], + "source": "analytic" +} diff --git a/tests/kernel-cases/history/cov-config-table-lists-every-row/recipe.json b/tests/kernel-cases/history/cov-config-table-lists-every-row/recipe.json new file mode 100644 index 000000000..55f529284 --- /dev/null +++ b/tests/kernel-cases/history/cov-config-table-lists-every-row/recipe.json @@ -0,0 +1,27 @@ +{ + "base": "../cov-config-configure-default-row", + "commands": [ + { + "command": "config.row", + "params": { + "name": "Long", + "values": { + "W": "60 mm" + } + } + }, + { + "command": "config.row", + "params": { + "name": "Plain", + "values": { + "suppress:Hole": true + } + } + }, + { + "command": "config.table", + "params": {} + } + ] +} From 445f6faa4661d10d0041c1e89a276eb4999cd2d9 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:10:09 -0400 Subject: [PATCH 082/108] Kernel rig: parameter cases, an expression in a sketch dimension and a cyclic one refused Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 8 +++ .../recipe.json | 35 +++++++++ .../expected.json | 10 +++ .../recipe.json | 72 +++++++++++++++++++ 4 files changed, 125 insertions(+) create mode 100644 tests/kernel-cases/history/cov-parameters-cyclic-expression-refused/expected.json create mode 100644 tests/kernel-cases/history/cov-parameters-cyclic-expression-refused/recipe.json create mode 100644 tests/kernel-cases/history/cov-parameters-expression-drives-a-dimension/expected.json create mode 100644 tests/kernel-cases/history/cov-parameters-expression-drives-a-dimension/recipe.json diff --git a/tests/kernel-cases/history/cov-parameters-cyclic-expression-refused/expected.json b/tests/kernel-cases/history/cov-parameters-cyclic-expression-refused/expected.json new file mode 100644 index 000000000..9fff847ea --- /dev/null +++ b/tests/kernel-cases/history/cov-parameters-cyclic-expression-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "parameters.change that makes two parameters depend on each other", + "source": "invariants", + "method": "A = B - 5 with B = A + 5 has no value: refused", + "outcome": "refused", + "refusal": "circular reference" +} diff --git a/tests/kernel-cases/history/cov-parameters-cyclic-expression-refused/recipe.json b/tests/kernel-cases/history/cov-parameters-cyclic-expression-refused/recipe.json new file mode 100644 index 000000000..8a833e4a2 --- /dev/null +++ b/tests/kernel-cases/history/cov-parameters-cyclic-expression-refused/recipe.json @@ -0,0 +1,35 @@ +{ + "commands": [ + { + "command": "parameters.add", + "params": { + "name": "A", + "expression": "10 mm", + "unit": "mm" + } + }, + { + "command": "parameters.add", + "params": { + "name": "B", + "expression": "A + 5 mm", + "unit": "mm" + } + }, + { + "command": "solid.box", + "params": { + "length": "B", + "width": 10, + "height": 10 + } + }, + { + "command": "parameters.change", + "params": { + "name": "A", + "expression": "B - 5 mm" + } + } + ] +} diff --git a/tests/kernel-cases/history/cov-parameters-expression-drives-a-dimension/expected.json b/tests/kernel-cases/history/cov-parameters-expression-drives-a-dimension/expected.json new file mode 100644 index 000000000..762264604 --- /dev/null +++ b/tests/kernel-cases/history/cov-parameters-expression-drives-a-dimension/expected.json @@ -0,0 +1,10 @@ +{ + "sources": [], + "what": "sketch dimensions 2 W and W / 2: changing W rebuilds the plate", + "method": "W = 30: a 60x15 rectangle extruded 10: V = 9000, A = 2 (900 + 600 + 150) = 3300; 6 faces", + "body_count": 1, + "volume_mm3": 9000.0, + "area_mm2": 3300.0, + "faces": 6, + "source": "analytic" +} diff --git a/tests/kernel-cases/history/cov-parameters-expression-drives-a-dimension/recipe.json b/tests/kernel-cases/history/cov-parameters-expression-drives-a-dimension/recipe.json new file mode 100644 index 000000000..7a6d7d5dc --- /dev/null +++ b/tests/kernel-cases/history/cov-parameters-expression-drives-a-dimension/recipe.json @@ -0,0 +1,72 @@ +{ + "commands": [ + { + "command": "parameters.add", + "params": { + "name": "W", + "expression": "20 mm", + "unit": "mm" + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "S" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 40, + 10 + ] + } + }, + { + "command": "sketch.dimension", + "params": { + "entities": [ + "l1" + ], + "type": "length", + "value": "2 * W" + } + }, + { + "command": "sketch.dimension", + "params": { + "entities": [ + "l4" + ], + "type": "length", + "value": "W / 2" + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "solid.extrude", + "params": { + "sketch": "S", + "distance": 10, + "operation": "new", + "body_name": "Plate" + } + }, + { + "command": "parameters.change", + "params": { + "name": "W", + "expression": "30 mm" + } + } + ] +} From 2cd1a033541f19326cf63fc17d5f501aaeabd0f8 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:20:41 -0400 Subject: [PATCH 083/108] Kernel rig: an assemblies area, with the source files that rerun it Co-Authored-By: Claude Opus 5.5 --- tests/kernel-cases/README.md | 1 + tests/kernel-cases/assemblies/KNOWN_FAILING | 4 +++ tests/kernel-cases/assemblies/PATHS | 28 +++++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 tests/kernel-cases/assemblies/KNOWN_FAILING create mode 100644 tests/kernel-cases/assemblies/PATHS diff --git a/tests/kernel-cases/README.md b/tests/kernel-cases/README.md index 901cf34cb..f993d12fc 100644 --- a/tests/kernel-cases/README.md +++ b/tests/kernel-cases/README.md @@ -44,6 +44,7 @@ One directory per area, one per case: `tests/kernel-cases///`. | `construction` (construction planes, axes and points: `construct.*`) | tool coverage rig | | `inspect` (the inspect commands that return numbers) | tool coverage rig | | `history` (the timeline's suppress, reorder, delete, roll back, edit and folders; configuration rows, columns and rules; parameters that drive geometry) | tool coverage rig | +| `assemblies` (joints and couplings, motion studies, contact, components and occurrences, interference and clearance between placed parts: placements and answers worked out by hand) | rig coverage | Each area also has its gate files: `KNOWN_FAILING` and `PATHS` (see [the gate](#the-kernel-rig-gate)). diff --git a/tests/kernel-cases/assemblies/KNOWN_FAILING b/tests/kernel-cases/assemblies/KNOWN_FAILING new file mode 100644 index 000000000..b9e904251 --- /dev/null +++ b/tests/kernel-cases/assemblies/KNOWN_FAILING @@ -0,0 +1,4 @@ +# The assemblies cases that fail today, one a line: ` `. Sorted. A gate +# fails on a case that fails and is not listed here, and on a listed case that passes: a fix +# removes its line in the same pull request. +# Baseline: rig-cases-assemblies 45f69c0e5 with SMLib 60b1c6a, aarch64 Linux. None fail today. diff --git a/tests/kernel-cases/assemblies/PATHS b/tests/kernel-cases/assemblies/PATHS new file mode 100644 index 000000000..c4d4c73b5 --- /dev/null +++ b/tests/kernel-cases/assemblies/PATHS @@ -0,0 +1,28 @@ +# Source files whose change must rerun the assemblies cases (one git pathspec glob a line). +# Joints, couplings, cams, reach and the solver. +crates/doc/src/joints*.rs +crates/doc/src/assembly.rs +crates/engine/src/cmd/joints.rs +crates/engine/src/cmd/joints_inspect.rs +# Motion studies, plots, traces, interference, sweeps, contact and exploded views. +crates/doc/src/motion.rs +crates/engine/src/cmd/motion.rs +crates/engine/src/cmd/motion_analysis.rs +crates/engine/src/cmd/motion_sweep.rs +crates/engine/src/cmd/motion_trace.rs +crates/engine/src/cmd/contact_sweep.rs +# Components and occurrences (their placement in the world is crates/doc/src/eval.rs: shared core). +crates/engine/src/cmd/component.rs +crates/engine/src/cmd/component_clone.rs +crates/engine/src/cmd/component_clone_assembly.rs +crates/engine/src/cmd/component_drag.rs +crates/engine/src/cmd/component_extract.rs +crates/engine/src/cmd/component_link.rs +crates/engine/src/cmd/component_properties.rs +crates/engine/src/cmd/component_reparent.rs +crates/engine/src/cmd/component_transfer.rs +# Interference and clearance between placed bodies. +crates/engine/src/cmd/clearance.rs +crates/engine/src/cmd/interference.rs +# The cases themselves. +tests/kernel-cases/assemblies/** From 0da95a8cc7524d153673f4584bd14fab1673ef87 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:20:41 -0400 Subject: [PATCH 084/108] Kernel rig: each joint type moves its part to the placement worked out by hand, limits clamp, as-built keeps it in place Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 44 +++++ .../recipe.json | 129 +++++++++++++ .../expected.json | 44 +++++ .../recipe.json | 124 +++++++++++++ .../expected.json | 50 +++++ .../cov-joint-ball-yaw-and-pitch/recipe.json | 142 +++++++++++++++ .../expected.json | 47 +++++ .../recipe.json | 127 +++++++++++++ .../expected.json | 22 +++ .../recipe.json | 122 +++++++++++++ .../expected.json | 32 ++++ .../recipe.json | 132 ++++++++++++++ .../expected.json | 47 +++++ .../recipe.json | 141 +++++++++++++++ .../expected.json | 50 +++++ .../recipe.json | 142 +++++++++++++++ .../expected.json | 32 ++++ .../recipe.json | 130 +++++++++++++ .../expected.json | 44 +++++ .../recipe.json | 124 +++++++++++++ .../expected.json | 34 ++++ .../recipe.json | 171 ++++++++++++++++++ .../expected.json | 41 +++++ .../recipe.json | 120 ++++++++++++ .../expected.json | 34 ++++ .../recipe.json | 117 ++++++++++++ .../cov-joint-slider-along-x/expected.json | 44 +++++ .../cov-joint-slider-along-x/recipe.json | 124 +++++++++++++ .../expected.json | 54 ++++++ .../recipe.json | 144 +++++++++++++++ .../expected.json | 8 + .../recipe.json | 109 +++++++++++ 32 files changed, 2725 insertions(+) create mode 100644 tests/kernel-cases/assemblies/cov-joint-as-built-keeps-the-arm-where-it-is/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-as-built-keeps-the-arm-where-it-is/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-as-built-slider-with-limits/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-as-built-slider-with-limits/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-ball-yaw-and-pitch/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-ball-yaw-and-pitch/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-cylindrical-turn-and-slide/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-cylindrical-turn-and-slide/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-limits-new-joint-starts-at-the-nearer-limit/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-limits-new-joint-starts-at-the-nearer-limit/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-limits-set-then-drive-past/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-limits-set-then-drive-past/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-pin-slot-turn-then-slide/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-pin-slot-turn-then-slide/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-planar-move-and-turn/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-planar-move-and-turn/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-revolute-drive-past-the-limit-is-clamped/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-revolute-drive-past-the-limit-is-clamped/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-revolute-quarter-turn/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-revolute-quarter-turn/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-rigid-group-moves-together/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-rigid-group-moves-together/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-rigid-holds-the-arm-where-it-is/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-rigid-holds-the-arm-where-it-is/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-rigid-with-an-offset-lifts-the-arm/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-rigid-with-an-offset-lifts-the-arm/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-slider-along-x/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-slider-along-x/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-slider-drive-past-the-limit-is-clamped/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-slider-drive-past-the-limit-is-clamped/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-two-origins-on-one-part-refused/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-two-origins-on-one-part-refused/recipe.json diff --git a/tests/kernel-cases/assemblies/cov-joint-as-built-keeps-the-arm-where-it-is/expected.json b/tests/kernel-cases/assemblies/cov-joint-as-built-keeps-the-arm-where-it-is/expected.json new file mode 100644 index 000000000..203a8a558 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-as-built-keeps-the-arm-where-it-is/expected.json @@ -0,0 +1,44 @@ +{ + "sources": [], + "what": "an as-built revolute on an arm lifted 20 mm, then driven 90 degrees", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Arm moved by (0,0,20) first, then joint.as_built revolute about z through the origin: it stays at (20,0,25); a drive to 90 turns it to (0,20,25)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 10, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 0.0, + 25.0 + ] + } + } + }, + { + "step": 11, + "json": { + "values": [ + { + "value": 90.0 + } + ] + } + }, + { + "step": 12, + "json": { + "total": { + "center_of_mass": [ + 0.0, + 20.0, + 25.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-as-built-keeps-the-arm-where-it-is/recipe.json b/tests/kernel-cases/assemblies/cov-joint-as-built-keeps-the-arm-where-it-is/recipe.json new file mode 100644 index 000000000..732cb60b6 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-as-built-keeps-the-arm-where-it-is/recipe.json @@ -0,0 +1,129 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "occurrence.move", + "params": { + "occurrence": "Arm:1", + "translate": [ + 0, + 0, + 20 + ] + } + }, + { + "command": "joint.as_built", + "params": { + "type": "revolute", + "a": "Base", + "b": "Arm", + "at": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "name": "Hinge", + "quiet": true + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Hinge", + "quiet": true, + "value": 90 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-as-built-slider-with-limits/expected.json b/tests/kernel-cases/assemblies/cov-joint-as-built-slider-with-limits/expected.json new file mode 100644 index 000000000..9d3e90215 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-as-built-slider-with-limits/expected.json @@ -0,0 +1,44 @@ +{ + "sources": [], + "what": "an as-built slider along +x with limits -5..5, driven to 20", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); joint.as_built keeps Arm at (20,0,5); 20 is clamped to 5: centre (25,0,5)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 9, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 0.0, + 5.0 + ] + } + } + }, + { + "step": 10, + "json": { + "values": [ + { + "value": 5.0 + } + ] + } + }, + { + "step": 11, + "json": { + "total": { + "center_of_mass": [ + 25.0, + 0.0, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-as-built-slider-with-limits/recipe.json b/tests/kernel-cases/assemblies/cov-joint-as-built-slider-with-limits/recipe.json new file mode 100644 index 000000000..222524c9b --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-as-built-slider-with-limits/recipe.json @@ -0,0 +1,124 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.as_built", + "params": { + "type": "slider", + "a": "Base", + "b": "Arm", + "at": { + "occurrence": "Base", + "point": [ + 0, + 0, + 5 + ], + "z": [ + 1, + 0, + 0 + ] + }, + "name": "Slide", + "limits": [ + [ + -5, + 5 + ] + ], + "quiet": true + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Slide", + "quiet": true, + "value": 20 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-ball-yaw-and-pitch/expected.json b/tests/kernel-cases/assemblies/cov-joint-ball-yaw-and-pitch/expected.json new file mode 100644 index 000000000..f200da4e0 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-ball-yaw-and-pitch/expected.json @@ -0,0 +1,50 @@ +{ + "sources": [], + "what": "a ball joint driven to yaw 90 and pitch 90", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); ball with frame z = +z, x = +x: M = Rz(yaw)\u00b7Ry(pitch)\u00b7Rz(roll); Ry(90): (x,y,z) -> (z,y,-x), then Rz(90): (x,y) -> (-y,x): (20,0,5) -> (5,0,-20) -> (0,5,-20); box x -5..5, y 0..10, z -40..0", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 9, + "json": { + "values": [ + { + "value": 90.0 + }, + { + "value": 90.0 + }, + { + "value": 0.0 + } + ] + } + }, + { + "step": 10, + "json": { + "total": { + "center_of_mass": [ + 0.0, + 5.0, + -20.0 + ], + "bbox": { + "min": [ + -5.0, + 0.0, + -40.0 + ], + "max": [ + 5.0, + 10.0, + 0.0 + ] + } + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-ball-yaw-and-pitch/recipe.json b/tests/kernel-cases/assemblies/cov-joint-ball-yaw-and-pitch/recipe.json new file mode 100644 index 000000000..0399ddfe0 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-ball-yaw-and-pitch/recipe.json @@ -0,0 +1,142 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "ball", + "name": "Socket", + "flip": true, + "a": { + "occurrence": "Base", + "frame": { + "origin": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ], + "x": [ + 1, + 0, + 0 + ] + } + }, + "b": { + "occurrence": "Arm", + "frame": { + "origin": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ], + "x": [ + 1, + 0, + 0 + ] + } + }, + "quiet": true + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Socket", + "quiet": true, + "values": [ + 90, + 90, + 0 + ] + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-cylindrical-turn-and-slide/expected.json b/tests/kernel-cases/assemblies/cov-joint-cylindrical-turn-and-slide/expected.json new file mode 100644 index 000000000..55da6233c --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-cylindrical-turn-and-slide/expected.json @@ -0,0 +1,47 @@ +{ + "sources": [], + "what": "a cylindrical joint about z driven to 90 degrees and 7 mm", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); cylindrical about z: M = Rz(90)\u00b7T(0,0,7): (20,0,5) -> (20,0,12) -> (0,20,12)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 9, + "json": { + "values": [ + { + "value": 90.0 + }, + { + "value": 7.0 + } + ] + } + }, + { + "step": 10, + "json": { + "total": { + "center_of_mass": [ + 0.0, + 20.0, + 12.0 + ], + "bbox": { + "min": [ + -5.0, + 0.0, + 7.0 + ], + "max": [ + 5.0, + 40.0, + 17.0 + ] + } + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-cylindrical-turn-and-slide/recipe.json b/tests/kernel-cases/assemblies/cov-joint-cylindrical-turn-and-slide/recipe.json new file mode 100644 index 000000000..39e495d88 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-cylindrical-turn-and-slide/recipe.json @@ -0,0 +1,127 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "cylindrical", + "name": "Spindle", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Spindle", + "quiet": true, + "values": [ + 90, + 7 + ] + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-limits-new-joint-starts-at-the-nearer-limit/expected.json b/tests/kernel-cases/assemblies/cov-joint-limits-new-joint-starts-at-the-nearer-limit/expected.json new file mode 100644 index 000000000..7243d6e85 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-limits-new-joint-starts-at-the-nearer-limit/expected.json @@ -0,0 +1,22 @@ +{ + "sources": [], + "what": "a new revolute whose limits 10..60 leave out its start value 0", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); a new joint starts at 0; outside its limits it starts at the nearer one, 10: centre (20 cos10, 20 sin10, 5)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 9, + "json": { + "total": { + "center_of_mass": [ + 19.696155, + 3.472964, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-limits-new-joint-starts-at-the-nearer-limit/recipe.json b/tests/kernel-cases/assemblies/cov-joint-limits-new-joint-starts-at-the-nearer-limit/recipe.json new file mode 100644 index 000000000..3910ef14c --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-limits-new-joint-starts-at-the-nearer-limit/recipe.json @@ -0,0 +1,122 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true, + "limits": [ + [ + 10, + 60 + ] + ] + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-limits-set-then-drive-past/expected.json b/tests/kernel-cases/assemblies/cov-joint-limits-set-then-drive-past/expected.json new file mode 100644 index 000000000..96a43ccce --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-limits-set-then-drive-past/expected.json @@ -0,0 +1,32 @@ +{ + "sources": [], + "what": "joint.limits -10..45 on a revolute, then a drive to 90", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); limits set afterwards clamp the same way: 90 -> 45, centre (20 cos45, 20 sin45, 5)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 10, + "json": { + "values": [ + { + "value": 45.0 + } + ] + } + }, + { + "step": 11, + "json": { + "total": { + "center_of_mass": [ + 14.142136, + 14.142136, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-limits-set-then-drive-past/recipe.json b/tests/kernel-cases/assemblies/cov-joint-limits-set-then-drive-past/recipe.json new file mode 100644 index 000000000..9598f4e00 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-limits-set-then-drive-past/recipe.json @@ -0,0 +1,132 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.limits", + "params": { + "joint": "Hinge", + "min": -10, + "max": 45 + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Hinge", + "quiet": true, + "value": 90 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-pin-slot-turn-then-slide/expected.json b/tests/kernel-cases/assemblies/cov-joint-pin-slot-turn-then-slide/expected.json new file mode 100644 index 000000000..a370c5ccb --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-pin-slot-turn-then-slide/expected.json @@ -0,0 +1,47 @@ +{ + "sources": [], + "what": "a pin-slot joint driven to 90 degrees and a 7 mm slide", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); pin_slot with frame z = +z, x = +x at the origin: M = T(slide along x)\u00b7Rz(angle): (20,0,5) -> (0,20,5) -> (7,20,5)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 9, + "json": { + "values": [ + { + "value": 90.0 + }, + { + "value": 7.0 + } + ] + } + }, + { + "step": 10, + "json": { + "total": { + "center_of_mass": [ + 7.0, + 20.0, + 5.0 + ], + "bbox": { + "min": [ + 2.0, + 0.0, + 0.0 + ], + "max": [ + 12.0, + 40.0, + 10.0 + ] + } + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-pin-slot-turn-then-slide/recipe.json b/tests/kernel-cases/assemblies/cov-joint-pin-slot-turn-then-slide/recipe.json new file mode 100644 index 000000000..ce04728a9 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-pin-slot-turn-then-slide/recipe.json @@ -0,0 +1,141 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "pin_slot", + "name": "Slot", + "flip": true, + "a": { + "occurrence": "Base", + "frame": { + "origin": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ], + "x": [ + 1, + 0, + 0 + ] + } + }, + "b": { + "occurrence": "Arm", + "frame": { + "origin": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ], + "x": [ + 1, + 0, + 0 + ] + } + }, + "quiet": true + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Slot", + "quiet": true, + "values": [ + 90, + 7 + ] + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-planar-move-and-turn/expected.json b/tests/kernel-cases/assemblies/cov-joint-planar-move-and-turn/expected.json new file mode 100644 index 000000000..d21bf54f6 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-planar-move-and-turn/expected.json @@ -0,0 +1,50 @@ +{ + "sources": [], + "what": "a planar joint driven to x 3, y 4 and 90 degrees", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); planar with frame z = +z, x = +x: M = T(3,4,0)\u00b7Rz(90): (20,0,5) -> (0,20,5) -> (3,24,5)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 9, + "json": { + "values": [ + { + "value": 3.0 + }, + { + "value": 4.0 + }, + { + "value": 90.0 + } + ] + } + }, + { + "step": 10, + "json": { + "total": { + "center_of_mass": [ + 3.0, + 24.0, + 5.0 + ], + "bbox": { + "min": [ + -2.0, + 4.0, + 0.0 + ], + "max": [ + 8.0, + 44.0, + 10.0 + ] + } + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-planar-move-and-turn/recipe.json b/tests/kernel-cases/assemblies/cov-joint-planar-move-and-turn/recipe.json new file mode 100644 index 000000000..d2874d2ee --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-planar-move-and-turn/recipe.json @@ -0,0 +1,142 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "planar", + "name": "Table", + "flip": true, + "a": { + "occurrence": "Base", + "frame": { + "origin": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ], + "x": [ + 1, + 0, + 0 + ] + } + }, + "b": { + "occurrence": "Arm", + "frame": { + "origin": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ], + "x": [ + 1, + 0, + 0 + ] + } + }, + "quiet": true + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Table", + "quiet": true, + "values": [ + 3, + 4, + 90 + ] + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-revolute-drive-past-the-limit-is-clamped/expected.json b/tests/kernel-cases/assemblies/cov-joint-revolute-drive-past-the-limit-is-clamped/expected.json new file mode 100644 index 000000000..1724f013c --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-revolute-drive-past-the-limit-is-clamped/expected.json @@ -0,0 +1,32 @@ +{ + "sources": [], + "what": "a revolute with limits -30..30 driven to 90", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); a drive past a joint's limits is clamped to them: 90 -> 30, centre (20 cos30, 20 sin30, 5)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 9, + "json": { + "values": [ + { + "value": 30.0 + } + ] + } + }, + { + "step": 10, + "json": { + "total": { + "center_of_mass": [ + 17.320508, + 10.0, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-revolute-drive-past-the-limit-is-clamped/recipe.json b/tests/kernel-cases/assemblies/cov-joint-revolute-drive-past-the-limit-is-clamped/recipe.json new file mode 100644 index 000000000..be381f207 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-revolute-drive-past-the-limit-is-clamped/recipe.json @@ -0,0 +1,130 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true, + "limits": [ + [ + -30, + 30 + ] + ] + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Hinge", + "quiet": true, + "value": 90 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-revolute-quarter-turn/expected.json b/tests/kernel-cases/assemblies/cov-joint-revolute-quarter-turn/expected.json new file mode 100644 index 000000000..97db92b84 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-revolute-quarter-turn/expected.json @@ -0,0 +1,44 @@ +{ + "sources": [], + "what": "a revolute joint driven 90 degrees", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); revolute about z through the origin, driven to 90: (x,y) -> (-y,x), Arm's box becomes x -5..5, y 0..40", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 9, + "json": { + "values": [ + { + "value": 90.0 + } + ] + } + }, + { + "step": 10, + "json": { + "total": { + "center_of_mass": [ + 0.0, + 20.0, + 5.0 + ], + "bbox": { + "min": [ + -5.0, + 0.0, + 0.0 + ], + "max": [ + 5.0, + 40.0, + 10.0 + ] + } + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-revolute-quarter-turn/recipe.json b/tests/kernel-cases/assemblies/cov-joint-revolute-quarter-turn/recipe.json new file mode 100644 index 000000000..24a638396 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-revolute-quarter-turn/recipe.json @@ -0,0 +1,124 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Hinge", + "quiet": true, + "value": 90 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-rigid-group-moves-together/expected.json b/tests/kernel-cases/assemblies/cov-joint-rigid-group-moves-together/expected.json new file mode 100644 index 000000000..d04c59a1c --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-rigid-group-moves-together/expected.json @@ -0,0 +1,34 @@ +{ + "sources": [], + "what": "Arm and Gear in a rigid group, the arm turned 90 degrees", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Gear block from (60,-5,0), centre (65,0,5), rigid-grouped with Arm: both turn about z through the origin: Gear (65,0,5) -> (0,65,5)", + "body_count": 3, + "volume_mm3": 9000.0, + "results": [ + { + "step": 14, + "json": { + "total": { + "center_of_mass": [ + 0.0, + 65.0, + 5.0 + ] + } + } + }, + { + "step": 15, + "json": { + "total": { + "center_of_mass": [ + 0.0, + 20.0, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-rigid-group-moves-together/recipe.json b/tests/kernel-cases/assemblies/cov-joint-rigid-group-moves-together/recipe.json new file mode 100644 index 000000000..184d04727 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-rigid-group-moves-together/recipe.json @@ -0,0 +1,171 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "solid.box", + "params": { + "length": 10, + "width": 10, + "height": 10, + "corner": [ + 60, + -5, + 0 + ], + "operation": "new", + "body_name": "GearBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Gear", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "GearBox" + ], + "component": "Gear" + } + }, + { + "command": "joint.rigid_group", + "params": { + "occurrences": [ + "Arm:1", + "Gear:1" + ] + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Hinge", + "quiet": true, + "value": 90 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Gear:1" + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-rigid-holds-the-arm-where-it-is/expected.json b/tests/kernel-cases/assemblies/cov-joint-rigid-holds-the-arm-where-it-is/expected.json new file mode 100644 index 000000000..1d09f6dca --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-rigid-holds-the-arm-where-it-is/expected.json @@ -0,0 +1,41 @@ +{ + "sources": [], + "what": "a rigid joint between two blocks made where they sit", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); rigid with equal origins and flip: B = F\u00b7I\u00b7F^-1 = I, so Arm stays at (20,0,5) with 0 degrees of freedom left", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 9, + "json": { + "conflicts": [], + "errors": [] + } + }, + { + "step": 10, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 0.0, + 5.0 + ], + "bbox": { + "min": [ + 0.0, + -5.0, + 0.0 + ], + "max": [ + 40.0, + 5.0, + 10.0 + ] + } + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-rigid-holds-the-arm-where-it-is/recipe.json b/tests/kernel-cases/assemblies/cov-joint-rigid-holds-the-arm-where-it-is/recipe.json new file mode 100644 index 000000000..7c11c34c3 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-rigid-holds-the-arm-where-it-is/recipe.json @@ -0,0 +1,120 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "rigid", + "name": "Glue", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.solve", + "params": {} + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-rigid-with-an-offset-lifts-the-arm/expected.json b/tests/kernel-cases/assemblies/cov-joint-rigid-with-an-offset-lifts-the-arm/expected.json new file mode 100644 index 000000000..93f30c0d6 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-rigid-with-an-offset-lifts-the-arm/expected.json @@ -0,0 +1,34 @@ +{ + "sources": [], + "what": "a rigid joint with an offset of 5 mm along its z", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); rigid, flip, offset 5: B's frame sits 5 mm up A's z, so Arm moves by (0,0,5): centre (20,0,10)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 9, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 0.0, + 10.0 + ], + "bbox": { + "min": [ + 0.0, + -5.0, + 5.0 + ], + "max": [ + 40.0, + 5.0, + 15.0 + ] + } + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-rigid-with-an-offset-lifts-the-arm/recipe.json b/tests/kernel-cases/assemblies/cov-joint-rigid-with-an-offset-lifts-the-arm/recipe.json new file mode 100644 index 000000000..8017c9946 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-rigid-with-an-offset-lifts-the-arm/recipe.json @@ -0,0 +1,117 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "rigid", + "name": "Glue", + "flip": true, + "offset": 5, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-slider-along-x/expected.json b/tests/kernel-cases/assemblies/cov-joint-slider-along-x/expected.json new file mode 100644 index 000000000..4d3531911 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-slider-along-x/expected.json @@ -0,0 +1,44 @@ +{ + "sources": [], + "what": "a slider along +x driven 15 mm", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); slider with z = +x at (0,0,5), driven to 15: Arm moves by (15,0,0), centre (35,0,5)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 9, + "json": { + "values": [ + { + "value": 15.0 + } + ] + } + }, + { + "step": 10, + "json": { + "total": { + "center_of_mass": [ + 35.0, + 0.0, + 5.0 + ], + "bbox": { + "min": [ + 15.0, + -5.0, + 0.0 + ], + "max": [ + 55.0, + 5.0, + 10.0 + ] + } + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-slider-along-x/recipe.json b/tests/kernel-cases/assemblies/cov-joint-slider-along-x/recipe.json new file mode 100644 index 000000000..ab9f637e9 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-slider-along-x/recipe.json @@ -0,0 +1,124 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "slider", + "name": "Slide", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 5 + ], + "z": [ + 1, + 0, + 0 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 5 + ], + "z": [ + 1, + 0, + 0 + ] + }, + "quiet": true + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Slide", + "quiet": true, + "value": 15 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-slider-drive-past-the-limit-is-clamped/expected.json b/tests/kernel-cases/assemblies/cov-joint-slider-drive-past-the-limit-is-clamped/expected.json new file mode 100644 index 000000000..5c000fe74 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-slider-drive-past-the-limit-is-clamped/expected.json @@ -0,0 +1,54 @@ +{ + "sources": [], + "what": "a slider with limits 0..10 driven to 15 and to -4", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); slider along +x, limits [0,10]: 15 -> 10 (centre (30,0,5)), then -4 -> 0 (centre (20,0,5))", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 9, + "json": { + "values": [ + { + "value": 10.0 + } + ] + } + }, + { + "step": 10, + "json": { + "total": { + "center_of_mass": [ + 30.0, + 0.0, + 5.0 + ] + } + } + }, + { + "step": 11, + "json": { + "values": [ + { + "value": 0.0 + } + ] + } + }, + { + "step": 12, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 0.0, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-slider-drive-past-the-limit-is-clamped/recipe.json b/tests/kernel-cases/assemblies/cov-joint-slider-drive-past-the-limit-is-clamped/recipe.json new file mode 100644 index 000000000..05d3594d9 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-slider-drive-past-the-limit-is-clamped/recipe.json @@ -0,0 +1,144 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "slider", + "name": "Slide", + "flip": true, + "limits": [ + [ + 0, + 10 + ] + ], + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 5 + ], + "z": [ + 1, + 0, + 0 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 5 + ], + "z": [ + 1, + 0, + 0 + ] + }, + "quiet": true + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Slide", + "quiet": true, + "value": 15 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Slide", + "quiet": true, + "value": -4 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-two-origins-on-one-part-refused/expected.json b/tests/kernel-cases/assemblies/cov-joint-two-origins-on-one-part-refused/expected.json new file mode 100644 index 000000000..bbc41b9d7 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-two-origins-on-one-part-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "a joint whose two origins are on the same occurrence", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); a joint needs two different occurrences: both origins on Arm is refused", + "outcome": "refused", + "refusal": "two different occurrences" +} diff --git a/tests/kernel-cases/assemblies/cov-joint-two-origins-on-one-part-refused/recipe.json b/tests/kernel-cases/assemblies/cov-joint-two-origins-on-one-part-refused/recipe.json new file mode 100644 index 000000000..f582f4139 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-two-origins-on-one-part-refused/recipe.json @@ -0,0 +1,109 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Self", + "flip": true, + "a": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 10, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + } + } + } + ] +} From 236a5597e83503d4ae54d2ce511f83a9062cf1eb Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:20:41 -0400 Subject: [PATCH 085/108] Kernel rig: gears turn by their radii, a rack travels r per radian, a screw its lead per turn, a disc cam lifts 2e Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 30 +++ .../recipe.json | 212 ++++++++++++++++++ .../expected.json | 30 +++ .../recipe.json | 212 ++++++++++++++++++ .../expected.json | 28 +++ .../recipe.json | 201 +++++++++++++++++ .../expected.json | 40 ++++ .../recipe.json | 206 +++++++++++++++++ .../expected.json | 28 +++ .../recipe.json | 200 +++++++++++++++++ .../expected.json | 28 +++ .../recipe.json | 199 ++++++++++++++++ .../expected.json | 41 ++++ .../cov-joint-screw-lead-per-turn/recipe.json | 131 +++++++++++ .../cov-joint-screw-left-hand/expected.json | 41 ++++ .../cov-joint-screw-left-hand/recipe.json | 132 +++++++++++ .../expected.json | 28 +++ .../recipe.json | 199 ++++++++++++++++ 18 files changed, 1986 insertions(+) create mode 100644 tests/kernel-cases/assemblies/cov-joint-cam-eccentric-disc-half-turn/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-cam-eccentric-disc-half-turn/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-cam-eccentric-disc-quarter-turn/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-cam-eccentric-disc-quarter-turn/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-gear-internal-turns-the-same-way/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-gear-internal-turns-the-same-way/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-gear-ratio-turns-the-other-way/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-gear-ratio-turns-the-other-way/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-rack-pinion-reversed/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-rack-pinion-reversed/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-rack-pinion-travel-per-turn/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-rack-pinion-travel-per-turn/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-screw-lead-per-turn/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-screw-lead-per-turn/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-screw-left-hand/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-screw-left-hand/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-screw-revolute-drives-slider/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-screw-revolute-drives-slider/recipe.json diff --git a/tests/kernel-cases/assemblies/cov-joint-cam-eccentric-disc-half-turn/expected.json b/tests/kernel-cases/assemblies/cov-joint-cam-eccentric-disc-half-turn/expected.json new file mode 100644 index 000000000..b45f6281c --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-cam-eccentric-disc-half-turn/expected.json @@ -0,0 +1,30 @@ +{ + "sources": [], + "what": "a knife follower on an eccentric disc cam, the cam turned 180 degrees", + "source": "analytic", + "method": "an eccentric disc cam (radius 10, centre 5 off its shaft on z through the origin) with a knife follower on a slider along +x through the shaft, touching at x = 15; the knife's distance at cam turn \u03c6 is s(\u03c6) = e cos \u03c6 + \u221a(R\u00b2 - e\u00b2 sin\u00b2 \u03c6) (e 5, R 10): rise s(0) - s(180) = 15 - 5 = 10; at 180 the knife is at s = 5, 10 mm in: the tappet's centre (20,0,2.5) -> (10,0,2.5)", + "body_count": 3, + "volume_mm3": 5770.796, + "results": [ + { + "step": 13, + "json": { + "lift": { + "rise": 10.0 + } + } + }, + { + "step": 15, + "json": { + "total": { + "center_of_mass": [ + 10.0, + 0.0, + 2.5 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-cam-eccentric-disc-half-turn/recipe.json b/tests/kernel-cases/assemblies/cov-joint-cam-eccentric-disc-half-turn/recipe.json new file mode 100644 index 000000000..4ac5cfaf3 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-cam-eccentric-disc-half-turn/recipe.json @@ -0,0 +1,212 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.cylinder", + "params": { + "radius": 10, + "height": 5, + "base": [ + 5, + 0, + 0 + ], + "axis": [ + 0, + 0, + 1 + ], + "operation": "new", + "body_name": "Disc" + } + }, + { + "command": "solid.box", + "params": { + "length": 10, + "width": 4, + "height": 5, + "corner": [ + 15, + -2, + 0 + ], + "operation": "new", + "body_name": "Tappet" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Cam", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "Disc" + ], + "component": "Cam" + } + }, + { + "command": "component.create", + "params": { + "name": "Follower", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "Tappet" + ], + "component": "Follower" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Shaft", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Cam", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.create", + "params": { + "type": "slider", + "name": "Lift", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 15, + 0, + 2.5 + ], + "z": [ + 1, + 0, + 0 + ] + }, + "b": { + "occurrence": "Follower", + "point": [ + 15, + 0, + 2.5 + ], + "z": [ + 1, + 0, + 0 + ] + }, + "quiet": true + } + }, + { + "command": "joint.cam", + "params": { + "a": "Shaft", + "b": "Lift", + "profile": { + "edges": [ + [ + 15, + 0, + 0 + ] + ], + "occurrence": "Cam" + } + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Shaft", + "quiet": true, + "value": 180 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Follower:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-cam-eccentric-disc-quarter-turn/expected.json b/tests/kernel-cases/assemblies/cov-joint-cam-eccentric-disc-quarter-turn/expected.json new file mode 100644 index 000000000..dfaee0cf5 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-cam-eccentric-disc-quarter-turn/expected.json @@ -0,0 +1,30 @@ +{ + "sources": [], + "what": "a knife follower on an eccentric disc cam, the cam turned 90 degrees", + "source": "analytic", + "method": "an eccentric disc cam (radius 10, centre 5 off its shaft on z through the origin) with a knife follower on a slider along +x through the shaft, touching at x = 15; the knife's distance at cam turn \u03c6 is s(\u03c6) = e cos \u03c6 + \u221a(R\u00b2 - e\u00b2 sin\u00b2 \u03c6) (e 5, R 10): rise s(0) - s(180) = 15 - 5 = 10; at 90 the knife meets the disc where \u03c6 = -90 in the cam's frame: s = \u221a(100 - 25) = 8.66025: tappet centre x 20 + (8.66025 - 15)", + "body_count": 3, + "volume_mm3": 5770.796, + "results": [ + { + "step": 13, + "json": { + "lift": { + "rise": 10.0 + } + } + }, + { + "step": 15, + "json": { + "total": { + "center_of_mass": [ + 13.660254, + 0.0, + 2.5 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-cam-eccentric-disc-quarter-turn/recipe.json b/tests/kernel-cases/assemblies/cov-joint-cam-eccentric-disc-quarter-turn/recipe.json new file mode 100644 index 000000000..97135540e --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-cam-eccentric-disc-quarter-turn/recipe.json @@ -0,0 +1,212 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.cylinder", + "params": { + "radius": 10, + "height": 5, + "base": [ + 5, + 0, + 0 + ], + "axis": [ + 0, + 0, + 1 + ], + "operation": "new", + "body_name": "Disc" + } + }, + { + "command": "solid.box", + "params": { + "length": 10, + "width": 4, + "height": 5, + "corner": [ + 15, + -2, + 0 + ], + "operation": "new", + "body_name": "Tappet" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Cam", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "Disc" + ], + "component": "Cam" + } + }, + { + "command": "component.create", + "params": { + "name": "Follower", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "Tappet" + ], + "component": "Follower" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Shaft", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Cam", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.create", + "params": { + "type": "slider", + "name": "Lift", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 15, + 0, + 2.5 + ], + "z": [ + 1, + 0, + 0 + ] + }, + "b": { + "occurrence": "Follower", + "point": [ + 15, + 0, + 2.5 + ], + "z": [ + 1, + 0, + 0 + ] + }, + "quiet": true + } + }, + { + "command": "joint.cam", + "params": { + "a": "Shaft", + "b": "Lift", + "profile": { + "edges": [ + [ + 15, + 0, + 0 + ] + ], + "occurrence": "Cam" + } + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Shaft", + "quiet": true, + "value": 90 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Follower:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-gear-internal-turns-the-same-way/expected.json b/tests/kernel-cases/assemblies/cov-joint-gear-internal-turns-the-same-way/expected.json new file mode 100644 index 000000000..ce32b7bdb --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-gear-internal-turns-the-same-way/expected.json @@ -0,0 +1,28 @@ +{ + "sources": [], + "what": "an internal gear pair (a ring gear), radii 10 and 20", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Gear: box 10x10x10 from (60,-5,0), centre (65,0,5), on revolute G2 about z through (50,0,0); internal: ratio +ra/rb = +0.5, Hinge 60 turns G2 +30: Gear centre (50 + 15 cos30, 15 sin30, 5)", + "body_count": 3, + "volume_mm3": 9000.0, + "results": [ + { + "step": 13, + "json": { + "ratio": 0.5 + } + }, + { + "step": 15, + "json": { + "total": { + "center_of_mass": [ + 62.990381, + 7.5, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-gear-internal-turns-the-same-way/recipe.json b/tests/kernel-cases/assemblies/cov-joint-gear-internal-turns-the-same-way/recipe.json new file mode 100644 index 000000000..b08ed2d19 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-gear-internal-turns-the-same-way/recipe.json @@ -0,0 +1,201 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "solid.box", + "params": { + "length": 10, + "width": 10, + "height": 10, + "corner": [ + 60, + -5, + 0 + ], + "operation": "new", + "body_name": "GearBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Gear", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "GearBox" + ], + "component": "Gear" + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "G2", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 50, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Gear", + "point": [ + 50, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.gear", + "params": { + "a": "Hinge", + "b": "G2", + "ra": 10, + "rb": 20, + "internal": true + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Hinge", + "quiet": true, + "value": 60 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Gear:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-gear-ratio-turns-the-other-way/expected.json b/tests/kernel-cases/assemblies/cov-joint-gear-ratio-turns-the-other-way/expected.json new file mode 100644 index 000000000..1fbc48771 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-gear-ratio-turns-the-other-way/expected.json @@ -0,0 +1,40 @@ +{ + "sources": [], + "what": "a gear pair of pitch radii 10 and 20, the driver turned 60 degrees", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Gear: box 10x10x10 from (60,-5,0), centre (65,0,5), on revolute G2 about z through (50,0,0); joint.gear Hinge -> G2, ra 10, rb 20: ratio -ra/rb = -0.5, so Hinge 60 turns G2 -30: Gear centre (50 + 15 cos(-30), 15 sin(-30), 5)", + "body_count": 3, + "volume_mm3": 9000.0, + "results": [ + { + "step": 13, + "json": { + "ratio": -0.5 + } + }, + { + "step": 15, + "json": { + "total": { + "center_of_mass": [ + 62.990381, + -7.5, + 5.0 + ] + } + } + }, + { + "step": 16, + "json": { + "total": { + "center_of_mass": [ + 10.0, + 17.320508, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-gear-ratio-turns-the-other-way/recipe.json b/tests/kernel-cases/assemblies/cov-joint-gear-ratio-turns-the-other-way/recipe.json new file mode 100644 index 000000000..d4eaa38c0 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-gear-ratio-turns-the-other-way/recipe.json @@ -0,0 +1,206 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "solid.box", + "params": { + "length": 10, + "width": 10, + "height": 10, + "corner": [ + 60, + -5, + 0 + ], + "operation": "new", + "body_name": "GearBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Gear", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "GearBox" + ], + "component": "Gear" + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "G2", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 50, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Gear", + "point": [ + 50, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.gear", + "params": { + "a": "Hinge", + "b": "G2", + "ra": 10, + "rb": 20 + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Hinge", + "quiet": true, + "value": 60 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Gear:1" + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-rack-pinion-reversed/expected.json b/tests/kernel-cases/assemblies/cov-joint-rack-pinion-reversed/expected.json new file mode 100644 index 000000000..73ff6d024 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-rack-pinion-reversed/expected.json @@ -0,0 +1,28 @@ +{ + "sources": [], + "what": "a reversed rack and pinion, the pinion turned 90 degrees", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); as the rack case with reverse: the rack travels -10\u00b7\u03c0/2: Gear centre (65 - 15.70796, 0, 5)", + "body_count": 3, + "volume_mm3": 9000.0, + "results": [ + { + "step": 13, + "json": { + "ratio": -0.174533 + } + }, + { + "step": 15, + "json": { + "total": { + "center_of_mass": [ + 49.292037, + 0.0, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-rack-pinion-reversed/recipe.json b/tests/kernel-cases/assemblies/cov-joint-rack-pinion-reversed/recipe.json new file mode 100644 index 000000000..1c9397d0c --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-rack-pinion-reversed/recipe.json @@ -0,0 +1,200 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "solid.box", + "params": { + "length": 10, + "width": 10, + "height": 10, + "corner": [ + 60, + -5, + 0 + ], + "operation": "new", + "body_name": "GearBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Gear", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "GearBox" + ], + "component": "Gear" + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.create", + "params": { + "type": "slider", + "name": "Rack", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 50, + 0, + 0 + ], + "z": [ + 1, + 0, + 0 + ] + }, + "b": { + "occurrence": "Gear", + "point": [ + 50, + 0, + 0 + ], + "z": [ + 1, + 0, + 0 + ] + }, + "quiet": true + } + }, + { + "command": "joint.rack_pinion", + "params": { + "a": "Hinge", + "b": "Rack", + "radius": 10, + "reverse": true + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Hinge", + "quiet": true, + "value": 90 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Gear:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-rack-pinion-travel-per-turn/expected.json b/tests/kernel-cases/assemblies/cov-joint-rack-pinion-travel-per-turn/expected.json new file mode 100644 index 000000000..27a35d506 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-rack-pinion-travel-per-turn/expected.json @@ -0,0 +1,28 @@ +{ + "sources": [], + "what": "a rack on a pinion of pitch radius 10, the pinion turned 90 degrees", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Gear block on a slider along +x at (50,0,0); joint.rack_pinion radius 10: the rack travels r\u00b7\u03b8 = 10\u00b7\u03c0/2 = 15.70796 mm (\u03c0\u00b7d = 62.83 mm a turn), ratio 10\u03c0/180 mm per degree; Gear centre (65 + 15.70796, 0, 5)", + "body_count": 3, + "volume_mm3": 9000.0, + "results": [ + { + "step": 13, + "json": { + "ratio": 0.174533 + } + }, + { + "step": 15, + "json": { + "total": { + "center_of_mass": [ + 80.707963, + 0.0, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-rack-pinion-travel-per-turn/recipe.json b/tests/kernel-cases/assemblies/cov-joint-rack-pinion-travel-per-turn/recipe.json new file mode 100644 index 000000000..60ae4ab93 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-rack-pinion-travel-per-turn/recipe.json @@ -0,0 +1,199 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "solid.box", + "params": { + "length": 10, + "width": 10, + "height": 10, + "corner": [ + 60, + -5, + 0 + ], + "operation": "new", + "body_name": "GearBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Gear", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "GearBox" + ], + "component": "Gear" + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.create", + "params": { + "type": "slider", + "name": "Rack", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 50, + 0, + 0 + ], + "z": [ + 1, + 0, + 0 + ] + }, + "b": { + "occurrence": "Gear", + "point": [ + 50, + 0, + 0 + ], + "z": [ + 1, + 0, + 0 + ] + }, + "quiet": true + } + }, + { + "command": "joint.rack_pinion", + "params": { + "a": "Hinge", + "b": "Rack", + "radius": 10 + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Hinge", + "quiet": true, + "value": 90 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Gear:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-screw-lead-per-turn/expected.json b/tests/kernel-cases/assemblies/cov-joint-screw-lead-per-turn/expected.json new file mode 100644 index 000000000..ac36de4ff --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-screw-lead-per-turn/expected.json @@ -0,0 +1,41 @@ +{ + "sources": [], + "what": "a screw of lead 2 mm on a cylindrical joint, turned half a turn", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); joint.screw on cylindrical Spindle, pitch 2: ratio 2/360 mm per degree, so 180 degrees advance 1 mm: M = Rz(180)\u00b7T(0,0,1): (20,0,5) -> (-20,0,6)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 9, + "json": { + "ratio": 0.005556 + } + }, + { + "step": 10, + "json": { + "values": [ + { + "value": 180.0 + }, + { + "value": 1.0 + } + ] + } + }, + { + "step": 11, + "json": { + "total": { + "center_of_mass": [ + -20.0, + 0.0, + 6.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-screw-lead-per-turn/recipe.json b/tests/kernel-cases/assemblies/cov-joint-screw-lead-per-turn/recipe.json new file mode 100644 index 000000000..7cf91e944 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-screw-lead-per-turn/recipe.json @@ -0,0 +1,131 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "cylindrical", + "name": "Spindle", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.screw", + "params": { + "joint": "Spindle", + "pitch": 2 + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Spindle", + "quiet": true, + "value": 180 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-screw-left-hand/expected.json b/tests/kernel-cases/assemblies/cov-joint-screw-left-hand/expected.json new file mode 100644 index 000000000..152934c7c --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-screw-left-hand/expected.json @@ -0,0 +1,41 @@ +{ + "sources": [], + "what": "a left-hand screw of lead 2 mm, turned half a turn", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); reverse: -2/360 mm per degree, 180 degrees retract 1 mm: (20,0,5) -> (-20,0,4)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 9, + "json": { + "ratio": -0.005556 + } + }, + { + "step": 10, + "json": { + "values": [ + { + "value": 180.0 + }, + { + "value": -1.0 + } + ] + } + }, + { + "step": 11, + "json": { + "total": { + "center_of_mass": [ + -20.0, + 0.0, + 4.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-screw-left-hand/recipe.json b/tests/kernel-cases/assemblies/cov-joint-screw-left-hand/recipe.json new file mode 100644 index 000000000..8079ed464 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-screw-left-hand/recipe.json @@ -0,0 +1,132 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "cylindrical", + "name": "Spindle", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.screw", + "params": { + "joint": "Spindle", + "pitch": 2, + "reverse": true + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Spindle", + "quiet": true, + "value": 180 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-screw-revolute-drives-slider/expected.json b/tests/kernel-cases/assemblies/cov-joint-screw-revolute-drives-slider/expected.json new file mode 100644 index 000000000..0dac1cc86 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-screw-revolute-drives-slider/expected.json @@ -0,0 +1,28 @@ +{ + "sources": [], + "what": "a screw of lead 4 mm between a revolute and a slider", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Gear: box 10x10x10 from (60,-5,0), centre (65,0,5), on revolute G2 about z through (50,0,0), here on a slider along +x at (50,0,0); joint.screw a Hinge, b Rack, pitch 4: 90 degrees advance 4/4 = 1 mm: Gear centre (66,0,5)", + "body_count": 3, + "volume_mm3": 9000.0, + "results": [ + { + "step": 13, + "json": { + "ratio": 0.011111 + } + }, + { + "step": 15, + "json": { + "total": { + "center_of_mass": [ + 66.0, + 0.0, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-screw-revolute-drives-slider/recipe.json b/tests/kernel-cases/assemblies/cov-joint-screw-revolute-drives-slider/recipe.json new file mode 100644 index 000000000..0e1c66550 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-screw-revolute-drives-slider/recipe.json @@ -0,0 +1,199 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "solid.box", + "params": { + "length": 10, + "width": 10, + "height": 10, + "corner": [ + 60, + -5, + 0 + ], + "operation": "new", + "body_name": "GearBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Gear", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "GearBox" + ], + "component": "Gear" + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.create", + "params": { + "type": "slider", + "name": "Rack", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 50, + 0, + 0 + ], + "z": [ + 1, + 0, + 0 + ] + }, + "b": { + "occurrence": "Gear", + "point": [ + 50, + 0, + 0 + ], + "z": [ + 1, + 0, + 0 + ] + }, + "quiet": true + } + }, + { + "command": "joint.screw", + "params": { + "a": "Hinge", + "b": "Rack", + "pitch": 4 + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Hinge", + "quiet": true, + "value": 90 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Gear:1" + } + } + ] +} From d136b313a1494d3496769e305bcf4f4003462177 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:20:41 -0400 Subject: [PATCH 086/108] Kernel rig: motion links, rigid groups, floating chains, named origins, edit, delete, solve, inspect, reach and sweep Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 40 +++ .../recipe.json | 227 ++++++++++++++++++ .../cov-joint-delete-joint/expected.json | 29 +++ .../cov-joint-delete-joint/recipe.json | 134 +++++++++++ .../cov-joint-delete-link/expected.json | 28 +++ .../cov-joint-delete-link/recipe.json | 209 ++++++++++++++++ .../expected.json | 46 ++++ .../recipe.json | 143 +++++++++++ .../expected.json | 44 ++++ .../recipe.json | 137 +++++++++++ .../expected.json | 28 +++ .../recipe.json | 131 ++++++++++ .../expected.json | 58 +++++ .../recipe.json | 116 +++++++++ .../expected.json | 34 +++ .../recipe.json | 211 ++++++++++++++++ .../expected.json | 22 ++ .../recipe.json | 200 +++++++++++++++ .../expected.json | 40 +++ .../recipe.json | 162 +++++++++++++ .../expected.json | 32 +++ .../cov-joint-origin-face-centre/recipe.json | 113 +++++++++ .../cov-joint-origin-named-face/expected.json | 32 +++ .../cov-joint-origin-named-face/recipe.json | 118 +++++++++ .../expected.json | 32 +++ .../cov-joint-origin-named-points/recipe.json | 134 +++++++++++ .../expected.json | 34 +++ .../cov-joint-reach-out-of-reach/recipe.json | 133 ++++++++++ .../expected.json | 33 +++ .../cov-joint-reach-quarter-turn/recipe.json | 133 ++++++++++ .../expected.json | 29 +++ .../recipe.json | 131 ++++++++++ .../expected.json | 29 +++ .../recipe.json | 170 +++++++++++++ .../expected.json | 17 ++ .../recipe.json | 163 +++++++++++++ .../expected.json | 29 +++ .../recipe.json | 169 +++++++++++++ 38 files changed, 3570 insertions(+) create mode 100644 tests/kernel-cases/assemblies/cov-joint-chain-joined-to-nothing-grounded-moves-nothing/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-chain-joined-to-nothing-grounded-moves-nothing/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-delete-joint/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-delete-joint/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-delete-link/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-delete-link/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-edit-flip-turns-the-arm-over/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-edit-flip-turns-the-arm-over/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-edit-offset-lifts-the-arm/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-edit-offset-lifts-the-arm/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-edit-suppressed-moves-nothing/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-edit-suppressed-moves-nothing/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-inspect-reads-the-frames/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-inspect-reads-the-frames/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-motion-link-clamped-to-the-followers-limits/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-motion-link-clamped-to-the-followers-limits/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-motion-link-ratio-and-offset/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-motion-link-ratio-and-offset/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-only-chain-fixes-its-first-a-side/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-only-chain-fixes-its-first-a-side/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-origin-face-centre/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-origin-face-centre/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-origin-named-face/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-origin-named-face/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-origin-named-points/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-origin-named-points/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-reach-out-of-reach/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-reach-out-of-reach/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-reach-quarter-turn/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-reach-quarter-turn/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-solve-puts-a-moved-arm-back/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-solve-puts-a-moved-arm-back/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-sweep-apply-leaves-it-at-the-stop/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-sweep-apply-leaves-it-at-the-stop/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-sweep-clear-to-the-end/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-sweep-clear-to-the-end/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-sweep-stops-at-the-block/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-joint-sweep-stops-at-the-block/recipe.json diff --git a/tests/kernel-cases/assemblies/cov-joint-chain-joined-to-nothing-grounded-moves-nothing/expected.json b/tests/kernel-cases/assemblies/cov-joint-chain-joined-to-nothing-grounded-moves-nothing/expected.json new file mode 100644 index 000000000..100755569 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-chain-joined-to-nothing-grounded-moves-nothing/expected.json @@ -0,0 +1,40 @@ +{ + "sources": [], + "what": "a revolute between Gear and a free peg beside a grounded hinge chain", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Gear: box 10x10x10 from (60,-5,0), centre (65,0,5), on revolute G2 about z through (50,0,0), here G2 joins a free Peg (not Base) to Gear while Hinge joins Arm to grounded Base: the Peg-Gear chain reaches nothing fixed, so a drive answers moved: false and Gear stays at (65,0,5)", + "body_count": 4, + "volume_mm3": 9064.0, + "results": [ + { + "step": 16, + "json": { + "moved": false + } + }, + { + "step": 17, + "json": { + "total": { + "center_of_mass": [ + 65.0, + 0.0, + 5.0 + ] + } + } + }, + { + "step": 18, + "json": { + "floating": [ + { + "joints": [ + "G2" + ] + } + ] + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-chain-joined-to-nothing-grounded-moves-nothing/recipe.json b/tests/kernel-cases/assemblies/cov-joint-chain-joined-to-nothing-grounded-moves-nothing/recipe.json new file mode 100644 index 000000000..01ef0ed17 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-chain-joined-to-nothing-grounded-moves-nothing/recipe.json @@ -0,0 +1,227 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "solid.box", + "params": { + "length": 10, + "width": 10, + "height": 10, + "corner": [ + 60, + -5, + 0 + ], + "operation": "new", + "body_name": "GearBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Gear", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "GearBox" + ], + "component": "Gear" + } + }, + { + "command": "solid.box", + "params": { + "length": 4, + "width": 4, + "height": 4, + "corner": [ + 48, + -2, + -14 + ], + "operation": "new", + "body_name": "PegBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Peg", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "PegBox" + ], + "component": "Peg" + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "G2", + "flip": true, + "a": { + "occurrence": "Peg", + "point": [ + 50, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Gear", + "point": [ + 50, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.drive", + "params": { + "joint": "G2", + "value": 90, + "quiet": true + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Gear:1" + } + }, + { + "command": "joint.list", + "params": {} + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-delete-joint/expected.json b/tests/kernel-cases/assemblies/cov-joint-delete-joint/expected.json new file mode 100644 index 000000000..52a342d88 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-delete-joint/expected.json @@ -0,0 +1,29 @@ +{ + "sources": [], + "what": "a revolute driven 90 degrees, then deleted", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); after joint.delete the design has no joints and no links; Arm keeps the placement it had: (0,20,5)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 11, + "json": { + "joints": [], + "links": [] + } + }, + { + "step": 12, + "json": { + "total": { + "center_of_mass": [ + 0.0, + 20.0, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-delete-joint/recipe.json b/tests/kernel-cases/assemblies/cov-joint-delete-joint/recipe.json new file mode 100644 index 000000000..2afdbeaff --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-delete-joint/recipe.json @@ -0,0 +1,134 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Hinge", + "quiet": true, + "value": 90 + } + }, + { + "command": "joint.delete", + "params": { + "joint": "Hinge" + } + }, + { + "command": "joint.list", + "params": {} + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-delete-link/expected.json b/tests/kernel-cases/assemblies/cov-joint-delete-link/expected.json new file mode 100644 index 000000000..398719ead --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-delete-link/expected.json @@ -0,0 +1,28 @@ +{ + "sources": [], + "what": "a motion link deleted, then its driver turned", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Gear: box 10x10x10 from (60,-5,0), centre (65,0,5), on revolute G2 about z through (50,0,0); link Hinge -> G2 (ratio 1) deleted (link 0): Hinge 30 leaves G2 at 0, Gear at (65,0,5)", + "body_count": 3, + "volume_mm3": 9000.0, + "results": [ + { + "step": 15, + "json": { + "links": [] + } + }, + { + "step": 17, + "json": { + "total": { + "center_of_mass": [ + 65.0, + 0.0, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-delete-link/recipe.json b/tests/kernel-cases/assemblies/cov-joint-delete-link/recipe.json new file mode 100644 index 000000000..9f2c991a1 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-delete-link/recipe.json @@ -0,0 +1,209 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "solid.box", + "params": { + "length": 10, + "width": 10, + "height": 10, + "corner": [ + 60, + -5, + 0 + ], + "operation": "new", + "body_name": "GearBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Gear", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "GearBox" + ], + "component": "Gear" + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "G2", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 50, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Gear", + "point": [ + 50, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.motion_link", + "params": { + "a": "Hinge", + "b": "G2", + "ratio": 1 + } + }, + { + "command": "joint.delete", + "params": { + "link": 0 + } + }, + { + "command": "joint.list", + "params": {} + }, + { + "command": "joint.drive", + "params": { + "joint": "Hinge", + "quiet": true, + "value": 30 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Gear:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-edit-flip-turns-the-arm-over/expected.json b/tests/kernel-cases/assemblies/cov-joint-edit-flip-turns-the-arm-over/expected.json new file mode 100644 index 000000000..c61a00ca0 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-edit-flip-turns-the-arm-over/expected.json @@ -0,0 +1,46 @@ +{ + "sources": [], + "what": "joint.edit flip: false on a revolute made with flip: true", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); frame x = +x, z = +z at the origin on both sides; unflipped, B's frame is turned by diag(1,-1,-1) in A's, a half turn about world x: (20,0,5) -> (20,0,-5)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 9, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 0.0, + 5.0 + ] + } + } + }, + { + "step": 11, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 0.0, + -5.0 + ], + "bbox": { + "min": [ + 0.0, + -5.0, + -10.0 + ], + "max": [ + 40.0, + 5.0, + 0.0 + ] + } + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-edit-flip-turns-the-arm-over/recipe.json b/tests/kernel-cases/assemblies/cov-joint-edit-flip-turns-the-arm-over/recipe.json new file mode 100644 index 000000000..a9c62c3a7 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-edit-flip-turns-the-arm-over/recipe.json @@ -0,0 +1,143 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "frame": { + "origin": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ], + "x": [ + 1, + 0, + 0 + ] + } + }, + "b": { + "occurrence": "Arm", + "frame": { + "origin": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ], + "x": [ + 1, + 0, + 0 + ] + } + }, + "quiet": true + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + }, + { + "command": "joint.edit", + "params": { + "joint": "Hinge", + "flip": false + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-edit-offset-lifts-the-arm/expected.json b/tests/kernel-cases/assemblies/cov-joint-edit-offset-lifts-the-arm/expected.json new file mode 100644 index 000000000..4a9ce569d --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-edit-offset-lifts-the-arm/expected.json @@ -0,0 +1,44 @@ +{ + "sources": [], + "what": "joint.edit offset 3 on a revolute", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); the offset moves B's frame 3 mm up A's z: (20,0,5) -> (20,0,8); a drive to 90 then gives (0,20,8)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 10, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 0.0, + 8.0 + ] + } + } + }, + { + "step": 11, + "json": { + "values": [ + { + "value": 90.0 + } + ] + } + }, + { + "step": 12, + "json": { + "total": { + "center_of_mass": [ + 0.0, + 20.0, + 8.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-edit-offset-lifts-the-arm/recipe.json b/tests/kernel-cases/assemblies/cov-joint-edit-offset-lifts-the-arm/recipe.json new file mode 100644 index 000000000..638b618b8 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-edit-offset-lifts-the-arm/recipe.json @@ -0,0 +1,137 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.edit", + "params": { + "joint": "Hinge", + "offset": 3 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Hinge", + "quiet": true, + "value": 90 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-edit-suppressed-moves-nothing/expected.json b/tests/kernel-cases/assemblies/cov-joint-edit-suppressed-moves-nothing/expected.json new file mode 100644 index 000000000..48c5001fe --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-edit-suppressed-moves-nothing/expected.json @@ -0,0 +1,28 @@ +{ + "sources": [], + "what": "a suppressed revolute driven 90 degrees", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); a suppressed joint can move nothing: the drive answers moved: false and Arm stays at (20,0,5)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 10, + "json": { + "moved": false + } + }, + { + "step": 11, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 0.0, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-edit-suppressed-moves-nothing/recipe.json b/tests/kernel-cases/assemblies/cov-joint-edit-suppressed-moves-nothing/recipe.json new file mode 100644 index 000000000..afc83f86d --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-edit-suppressed-moves-nothing/recipe.json @@ -0,0 +1,131 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.edit", + "params": { + "joint": "Hinge", + "suppressed": true + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Hinge", + "value": 90, + "quiet": true + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-inspect-reads-the-frames/expected.json b/tests/kernel-cases/assemblies/cov-joint-inspect-reads-the-frames/expected.json new file mode 100644 index 000000000..c7644e0a3 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-inspect-reads-the-frames/expected.json @@ -0,0 +1,58 @@ +{ + "sources": [], + "what": "joint.inspect of a revolute about z at (0,0,0)", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); the hinge's frames are at the origin with z up on both sides, revolute, its one value 'angle' at 0", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 9, + "json": { + "joints": [ + { + "name": "Hinge", + "type": "revolute", + "flip": true, + "a": { + "occurrence_name": "Base:1", + "frame": { + "origin": [ + 0.0, + 0.0, + 0.0 + ], + "z": [ + 0.0, + 0.0, + 1.0 + ] + } + }, + "b": { + "occurrence_name": "Arm:1", + "frame": { + "origin": [ + 0.0, + 0.0, + 0.0 + ], + "z": [ + 0.0, + 0.0, + 1.0 + ] + } + }, + "values": [ + { + "name": "angle", + "value": 0.0 + } + ] + } + ] + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-inspect-reads-the-frames/recipe.json b/tests/kernel-cases/assemblies/cov-joint-inspect-reads-the-frames/recipe.json new file mode 100644 index 000000000..267716f7b --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-inspect-reads-the-frames/recipe.json @@ -0,0 +1,116 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.inspect", + "params": { + "joint": "Hinge" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-motion-link-clamped-to-the-followers-limits/expected.json b/tests/kernel-cases/assemblies/cov-joint-motion-link-clamped-to-the-followers-limits/expected.json new file mode 100644 index 000000000..45a2736c9 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-motion-link-clamped-to-the-followers-limits/expected.json @@ -0,0 +1,34 @@ +{ + "sources": [], + "what": "a motion link b = a into a follower limited to -20..20", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Gear: box 10x10x10 from (60,-5,0), centre (65,0,5), on revolute G2 about z through (50,0,0); b = a clamped to b's limits: Hinge 45 leaves G2 at 20: Gear centre (50 + 15 cos20, 15 sin20, 5)", + "body_count": 3, + "volume_mm3": 9000.0, + "results": [ + { + "step": 15, + "json": { + "total": { + "center_of_mass": [ + 64.095389, + 5.130302, + 5.0 + ] + } + } + }, + { + "step": 16, + "json": { + "total": { + "center_of_mass": [ + 14.142136, + 14.142136, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-motion-link-clamped-to-the-followers-limits/recipe.json b/tests/kernel-cases/assemblies/cov-joint-motion-link-clamped-to-the-followers-limits/recipe.json new file mode 100644 index 000000000..98caf2982 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-motion-link-clamped-to-the-followers-limits/recipe.json @@ -0,0 +1,211 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "solid.box", + "params": { + "length": 10, + "width": 10, + "height": 10, + "corner": [ + 60, + -5, + 0 + ], + "operation": "new", + "body_name": "GearBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Gear", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "GearBox" + ], + "component": "Gear" + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "G2", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 50, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Gear", + "point": [ + 50, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true, + "limits": [ + [ + -20, + 20 + ] + ] + } + }, + { + "command": "joint.motion_link", + "params": { + "a": "Hinge", + "b": "G2", + "ratio": 1 + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Hinge", + "quiet": true, + "value": 45 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Gear:1" + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-motion-link-ratio-and-offset/expected.json b/tests/kernel-cases/assemblies/cov-joint-motion-link-ratio-and-offset/expected.json new file mode 100644 index 000000000..a5dbfad90 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-motion-link-ratio-and-offset/expected.json @@ -0,0 +1,22 @@ +{ + "sources": [], + "what": "a motion link b = 2a + 10 between two revolutes", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Gear: box 10x10x10 from (60,-5,0), centre (65,0,5), on revolute G2 about z through (50,0,0); G2 = 2\u00b7Hinge + 10 deg: Hinge 20 puts G2 at 50: Gear centre (50 + 15 cos50, 15 sin50, 5)", + "body_count": 3, + "volume_mm3": 9000.0, + "results": [ + { + "step": 15, + "json": { + "total": { + "center_of_mass": [ + 59.641814, + 11.490667, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-motion-link-ratio-and-offset/recipe.json b/tests/kernel-cases/assemblies/cov-joint-motion-link-ratio-and-offset/recipe.json new file mode 100644 index 000000000..96089c745 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-motion-link-ratio-and-offset/recipe.json @@ -0,0 +1,200 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "solid.box", + "params": { + "length": 10, + "width": 10, + "height": 10, + "corner": [ + 60, + -5, + 0 + ], + "operation": "new", + "body_name": "GearBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Gear", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "GearBox" + ], + "component": "Gear" + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "G2", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 50, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Gear", + "point": [ + 50, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.motion_link", + "params": { + "a": "Hinge", + "b": "G2", + "ratio": 2, + "offset": 10 + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Hinge", + "quiet": true, + "value": 20 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Gear:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-only-chain-fixes-its-first-a-side/expected.json b/tests/kernel-cases/assemblies/cov-joint-only-chain-fixes-its-first-a-side/expected.json new file mode 100644 index 000000000..ef60719ab --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-only-chain-fixes-its-first-a-side/expected.json @@ -0,0 +1,40 @@ +{ + "sources": [], + "what": "a revolute between two free parts, the design's only joint", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Gear: box 10x10x10 from (60,-5,0), centre (65,0,5), on revolute G2 about z through (50,0,0), here G2 joins Arm (not Base) to Gear and no joint reaches Base: with nothing grounded involved, the first joint's A side (Arm) is fixed, so Gear turns 90 about (50,0,0): (50,15,5)", + "body_count": 3, + "volume_mm3": 9000.0, + "results": [ + { + "step": 12, + "json": { + "moved": true + } + }, + { + "step": 13, + "json": { + "total": { + "center_of_mass": [ + 50.0, + 15.0, + 5.0 + ] + } + } + }, + { + "step": 14, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 0.0, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-only-chain-fixes-its-first-a-side/recipe.json b/tests/kernel-cases/assemblies/cov-joint-only-chain-fixes-its-first-a-side/recipe.json new file mode 100644 index 000000000..667d6beb6 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-only-chain-fixes-its-first-a-side/recipe.json @@ -0,0 +1,162 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "solid.box", + "params": { + "length": 10, + "width": 10, + "height": 10, + "corner": [ + 60, + -5, + 0 + ], + "operation": "new", + "body_name": "GearBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Gear", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "GearBox" + ], + "component": "Gear" + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "G2", + "flip": true, + "a": { + "occurrence": "Arm", + "point": [ + 50, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Gear", + "point": [ + 50, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.drive", + "params": { + "joint": "G2", + "value": 90, + "quiet": true + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Gear:1" + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-origin-face-centre/expected.json b/tests/kernel-cases/assemblies/cov-joint-origin-face-centre/expected.json new file mode 100644 index 000000000..451b29634 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-origin-face-centre/expected.json @@ -0,0 +1,32 @@ +{ + "sources": [], + "what": "a slider whose origins are the centres of two planar faces", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); a: Base's top face (centre (0,0,0), z +z); b: Arm's bottom face (centre (20,0,0), z -z); mated (no flip) the two faces meet: Arm slides 20 back along x so its bottom centre sits on (0,0,0) and turns at most about z; a slide of 3 lifts it 3 mm off the face: z centre 8, volume unchanged", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 9, + "json": { + "values": [ + { + "value": 3.0 + } + ] + } + }, + { + "step": 10, + "json": { + "total": { + "center_of_mass": [ + 0.0, + 0.0, + 8.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-origin-face-centre/recipe.json b/tests/kernel-cases/assemblies/cov-joint-origin-face-centre/recipe.json new file mode 100644 index 000000000..0eb4f51f9 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-origin-face-centre/recipe.json @@ -0,0 +1,113 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "slider", + "name": "Lift", + "a": { + "occurrence": "Base", + "face": [ + 5, + 5, + 0 + ] + }, + "b": { + "occurrence": "Arm", + "face": [ + 30, + 0, + 0 + ] + }, + "quiet": true + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Lift", + "quiet": true, + "value": 3 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-origin-named-face/expected.json b/tests/kernel-cases/assemblies/cov-joint-origin-named-face/expected.json new file mode 100644 index 000000000..62c7adb87 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-origin-named-face/expected.json @@ -0,0 +1,32 @@ +{ + "sources": [], + "what": "a slider from a named origin on the base's top face to the arm's bottom face", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); joint.origin 'Top' is the centre of Base's top face, (0,0,0) with z up; the arm's bottom face centre (20,0,0) mates to it, so the arm slides 20 back along x and a slide of 3 lifts it to z centre 8", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 10, + "json": { + "values": [ + { + "value": 3.0 + } + ] + } + }, + { + "step": 11, + "json": { + "total": { + "center_of_mass": [ + 0.0, + 0.0, + 8.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-origin-named-face/recipe.json b/tests/kernel-cases/assemblies/cov-joint-origin-named-face/recipe.json new file mode 100644 index 000000000..efe3c5f80 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-origin-named-face/recipe.json @@ -0,0 +1,118 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.origin", + "params": { + "name": "Top", + "occurrence": "Base", + "face": [ + 5, + 5, + 0 + ] + } + }, + { + "command": "joint.create", + "params": { + "type": "slider", + "name": "Lift", + "a": "Top", + "b": { + "occurrence": "Arm", + "face": [ + 30, + 0, + 0 + ] + }, + "quiet": true + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Lift", + "quiet": true, + "value": 3 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-origin-named-points/expected.json b/tests/kernel-cases/assemblies/cov-joint-origin-named-points/expected.json new file mode 100644 index 000000000..e0e10da28 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-origin-named-points/expected.json @@ -0,0 +1,32 @@ +{ + "sources": [], + "what": "a revolute between two named joint origins, driven 90 degrees", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); joint.origin 'Pivot A' on Base and 'Pivot B' on Arm, both at the origin with z up; the joint between them turns Arm to (0,20,5)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 11, + "json": { + "values": [ + { + "value": 90.0 + } + ] + } + }, + { + "step": 12, + "json": { + "total": { + "center_of_mass": [ + 0.0, + 20.0, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-origin-named-points/recipe.json b/tests/kernel-cases/assemblies/cov-joint-origin-named-points/recipe.json new file mode 100644 index 000000000..4b98bdc48 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-origin-named-points/recipe.json @@ -0,0 +1,134 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.origin", + "params": { + "name": "Pivot A", + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + } + }, + { + "command": "joint.origin", + "params": { + "name": "Pivot B", + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": "Pivot A", + "b": "Pivot B", + "quiet": true + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Hinge", + "quiet": true, + "value": 90 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-reach-out-of-reach/expected.json b/tests/kernel-cases/assemblies/cov-joint-reach-out-of-reach/expected.json new file mode 100644 index 000000000..7a380c069 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-reach-out-of-reach/expected.json @@ -0,0 +1,34 @@ +{ + "sources": [], + "what": "joint.reach asked to take the arm's tip to (0,60,5), 60 from the hinge", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); the tip moves on a circle of radius 40: the nearest it gets is (0,40,5), 20 mm short", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 9, + "json": { + "reached": false, + "error_mm": 20.0, + "point": [ + 0.0, + 40.0, + 5.0 + ] + } + }, + { + "step": 10, + "json": { + "total": { + "center_of_mass": [ + 0.0, + 20.0, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-reach-out-of-reach/recipe.json b/tests/kernel-cases/assemblies/cov-joint-reach-out-of-reach/recipe.json new file mode 100644 index 000000000..5883ab0d3 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-reach-out-of-reach/recipe.json @@ -0,0 +1,133 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.reach", + "params": { + "occurrence": "Arm", + "at": [ + 40, + 0, + 5 + ], + "point": [ + 0, + 60, + 5 + ], + "quiet": true + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-reach-quarter-turn/expected.json b/tests/kernel-cases/assemblies/cov-joint-reach-quarter-turn/expected.json new file mode 100644 index 000000000..82501253b --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-reach-quarter-turn/expected.json @@ -0,0 +1,33 @@ +{ + "sources": [], + "what": "joint.reach takes the arm's tip from (40,0,5) to (0,40,5)", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); the tip turns about z through the origin at radius 40: (0,40,5) is reached at 90 degrees, error 0; Arm centre (0,20,5)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 9, + "json": { + "reached": true, + "point": [ + 0.0, + 40.0, + 5.0 + ] + } + }, + { + "step": 10, + "json": { + "total": { + "center_of_mass": [ + 0.0, + 20.0, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-reach-quarter-turn/recipe.json b/tests/kernel-cases/assemblies/cov-joint-reach-quarter-turn/recipe.json new file mode 100644 index 000000000..72b28a4e1 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-reach-quarter-turn/recipe.json @@ -0,0 +1,133 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.reach", + "params": { + "occurrence": "Arm", + "at": [ + 40, + 0, + 5 + ], + "point": [ + 0, + 40, + 5 + ], + "quiet": true + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-solve-puts-a-moved-arm-back/expected.json b/tests/kernel-cases/assemblies/cov-joint-solve-puts-a-moved-arm-back/expected.json new file mode 100644 index 000000000..6f4c0cb37 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-solve-puts-a-moved-arm-back/expected.json @@ -0,0 +1,29 @@ +{ + "sources": [], + "what": "a hinged arm moved off its joint, then joint.solve", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); the hinge at 0 places Arm at (20,0,5); joint.solve re-places it there after a move of (0,0,50)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 10, + "json": { + "conflicts": [], + "errors": [] + } + }, + { + "step": 11, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 0.0, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-solve-puts-a-moved-arm-back/recipe.json b/tests/kernel-cases/assemblies/cov-joint-solve-puts-a-moved-arm-back/recipe.json new file mode 100644 index 000000000..e1bbc662a --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-solve-puts-a-moved-arm-back/recipe.json @@ -0,0 +1,131 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "occurrence.move", + "params": { + "occurrence": "Arm:1", + "translate": [ + 0, + 0, + 50 + ] + } + }, + { + "command": "joint.solve", + "params": {} + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-sweep-apply-leaves-it-at-the-stop/expected.json b/tests/kernel-cases/assemblies/cov-joint-sweep-apply-leaves-it-at-the-stop/expected.json new file mode 100644 index 000000000..325cf6c13 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-sweep-apply-leaves-it-at-the-stop/expected.json @@ -0,0 +1,29 @@ +{ + "sources": [], + "what": "joint.sweep with apply: true", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Stop: box 50x10x10 from (-10,30,0), grounded; the arm's corner (40,5) turned \u03b8 reaches y = 40 sin \u03b8 + 5 cos \u03b8, which is 30 at \u03b8 = asin(30/\u221a1625) - atan(5/40) = 40.9676; apply leaves the hinge at the stop: Arm centre (20 cos \u03b8, 20 sin \u03b8, 5)", + "body_count": 3, + "volume_mm3": 13000.0, + "results": [ + { + "step": 13, + "json": { + "stopped_at": 40.966136, + "applied": true + } + }, + { + "step": 14, + "json": { + "total": { + "center_of_mass": [ + 15.101944, + 13.112257, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-sweep-apply-leaves-it-at-the-stop/recipe.json b/tests/kernel-cases/assemblies/cov-joint-sweep-apply-leaves-it-at-the-stop/recipe.json new file mode 100644 index 000000000..015732b52 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-sweep-apply-leaves-it-at-the-stop/recipe.json @@ -0,0 +1,170 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "solid.box", + "params": { + "length": 50, + "width": 10, + "height": 10, + "corner": [ + -10, + 30, + 0 + ], + "operation": "new", + "body_name": "StopBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Stop", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "StopBox" + ], + "component": "Stop" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Stop:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.sweep", + "params": { + "joint": "Hinge", + "occurrences": [ + "Arm" + ], + "against": [ + "Stop" + ], + "apply": true, + "from": 0, + "to": 120 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-sweep-clear-to-the-end/expected.json b/tests/kernel-cases/assemblies/cov-joint-sweep-clear-to-the-end/expected.json new file mode 100644 index 000000000..9248a7f7b --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-sweep-clear-to-the-end/expected.json @@ -0,0 +1,17 @@ +{ + "sources": [], + "what": "joint.sweep of the hinged arm from 0 to 30, short of the block", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Stop: box 50x10x10 from (-10,30,0), grounded; the arm's corner (40,5) turned \u03b8 reaches y = 40 sin \u03b8 + 5 cos \u03b8, which is 30 at \u03b8 = asin(30/\u221a1625) - atan(5/40) = 40.9676; 30 < 40.97, so nothing stops it: stopped_at and stopped_by null", + "body_count": 3, + "volume_mm3": 13000.0, + "results": [ + { + "step": 13, + "json": { + "stopped_at": null, + "stopped_by": null + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-sweep-clear-to-the-end/recipe.json b/tests/kernel-cases/assemblies/cov-joint-sweep-clear-to-the-end/recipe.json new file mode 100644 index 000000000..7c01a9710 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-sweep-clear-to-the-end/recipe.json @@ -0,0 +1,163 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "solid.box", + "params": { + "length": 50, + "width": 10, + "height": 10, + "corner": [ + -10, + 30, + 0 + ], + "operation": "new", + "body_name": "StopBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Stop", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "StopBox" + ], + "component": "Stop" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Stop:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.sweep", + "params": { + "joint": "Hinge", + "occurrences": [ + "Arm" + ], + "against": [ + "Stop" + ], + "from": 0, + "to": 30 + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-sweep-stops-at-the-block/expected.json b/tests/kernel-cases/assemblies/cov-joint-sweep-stops-at-the-block/expected.json new file mode 100644 index 000000000..278ba80ce --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-sweep-stops-at-the-block/expected.json @@ -0,0 +1,29 @@ +{ + "sources": [], + "what": "joint.sweep of the hinged arm towards a grounded block", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Stop: box 50x10x10 from (-10,30,0), grounded; the arm's corner (40,5) turned \u03b8 reaches y = 40 sin \u03b8 + 5 cos \u03b8, which is 30 at \u03b8 = asin(30/\u221a1625) - atan(5/40) = 40.9676; the sweep from 0 to 120 stops there", + "body_count": 3, + "volume_mm3": 13000.0, + "results": [ + { + "step": 13, + "json": { + "stopped_at": 40.966136, + "applied": false + } + }, + { + "step": 14, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 0.0, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-joint-sweep-stops-at-the-block/recipe.json b/tests/kernel-cases/assemblies/cov-joint-sweep-stops-at-the-block/recipe.json new file mode 100644 index 000000000..4c537d000 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-joint-sweep-stops-at-the-block/recipe.json @@ -0,0 +1,169 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "solid.box", + "params": { + "length": 50, + "width": 10, + "height": 10, + "corner": [ + -10, + 30, + 0 + ], + "operation": "new", + "body_name": "StopBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Stop", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "StopBox" + ], + "component": "Stop" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Stop:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.sweep", + "params": { + "joint": "Hinge", + "occurrences": [ + "Arm" + ], + "against": [ + "Stop" + ], + "from": 0, + "to": 120 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} From 489441907536bb09722b9e797d6a00a6adb47919 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:20:41 -0400 Subject: [PATCH 087/108] Kernel rig: motion studies play, plot and trace to known values; a crank-slider's slider follows r cos t + sqrt(l^2 - r^2 sin^2 t) Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 40 +++ .../recipe.json | 299 ++++++++++++++++ .../expected.json | 111 ++++++ .../recipe.json | 316 +++++++++++++++++ .../expected.json | 34 ++ .../recipe.json | 319 ++++++++++++++++++ .../expected.json | 43 +++ .../recipe.json | 189 +++++++++++ .../expected.json | 17 + .../cov-motion-interference-clear/recipe.json | 183 ++++++++++ .../expected.json | 22 ++ .../recipe.json | 146 ++++++++ .../cov-motion-play-half-way/expected.json | 28 ++ .../cov-motion-play-half-way/recipe.json | 146 ++++++++ .../cov-motion-plot-linear-ramp/expected.json | 71 ++++ .../cov-motion-plot-linear-ramp/recipe.json | 148 ++++++++ .../expected.json | 34 ++ .../recipe.json | 148 ++++++++ .../expected.json | 22 ++ .../recipe.json | 167 +++++++++ .../cov-motion-trace-arm-tip/expected.json | 46 +++ .../cov-motion-trace-arm-tip/recipe.json | 131 +++++++ .../expected.json | 38 +++ .../recipe.json | 294 ++++++++++++++++ .../expected.json | 19 ++ .../recipe.json | 178 ++++++++++ 26 files changed, 3189 insertions(+) create mode 100644 tests/kernel-cases/assemblies/cov-motion-crank-slider-drive-at-90/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-motion-crank-slider-drive-at-90/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-motion-crank-slider-follows-the-formula/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-motion-crank-slider-follows-the-formula/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-motion-crank-slider-play-at-60/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-motion-crank-slider-play-at-60/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-motion-interference-arm-into-the-block/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-motion-interference-arm-into-the-block/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-motion-interference-clear/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-motion-interference-clear/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-motion-play-fractional-step/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-motion-play-fractional-step/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-motion-play-half-way/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-motion-play-half-way/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-motion-plot-linear-ramp/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-motion-plot-linear-ramp/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-motion-plot-point-on-the-arm/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-motion-plot-point-on-the-arm/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-motion-study-edit-replaces-the-keys/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-motion-study-edit-replaces-the-keys/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-motion-trace-arm-tip/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-motion-trace-arm-tip/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-motion-trace-coupler-midpoint/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-motion-trace-coupler-midpoint/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-motion-trace-stops-at-contact/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-motion-trace-stops-at-contact/recipe.json diff --git a/tests/kernel-cases/assemblies/cov-motion-crank-slider-drive-at-90/expected.json b/tests/kernel-cases/assemblies/cov-motion-crank-slider-drive-at-90/expected.json new file mode 100644 index 000000000..36fd366c7 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-motion-crank-slider-drive-at-90/expected.json @@ -0,0 +1,40 @@ +{ + "sources": [], + "what": "a crank-slider driven to 90 degrees", + "source": "analytic", + "method": "a crank-slider: crank r 10 about z through the origin, rod l 30 from the crank pin (10,0) to the slider's pin (40,0), slider on +x; the slider sits at x = r cos \u03b8 + \u221a(l\u00b2 - r\u00b2 sin\u00b2 \u03b8); at 90: x = \u221a(900 - 100) = 28.28427; the rod's middle is halfway between (0,10) and (x,0), at z 3", + "body_count": 4, + "volume_mm3": 2720, + "results": [ + { + "step": 17, + "json": { + "conflicts": [] + } + }, + { + "step": 19, + "json": { + "total": { + "center_of_mass": [ + 28.284271, + 0.0, + 5.0 + ] + } + } + }, + { + "step": 20, + "json": { + "total": { + "center_of_mass": [ + 14.142136, + 5.0, + 3.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-motion-crank-slider-drive-at-90/recipe.json b/tests/kernel-cases/assemblies/cov-motion-crank-slider-drive-at-90/recipe.json new file mode 100644 index 000000000..d6b495a61 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-motion-crank-slider-drive-at-90/recipe.json @@ -0,0 +1,299 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 60, + "width": 20, + "height": 2, + "corner": [ + -10, + -10, + -12 + ], + "operation": "new", + "body_name": "BedBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 14, + "width": 4, + "height": 2, + "corner": [ + -2, + -2, + 0 + ], + "operation": "new", + "body_name": "CrankBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 34, + "width": 2, + "height": 2, + "corner": [ + 8, + -1, + 2 + ], + "operation": "new", + "body_name": "RodBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 6, + "width": 6, + "height": 2, + "corner": [ + 37, + -3, + 4 + ], + "operation": "new", + "body_name": "SliderBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Bed", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BedBox" + ], + "component": "Bed" + } + }, + { + "command": "component.create", + "params": { + "name": "Crank", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "CrankBox" + ], + "component": "Crank" + } + }, + { + "command": "component.create", + "params": { + "name": "Rod", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "RodBox" + ], + "component": "Rod" + } + }, + { + "command": "component.create", + "params": { + "name": "Slider", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "SliderBox" + ], + "component": "Slider" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Bed:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Crank pin", + "flip": true, + "a": { + "occurrence": "Bed", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Crank", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Big end", + "flip": true, + "a": { + "occurrence": "Crank", + "point": [ + 10, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Rod", + "point": [ + 10, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.create", + "params": { + "type": "slider", + "name": "Guide", + "flip": true, + "a": { + "occurrence": "Bed", + "point": [ + 40, + 0, + 5 + ], + "z": [ + 1, + 0, + 0 + ] + }, + "b": { + "occurrence": "Slider", + "point": [ + 40, + 0, + 5 + ], + "z": [ + 1, + 0, + 0 + ] + }, + "quiet": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Small end", + "flip": true, + "a": { + "occurrence": "Rod", + "point": [ + 40, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Slider", + "point": [ + 40, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Crank pin", + "value": 90, + "quiet": true + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Slider:1" + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Rod:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-motion-crank-slider-follows-the-formula/expected.json b/tests/kernel-cases/assemblies/cov-motion-crank-slider-follows-the-formula/expected.json new file mode 100644 index 000000000..96232156b --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-motion-crank-slider-follows-the-formula/expected.json @@ -0,0 +1,111 @@ +{ + "sources": [], + "what": "motion.plot of a crank-slider's slider over a full turn of the crank, every 30 degrees", + "source": "analytic", + "method": "a crank-slider: crank r 10 about z through the origin, rod l 30 from the crank pin (10,0) to the slider's pin (40,0), slider on +x; the slider sits at x = r cos \u03b8 + \u221a(l\u00b2 - r\u00b2 sin\u00b2 \u03b8); the guide's value is x - 40", + "body_count": 4, + "volume_mm3": 2720, + "results": [ + { + "step": 17, + "json": { + "conflicts": [] + } + }, + { + "step": 19, + "json": { + "samples": 13, + "stopped_at": null, + "joints": [ + { + "value": [ + 0.0, + -1.759347, + -6.277187, + -11.715729, + -16.277187, + -19.079855, + -20.0, + -19.079855, + -16.277187, + -11.715729, + -6.277187, + -1.759347, + 0.0 + ] + } + ], + "point": { + "position": [ + [ + 40.0, + 0.0, + 5.0 + ], + [ + 38.240653, + 0.0, + 5.0 + ], + [ + 33.722813, + 0.0, + 5.0 + ], + [ + 28.284271, + 0.0, + 5.0 + ], + [ + 23.722813, + 0.0, + 5.0 + ], + [ + 20.920145, + 0.0, + 5.0 + ], + [ + 20.0, + 0.0, + 5.0 + ], + [ + 20.920145, + 0.0, + 5.0 + ], + [ + 23.722813, + 0.0, + 5.0 + ], + [ + 28.284271, + 0.0, + 5.0 + ], + [ + 33.722813, + 0.0, + 5.0 + ], + [ + 38.240653, + 0.0, + 5.0 + ], + [ + 40.0, + 0.0, + 5.0 + ] + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-motion-crank-slider-follows-the-formula/recipe.json b/tests/kernel-cases/assemblies/cov-motion-crank-slider-follows-the-formula/recipe.json new file mode 100644 index 000000000..559ca54f6 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-motion-crank-slider-follows-the-formula/recipe.json @@ -0,0 +1,316 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 60, + "width": 20, + "height": 2, + "corner": [ + -10, + -10, + -12 + ], + "operation": "new", + "body_name": "BedBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 14, + "width": 4, + "height": 2, + "corner": [ + -2, + -2, + 0 + ], + "operation": "new", + "body_name": "CrankBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 34, + "width": 2, + "height": 2, + "corner": [ + 8, + -1, + 2 + ], + "operation": "new", + "body_name": "RodBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 6, + "width": 6, + "height": 2, + "corner": [ + 37, + -3, + 4 + ], + "operation": "new", + "body_name": "SliderBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Bed", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BedBox" + ], + "component": "Bed" + } + }, + { + "command": "component.create", + "params": { + "name": "Crank", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "CrankBox" + ], + "component": "Crank" + } + }, + { + "command": "component.create", + "params": { + "name": "Rod", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "RodBox" + ], + "component": "Rod" + } + }, + { + "command": "component.create", + "params": { + "name": "Slider", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "SliderBox" + ], + "component": "Slider" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Bed:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Crank pin", + "flip": true, + "a": { + "occurrence": "Bed", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Crank", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Big end", + "flip": true, + "a": { + "occurrence": "Crank", + "point": [ + 10, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Rod", + "point": [ + 10, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.create", + "params": { + "type": "slider", + "name": "Guide", + "flip": true, + "a": { + "occurrence": "Bed", + "point": [ + 40, + 0, + 5 + ], + "z": [ + 1, + 0, + 0 + ] + }, + "b": { + "occurrence": "Slider", + "point": [ + 40, + 0, + 5 + ], + "z": [ + 1, + 0, + 0 + ] + }, + "quiet": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Small end", + "flip": true, + "a": { + "occurrence": "Rod", + "point": [ + 40, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Slider", + "point": [ + 40, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "motion.study", + "params": { + "name": "Turn", + "steps": 12, + "keys": [ + { + "joint": "Crank pin", + "points": [ + [ + 0, + 0 + ], + [ + 12, + 360 + ] + ] + } + ] + } + }, + { + "command": "motion.plot", + "params": { + "study": "Turn", + "joints": [ + "Guide" + ], + "occurrence": "Slider", + "point": [ + 40, + 0, + 5 + ] + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-motion-crank-slider-play-at-60/expected.json b/tests/kernel-cases/assemblies/cov-motion-crank-slider-play-at-60/expected.json new file mode 100644 index 000000000..cc69e76a7 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-motion-crank-slider-play-at-60/expected.json @@ -0,0 +1,34 @@ +{ + "sources": [], + "what": "a crank-slider study played where the crank is at 60 degrees", + "source": "analytic", + "method": "a crank-slider: crank r 10 about z through the origin, rod l 30 from the crank pin (10,0) to the slider's pin (40,0), slider on +x; the slider sits at x = r cos \u03b8 + \u221a(l\u00b2 - r\u00b2 sin\u00b2 \u03b8); at 60: x = 5 + \u221a(900 - 75) = 33.72281; the slider block's centre (x, 0, 5), the guide's value x - 40", + "body_count": 4, + "volume_mm3": 2720, + "results": [ + { + "step": 17, + "json": { + "conflicts": [] + } + }, + { + "step": 20, + "json": { + "total": { + "center_of_mass": [ + 33.722813, + 0.0, + 5.0 + ] + } + } + }, + { + "step": 21, + "json": { + "conflicts": [] + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-motion-crank-slider-play-at-60/recipe.json b/tests/kernel-cases/assemblies/cov-motion-crank-slider-play-at-60/recipe.json new file mode 100644 index 000000000..972d2b1e4 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-motion-crank-slider-play-at-60/recipe.json @@ -0,0 +1,319 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 60, + "width": 20, + "height": 2, + "corner": [ + -10, + -10, + -12 + ], + "operation": "new", + "body_name": "BedBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 14, + "width": 4, + "height": 2, + "corner": [ + -2, + -2, + 0 + ], + "operation": "new", + "body_name": "CrankBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 34, + "width": 2, + "height": 2, + "corner": [ + 8, + -1, + 2 + ], + "operation": "new", + "body_name": "RodBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 6, + "width": 6, + "height": 2, + "corner": [ + 37, + -3, + 4 + ], + "operation": "new", + "body_name": "SliderBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Bed", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BedBox" + ], + "component": "Bed" + } + }, + { + "command": "component.create", + "params": { + "name": "Crank", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "CrankBox" + ], + "component": "Crank" + } + }, + { + "command": "component.create", + "params": { + "name": "Rod", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "RodBox" + ], + "component": "Rod" + } + }, + { + "command": "component.create", + "params": { + "name": "Slider", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "SliderBox" + ], + "component": "Slider" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Bed:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Crank pin", + "flip": true, + "a": { + "occurrence": "Bed", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Crank", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Big end", + "flip": true, + "a": { + "occurrence": "Crank", + "point": [ + 10, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Rod", + "point": [ + 10, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.create", + "params": { + "type": "slider", + "name": "Guide", + "flip": true, + "a": { + "occurrence": "Bed", + "point": [ + 40, + 0, + 5 + ], + "z": [ + 1, + 0, + 0 + ] + }, + "b": { + "occurrence": "Slider", + "point": [ + 40, + 0, + 5 + ], + "z": [ + 1, + 0, + 0 + ] + }, + "quiet": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Small end", + "flip": true, + "a": { + "occurrence": "Rod", + "point": [ + 40, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Slider", + "point": [ + 40, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "motion.study", + "params": { + "name": "Turn", + "steps": 6, + "keys": [ + { + "joint": "Crank pin", + "points": [ + [ + 0, + 0 + ], + [ + 6, + 360 + ] + ] + } + ] + } + }, + { + "command": "motion.play", + "params": { + "study": "Turn", + "step": 1, + "quiet": true + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Slider:1" + } + }, + { + "command": "joint.list", + "params": {} + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-motion-interference-arm-into-the-block/expected.json b/tests/kernel-cases/assemblies/cov-motion-interference-arm-into-the-block/expected.json new file mode 100644 index 000000000..00cfedb7e --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-motion-interference-arm-into-the-block/expected.json @@ -0,0 +1,43 @@ +{ + "sources": [], + "what": "motion.interference of the arm turning 0 to 90 in 9 steps into a grounded block", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Stop: box 50x10x10 from (-10,30,0), grounded; the arm's corner (40,5) turned \u03b8 reaches y = 40 sin \u03b8 + 5 cos \u03b8, which is 30 at \u03b8 = asin(30/\u221a1625) - atan(5/40) = 40.9676; samples every 10 degrees: clear at 40, overlapping from step 5 (50) to 9 (90); at 90 the arm (x -5..5, y 0..40) and block (x -10..40, y 30..40) share 10x10x10 = 1000 mm3", + "body_count": 3, + "volume_mm3": 13000.0, + "results": [ + { + "step": 14, + "json": { + "clear": false, + "samples": 10, + "collisions": [ + { + "first_step": 5.0, + "last_step": 9.0, + "steps": [ + [ + 5.0, + 9.0 + ] + ], + "deepest_step": 9.0, + "volume_mm3": 1000.0 + } + ] + } + }, + { + "step": 15, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 0.0, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-motion-interference-arm-into-the-block/recipe.json b/tests/kernel-cases/assemblies/cov-motion-interference-arm-into-the-block/recipe.json new file mode 100644 index 000000000..cb5b6bbd8 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-motion-interference-arm-into-the-block/recipe.json @@ -0,0 +1,189 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "solid.box", + "params": { + "length": 50, + "width": 10, + "height": 10, + "corner": [ + -10, + 30, + 0 + ], + "operation": "new", + "body_name": "StopBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Stop", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "StopBox" + ], + "component": "Stop" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Stop:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "motion.study", + "params": { + "name": "Open", + "steps": 9, + "keys": [ + { + "joint": "Hinge", + "points": [ + [ + 0, + 0 + ], + [ + 9, + 90 + ] + ] + } + ] + } + }, + { + "command": "motion.interference", + "params": { + "study": "Open", + "occurrences": [ + "Arm" + ], + "against": [ + "Stop" + ] + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-motion-interference-clear/expected.json b/tests/kernel-cases/assemblies/cov-motion-interference-clear/expected.json new file mode 100644 index 000000000..a6358e43b --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-motion-interference-clear/expected.json @@ -0,0 +1,17 @@ +{ + "sources": [], + "what": "motion.interference of the arm turning 0 to 30, short of the block", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Stop: box 50x10x10 from (-10,30,0), grounded; the arm's corner (40,5) turned \u03b8 reaches y = 40 sin \u03b8 + 5 cos \u03b8, which is 30 at \u03b8 = asin(30/\u221a1625) - atan(5/40) = 40.9676; 30 < 40.97: no collisions", + "body_count": 3, + "volume_mm3": 13000.0, + "results": [ + { + "step": 14, + "json": { + "clear": true, + "collisions": [] + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-motion-interference-clear/recipe.json b/tests/kernel-cases/assemblies/cov-motion-interference-clear/recipe.json new file mode 100644 index 000000000..ca19b2c77 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-motion-interference-clear/recipe.json @@ -0,0 +1,183 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "solid.box", + "params": { + "length": 50, + "width": 10, + "height": 10, + "corner": [ + -10, + 30, + 0 + ], + "operation": "new", + "body_name": "StopBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Stop", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "StopBox" + ], + "component": "Stop" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Stop:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "motion.study", + "params": { + "name": "Open", + "steps": 3, + "keys": [ + { + "joint": "Hinge", + "points": [ + [ + 0, + 0 + ], + [ + 3, + 30 + ] + ] + } + ] + } + }, + { + "command": "motion.interference", + "params": { + "study": "Open", + "occurrences": [ + "Arm" + ], + "against": [ + "Stop" + ] + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-motion-play-fractional-step/expected.json b/tests/kernel-cases/assemblies/cov-motion-play-fractional-step/expected.json new file mode 100644 index 000000000..c5eef5765 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-motion-play-fractional-step/expected.json @@ -0,0 +1,22 @@ +{ + "sources": [], + "what": "the same study played at step 2.5", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); step 2.5 of 10 is 22.5 degrees: Arm centre (20 cos22.5, 20 sin22.5, 5)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 11, + "json": { + "total": { + "center_of_mass": [ + 18.477591, + 7.653669, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-motion-play-fractional-step/recipe.json b/tests/kernel-cases/assemblies/cov-motion-play-fractional-step/recipe.json new file mode 100644 index 000000000..e68dae133 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-motion-play-fractional-step/recipe.json @@ -0,0 +1,146 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "motion.study", + "params": { + "name": "Open", + "steps": 10, + "keys": [ + { + "joint": "Hinge", + "points": [ + [ + 0, + 0 + ], + [ + 10, + 90 + ] + ] + } + ] + } + }, + { + "command": "motion.play", + "params": { + "study": "Open", + "step": 2.5, + "quiet": true + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-motion-play-half-way/expected.json b/tests/kernel-cases/assemblies/cov-motion-play-half-way/expected.json new file mode 100644 index 000000000..4c82bce74 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-motion-play-half-way/expected.json @@ -0,0 +1,28 @@ +{ + "sources": [], + "what": "a study turning the hinge 0 to 90 over 10 steps, played at step 5", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); linear between keys: step 5 is 45 degrees: Arm centre (20 cos45, 20 sin45, 5)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 10, + "json": { + "moved": true + } + }, + { + "step": 11, + "json": { + "total": { + "center_of_mass": [ + 14.142136, + 14.142136, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-motion-play-half-way/recipe.json b/tests/kernel-cases/assemblies/cov-motion-play-half-way/recipe.json new file mode 100644 index 000000000..d2a2c66b3 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-motion-play-half-way/recipe.json @@ -0,0 +1,146 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "motion.study", + "params": { + "name": "Open", + "steps": 10, + "keys": [ + { + "joint": "Hinge", + "points": [ + [ + 0, + 0 + ], + [ + 10, + 90 + ] + ] + } + ] + } + }, + { + "command": "motion.play", + "params": { + "study": "Open", + "step": 5, + "quiet": true + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-motion-plot-linear-ramp/expected.json b/tests/kernel-cases/assemblies/cov-motion-plot-linear-ramp/expected.json new file mode 100644 index 000000000..1e7b316ae --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-motion-plot-linear-ramp/expected.json @@ -0,0 +1,71 @@ +{ + "sources": [], + "what": "motion.plot of a hinge keyed 0 to 90 over 10 steps, played in 1 s", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); 11 samples, 9 degrees apart; with duration 1 s the rate is 90 deg/s throughout and the acceleration 0", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 10, + "json": { + "samples": 11, + "joints": [ + { + "value": [ + 0.0, + 9.0, + 18.0, + 27.0, + 36.0, + 45.0, + 54.0, + 63.0, + 72.0, + 81.0, + 90.0 + ], + "velocity": [ + 90.0, + 90.0, + 90.0, + 90.0, + 90.0, + 90.0, + 90.0, + 90.0, + 90.0, + 90.0, + 90.0 + ], + "acceleration": [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ] + } + ] + } + }, + { + "step": 11, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 0.0, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-motion-plot-linear-ramp/recipe.json b/tests/kernel-cases/assemblies/cov-motion-plot-linear-ramp/recipe.json new file mode 100644 index 000000000..da992cbc8 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-motion-plot-linear-ramp/recipe.json @@ -0,0 +1,148 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "motion.study", + "params": { + "name": "Open", + "steps": 10, + "keys": [ + { + "joint": "Hinge", + "points": [ + [ + 0, + 0 + ], + [ + 10, + 90 + ] + ] + } + ] + } + }, + { + "command": "motion.plot", + "params": { + "study": "Open", + "joints": [ + "Hinge" + ], + "duration": 1 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-motion-plot-point-on-the-arm/expected.json b/tests/kernel-cases/assemblies/cov-motion-plot-point-on-the-arm/expected.json new file mode 100644 index 000000000..afc5a90b6 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-motion-plot-point-on-the-arm/expected.json @@ -0,0 +1,34 @@ +{ + "sources": [], + "what": "motion.plot following the arm's tip (40,0,5) over the study, 3 samples", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); the tip turns at radius 40: at 0, 45 and 90 degrees it is at (40,0,5), (40 cos45, 40 sin45, 5), (0,40,5)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 10, + "json": { + "point": { + "position": [ + [ + 40.0, + 0.0, + 5.0 + ], + [ + 28.284271, + 28.284271, + 5.0 + ], + [ + 0.0, + 40.0, + 5.0 + ] + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-motion-plot-point-on-the-arm/recipe.json b/tests/kernel-cases/assemblies/cov-motion-plot-point-on-the-arm/recipe.json new file mode 100644 index 000000000..edb3f9ffd --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-motion-plot-point-on-the-arm/recipe.json @@ -0,0 +1,148 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "motion.study", + "params": { + "name": "Open", + "steps": 10, + "keys": [ + { + "joint": "Hinge", + "points": [ + [ + 0, + 0 + ], + [ + 10, + 90 + ] + ] + } + ] + } + }, + { + "command": "motion.plot", + "params": { + "study": "Open", + "joints": [ + "Hinge" + ], + "occurrence": "Arm", + "point": [ + 40, + 0, + 5 + ], + "samples": 3 + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-motion-study-edit-replaces-the-keys/expected.json b/tests/kernel-cases/assemblies/cov-motion-study-edit-replaces-the-keys/expected.json new file mode 100644 index 000000000..d45dfa051 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-motion-study-edit-replaces-the-keys/expected.json @@ -0,0 +1,22 @@ +{ + "sources": [], + "what": "motion.study editing a study's keys to turn the hinge 0 to -90", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); keys given replace all keys: step 5 of 10 is now -45 degrees: Arm centre (20 cos45, -20 sin45, 5)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 12, + "json": { + "total": { + "center_of_mass": [ + 14.142136, + -14.142136, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-motion-study-edit-replaces-the-keys/recipe.json b/tests/kernel-cases/assemblies/cov-motion-study-edit-replaces-the-keys/recipe.json new file mode 100644 index 000000000..3638f0a60 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-motion-study-edit-replaces-the-keys/recipe.json @@ -0,0 +1,167 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "motion.study", + "params": { + "name": "Open", + "steps": 10, + "keys": [ + { + "joint": "Hinge", + "points": [ + [ + 0, + 0 + ], + [ + 10, + 90 + ] + ] + } + ] + } + }, + { + "command": "motion.study", + "params": { + "study": "Open", + "keys": [ + { + "joint": "Hinge", + "points": [ + [ + 0, + 0 + ], + [ + 10, + -90 + ] + ] + } + ] + } + }, + { + "command": "motion.play", + "params": { + "study": "Open", + "step": 5, + "quiet": true + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-motion-trace-arm-tip/expected.json b/tests/kernel-cases/assemblies/cov-motion-trace-arm-tip/expected.json new file mode 100644 index 000000000..aa0291c9b --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-motion-trace-arm-tip/expected.json @@ -0,0 +1,46 @@ +{ + "sources": [], + "what": "motion.trace of the arm's tip as the hinge turns 0 to 90, 3 samples", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); radius 40 about z: (40,0,5), (40 cos45, 40 sin45, 5), (0,40,5); the design is not changed", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 9, + "json": { + "samples": 3, + "stopped_at": null, + "points": [ + [ + 40.0, + 0.0, + 5.0 + ], + [ + 28.284271, + 28.284271, + 5.0 + ], + [ + 0.0, + 40.0, + 5.0 + ] + ] + } + }, + { + "step": 10, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 0.0, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-motion-trace-arm-tip/recipe.json b/tests/kernel-cases/assemblies/cov-motion-trace-arm-tip/recipe.json new file mode 100644 index 000000000..52014a1e8 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-motion-trace-arm-tip/recipe.json @@ -0,0 +1,131 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "motion.trace", + "params": { + "occurrence": "Arm", + "point": [ + 40, + 0, + 5 + ], + "joint": "Hinge", + "samples": 3, + "from": 0, + "to": 90 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-motion-trace-coupler-midpoint/expected.json b/tests/kernel-cases/assemblies/cov-motion-trace-coupler-midpoint/expected.json new file mode 100644 index 000000000..7075bbf24 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-motion-trace-coupler-midpoint/expected.json @@ -0,0 +1,38 @@ +{ + "sources": [], + "what": "motion.trace of a crank-slider rod's middle over half a turn, 3 samples", + "source": "analytic", + "method": "a crank-slider: crank r 10 about z through the origin, rod l 30 from the crank pin (10,0) to the slider's pin (40,0), slider on +x; the slider sits at x = r cos \u03b8 + \u221a(l\u00b2 - r\u00b2 sin\u00b2 \u03b8); the rod's middle is ((10 cos \u03b8 + x)/2, 5 sin \u03b8, 3): \u03b8 0 (25,0,3), 90 (14.14214,5,3), 180 (5,0,3)", + "body_count": 4, + "volume_mm3": 2720, + "results": [ + { + "step": 17, + "json": { + "conflicts": [] + } + }, + { + "step": 18, + "json": { + "points": [ + [ + 25.0, + 0.0, + 3.0 + ], + [ + 14.142136, + 5.0, + 3.0 + ], + [ + 5.0, + 0.0, + 3.0 + ] + ] + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-motion-trace-coupler-midpoint/recipe.json b/tests/kernel-cases/assemblies/cov-motion-trace-coupler-midpoint/recipe.json new file mode 100644 index 000000000..23039f75c --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-motion-trace-coupler-midpoint/recipe.json @@ -0,0 +1,294 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 60, + "width": 20, + "height": 2, + "corner": [ + -10, + -10, + -12 + ], + "operation": "new", + "body_name": "BedBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 14, + "width": 4, + "height": 2, + "corner": [ + -2, + -2, + 0 + ], + "operation": "new", + "body_name": "CrankBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 34, + "width": 2, + "height": 2, + "corner": [ + 8, + -1, + 2 + ], + "operation": "new", + "body_name": "RodBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 6, + "width": 6, + "height": 2, + "corner": [ + 37, + -3, + 4 + ], + "operation": "new", + "body_name": "SliderBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Bed", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BedBox" + ], + "component": "Bed" + } + }, + { + "command": "component.create", + "params": { + "name": "Crank", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "CrankBox" + ], + "component": "Crank" + } + }, + { + "command": "component.create", + "params": { + "name": "Rod", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "RodBox" + ], + "component": "Rod" + } + }, + { + "command": "component.create", + "params": { + "name": "Slider", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "SliderBox" + ], + "component": "Slider" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Bed:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Crank pin", + "flip": true, + "a": { + "occurrence": "Bed", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Crank", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Big end", + "flip": true, + "a": { + "occurrence": "Crank", + "point": [ + 10, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Rod", + "point": [ + 10, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.create", + "params": { + "type": "slider", + "name": "Guide", + "flip": true, + "a": { + "occurrence": "Bed", + "point": [ + 40, + 0, + 5 + ], + "z": [ + 1, + 0, + 0 + ] + }, + "b": { + "occurrence": "Slider", + "point": [ + 40, + 0, + 5 + ], + "z": [ + 1, + 0, + 0 + ] + }, + "quiet": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Small end", + "flip": true, + "a": { + "occurrence": "Rod", + "point": [ + 40, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Slider", + "point": [ + 40, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "motion.trace", + "params": { + "occurrence": "Rod", + "point": [ + 25, + 0, + 3 + ], + "joint": "Crank pin", + "samples": 3, + "from": 0, + "to": 180 + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-motion-trace-stops-at-contact/expected.json b/tests/kernel-cases/assemblies/cov-motion-trace-stops-at-contact/expected.json new file mode 100644 index 000000000..f9299afb5 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-motion-trace-stops-at-contact/expected.json @@ -0,0 +1,19 @@ +{ + "sources": [], + "what": "motion.trace of the arm's tip with a contact set between the arm and a block", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Stop: box 50x10x10 from (-10,30,0), grounded; the arm's corner (40,5) turned \u03b8 reaches y = 40 sin \u03b8 + 5 cos \u03b8, which is 30 at \u03b8 = asin(30/\u221a1625) - atan(5/40) = 40.9676; contact sets stop the motion: the trace from 0 to 90 stops short of the block, its last point within the circle's arc up to \u03b8 = 40.97 (y \u2264 40 sin 40.97 = 26.22)", + "body_count": 3, + "volume_mm3": 13000.0, + "results": [ + { + "step": 15, + "json": { + "stopped_by_contact": { + "a": "Stop:1", + "b": "Arm:1" + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-motion-trace-stops-at-contact/recipe.json b/tests/kernel-cases/assemblies/cov-motion-trace-stops-at-contact/recipe.json new file mode 100644 index 000000000..a1335955b --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-motion-trace-stops-at-contact/recipe.json @@ -0,0 +1,178 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "solid.box", + "params": { + "length": 50, + "width": 10, + "height": 10, + "corner": [ + -10, + 30, + 0 + ], + "operation": "new", + "body_name": "StopBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Stop", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "StopBox" + ], + "component": "Stop" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Stop:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "contact.create", + "params": { + "occurrences": [ + "Arm", + "Stop" + ], + "name": "Stop set" + } + }, + { + "command": "contact.enable_sets", + "params": {} + }, + { + "command": "motion.trace", + "params": { + "occurrence": "Arm", + "point": [ + 40, + 0, + 5 + ], + "joint": "Hinge", + "samples": 10, + "from": 0, + "to": 90 + } + } + ] +} From e7eb8a5d44ef609a9dba953f70bced636690e8a0 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:20:41 -0400 Subject: [PATCH 088/108] Kernel rig: contact sets stop a drive at the block, touching faces don't, and edit, list, enable and disable do as coded Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 21 ++ .../recipe.json | 179 +++++++++++++++++ .../expected.json | 39 ++++ .../recipe.json | 142 ++++++++++++++ .../expected.json | 38 ++++ .../recipe.json | 185 ++++++++++++++++++ .../expected.json | 35 ++++ .../recipe.json | 177 +++++++++++++++++ .../expected.json | 22 +++ .../recipe.json | 152 ++++++++++++++ .../expected.json | 32 +++ .../recipe.json | 184 +++++++++++++++++ .../expected.json | 39 ++++ .../recipe.json | 171 ++++++++++++++++ .../cov-contact-list-sets/expected.json | 25 +++ .../cov-contact-list-sets/recipe.json | 142 ++++++++++++++ 16 files changed, 1583 insertions(+) create mode 100644 tests/kernel-cases/assemblies/cov-contact-check-lists-the-overlap/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-contact-check-lists-the-overlap/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-contact-check-touching-faces-do-not-overlap/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-contact-check-touching-faces-do-not-overlap/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-contact-disable-all-lets-it-pass/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-contact-disable-all-lets-it-pass/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-contact-drive-stops-at-the-block/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-contact-drive-stops-at-the-block/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-contact-edit-delete-and-rename/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-contact-edit-delete-and-rename/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-contact-edit-suppressed-set-does-not-stop/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-contact-edit-suppressed-set-does-not-stop/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-contact-enable-all-stops-the-drive/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-contact-enable-all-stops-the-drive/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-contact-list-sets/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-contact-list-sets/recipe.json diff --git a/tests/kernel-cases/assemblies/cov-contact-check-lists-the-overlap/expected.json b/tests/kernel-cases/assemblies/cov-contact-check-lists-the-overlap/expected.json new file mode 100644 index 000000000..5bdee8abc --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-contact-check-lists-the-overlap/expected.json @@ -0,0 +1,21 @@ +{ + "sources": [], + "what": "contact.check with the arm driven into the block (contact off for the drive)", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Stop: box 50x10x10 from (-10,30,0), grounded; the arm's corner (40,5) turned \u03b8 reaches y = 40 sin \u03b8 + 5 cos \u03b8, which is 30 at \u03b8 = asin(30/\u221a1625) - atan(5/40) = 40.9676; at 60 the corner reaches y = 40 sin60 + 5 cos60 = 37.14 > 30: the pair overlaps; with the set enabled again contact.check lists it", + "body_count": 3, + "volume_mm3": 13000.0, + "results": [ + { + "step": 17, + "json": { + "collisions": [ + { + "a": "Arm:1", + "b": "Stop:1" + } + ] + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-contact-check-lists-the-overlap/recipe.json b/tests/kernel-cases/assemblies/cov-contact-check-lists-the-overlap/recipe.json new file mode 100644 index 000000000..4f93e7089 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-contact-check-lists-the-overlap/recipe.json @@ -0,0 +1,179 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "solid.box", + "params": { + "length": 50, + "width": 10, + "height": 10, + "corner": [ + -10, + 30, + 0 + ], + "operation": "new", + "body_name": "StopBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Stop", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "StopBox" + ], + "component": "Stop" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Stop:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "contact.create", + "params": { + "occurrences": [ + "Arm", + "Stop" + ], + "name": "Stop set" + } + }, + { + "command": "contact.disable_all", + "params": {} + }, + { + "command": "joint.drive", + "params": { + "joint": "Hinge", + "quiet": true, + "value": 60 + } + }, + { + "command": "contact.enable_sets", + "params": {} + }, + { + "command": "contact.check", + "params": {} + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-contact-check-touching-faces-do-not-overlap/expected.json b/tests/kernel-cases/assemblies/cov-contact-check-touching-faces-do-not-overlap/expected.json new file mode 100644 index 000000000..cad2100ea --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-contact-check-touching-faces-do-not-overlap/expected.json @@ -0,0 +1,39 @@ +{ + "sources": [], + "what": "contact.check of two blocks touching face to face, then a drive in that set", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Arm stands on Base's top face (z = 0, a 10x10 patch): touching is not passing through, so contact.check lists nothing and a drive to 90 is not stopped", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 11, + "json": { + "collisions": [] + } + }, + { + "step": 12, + "json": { + "values": [ + { + "value": 90.0 + } + ], + "stopped_by_contact": null + } + }, + { + "step": 13, + "json": { + "total": { + "center_of_mass": [ + 0.0, + 20.0, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-contact-check-touching-faces-do-not-overlap/recipe.json b/tests/kernel-cases/assemblies/cov-contact-check-touching-faces-do-not-overlap/recipe.json new file mode 100644 index 000000000..e567ae560 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-contact-check-touching-faces-do-not-overlap/recipe.json @@ -0,0 +1,142 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "contact.create", + "params": { + "occurrences": [ + "Base", + "Arm" + ], + "name": "Face set" + } + }, + { + "command": "contact.enable_sets", + "params": {} + }, + { + "command": "contact.check", + "params": {} + }, + { + "command": "joint.drive", + "params": { + "joint": "Hinge", + "value": 90, + "quiet": true + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-contact-disable-all-lets-it-pass/expected.json b/tests/kernel-cases/assemblies/cov-contact-disable-all-lets-it-pass/expected.json new file mode 100644 index 000000000..812278532 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-contact-disable-all-lets-it-pass/expected.json @@ -0,0 +1,38 @@ +{ + "sources": [], + "what": "contact.disable_all after a set was enabled, and a 90 degree drive", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Stop: box 50x10x10 from (-10,30,0), grounded; the arm's corner (40,5) turned \u03b8 reaches y = 40 sin \u03b8 + 5 cos \u03b8, which is 30 at \u03b8 = asin(30/\u221a1625) - atan(5/40) = 40.9676; contact off: the drive reaches 90, Arm at (0,20,5) inside the block", + "body_count": 3, + "volume_mm3": 13000.0, + "results": [ + { + "step": 16, + "json": { + "enabled": false + } + }, + { + "step": 17, + "json": { + "values": [ + { + "value": 90.0 + } + ] + } + }, + { + "step": 18, + "json": { + "total": { + "center_of_mass": [ + 0.0, + 20.0, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-contact-disable-all-lets-it-pass/recipe.json b/tests/kernel-cases/assemblies/cov-contact-disable-all-lets-it-pass/recipe.json new file mode 100644 index 000000000..6d454d23a --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-contact-disable-all-lets-it-pass/recipe.json @@ -0,0 +1,185 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "solid.box", + "params": { + "length": 50, + "width": 10, + "height": 10, + "corner": [ + -10, + 30, + 0 + ], + "operation": "new", + "body_name": "StopBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Stop", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "StopBox" + ], + "component": "Stop" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Stop:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "contact.create", + "params": { + "occurrences": [ + "Arm", + "Stop" + ], + "name": "Stop set" + } + }, + { + "command": "contact.enable_sets", + "params": {} + }, + { + "command": "contact.disable_all", + "params": {} + }, + { + "command": "contact.list", + "params": {} + }, + { + "command": "joint.drive", + "params": { + "joint": "Hinge", + "quiet": true, + "value": 90 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-contact-drive-stops-at-the-block/expected.json b/tests/kernel-cases/assemblies/cov-contact-drive-stops-at-the-block/expected.json new file mode 100644 index 000000000..d515b9a4e --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-contact-drive-stops-at-the-block/expected.json @@ -0,0 +1,35 @@ +{ + "sources": [], + "what": "a contact set stops a 90 degree drive of the arm at the block", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Stop: box 50x10x10 from (-10,30,0), grounded; the arm's corner (40,5) turned \u03b8 reaches y = 40 sin \u03b8 + 5 cos \u03b8, which is 30 at \u03b8 = asin(30/\u221a1625) - atan(5/40) = 40.9676; the drive stops there, fraction \u03b8/90 = 0.45520", + "body_count": 3, + "volume_mm3": 13000.0, + "results": [ + { + "step": 15, + "json": { + "values": [ + { + "value": 40.966136 + } + ], + "stopped_by_contact": { + "fraction": 0.455179 + } + } + }, + { + "step": 16, + "json": { + "total": { + "center_of_mass": [ + 15.101944, + 13.112257, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-contact-drive-stops-at-the-block/recipe.json b/tests/kernel-cases/assemblies/cov-contact-drive-stops-at-the-block/recipe.json new file mode 100644 index 000000000..4d25d31f2 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-contact-drive-stops-at-the-block/recipe.json @@ -0,0 +1,177 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "solid.box", + "params": { + "length": 50, + "width": 10, + "height": 10, + "corner": [ + -10, + 30, + 0 + ], + "operation": "new", + "body_name": "StopBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Stop", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "StopBox" + ], + "component": "Stop" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Stop:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "contact.create", + "params": { + "occurrences": [ + "Arm", + "Stop" + ], + "name": "Stop set" + } + }, + { + "command": "contact.enable_sets", + "params": {} + }, + { + "command": "joint.drive", + "params": { + "joint": "Hinge", + "value": 90, + "quiet": true + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-contact-edit-delete-and-rename/expected.json b/tests/kernel-cases/assemblies/cov-contact-edit-delete-and-rename/expected.json new file mode 100644 index 000000000..9c1470e5c --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-contact-edit-delete-and-rename/expected.json @@ -0,0 +1,22 @@ +{ + "sources": [], + "what": "contact.edit renaming one set and deleting another", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Stop: box 50x10x10 from (-10,30,0), grounded; the arm's corner (40,5) turned \u03b8 reaches y = 40 sin \u03b8 + 5 cos \u03b8, which is 30 at \u03b8 = asin(30/\u221a1625) - atan(5/40) = 40.9676; two sets made (contact.create turns contact on), the first renamed 'Arm stop', the second deleted: one set left", + "body_count": 3, + "volume_mm3": 13000.0, + "results": [ + { + "step": 16, + "json": { + "all": false, + "enabled": true, + "sets": [ + { + "name": "Arm stop" + } + ] + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-contact-edit-delete-and-rename/recipe.json b/tests/kernel-cases/assemblies/cov-contact-edit-delete-and-rename/recipe.json new file mode 100644 index 000000000..7693e27db --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-contact-edit-delete-and-rename/recipe.json @@ -0,0 +1,152 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "solid.box", + "params": { + "length": 50, + "width": 10, + "height": 10, + "corner": [ + -10, + 30, + 0 + ], + "operation": "new", + "body_name": "StopBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Stop", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "StopBox" + ], + "component": "Stop" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Stop:1", + "grounded": true + } + }, + { + "command": "contact.create", + "params": { + "occurrences": [ + "Arm", + "Stop" + ], + "name": "Stop set" + } + }, + { + "command": "contact.create", + "params": { + "occurrences": [ + "Base", + "Arm" + ], + "name": "Face set" + } + }, + { + "command": "contact.edit", + "params": { + "set": "Stop set", + "name": "Arm stop" + } + }, + { + "command": "contact.edit", + "params": { + "set": "Face set", + "delete": true + } + }, + { + "command": "contact.list", + "params": {} + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-contact-edit-suppressed-set-does-not-stop/expected.json b/tests/kernel-cases/assemblies/cov-contact-edit-suppressed-set-does-not-stop/expected.json new file mode 100644 index 000000000..3c8861f5b --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-contact-edit-suppressed-set-does-not-stop/expected.json @@ -0,0 +1,32 @@ +{ + "sources": [], + "what": "a suppressed contact set and a 90 degree drive into the block", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Stop: box 50x10x10 from (-10,30,0), grounded; the arm's corner (40,5) turned \u03b8 reaches y = 40 sin \u03b8 + 5 cos \u03b8, which is 30 at \u03b8 = asin(30/\u221a1625) - atan(5/40) = 40.9676; with its only set suppressed nothing stops the drive: 90, Arm at (0,20,5)", + "body_count": 3, + "volume_mm3": 13000.0, + "results": [ + { + "step": 16, + "json": { + "values": [ + { + "value": 90.0 + } + ] + } + }, + { + "step": 17, + "json": { + "total": { + "center_of_mass": [ + 0.0, + 20.0, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-contact-edit-suppressed-set-does-not-stop/recipe.json b/tests/kernel-cases/assemblies/cov-contact-edit-suppressed-set-does-not-stop/recipe.json new file mode 100644 index 000000000..e41cffefd --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-contact-edit-suppressed-set-does-not-stop/recipe.json @@ -0,0 +1,184 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "solid.box", + "params": { + "length": 50, + "width": 10, + "height": 10, + "corner": [ + -10, + 30, + 0 + ], + "operation": "new", + "body_name": "StopBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Stop", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "StopBox" + ], + "component": "Stop" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Stop:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "contact.create", + "params": { + "occurrences": [ + "Arm", + "Stop" + ], + "name": "Stop set" + } + }, + { + "command": "contact.enable_sets", + "params": {} + }, + { + "command": "contact.edit", + "params": { + "set": "Stop set", + "suppressed": true + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Hinge", + "quiet": true, + "value": 90 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-contact-enable-all-stops-the-drive/expected.json b/tests/kernel-cases/assemblies/cov-contact-enable-all-stops-the-drive/expected.json new file mode 100644 index 000000000..5bb6d726e --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-contact-enable-all-stops-the-drive/expected.json @@ -0,0 +1,39 @@ +{ + "sources": [], + "what": "contact.enable_all and a 90 degree drive into the block", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Stop: box 50x10x10 from (-10,30,0), grounded; the arm's corner (40,5) turned \u03b8 reaches y = 40 sin \u03b8 + 5 cos \u03b8, which is 30 at \u03b8 = asin(30/\u221a1625) - atan(5/40) = 40.9676; every occurrence in one set: the block stops the arm at \u03b8 = 40.97 (Base, which Arm only touches, does not)", + "body_count": 3, + "volume_mm3": 13000.0, + "results": [ + { + "step": 14, + "json": { + "all": true, + "enabled": true + } + }, + { + "step": 15, + "json": { + "values": [ + { + "value": 40.966136 + } + ] + } + }, + { + "step": 16, + "json": { + "total": { + "center_of_mass": [ + 15.101944, + 13.112257, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-contact-enable-all-stops-the-drive/recipe.json b/tests/kernel-cases/assemblies/cov-contact-enable-all-stops-the-drive/recipe.json new file mode 100644 index 000000000..6b8748aaf --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-contact-enable-all-stops-the-drive/recipe.json @@ -0,0 +1,171 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "solid.box", + "params": { + "length": 50, + "width": 10, + "height": 10, + "corner": [ + -10, + 30, + 0 + ], + "operation": "new", + "body_name": "StopBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Stop", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "StopBox" + ], + "component": "Stop" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Stop:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "contact.enable_all", + "params": {} + }, + { + "command": "contact.list", + "params": {} + }, + { + "command": "joint.drive", + "params": { + "joint": "Hinge", + "quiet": true, + "value": 90 + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-contact-list-sets/expected.json b/tests/kernel-cases/assemblies/cov-contact-list-sets/expected.json new file mode 100644 index 000000000..ee2f728bc --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-contact-list-sets/expected.json @@ -0,0 +1,25 @@ +{ + "sources": [], + "what": "contact.list after two sets and contact.enable_sets", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Stop: box 50x10x10 from (-10,30,0), grounded; the arm's corner (40,5) turned \u03b8 reaches y = 40 sin \u03b8 + 5 cos \u03b8, which is 30 at \u03b8 = asin(30/\u221a1625) - atan(5/40) = 40.9676; both sets, in the order made, contact enabled for sets, not all", + "body_count": 3, + "volume_mm3": 13000.0, + "results": [ + { + "step": 15, + "json": { + "all": false, + "enabled": true, + "sets": [ + { + "name": "Stop set" + }, + { + "name": "Face set" + } + ] + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-contact-list-sets/recipe.json b/tests/kernel-cases/assemblies/cov-contact-list-sets/recipe.json new file mode 100644 index 000000000..17f90c12d --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-contact-list-sets/recipe.json @@ -0,0 +1,142 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "solid.box", + "params": { + "length": 50, + "width": 10, + "height": 10, + "corner": [ + -10, + 30, + 0 + ], + "operation": "new", + "body_name": "StopBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Stop", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "StopBox" + ], + "component": "Stop" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Stop:1", + "grounded": true + } + }, + { + "command": "contact.create", + "params": { + "occurrences": [ + "Arm", + "Stop" + ], + "name": "Stop set" + } + }, + { + "command": "contact.create", + "params": { + "occurrences": [ + "Base", + "Arm" + ], + "name": "Face set" + } + }, + { + "command": "contact.enable_sets", + "params": {} + }, + { + "command": "contact.list", + "params": {} + } + ] +} From 3b7dabdb7d4ad4f337cf8eac7ee054ef28a835eb Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:20:41 -0400 Subject: [PATCH 089/108] Kernel rig: bodies moved, copied and extracted, designs inserted, occurrences copied, reparented, dragged and exploded land where worked out Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 13 ++ .../recipe.json | 127 ++++++++++++++++ .../expected.json | 23 +++ .../recipe.json | 90 ++++++++++++ .../expected.json | 8 ++ .../recipe.json | 86 +++++++++++ .../expected.json | 8 ++ .../recipe.json | 82 +++++++++++ .../expected.json | 62 ++++++++ .../recipe.json | 103 +++++++++++++ .../expected.json | 36 +++++ .../recipe.json | 55 +++++++ .../expected.json | 8 ++ .../recipe.json | 22 +++ .../expected.json | 57 ++++++++ .../plate.solidcraft | 11 ++ .../recipe.json | 21 +++ .../expected.json | 25 ++++ .../plate.solidcraft | 11 ++ .../recipe.json | 22 +++ .../expected.json | 23 +++ .../recipe.json | 124 ++++++++++++++++ .../expected.json | 72 ++++++++++ .../recipe.json | 87 +++++++++++ .../expected.json | 25 ++++ .../recipe.json | 131 +++++++++++++++++ .../expected.json | 25 ++++ .../recipe.json | 86 +++++++++++ .../expected.json | 43 ++++++ .../recipe.json | 94 ++++++++++++ .../expected.json | 36 +++++ .../recipe.json | 103 +++++++++++++ .../expected.json | 39 +++++ .../recipe.json | 136 ++++++++++++++++++ .../expected.json | 40 ++++++ .../cov-occurrence-copy-translate/recipe.json | 92 ++++++++++++ .../expected.json | 8 ++ .../recipe.json | 91 ++++++++++++ .../expected.json | 34 +++++ .../recipe.json | 97 +++++++++++++ .../expected.json | 34 +++++ .../recipe.json | 120 ++++++++++++++++ .../expected.json | 34 +++++ .../recipe.json | 113 +++++++++++++++ 44 files changed, 2557 insertions(+) create mode 100644 tests/kernel-cases/assemblies/cov-component-copy-bodies-from-a-turned-part/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-component-copy-bodies-from-a-turned-part/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-component-copy-bodies-stays-in-place/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-component-copy-bodies-stays-in-place/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-component-extract-linked-refused/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-component-extract-linked-refused/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-component-extract-moved-in-bodies-refused/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-component-extract-moved-in-bodies-refused/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-component-extract-then-insert-it-again/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-component-extract-then-insert-it-again/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-component-from-bodies-one-each/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-component-from-bodies-one-each/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-component-from-bodies-unknown-body-refused/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-component-from-bodies-unknown-body-refused/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-component-insert-design-hand-written/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-component-insert-design-hand-written/plate.solidcraft create mode 100644 tests/kernel-cases/assemblies/cov-component-insert-design-hand-written/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-component-insert-design-twice-reused/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-component-insert-design-twice-reused/plate.solidcraft create mode 100644 tests/kernel-cases/assemblies/cov-component-insert-design-twice-reused/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-component-move-bodies-into-a-moved-part/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-component-move-bodies-into-a-moved-part/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-component-move-bodies-into-two-parts/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-component-move-bodies-into-two-parts/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-component-paste-new-in-place-of-a-turned-part/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-component-paste-new-in-place-of-a-turned-part/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-component-paste-new-independent-copy/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-component-paste-new-independent-copy/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-explode-create-automatic-scale-2/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-explode-create-automatic-scale-2/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-explode-create-explicit-move/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-explode-create-explicit-move/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-occurrence-copy-in-place-of-a-turned-part/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-occurrence-copy-in-place-of-a-turned-part/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-occurrence-copy-translate/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-occurrence-copy-translate/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-occurrence-drag-grounded-refused/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-occurrence-drag-grounded-refused/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-occurrence-drag-moves-by-the-difference/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-occurrence-drag-moves-by-the-difference/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-occurrence-reparent-keeps-the-world-place/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-occurrence-reparent-keeps-the-world-place/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-occurrence-reparent-under-a-turned-part/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-occurrence-reparent-under-a-turned-part/recipe.json diff --git a/tests/kernel-cases/assemblies/cov-component-copy-bodies-from-a-turned-part/expected.json b/tests/kernel-cases/assemblies/cov-component-copy-bodies-from-a-turned-part/expected.json new file mode 100644 index 000000000..2bc234e98 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-copy-bodies-from-a-turned-part/expected.json @@ -0,0 +1,13 @@ +{ + "sources": [], + "what": "the body of an arm turned 90 degrees copied to the root", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); hinge driven to 90 puts ArmBox at (0,20,5); its copy in the root stays there: centres (0,0,-5), (0,20,5), (0,20,5): mean (0,13.333,1.667)", + "body_count": 3, + "volume_mm3": 12000.0, + "center_of_mass": [ + 0, + 13.333333, + 1.666667 + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-copy-bodies-from-a-turned-part/recipe.json b/tests/kernel-cases/assemblies/cov-component-copy-bodies-from-a-turned-part/recipe.json new file mode 100644 index 000000000..aa170d056 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-copy-bodies-from-a-turned-part/recipe.json @@ -0,0 +1,127 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Hinge", + "quiet": true, + "value": 90 + } + }, + { + "command": "component.copy_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "root" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-copy-bodies-stays-in-place/expected.json b/tests/kernel-cases/assemblies/cov-component-copy-bodies-stays-in-place/expected.json new file mode 100644 index 000000000..90fa79ad1 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-copy-bodies-stays-in-place/expected.json @@ -0,0 +1,23 @@ +{ + "sources": [], + "what": "the arm's body copied into the base's component", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); a copy stays where its body is: Base then holds 4000 at (0,0,-5) and 4000 at (20,0,5): 8000, centre (10,0,0); the world has 3 bodies, 12000", + "body_count": 3, + "volume_mm3": 12000.0, + "results": [ + { + "step": 9, + "json": { + "total": { + "center_of_mass": [ + 10.0, + 0.0, + 0.0 + ], + "volume_mm3": 8000.0 + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-copy-bodies-stays-in-place/recipe.json b/tests/kernel-cases/assemblies/cov-component-copy-bodies-stays-in-place/recipe.json new file mode 100644 index 000000000..1b6860670 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-copy-bodies-stays-in-place/recipe.json @@ -0,0 +1,90 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "component.copy_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Base" + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Base:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-extract-linked-refused/expected.json b/tests/kernel-cases/assemblies/cov-component-extract-linked-refused/expected.json new file mode 100644 index 000000000..ab0f37d72 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-extract-linked-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "component.extract of a component that is already linked", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5), Arm's box built inside Arm; after one extract Arm is linked; extracting it again is refused", + "outcome": "refused", + "refusal": "is linked to a design file already" +} diff --git a/tests/kernel-cases/assemblies/cov-component-extract-linked-refused/recipe.json b/tests/kernel-cases/assemblies/cov-component-extract-linked-refused/recipe.json new file mode 100644 index 000000000..dba316304 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-extract-linked-refused/recipe.json @@ -0,0 +1,86 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": true + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.activate", + "params": { + "component": "root" + } + }, + { + "command": "component.extract", + "params": { + "component": "Arm", + "path": "$OUT/arm.solidcraft" + } + }, + { + "command": "component.extract", + "params": { + "component": "Arm", + "path": "$OUT/arm2.solidcraft" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-extract-moved-in-bodies-refused/expected.json b/tests/kernel-cases/assemblies/cov-component-extract-moved-in-bodies-refused/expected.json new file mode 100644 index 000000000..053a6763e --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-extract-moved-in-bodies-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "component.extract of a component whose body was moved in from the root", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Arm's body came in by component.move_bodies, a feature outside it: its history can't move to a design of its own, so extract is refused", + "outcome": "refused", + "refusal": "moves bodies into or out of Arm" +} diff --git a/tests/kernel-cases/assemblies/cov-component-extract-moved-in-bodies-refused/recipe.json b/tests/kernel-cases/assemblies/cov-component-extract-moved-in-bodies-refused/recipe.json new file mode 100644 index 000000000..d4701fd89 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-extract-moved-in-bodies-refused/recipe.json @@ -0,0 +1,82 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "component.extract", + "params": { + "component": "Arm", + "path": "$OUT/arm.solidcraft" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-extract-then-insert-it-again/expected.json b/tests/kernel-cases/assemblies/cov-component-extract-then-insert-it-again/expected.json new file mode 100644 index 000000000..bd4922304 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-extract-then-insert-it-again/expected.json @@ -0,0 +1,62 @@ +{ + "sources": [], + "what": "an arm built in its component extracted to a design file, then that file inserted again 50 mm along y", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5), Arm's box built inside Arm; extract keeps Arm where it is (now linked to the file: centre (20,0,5)); the file inserted with translate (0,50,0) holds the same 40x10x10 bar: centre (20,50,5)", + "body_count": 3, + "volume_mm3": 12000.0, + "results": [ + { + "step": 8, + "json": { + "bodies": [ + "ArmBox" + ] + } + }, + { + "step": 9, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 0.0, + 5.0 + ], + "volume_mm3": 4000.0 + } + } + }, + { + "step": 10, + "json": { + "name": "Arm copy" + } + }, + { + "step": 11, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 50.0, + 5.0 + ], + "bbox": { + "min": [ + 0.0, + 45.0, + 0.0 + ], + "max": [ + 40.0, + 55.0, + 10.0 + ] + }, + "volume_mm3": 4000.0 + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-extract-then-insert-it-again/recipe.json b/tests/kernel-cases/assemblies/cov-component-extract-then-insert-it-again/recipe.json new file mode 100644 index 000000000..cca31d878 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-extract-then-insert-it-again/recipe.json @@ -0,0 +1,103 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": true + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.activate", + "params": { + "component": "root" + } + }, + { + "command": "component.extract", + "params": { + "component": "Arm", + "path": "$OUT/arm.solidcraft" + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + }, + { + "command": "component.insert_design", + "params": { + "path": "$OUT/arm.solidcraft", + "name": "Arm copy", + "translate": [ + 0, + 50, + 0 + ] + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm copy:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-from-bodies-one-each/expected.json b/tests/kernel-cases/assemblies/cov-component-from-bodies-one-each/expected.json new file mode 100644 index 000000000..e0a799922 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-from-bodies-one-each/expected.json @@ -0,0 +1,36 @@ +{ + "sources": [], + "what": "component.from_bodies on two root bodies", + "source": "analytic", + "method": "boxes P 10x10x10 from (0,0,0) and Q 20x10x10 from (30,0,0): one component each, named after its body, in place: P:1 (5,5,5), Q:1 (40,5,5)", + "body_count": 2, + "volume_mm3": 3000.0, + "results": [ + { + "step": 4, + "json": { + "total": { + "center_of_mass": [ + 5.0, + 5.0, + 5.0 + ], + "volume_mm3": 1000.0 + } + } + }, + { + "step": 5, + "json": { + "total": { + "center_of_mass": [ + 40.0, + 5.0, + 5.0 + ], + "volume_mm3": 2000.0 + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-from-bodies-one-each/recipe.json b/tests/kernel-cases/assemblies/cov-component-from-bodies-one-each/recipe.json new file mode 100644 index 000000000..6de465f4c --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-from-bodies-one-each/recipe.json @@ -0,0 +1,55 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 10, + "width": 10, + "height": 10, + "corner": [ + 0, + 0, + 0 + ], + "operation": "new", + "body_name": "P" + } + }, + { + "command": "solid.box", + "params": { + "length": 20, + "width": 10, + "height": 10, + "corner": [ + 30, + 0, + 0 + ], + "operation": "new", + "body_name": "Q" + } + }, + { + "command": "component.from_bodies", + "params": { + "bodies": [ + "P", + "Q" + ] + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "P:1" + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Q:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-from-bodies-unknown-body-refused/expected.json b/tests/kernel-cases/assemblies/cov-component-from-bodies-unknown-body-refused/expected.json new file mode 100644 index 000000000..20f1c4d7a --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-from-bodies-unknown-body-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "component.from_bodies naming a body that is not there", + "source": "analytic", + "method": "a design with one body P: from_bodies of 'Nope' is refused, naming it", + "outcome": "refused", + "refusal": "Nope" +} diff --git a/tests/kernel-cases/assemblies/cov-component-from-bodies-unknown-body-refused/recipe.json b/tests/kernel-cases/assemblies/cov-component-from-bodies-unknown-body-refused/recipe.json new file mode 100644 index 000000000..21e4a3e44 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-from-bodies-unknown-body-refused/recipe.json @@ -0,0 +1,22 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 10, + "width": 10, + "height": 10, + "operation": "new", + "body_name": "P" + } + }, + { + "command": "component.from_bodies", + "params": { + "bodies": [ + "Nope" + ] + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-insert-design-hand-written/expected.json b/tests/kernel-cases/assemblies/cov-component-insert-design-hand-written/expected.json new file mode 100644 index 000000000..8ec526f9f --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-insert-design-hand-written/expected.json @@ -0,0 +1,57 @@ +{ + "sources": [], + "what": "a hand-written design (one 30x20x10 box) inserted 100 mm along x", + "source": "analytic", + "method": "plate.solidcraft in the case directory: a box 30x20x10 at the origin; inserted with translate (100,0,0): 6000 mm3, box (100,0,0)-(130,20,10), centre (115,10,5)", + "body_count": 1, + "volume_mm3": 6000.0, + "area_mm2": 2200.0, + "bbox": { + "min": [ + 100, + 0, + 0 + ], + "max": [ + 130, + 20, + 10 + ] + }, + "results": [ + { + "step": 1, + "json": { + "bodies": [ + "Plate" + ], + "name": "plate" + } + }, + { + "step": 2, + "json": { + "total": { + "center_of_mass": [ + 115.0, + 10.0, + 5.0 + ], + "bbox": { + "min": [ + 100.0, + 0.0, + 0.0 + ], + "max": [ + 130.0, + 20.0, + 10.0 + ] + }, + "volume_mm3": 6000.0 + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-insert-design-hand-written/plate.solidcraft b/tests/kernel-cases/assemblies/cov-component-insert-design-hand-written/plate.solidcraft new file mode 100644 index 000000000..456fc2708 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-insert-design-hand-written/plate.solidcraft @@ -0,0 +1,11 @@ +{ + "format": "solidcraft/40", + "name": "plate", + "units": "mm", + "params": [], + "next_id": 2, + "features": [ + {"id": 1, "name": "Box1", "type": "box", "suppressed": false, "operation": "new_body", "body_names": ["Plate"], + "corner": [0.0, 0.0, 0.0], "length": "30", "width": "20", "height": "10"} + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-insert-design-hand-written/recipe.json b/tests/kernel-cases/assemblies/cov-component-insert-design-hand-written/recipe.json new file mode 100644 index 000000000..512ffc305 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-insert-design-hand-written/recipe.json @@ -0,0 +1,21 @@ +{ + "commands": [ + { + "command": "component.insert_design", + "params": { + "path": "$CASE/plate.solidcraft", + "translate": [ + 100, + 0, + 0 + ] + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "plate:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-insert-design-twice-reused/expected.json b/tests/kernel-cases/assemblies/cov-component-insert-design-twice-reused/expected.json new file mode 100644 index 000000000..62d56bedf --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-insert-design-twice-reused/expected.json @@ -0,0 +1,25 @@ +{ + "sources": [], + "what": "the hand-written design inserted twice, the second reusing the first's link", + "source": "analytic", + "method": "plate.solidcraft (box 30x20x10) at (0,0,0) and again with translate (0,50,0): 2 bodies, 12000 mm3, box (0,0,0)-(30,70,10)", + "body_count": 2, + "volume_mm3": 12000.0, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 30, + 70, + 10 + ] + }, + "center_of_mass": [ + 15, + 35, + 5 + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-insert-design-twice-reused/plate.solidcraft b/tests/kernel-cases/assemblies/cov-component-insert-design-twice-reused/plate.solidcraft new file mode 100644 index 000000000..456fc2708 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-insert-design-twice-reused/plate.solidcraft @@ -0,0 +1,11 @@ +{ + "format": "solidcraft/40", + "name": "plate", + "units": "mm", + "params": [], + "next_id": 2, + "features": [ + {"id": 1, "name": "Box1", "type": "box", "suppressed": false, "operation": "new_body", "body_names": ["Plate"], + "corner": [0.0, 0.0, 0.0], "length": "30", "width": "20", "height": "10"} + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-insert-design-twice-reused/recipe.json b/tests/kernel-cases/assemblies/cov-component-insert-design-twice-reused/recipe.json new file mode 100644 index 000000000..e9b5a590c --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-insert-design-twice-reused/recipe.json @@ -0,0 +1,22 @@ +{ + "commands": [ + { + "command": "component.insert_design", + "params": { + "path": "$CASE/plate.solidcraft" + } + }, + { + "command": "component.insert_design", + "params": { + "path": "$CASE/plate.solidcraft", + "reuse": true, + "translate": [ + 0, + 50, + 0 + ] + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-move-bodies-into-a-moved-part/expected.json b/tests/kernel-cases/assemblies/cov-component-move-bodies-into-a-moved-part/expected.json new file mode 100644 index 000000000..7c2abacf9 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-move-bodies-into-a-moved-part/expected.json @@ -0,0 +1,23 @@ +{ + "sources": [], + "what": "a root body moved into a component placed 100 mm along x", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Holder (empty) moved by (100,0,0), then a box 10x10x10 from (0,20,0) moved into it: the body keeps its world place, centre (5,25,5)", + "body_count": 3, + "volume_mm3": 9000.0, + "results": [ + { + "step": 12, + "json": { + "total": { + "center_of_mass": [ + 5.0, + 25.0, + 5.0 + ], + "volume_mm3": 1000.0 + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-move-bodies-into-a-moved-part/recipe.json b/tests/kernel-cases/assemblies/cov-component-move-bodies-into-a-moved-part/recipe.json new file mode 100644 index 000000000..056a83357 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-move-bodies-into-a-moved-part/recipe.json @@ -0,0 +1,124 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "component.create", + "params": { + "name": "Holder", + "parent": "root", + "activate": false + } + }, + { + "command": "occurrence.move", + "params": { + "occurrence": "Holder:1", + "translate": [ + 100, + 0, + 0 + ] + } + }, + { + "command": "solid.box", + "params": { + "length": 10, + "width": 10, + "height": 10, + "corner": [ + 0, + 20, + 0 + ], + "operation": "new", + "body_name": "Cube" + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "Cube" + ], + "component": "Holder" + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Holder:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-move-bodies-into-two-parts/expected.json b/tests/kernel-cases/assemblies/cov-component-move-bodies-into-two-parts/expected.json new file mode 100644 index 000000000..480082801 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-move-bodies-into-two-parts/expected.json @@ -0,0 +1,72 @@ +{ + "sources": [], + "what": "two bodies moved from the root into a component each", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); moving bodies into components keeps them where they are: Arm (20,0,5), Base (0,0,-5), 4000 mm3 each", + "body_count": 2, + "volume_mm3": 8000.0, + "bbox": { + "min": [ + -10, + -10, + -10 + ], + "max": [ + 40, + 10, + 10 + ] + }, + "results": [ + { + "step": 8, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 0.0, + 5.0 + ], + "bbox": { + "min": [ + 0.0, + -5.0, + 0.0 + ], + "max": [ + 40.0, + 5.0, + 10.0 + ] + }, + "volume_mm3": 4000.0 + } + } + }, + { + "step": 9, + "json": { + "total": { + "center_of_mass": [ + 0.0, + 0.0, + -5.0 + ], + "bbox": { + "min": [ + -10.0, + -10.0, + -10.0 + ], + "max": [ + 10.0, + 10.0, + 0.0 + ] + }, + "volume_mm3": 4000.0 + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-move-bodies-into-two-parts/recipe.json b/tests/kernel-cases/assemblies/cov-component-move-bodies-into-two-parts/recipe.json new file mode 100644 index 000000000..b5a4469dc --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-move-bodies-into-two-parts/recipe.json @@ -0,0 +1,87 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Base:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-paste-new-in-place-of-a-turned-part/expected.json b/tests/kernel-cases/assemblies/cov-component-paste-new-in-place-of-a-turned-part/expected.json new file mode 100644 index 000000000..9884f2e31 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-paste-new-in-place-of-a-turned-part/expected.json @@ -0,0 +1,25 @@ +{ + "sources": [], + "what": "component.paste_new in place of an arm turned 90 degrees, 20 mm up", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); hinge at 90 puts Arm at (0,20,5), box x -5..5, y 0..40; in_place puts the copy where it is in the world, moved (0,0,20): centres (0,0,-5), (0,20,5), (0,20,25): mean (0,13.333,8.333)", + "body_count": 3, + "volume_mm3": 12000.0, + "center_of_mass": [ + 0, + 13.333333, + 8.333333 + ], + "bbox": { + "min": [ + -10, + -10, + -10 + ], + "max": [ + 10, + 40, + 30 + ] + } +} diff --git a/tests/kernel-cases/assemblies/cov-component-paste-new-in-place-of-a-turned-part/recipe.json b/tests/kernel-cases/assemblies/cov-component-paste-new-in-place-of-a-turned-part/recipe.json new file mode 100644 index 000000000..15917ebf2 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-paste-new-in-place-of-a-turned-part/recipe.json @@ -0,0 +1,131 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Hinge", + "quiet": true, + "value": 90 + } + }, + { + "command": "component.paste_new", + "params": { + "component": "Arm", + "occurrence": "Arm:1", + "in_place": true, + "translate": [ + 0, + 0, + 20 + ] + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-component-paste-new-independent-copy/expected.json b/tests/kernel-cases/assemblies/cov-component-paste-new-independent-copy/expected.json new file mode 100644 index 000000000..84578dd99 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-paste-new-independent-copy/expected.json @@ -0,0 +1,25 @@ +{ + "sources": [], + "what": "component.paste_new of the arm 30 mm along y", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); an independent copy of Arm moved by (0,30,0): centres (0,0,-5), (20,0,5), (20,30,5), 4000 each: total 12000, centre (13.333,10,1.667), box (-10,-10,-10)-(40,35,10)", + "body_count": 3, + "volume_mm3": 12000.0, + "center_of_mass": [ + 13.333333, + 10, + 1.666667 + ], + "bbox": { + "min": [ + -10, + -10, + -10 + ], + "max": [ + 40, + 35, + 10 + ] + } +} diff --git a/tests/kernel-cases/assemblies/cov-component-paste-new-independent-copy/recipe.json b/tests/kernel-cases/assemblies/cov-component-paste-new-independent-copy/recipe.json new file mode 100644 index 000000000..afcc9d682 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-component-paste-new-independent-copy/recipe.json @@ -0,0 +1,86 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "component.paste_new", + "params": { + "component": "Arm", + "translate": [ + 0, + 30, + 0 + ] + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-explode-create-automatic-scale-2/expected.json b/tests/kernel-cases/assemblies/cov-explode-create-automatic-scale-2/expected.json new file mode 100644 index 000000000..21464fb60 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-explode-create-automatic-scale-2/expected.json @@ -0,0 +1,43 @@ +{ + "sources": [], + "what": "an automatic exploded view of scale 2", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); each occurrence moves scale \u00d7 (its centre - the mean of the centres): centres (0,0,-5) and (20,0,5), mean (10,0,0): Base by (-20,0,-10), Arm by (20,0,10); shown, Arm at (40,0,15)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 8, + "json": { + "moves": [ + { + "translate": [ + -20.0, + 0.0, + -10.0 + ] + }, + { + "translate": [ + 20.0, + 0.0, + 10.0 + ] + } + ] + } + }, + { + "step": 10, + "json": { + "total": { + "center_of_mass": [ + 40.0, + 0.0, + 15.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-explode-create-automatic-scale-2/recipe.json b/tests/kernel-cases/assemblies/cov-explode-create-automatic-scale-2/recipe.json new file mode 100644 index 000000000..557244826 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-explode-create-automatic-scale-2/recipe.json @@ -0,0 +1,94 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "explode.create", + "params": { + "name": "Apart", + "scale": 2 + } + }, + { + "command": "explode.show", + "params": { + "view": "Apart" + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-explode-create-explicit-move/expected.json b/tests/kernel-cases/assemblies/cov-explode-create-explicit-move/expected.json new file mode 100644 index 000000000..63cb1244d --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-explode-create-explicit-move/expected.json @@ -0,0 +1,36 @@ +{ + "sources": [], + "what": "an exploded view moving the arm 30 mm up, shown", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); explode.show places Arm by (0,0,30): centre (20,0,35)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 8, + "json": { + "moves": [ + { + "translate": [ + 0.0, + 0.0, + 30.0 + ] + } + ] + } + }, + { + "step": 10, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 0.0, + 35.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-explode-create-explicit-move/recipe.json b/tests/kernel-cases/assemblies/cov-explode-create-explicit-move/recipe.json new file mode 100644 index 000000000..714c2d324 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-explode-create-explicit-move/recipe.json @@ -0,0 +1,103 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "explode.create", + "params": { + "name": "Up", + "moves": [ + { + "occurrence": "Arm:1", + "translate": [ + 0, + 0, + 30 + ] + } + ] + } + }, + { + "command": "explode.show", + "params": { + "view": "Up" + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-occurrence-copy-in-place-of-a-turned-part/expected.json b/tests/kernel-cases/assemblies/cov-occurrence-copy-in-place-of-a-turned-part/expected.json new file mode 100644 index 000000000..90d25eb5f --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-occurrence-copy-in-place-of-a-turned-part/expected.json @@ -0,0 +1,39 @@ +{ + "sources": [], + "what": "occurrence.copy in place of an arm turned 90 degrees, 20 mm up", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); hinge at 90 puts Arm at (0,20,5); in_place copies where it is in the world, translate in world axes: Arm:2 at (0,20,25)", + "body_count": 3, + "volume_mm3": 12000.0, + "center_of_mass": [ + 0, + 13.333333, + 8.333333 + ], + "results": [ + { + "step": 11, + "json": { + "total": { + "center_of_mass": [ + 0.0, + 20.0, + 25.0 + ], + "bbox": { + "min": [ + -5.0, + 0.0, + 20.0 + ], + "max": [ + 5.0, + 40.0, + 30.0 + ] + } + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-occurrence-copy-in-place-of-a-turned-part/recipe.json b/tests/kernel-cases/assemblies/cov-occurrence-copy-in-place-of-a-turned-part/recipe.json new file mode 100644 index 000000000..1d9349c31 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-occurrence-copy-in-place-of-a-turned-part/recipe.json @@ -0,0 +1,136 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Hinge", + "quiet": true, + "value": 90 + } + }, + { + "command": "occurrence.copy", + "params": { + "occurrence": "Arm:1", + "in_place": true, + "translate": [ + 0, + 0, + 20 + ] + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:2" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-occurrence-copy-translate/expected.json b/tests/kernel-cases/assemblies/cov-occurrence-copy-translate/expected.json new file mode 100644 index 000000000..de5c9baf8 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-occurrence-copy-translate/expected.json @@ -0,0 +1,40 @@ +{ + "sources": [], + "what": "occurrence.copy of the arm 20 mm up", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); a second placement of Arm moved by (0,0,20): Arm:2 at (20,0,25); totals 12000, centre (13.333,0,8.333)", + "body_count": 3, + "volume_mm3": 12000.0, + "center_of_mass": [ + 13.333333, + 0, + 8.333333 + ], + "results": [ + { + "step": 9, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 0.0, + 25.0 + ], + "bbox": { + "min": [ + 0.0, + -5.0, + 20.0 + ], + "max": [ + 40.0, + 5.0, + 30.0 + ] + }, + "volume_mm3": 4000.0 + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-occurrence-copy-translate/recipe.json b/tests/kernel-cases/assemblies/cov-occurrence-copy-translate/recipe.json new file mode 100644 index 000000000..3af2cdcaf --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-occurrence-copy-translate/recipe.json @@ -0,0 +1,92 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "occurrence.copy", + "params": { + "component": "Arm", + "translate": [ + 0, + 0, + 20 + ] + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:2" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-occurrence-drag-grounded-refused/expected.json b/tests/kernel-cases/assemblies/cov-occurrence-drag-grounded-refused/expected.json new file mode 100644 index 000000000..8571d1b20 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-occurrence-drag-grounded-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "occurrence.drag of the grounded base", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); a grounded part is refused", + "outcome": "refused", + "refusal": "grounded" +} diff --git a/tests/kernel-cases/assemblies/cov-occurrence-drag-grounded-refused/recipe.json b/tests/kernel-cases/assemblies/cov-occurrence-drag-grounded-refused/recipe.json new file mode 100644 index 000000000..ba8da70c5 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-occurrence-drag-grounded-refused/recipe.json @@ -0,0 +1,91 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "occurrence.drag", + "params": { + "occurrence": "Base:1", + "at": [ + 0, + 0, + -5 + ], + "point": [ + 0, + 10, + -5 + ] + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-occurrence-drag-moves-by-the-difference/expected.json b/tests/kernel-cases/assemblies/cov-occurrence-drag-moves-by-the-difference/expected.json new file mode 100644 index 000000000..010b34404 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-occurrence-drag-moves-by-the-difference/expected.json @@ -0,0 +1,34 @@ +{ + "sources": [], + "what": "occurrence.drag of the free arm from (20,0,5) to (20,10,5)", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Arm moves by point - at = (0,10,0): centre (20,10,5), box (0,5,0)-(40,15,10)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 9, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 10.0, + 5.0 + ], + "bbox": { + "min": [ + 0.0, + 5.0, + 0.0 + ], + "max": [ + 40.0, + 15.0, + 10.0 + ] + } + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-occurrence-drag-moves-by-the-difference/recipe.json b/tests/kernel-cases/assemblies/cov-occurrence-drag-moves-by-the-difference/recipe.json new file mode 100644 index 000000000..80141b23d --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-occurrence-drag-moves-by-the-difference/recipe.json @@ -0,0 +1,97 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "occurrence.drag", + "params": { + "occurrence": "Arm:1", + "at": [ + 20, + 0, + 5 + ], + "point": [ + 20, + 10, + 5 + ] + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-occurrence-reparent-keeps-the-world-place/expected.json b/tests/kernel-cases/assemblies/cov-occurrence-reparent-keeps-the-world-place/expected.json new file mode 100644 index 000000000..e2431cad0 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-occurrence-reparent-keeps-the-world-place/expected.json @@ -0,0 +1,34 @@ +{ + "sources": [], + "what": "the arm reparented under a component placed 100 mm along x", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Holder moved by (100,0,0); reparenting keeps Arm's world place: (20,0,5); and back to the root, still (20,0,5)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 11, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 0.0, + 5.0 + ] + } + } + }, + { + "step": 13, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 0.0, + 5.0 + ] + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-occurrence-reparent-keeps-the-world-place/recipe.json b/tests/kernel-cases/assemblies/cov-occurrence-reparent-keeps-the-world-place/recipe.json new file mode 100644 index 000000000..d64612f0c --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-occurrence-reparent-keeps-the-world-place/recipe.json @@ -0,0 +1,120 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "component.create", + "params": { + "name": "Holder", + "parent": "root", + "activate": false + } + }, + { + "command": "occurrence.move", + "params": { + "occurrence": "Holder:1", + "translate": [ + 100, + 0, + 0 + ] + } + }, + { + "command": "occurrence.reparent", + "params": { + "occurrence": "Arm:1", + "parent": "Holder" + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + }, + { + "command": "occurrence.reparent", + "params": { + "occurrence": "Arm:1", + "parent": "root" + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-occurrence-reparent-under-a-turned-part/expected.json b/tests/kernel-cases/assemblies/cov-occurrence-reparent-under-a-turned-part/expected.json new file mode 100644 index 000000000..e8c46f1d6 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-occurrence-reparent-under-a-turned-part/expected.json @@ -0,0 +1,34 @@ +{ + "sources": [], + "what": "the arm reparented under a component turned 90 degrees about z", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Holder turned 90 about z through (100,0,0); reparenting keeps Arm's world place: centre (20,0,5), box (0,-5,0)-(40,5,10)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 11, + "json": { + "total": { + "center_of_mass": [ + 20.0, + 0.0, + 5.0 + ], + "bbox": { + "min": [ + 0.0, + -5.0, + 0.0 + ], + "max": [ + 40.0, + 5.0, + 10.0 + ] + } + } + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-occurrence-reparent-under-a-turned-part/recipe.json b/tests/kernel-cases/assemblies/cov-occurrence-reparent-under-a-turned-part/recipe.json new file mode 100644 index 000000000..d612d9e6a --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-occurrence-reparent-under-a-turned-part/recipe.json @@ -0,0 +1,113 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "component.create", + "params": { + "name": "Holder", + "parent": "root", + "activate": false + } + }, + { + "command": "occurrence.move", + "params": { + "occurrence": "Holder:1", + "axis": [ + 0, + 0, + 1 + ], + "angle": "90 deg", + "origin": [ + 100, + 0, + 0 + ] + } + }, + { + "command": "occurrence.reparent", + "params": { + "occurrence": "Arm:1", + "parent": "Holder" + } + }, + { + "command": "occurrence.properties", + "params": { + "occurrence": "Arm:1" + } + } + ] +} From 9fecf7709e86557d03ead6b55619d987013cf298 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:20:41 -0400 Subject: [PATCH 090/108] Kernel rig: interference and clearance between placed occurrences Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 21 +++ .../recipe.json | 92 ++++++++++ .../expected.json | 21 +++ .../recipe.json | 169 ++++++++++++++++++ .../expected.json | 39 ++++ .../recipe.json | 90 ++++++++++ .../expected.json | 17 ++ .../recipe.json | 79 ++++++++ 8 files changed, 528 insertions(+) create mode 100644 tests/kernel-cases/assemblies/cov-inspect-clearance-between-occurrences/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-inspect-clearance-between-occurrences/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-inspect-clearance-turned-occurrence/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-inspect-clearance-turned-occurrence/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-inspect-interference-between-occurrences/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-inspect-interference-between-occurrences/recipe.json create mode 100644 tests/kernel-cases/assemblies/cov-inspect-interference-touching-occurrences/expected.json create mode 100644 tests/kernel-cases/assemblies/cov-inspect-interference-touching-occurrences/recipe.json diff --git a/tests/kernel-cases/assemblies/cov-inspect-clearance-between-occurrences/expected.json b/tests/kernel-cases/assemblies/cov-inspect-clearance-between-occurrences/expected.json new file mode 100644 index 000000000..d196bfa6c --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-inspect-clearance-between-occurrences/expected.json @@ -0,0 +1,21 @@ +{ + "sources": [], + "what": "inspect.clearance of the arm lifted 5 mm off the base", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Arm moved by (0,0,5): its bottom (z 5) is 5 mm above Base's top (z 0) over x 0..10: distance 5", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 9, + "json": { + "overlaps": [], + "near": [ + { + "distance_mm": 5.0 + } + ] + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-inspect-clearance-between-occurrences/recipe.json b/tests/kernel-cases/assemblies/cov-inspect-clearance-between-occurrences/recipe.json new file mode 100644 index 000000000..f3045bb69 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-inspect-clearance-between-occurrences/recipe.json @@ -0,0 +1,92 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "occurrence.move", + "params": { + "occurrence": "Arm:1", + "translate": [ + 0, + 0, + 5 + ] + } + }, + { + "command": "inspect.clearance", + "params": { + "clearance": 10 + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-inspect-clearance-turned-occurrence/expected.json b/tests/kernel-cases/assemblies/cov-inspect-clearance-turned-occurrence/expected.json new file mode 100644 index 000000000..07c6dbb0b --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-inspect-clearance-turned-occurrence/expected.json @@ -0,0 +1,21 @@ +{ + "sources": [], + "what": "inspect.clearance between the arm turned 90 degrees and a grounded block", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); a block 10x10x10 from (20,0,0); hinge at 90 puts Arm at x -5..5, y 0..40: the gap to the block's face x = 20 is 15", + "body_count": 3, + "volume_mm3": 9000.0, + "results": [ + { + "step": 14, + "json": { + "overlaps": [], + "near": [ + { + "distance_mm": 15.0 + } + ] + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-inspect-clearance-turned-occurrence/recipe.json b/tests/kernel-cases/assemblies/cov-inspect-clearance-turned-occurrence/recipe.json new file mode 100644 index 000000000..78c6abd40 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-inspect-clearance-turned-occurrence/recipe.json @@ -0,0 +1,169 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "solid.box", + "params": { + "length": 10, + "width": 10, + "height": 10, + "corner": [ + 20, + 0, + 0 + ], + "operation": "new", + "body_name": "PostBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Post", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "PostBox" + ], + "component": "Post" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Post:1", + "grounded": true + } + }, + { + "command": "joint.create", + "params": { + "type": "revolute", + "name": "Hinge", + "flip": true, + "a": { + "occurrence": "Base", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "b": { + "occurrence": "Arm", + "point": [ + 0, + 0, + 0 + ], + "z": [ + 0, + 0, + 1 + ] + }, + "quiet": true + } + }, + { + "command": "joint.drive", + "params": { + "joint": "Hinge", + "quiet": true, + "value": 90 + } + }, + { + "command": "inspect.clearance", + "params": { + "bodies": [ + "ArmBox" + ], + "against": [ + "PostBox" + ], + "clearance": 20 + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-inspect-interference-between-occurrences/expected.json b/tests/kernel-cases/assemblies/cov-inspect-interference-between-occurrences/expected.json new file mode 100644 index 000000000..9b67417b3 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-inspect-interference-between-occurrences/expected.json @@ -0,0 +1,39 @@ +{ + "sources": [], + "what": "inspect.interference of the arm sunk 5 mm into the base", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); Arm moved by (0,0,-5): it shares x 0..10, y -5..5, z -5..0 with Base: 500 mm3, area 2(100+50+50) = 400, centre (5,0,-2.5)", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 9, + "json": { + "count": 1, + "interferences": [ + { + "volume_mm3": 500.0, + "area_mm2": 400.0, + "center": [ + 5.0, + 0.0, + -2.5 + ], + "bbox": { + "min": [ + 0.0, + -5.0, + -5.0 + ], + "max": [ + 10.0, + 5.0, + 0.0 + ] + } + } + ] + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-inspect-interference-between-occurrences/recipe.json b/tests/kernel-cases/assemblies/cov-inspect-interference-between-occurrences/recipe.json new file mode 100644 index 000000000..489b8e3f4 --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-inspect-interference-between-occurrences/recipe.json @@ -0,0 +1,90 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "occurrence.move", + "params": { + "occurrence": "Arm:1", + "translate": [ + 0, + 0, + -5 + ] + } + }, + { + "command": "inspect.interference", + "params": {} + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-inspect-interference-touching-occurrences/expected.json b/tests/kernel-cases/assemblies/cov-inspect-interference-touching-occurrences/expected.json new file mode 100644 index 000000000..3b095dc1a --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-inspect-interference-touching-occurrences/expected.json @@ -0,0 +1,17 @@ +{ + "sources": [], + "what": "inspect.interference of the arm standing on the base face to face", + "source": "analytic", + "method": "Base: box 20x20x10 from (-10,-10,-10), grounded; Arm: box 40x10x10 from (0,-5,0), centre (20,0,5); they meet on a face only: no overlap volume", + "body_count": 2, + "volume_mm3": 8000.0, + "results": [ + { + "step": 8, + "json": { + "count": 0, + "interferences": [] + } + } + ] +} diff --git a/tests/kernel-cases/assemblies/cov-inspect-interference-touching-occurrences/recipe.json b/tests/kernel-cases/assemblies/cov-inspect-interference-touching-occurrences/recipe.json new file mode 100644 index 000000000..f98026bbc --- /dev/null +++ b/tests/kernel-cases/assemblies/cov-inspect-interference-touching-occurrences/recipe.json @@ -0,0 +1,79 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 10, + "corner": [ + -10, + -10, + -10 + ], + "operation": "new", + "body_name": "BaseBox" + } + }, + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 10, + "corner": [ + 0, + -5, + 0 + ], + "operation": "new", + "body_name": "ArmBox" + } + }, + { + "command": "component.create", + "params": { + "name": "Base", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "BaseBox" + ], + "component": "Base" + } + }, + { + "command": "component.create", + "params": { + "name": "Arm", + "parent": "root", + "activate": false + } + }, + { + "command": "component.move_bodies", + "params": { + "bodies": [ + "ArmBox" + ], + "component": "Arm" + } + }, + { + "command": "occurrence.ground", + "params": { + "occurrence": "Base:1", + "grounded": true + } + }, + { + "command": "inspect.interference", + "params": {} + } + ] +} From 22cd8e74f63850b8052f9e5909fc77b35902c583 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:39:59 -0400 Subject: [PATCH 091/108] Ladder generator: cases.py writes the values committed by hand for 05/007, 06/017, 07/016 and 11/003 The tap maker's 6.8 mm M8 drill, the chamfered tip's ISO 724 d3 with tip: both, and 07/016's refusal reason were edited into the cases' JSON but not into cases.py, so running it undid them. Its output now matches the committed cases (to the last rounding digit of two volumes). Co-Authored-By: Claude Opus 5.5 --- tools/kernel-ladder/cases.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/tools/kernel-ladder/cases.py b/tools/kernel-ladder/cases.py index 562a4e09a..65d513e7b 100644 --- a/tools/kernel-ladder/cases.py +++ b/tools/kernel-ladder/cases.py @@ -530,11 +530,11 @@ case(T5, "005-countersink", "a countersunk hole: d6.6 through, d12 x 90 deg coun case(T5, "006-tapped-m6-through", "an M6 tapped hole through: the tap drill d5 (major - pitch), cosmetic thread", [H(position=top, thread="M6")], {"body_count": 1, "volume_mm3": VB - PI * 6.25 * 20, "faces": 7}, "M6 coarse pitch 1: tap drill 6 - 1 = 5; removed pi 2.5^2 20; the cosmetic thread adds no geometry", base=B1) -ch8 = 3.375 / math.tan(math.radians(59)) +ch8 = 3.4 / math.tan(math.radians(59)) case(T5, "007-tapped-m8-blind", "an M8 tapped blind hole 12 deep with a 118 deg drill point", [H(position=top, thread="M8", depth=12, type="drilled", tip_angle=118)], - {"body_count": 1, "volume_mm3": VB - PI * 3.375 ** 2 * 12 - PI * 3.375 ** 2 * ch8 / 3, "faces": 8}, - "M8 coarse pitch 1.25: tap drill (major - pitch) 6.75; removed pi r^2 12 to the shoulder + the point cone pi r^2 (r/tan59)/3", base=B1) + {"body_count": 1, "volume_mm3": VB - PI * 3.4 ** 2 * 12 - PI * 3.4 ** 2 * ch8 / 3, "faces": 8}, + "M8 coarse pitch 1.25: the tap maker's drill 6.8 (Yamawa YEU23 p.704); removed pi r^2 12 to the shoulder + the point cone pi r^2 (r/tan59)/3", base=B1) r, Rc = 2.1, 20 vint = quad(lambda y: 2 * math.sqrt(max(r * r - y * y, 0)) * 2 * math.sqrt(Rc * Rc - y * y), -r, r, 128) case(T5, "008-tapped-m5-into-curved-face", "an M5 tapped hole drilled radially through a cylinder r20 lying along X", @@ -568,7 +568,6 @@ case(T5, "013-part-holes", "the running part: an M6 tapped through hole, an M5 t {"body_count": 1, "volume_mm3": V5, "faces": 20}, "removed pi 2.5^2 20 (M6, tap drill 5) + pi 2.1^2 8 (M5, tap drill 4.2, flat) + pi 1.65^2 35; faces +1 +2 +1", base=C4) C5 = up(T5, "013-part-holes") - # ---------------------------------------------------------------- 06 threads def thr(face, **p): return C("solid.thread", face=face, modeled=True, **p) @@ -759,14 +758,14 @@ case(T6, "019-external-tr40x14-p7-two-start", "a modelled two-start trapezoidal "groove of pitch 7 would: over 42 mm (three leads, six pitches) between free ends") + "ISO 2904 for P 7: 30 deg, H1 = P/2, crest flat 0.366 P, " "ac = 0.5 (P 6..12), external minor d3 = d - 2 (H1 + ac) = 32") -rf10 = 5 - 5 * math.sqrt(3) / 2 * 1.5 / 8 -case(T6, "017-external-m10-chamfered-tip", "001's modelled M10 thread with ISO 4753's chamfered end at both free ends: a 45 deg cone down to the minor diameter, cut after the groove", - cylT + [thr([5, 0, 15], designation="M10", tip="chamfer")], +rf10 = 5 - 17 / 24 * math.sqrt(3) / 2 * 1.5 # ISO 724: d3 = d - 2 (17/24) H +case(T6, "017-external-m10-chamfered-tip", "001's modelled M10 thread with ISO 4753's chamfered end at both free ends: a 45 deg cone down to the external minor diameter d3, cut after the groove", + cylT + [thr([5, 0, 15], designation="M10", tip="both")], {"body_count": 1, "volume_mm3": ext_volume(10, 1.5, [(0, 5 - rf10, lambda z: rf10 + z), (5 - rf10, 25 + rf10, lambda z: 5), (25 + rf10, 30, lambda z: rf10 + 30 - z)]), "tolerance": {"rel": 1e-4}}, TMETH.replace("Tolerance 0.5%: solid.thread cuts faceted by design (chords within P/200 on the body, P/100 on the tool)", "Tolerance 0.01%: SMLib's exact screw sweep") + - "; the chamfer is axisymmetric and cut after the groove, so it only lowers the stock's outer radius: r <= d_f/2 + distance from the end (45 deg), d_f the minor diameter d - 5H/4 = 8.376 " - "(ISO 4753 chamfered end: the end's diameter at most the minor diameter)") + "; the chamfer is axisymmetric and cut after the groove, so it only lowers the stock's outer radius: r <= d_f/2 + distance from the end (45 deg), d_f the external minor diameter d3 = d - 1.226869 P = 8.160 " + "(ISO 724; ISO 4753 chamfered end: the end's diameter at most the minor diameter), below the modelled root d1") # ---------------------------------------------------------------- 07 fillets F = lambda edges, r, **p: C("solid.fillet", edges=edges, radius=r, **p) @@ -814,7 +813,7 @@ case(T7, "010-corner-unequal-r7-r3", "an r7 vertical round at a corner, then r3 "Faces: 6 planes + the r7 cylinder + the r3 chain's cylinder, torus, cylinder; edges: 5 round the bottom, 5 round the top, 5 vertical (two r7 tangent lines, the box's " "three other verticals), the chain's three on the walls and two end arcs, its two seams; vertices from Euler (V - E + F = 2): 14", base=B1) case(T7, "016-corner-three-sequential-r5-r3-r7", 'rounds r5 and r3 on the two top edges at a corner, then r7 on the vertical edge under them: refused, the r7 cannot exist', - [F([corner[0]], 5), F([corner[1]], 3, tangent_chain=False), F([[60, 40, 8]], 7)], {"outcome": "refused"}, + [F([corner[0]], 5), F([corner[1]], 3, tangent_chain=False), F([[60, 40, 8]], 7)], {"outcome": "refused", "refusal": "the fillet is larger than the faces beside its edges allow"}, "the r7 runs on (tangent chain) up the side x=60 along its arc on the r5 round, a circle of radius 5 about the r5 axis: the r7's contact line on that face would be the arc offset 7 towards its centre, radius 5 - 7 < 0, so the blend passes through itself; and along the seam of the r5 and r3 rounds no ball over r3 fits the r3 round. No such round exists, so the right answer is a clean refusal (SMLib: no room for the rolling ball). 018 is the same corner with a radius that fits.", base=B1, source="invariants") case(T7, "018-corner-three-sequential-r5-r3-r2", 'rounds r5 and r3 on the two top edges at a corner, then r2 on the vertical edge under them, run on up into the corner', [F([corner[0]], 5), F([corner[1]], 3, tangent_chain=False), F([[60, 40, 8]], 2)], {"body_count": 1, "faces": 11, "bbox": BBOX}, @@ -1119,12 +1118,12 @@ case(T11, "002-flange", "a revolved flange and hub with a bore, six bolt holes, w30 = ext_half_width(30, 3.5) case(T11, "003-threaded-flange", "the flange with a modelled M30 thread on its hub, between the round and the chamfer, and M8 tapped holes in the disk", [thr([15, 0, 20], designation="M30"), H(position=[0, 28, 10], thread="M8", name="Tap"), C("solid.pattern.circular", features=["Tap"], axis="Z", count=3)], - {"body_count": 1, "volume_mm3": Vf - groove(30, 3.5, [(13 + w30, 28.5, lambda z: 15), (28.5, 30, lambda z: 15 - (z - 28.5))]) - 3 * PI * 3.375 ** 2 * 10, + {"body_count": 1, "volume_mm3": Vf - groove(30, 3.5, [(13 + w30, 28.5, lambda z: 15), (28.5, 30, lambda z: 15 - (z - 28.5))]) - 3 * PI * 3.4 ** 2 * 10, "bbox": {"min": [-40, -40, 0], "max": [40, 40, 30]}, "tolerance": {"rel": 1e-4}}, "the hub's cylinder (r15) runs from the r3 round at its root (z 13) to the 1.5 chamfer at its top (z 28.5): the M30 groove (P 3.5) stops w = %.6f clear of the round, " "a shoulder (06/007's rule), and runs out through the chamfer, a free end (06/006's): it removes the stock less 2 pi int int r m(r) dr dz over z 13 + w..28.5 at r 15 and the chamfer " - "(r 15 - (z - 28.5)); the bore r8 is inside the root r 13.1. The M8 tap drills (6.75) go through the 10 mm disk at r 28, 90 deg + k 120, clear of the bolt holes (30 deg apart): " - "3 pi 3.375^2 10. Bbox: the flange's" % w30, base=up(T11, "002-flange")) + "(r 15 - (z - 28.5)); the bore r8 is inside the root r 13.1. The M8 tap drills (6.8, the tap maker's) go through the 10 mm disk at r 28, 90 deg + k 120, clear of the bolt holes (30 deg apart): " + "3 pi 3.4^2 10. Bbox: the flange's" % w30, base=up(T11, "002-flange")) case(T11, "004-housing", "the running part with every tier: back wall, boss, slot, spline window, tapped holes, rounds, chamfers, shell, vents, and a modelled M16 thread on the boss", [thr([23, 15, 25], designation="M16")], {"body_count": 1, "volume_mm3": V9 - 4 * PI * 1.5 ** 2 * 1.5 - groove(16, 2, [(21 + w16, 29, lambda z: 8), (29, 30, lambda z: 8 - (z - 29))]), From 4879144271767d41c28de6b3a01dabe385b66145 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:40:57 -0400 Subject: [PATCH 092/108] Ladder 05: UNC, UNF, Rc and NPT tapped holes, each drilled to its tap maker's drill 1/4-20 UNC (#7, 0.201 in) and Rc 1/2 (17.6) through the stock, 1/4-28 UNF (5.45) blind with a flat floor, 1/4-18 NPT (10.85) through: a cosmetic thread in a straight hole, so each volume is the stock less that cylinder. The drills are the catalogue's (Guhring, Yamawa YEU23); each method gives the standard's minor diameter beside it. Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 9 +++++++ .../014-tapped-1-4-20-unc-through/recipe.json | 16 +++++++++++++ .../015-tapped-1-4-28-unf-blind/expected.json | 9 +++++++ .../015-tapped-1-4-28-unf-blind/recipe.json | 17 +++++++++++++ .../016-tapped-rc-1-2-through/expected.json | 9 +++++++ .../016-tapped-rc-1-2-through/recipe.json | 16 +++++++++++++ .../017-tapped-1-4-npt-through/expected.json | 9 +++++++ .../017-tapped-1-4-npt-through/recipe.json | 16 +++++++++++++ tests/kernel-cases/ladder/ladder.json | 6 ++++- tools/kernel-ladder/cases.py | 24 +++++++++++++++++++ 10 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 tests/kernel-cases/ladder/05-holes-and-taps/014-tapped-1-4-20-unc-through/expected.json create mode 100644 tests/kernel-cases/ladder/05-holes-and-taps/014-tapped-1-4-20-unc-through/recipe.json create mode 100644 tests/kernel-cases/ladder/05-holes-and-taps/015-tapped-1-4-28-unf-blind/expected.json create mode 100644 tests/kernel-cases/ladder/05-holes-and-taps/015-tapped-1-4-28-unf-blind/recipe.json create mode 100644 tests/kernel-cases/ladder/05-holes-and-taps/016-tapped-rc-1-2-through/expected.json create mode 100644 tests/kernel-cases/ladder/05-holes-and-taps/016-tapped-rc-1-2-through/recipe.json create mode 100644 tests/kernel-cases/ladder/05-holes-and-taps/017-tapped-1-4-npt-through/expected.json create mode 100644 tests/kernel-cases/ladder/05-holes-and-taps/017-tapped-1-4-npt-through/recipe.json diff --git a/tests/kernel-cases/ladder/05-holes-and-taps/014-tapped-1-4-20-unc-through/expected.json b/tests/kernel-cases/ladder/05-holes-and-taps/014-tapped-1-4-20-unc-through/expected.json new file mode 100644 index 000000000..b8dac12c5 --- /dev/null +++ b/tests/kernel-cases/ladder/05-holes-and-taps/014-tapped-1-4-20-unc-through/expected.json @@ -0,0 +1,9 @@ +{ + "sources": [], + "what": "a 1/4-20 UNC tapped hole through the stock: drilled #7 (0.201 in), cosmetic thread", + "source": "analytic", + "method": "ASME B1.1 1/4-20 UNC: D = 0.25 in, P = 1/20 in, basic minor D1 = D - 1.082532 P = 0.1959 in; the tap drill is #7, 0.201 in = 5.1054 mm (the cutting-tap drill for about 75% thread, Guhring's table in thread_catalog.rs); removed pi 2.5527^2 20; the cosmetic thread adds no geometry: + one cylinder face", + "body_count": 1, + "volume_mm3": 47590.57022274, + "faces": 7 +} diff --git a/tests/kernel-cases/ladder/05-holes-and-taps/014-tapped-1-4-20-unc-through/recipe.json b/tests/kernel-cases/ladder/05-holes-and-taps/014-tapped-1-4-20-unc-through/recipe.json new file mode 100644 index 000000000..de94c5af2 --- /dev/null +++ b/tests/kernel-cases/ladder/05-holes-and-taps/014-tapped-1-4-20-unc-through/recipe.json @@ -0,0 +1,16 @@ +{ + "base": "../../01-primitives/001-box", + "commands": [ + { + "command": "solid.hole", + "params": { + "position": [ + 30, + 20, + 20 + ], + "thread": "1/4-20 UNC" + } + } + ] +} diff --git a/tests/kernel-cases/ladder/05-holes-and-taps/015-tapped-1-4-28-unf-blind/expected.json b/tests/kernel-cases/ladder/05-holes-and-taps/015-tapped-1-4-28-unf-blind/expected.json new file mode 100644 index 000000000..ab031d28d --- /dev/null +++ b/tests/kernel-cases/ladder/05-holes-and-taps/015-tapped-1-4-28-unf-blind/expected.json @@ -0,0 +1,9 @@ +{ + "sources": [], + "what": "a 1/4-28 UNF tapped blind hole 10 deep, flat bottom: drilled 5.45 mm, cosmetic thread", + "source": "analytic", + "method": "ASME B1.1 1/4-28 UNF: D = 0.25 in, P = 1/28 in, basic minor D1 = D - 1.082532 P = 5.368 mm; the tap maker's drill 5.45 mm (Guhring, thread_catalog.rs), above D1 as a drill must be; removed pi 2.725^2 10; + wall and floor", + "body_count": 1, + "volume_mm3": 47766.717110517, + "faces": 8 +} diff --git a/tests/kernel-cases/ladder/05-holes-and-taps/015-tapped-1-4-28-unf-blind/recipe.json b/tests/kernel-cases/ladder/05-holes-and-taps/015-tapped-1-4-28-unf-blind/recipe.json new file mode 100644 index 000000000..cdc832628 --- /dev/null +++ b/tests/kernel-cases/ladder/05-holes-and-taps/015-tapped-1-4-28-unf-blind/recipe.json @@ -0,0 +1,17 @@ +{ + "base": "../../01-primitives/001-box", + "commands": [ + { + "command": "solid.hole", + "params": { + "position": [ + 30, + 20, + 20 + ], + "thread": "1/4-28 UNF", + "depth": 10 + } + } + ] +} diff --git a/tests/kernel-cases/ladder/05-holes-and-taps/016-tapped-rc-1-2-through/expected.json b/tests/kernel-cases/ladder/05-holes-and-taps/016-tapped-rc-1-2-through/expected.json new file mode 100644 index 000000000..76c02b129 --- /dev/null +++ b/tests/kernel-cases/ladder/05-holes-and-taps/016-tapped-rc-1-2-through/expected.json @@ -0,0 +1,9 @@ +{ + "sources": [], + "what": "an Rc 1/2 tapped hole through the stock (ISO 7-1 internal taper): a straight hole at the tap maker's 17.6 mm, cosmetic thread", + "source": "analytic", + "method": "ISO 7-1 Rc 1/2: gauge diameter d = 20.955 at the face, 14 threads per inch, h = 0.640327 P, minor d1 = d - 2h = 18.631 there and 1/16 smaller per mm deeper (18.631 - 13.2/16 = 17.806 at the end of the 13.2 mm useful thread); a straight (not reamed) hole takes the tap maker's 17.6 (Yamawa YEU23 p.709, the largest for non-full threads): removed pi 8.8^2 20; + one cylinder face", + "body_count": 1, + "volume_mm3": 43134.30129812, + "faces": 7 +} diff --git a/tests/kernel-cases/ladder/05-holes-and-taps/016-tapped-rc-1-2-through/recipe.json b/tests/kernel-cases/ladder/05-holes-and-taps/016-tapped-rc-1-2-through/recipe.json new file mode 100644 index 000000000..886ccd640 --- /dev/null +++ b/tests/kernel-cases/ladder/05-holes-and-taps/016-tapped-rc-1-2-through/recipe.json @@ -0,0 +1,16 @@ +{ + "base": "../../01-primitives/001-box", + "commands": [ + { + "command": "solid.hole", + "params": { + "position": [ + 30, + 20, + 20 + ], + "thread": "Rc 1/2" + } + } + ] +} diff --git a/tests/kernel-cases/ladder/05-holes-and-taps/017-tapped-1-4-npt-through/expected.json b/tests/kernel-cases/ladder/05-holes-and-taps/017-tapped-1-4-npt-through/expected.json new file mode 100644 index 000000000..0a2b2a99e --- /dev/null +++ b/tests/kernel-cases/ladder/05-holes-and-taps/017-tapped-1-4-npt-through/expected.json @@ -0,0 +1,9 @@ +{ + "sources": [], + "what": "a 1/4-18 NPT tapped hole through the stock (ASME B1.20.1): a straight hole at the tap maker's 10.85 mm, cosmetic thread", + "source": "analytic", + "method": "ASME B1.20.1 1/4-18 NPT: E0 = 0.47739 in, L1 = 0.2278 in, h = 0.8 P; at the face the minor E1 - h = 0.48163 - 0.04444 in = 11.105 mm, 1/16 smaller per mm deeper; a straight hole takes the tap maker's 10.85 (Yamawa YEU23 p.710): removed pi 5.425^2 20; + one cylinder face", + "body_count": 1, + "volume_mm3": 46150.819294189, + "faces": 7 +} diff --git a/tests/kernel-cases/ladder/05-holes-and-taps/017-tapped-1-4-npt-through/recipe.json b/tests/kernel-cases/ladder/05-holes-and-taps/017-tapped-1-4-npt-through/recipe.json new file mode 100644 index 000000000..0ea44228c --- /dev/null +++ b/tests/kernel-cases/ladder/05-holes-and-taps/017-tapped-1-4-npt-through/recipe.json @@ -0,0 +1,16 @@ +{ + "base": "../../01-primitives/001-box", + "commands": [ + { + "command": "solid.hole", + "params": { + "position": [ + 30, + 20, + 20 + ], + "thread": "1/4-18 NPT" + } + } + ] +} diff --git a/tests/kernel-cases/ladder/ladder.json b/tests/kernel-cases/ladder/ladder.json index 77c68a5c1..3bc77da54 100644 --- a/tests/kernel-cases/ladder/ladder.json +++ b/tests/kernel-cases/ladder/ladder.json @@ -91,7 +91,11 @@ "ladder/05-holes-and-taps/011-crossing-holes-steinmetz", "ladder/05-holes-and-taps/012-crossing-tapped-holes-offset", "ladder/05-holes-and-taps/008-tapped-m5-into-curved-face", - "ladder/05-holes-and-taps/013-part-holes" + "ladder/05-holes-and-taps/013-part-holes", + "ladder/05-holes-and-taps/014-tapped-1-4-20-unc-through", + "ladder/05-holes-and-taps/015-tapped-1-4-28-unf-blind", + "ladder/05-holes-and-taps/016-tapped-rc-1-2-through", + "ladder/05-holes-and-taps/017-tapped-1-4-npt-through" ], "tier": "05-holes-and-taps", "what": "holes and tapped holes" diff --git a/tools/kernel-ladder/cases.py b/tools/kernel-ladder/cases.py index 65d513e7b..03ad3d2da 100644 --- a/tools/kernel-ladder/cases.py +++ b/tools/kernel-ladder/cases.py @@ -568,6 +568,30 @@ case(T5, "013-part-holes", "the running part: an M6 tapped through hole, an M5 t {"body_count": 1, "volume_mm3": V5, "faces": 20}, "removed pi 2.5^2 20 (M6, tap drill 5) + pi 2.1^2 8 (M5, tap drill 4.2, flat) + pi 1.65^2 35; faces +1 +2 +1", base=C4) C5 = up(T5, "013-part-holes") +# Tapped holes of the other catalogued families: cosmetic threads in a hole drilled to the tap +# maker's drill (crates/doc/src/thread_catalog.rs), so a drilled cylinder is all the geometry. +case(T5, "014-tapped-1-4-20-unc-through", "a 1/4-20 UNC tapped hole through the stock: drilled #7 (0.201 in), cosmetic thread", + [H(position=top, thread="1/4-20 UNC")], + {"body_count": 1, "volume_mm3": VB - PI * (0.201 * 25.4 / 2) ** 2 * 20, "faces": 7}, + "ASME B1.1 1/4-20 UNC: D = 0.25 in, P = 1/20 in, basic minor D1 = D - 1.082532 P = 0.1959 in; the tap drill is #7, 0.201 in = 5.1054 mm " + "(the cutting-tap drill for about 75% thread, Guhring's table in thread_catalog.rs); removed pi 2.5527^2 20; the cosmetic thread adds no geometry: + one cylinder face", base=B1) +case(T5, "015-tapped-1-4-28-unf-blind", "a 1/4-28 UNF tapped blind hole 10 deep, flat bottom: drilled 5.45 mm, cosmetic thread", + [H(position=top, thread="1/4-28 UNF", depth=10)], + {"body_count": 1, "volume_mm3": VB - PI * 2.725 ** 2 * 10, "faces": 8}, + "ASME B1.1 1/4-28 UNF: D = 0.25 in, P = 1/28 in, basic minor D1 = D - 1.082532 P = 5.368 mm; the tap maker's drill 5.45 mm (Guhring, thread_catalog.rs), " + "above D1 as a drill must be; removed pi 2.725^2 10; + wall and floor", base=B1) +case(T5, "016-tapped-rc-1-2-through", "an Rc 1/2 tapped hole through the stock (ISO 7-1 internal taper): a straight hole at the tap maker's 17.6 mm, cosmetic thread", + [H(position=top, thread="Rc 1/2")], + {"body_count": 1, "volume_mm3": VB - PI * 8.8 ** 2 * 20, "faces": 7}, + "ISO 7-1 Rc 1/2: gauge diameter d = 20.955 at the face, 14 threads per inch, h = 0.640327 P, minor d1 = d - 2h = 18.631 there and 1/16 smaller per mm deeper " + "(18.631 - 13.2/16 = 17.806 at the end of the 13.2 mm useful thread); a straight (not reamed) hole takes the tap maker's 17.6 (Yamawa YEU23 p.709, the largest for " + "non-full threads): removed pi 8.8^2 20; + one cylinder face", base=B1) +case(T5, "017-tapped-1-4-npt-through", "a 1/4-18 NPT tapped hole through the stock (ASME B1.20.1): a straight hole at the tap maker's 10.85 mm, cosmetic thread", + [H(position=top, thread="1/4-18 NPT")], + {"body_count": 1, "volume_mm3": VB - PI * 5.425 ** 2 * 20, "faces": 7}, + "ASME B1.20.1 1/4-18 NPT: E0 = 0.47739 in, L1 = 0.2278 in, h = 0.8 P; at the face the minor E1 - h = 0.48163 - 0.04444 in = 11.105 mm, 1/16 smaller per mm deeper; " + "a straight hole takes the tap maker's 10.85 (Yamawa YEU23 p.710): removed pi 5.425^2 20; + one cylinder face", base=B1) + # ---------------------------------------------------------------- 06 threads def thr(face, **p): return C("solid.thread", face=face, modeled=True, **p) From 1ad96604524d942731e92dd906e3008641cc9b5c Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:41:27 -0400 Subject: [PATCH 093/108] Ladder 06: pipe threads, the buttress's steep flank, the tip options and the square refusal G 1/2 external and Rp 1/2 internal (ISO 228-1 / ISO 7-1, 55 deg) by Pappus turn by turn; R 1/2 and 1/2-14 NPT external and Rc 1/2 internal tapers (1 in 16 from the standard's diameter at the free end, crests cut by the major or minor cone) by the screw sweep's Jacobian, integrated exactly (ladder_lib.sweep_removed); an S20x4 run down to a shoulder with its steep flank toward the end and toward the start, which moves where the groove stops; tip: start, and a Tr20x4 chamfered at its own 30 deg and 2.5 mm; refusals for a Tr chamfer without a depth and for the square form. Co-Authored-By: Claude Opus 5.5 --- .../020-external-g-1-2/expected.json | 11 ++ .../06-threads/020-external-g-1-2/recipe.json | 30 +++++ .../021-internal-rp-1-2/expected.json | 11 ++ .../021-internal-rp-1-2/recipe.json | 53 ++++++++ .../022-external-r-1-2-taper/expected.json | 23 ++++ .../022-external-r-1-2-taper/recipe.json | 34 +++++ .../023-external-1-2-npt/expected.json | 23 ++++ .../023-external-1-2-npt/recipe.json | 34 +++++ .../024-internal-rc-1-2-taper/expected.json | 23 ++++ .../024-internal-rc-1-2-taper/recipe.json | 58 ++++++++ .../expected.json | 23 ++++ .../recipe.json | 46 +++++++ .../expected.json | 23 ++++ .../recipe.json | 46 +++++++ .../expected.json | 11 ++ .../recipe.json | 35 +++++ .../expected.json | 11 ++ .../recipe.json | 32 +++++ .../expected.json | 8 ++ .../recipe.json | 30 +++++ .../030-square-thread-refused/expected.json | 8 ++ .../030-square-thread-refused/recipe.json | 29 ++++ tests/kernel-cases/ladder/ladder.json | 13 +- tools/kernel-ladder/cases.py | 127 ++++++++++++++++++ tools/kernel-ladder/ladder_lib.py | 59 ++++++++ 25 files changed, 800 insertions(+), 1 deletion(-) create mode 100644 tests/kernel-cases/ladder/06-threads/020-external-g-1-2/expected.json create mode 100644 tests/kernel-cases/ladder/06-threads/020-external-g-1-2/recipe.json create mode 100644 tests/kernel-cases/ladder/06-threads/021-internal-rp-1-2/expected.json create mode 100644 tests/kernel-cases/ladder/06-threads/021-internal-rp-1-2/recipe.json create mode 100644 tests/kernel-cases/ladder/06-threads/022-external-r-1-2-taper/expected.json create mode 100644 tests/kernel-cases/ladder/06-threads/022-external-r-1-2-taper/recipe.json create mode 100644 tests/kernel-cases/ladder/06-threads/023-external-1-2-npt/expected.json create mode 100644 tests/kernel-cases/ladder/06-threads/023-external-1-2-npt/recipe.json create mode 100644 tests/kernel-cases/ladder/06-threads/024-internal-rc-1-2-taper/expected.json create mode 100644 tests/kernel-cases/ladder/06-threads/024-internal-rc-1-2-taper/recipe.json create mode 100644 tests/kernel-cases/ladder/06-threads/025-external-s20x4-steep-flank-end-to-shoulder/expected.json create mode 100644 tests/kernel-cases/ladder/06-threads/025-external-s20x4-steep-flank-end-to-shoulder/recipe.json create mode 100644 tests/kernel-cases/ladder/06-threads/026-external-s20x4-steep-flank-start-to-shoulder/expected.json create mode 100644 tests/kernel-cases/ladder/06-threads/026-external-s20x4-steep-flank-start-to-shoulder/recipe.json create mode 100644 tests/kernel-cases/ladder/06-threads/027-external-m10-chamfered-start/expected.json create mode 100644 tests/kernel-cases/ladder/06-threads/027-external-m10-chamfered-start/recipe.json create mode 100644 tests/kernel-cases/ladder/06-threads/028-external-tr20x4-chamfer-30-deg-2.5-deep/expected.json create mode 100644 tests/kernel-cases/ladder/06-threads/028-external-tr20x4-chamfer-30-deg-2.5-deep/recipe.json create mode 100644 tests/kernel-cases/ladder/06-threads/029-external-tr20x4-chamfer-needs-depth/expected.json create mode 100644 tests/kernel-cases/ladder/06-threads/029-external-tr20x4-chamfer-needs-depth/recipe.json create mode 100644 tests/kernel-cases/ladder/06-threads/030-square-thread-refused/expected.json create mode 100644 tests/kernel-cases/ladder/06-threads/030-square-thread-refused/recipe.json diff --git a/tests/kernel-cases/ladder/06-threads/020-external-g-1-2/expected.json b/tests/kernel-cases/ladder/06-threads/020-external-g-1-2/expected.json new file mode 100644 index 000000000..a7e3d2ae0 --- /dev/null +++ b/tests/kernel-cases/ladder/06-threads/020-external-g-1-2/expected.json @@ -0,0 +1,11 @@ +{ + "sources": [], + "what": "a modelled G 1/2 parallel pipe thread (ISO 228-1, 55 deg) on a d20.955 shaft, six turns", + "source": "analytic", + "method": "groove volume per turn 2 pi int r w(r) dr over the material it cuts (Pappus on the axial section; a screw motion), w(r) = P - flat - depth (tan a + tan b); six whole turns between free ends, so V = stock - 6 x that. Tolerance 0.01%: SMLib's exact screw sweep. the space between the teeth is a groove of straight flanks, its tooth (H - h) tan(half angle) wide at the crest and its groove as wide at the root (the truncations split equally); the standard's crest and root rounds are flats here. ISO 228-1 G 1/2: d = 20.955, 14 threads per inch, H = 0.960491 P, h = 0.640327 P, so the crest flat (H - h) tan27.5 = 0.16667 P and the minor d1 = d - 2h = 18.631", + "body_count": 1, + "volume_mm3": 3355.923237102, + "tolerance": { + "rel": 0.0001 + } +} diff --git a/tests/kernel-cases/ladder/06-threads/020-external-g-1-2/recipe.json b/tests/kernel-cases/ladder/06-threads/020-external-g-1-2/recipe.json new file mode 100644 index 000000000..da396a280 --- /dev/null +++ b/tests/kernel-cases/ladder/06-threads/020-external-g-1-2/recipe.json @@ -0,0 +1,30 @@ +{ + "commands": [ + { + "command": "solid.cylinder", + "params": { + "base": [ + 0, + 0, + 0 + ], + "radius": 10.4775, + "height": 10.885714285714286, + "body_name": "Part" + } + }, + { + "command": "solid.thread", + "params": { + "face": [ + 10.4775, + 0, + 5.442857142857143 + ], + "modeled": true, + "form": "bspp", + "designation": "G 1/2" + } + } + ] +} diff --git a/tests/kernel-cases/ladder/06-threads/021-internal-rp-1-2/expected.json b/tests/kernel-cases/ladder/06-threads/021-internal-rp-1-2/expected.json new file mode 100644 index 000000000..643f778bd --- /dev/null +++ b/tests/kernel-cases/ladder/06-threads/021-internal-rp-1-2/expected.json @@ -0,0 +1,11 @@ +{ + "sources": [], + "what": "a modelled Rp 1/2 parallel internal pipe thread (ISO 7-1) in a d18.631 (its minor) bore through a 40x40 block six turns thick", + "source": "analytic", + "method": "groove volume per turn 2 pi int r w(r) dr over the material it cuts (Pappus on the axial section; a screw motion), w(r) = P - flat - depth (tan a + tan b); six whole turns through the block, both ends free, so V = stock - 6 x that. Tolerance 0.01%: SMLib's exact screw sweep. the space between the teeth is a groove of straight flanks, its tooth (H - h) tan(half angle) wide at the crest and its groove as wide at the root (the truncations split equally); the standard's crest and root rounds are flats here. ISO 7-1 Rp 1/2, the parallel internal thread an R screws into: the ISO 228-1 profile (H = 0.960491 P, h = 0.640327 P) at the gauge diameters, d = 20.955, D1 = d - 2h = 18.631, the bore; the groove from the bore wall out to r 10.4775, w(r) = P - 0.16667 P - (r - 9.3155) 2 tan27.5", + "body_count": 1, + "volume_mm3": 14061.219568064, + "tolerance": { + "rel": 0.0001 + } +} diff --git a/tests/kernel-cases/ladder/06-threads/021-internal-rp-1-2/recipe.json b/tests/kernel-cases/ladder/06-threads/021-internal-rp-1-2/recipe.json new file mode 100644 index 000000000..2c79b320f --- /dev/null +++ b/tests/kernel-cases/ladder/06-threads/021-internal-rp-1-2/recipe.json @@ -0,0 +1,53 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "corner": [ + -20, + -20, + 0 + ], + "length": 40, + "width": 40, + "height": 10.885714285714286, + "body_name": "Part" + } + }, + { + "command": "solid.cylinder", + "params": { + "base": [ + 0, + 0, + -1 + ], + "radius": 9.31576387142857, + "height": 12.885714285714286, + "body_name": "Bore" + } + }, + { + "command": "solid.combine", + "params": { + "target": "Part", + "tools": [ + "Bore" + ], + "operation": "cut" + } + }, + { + "command": "solid.thread", + "params": { + "face": [ + 9.31576387142857, + 0, + 5.442857142857143 + ], + "modeled": true, + "designation": "Rp 1/2" + } + } + ] +} diff --git a/tests/kernel-cases/ladder/06-threads/022-external-r-1-2-taper/expected.json b/tests/kernel-cases/ladder/06-threads/022-external-r-1-2-taper/expected.json new file mode 100644 index 000000000..738e3e98e --- /dev/null +++ b/tests/kernel-cases/ladder/06-threads/022-external-r-1-2-taper/expected.json @@ -0,0 +1,23 @@ +{ + "sources": [], + "what": "a modelled R 1/2 taper pipe thread (ISO 7-1, 55 deg, 1 in 16) on a 21.3 mm pipe (ISO 65), its standard 13.2 mm from the pipe's end", + "source": "analytic", + "method": "ISO 7-1 / ASME B1.20.1 taper 1 in 16 on the diameter. The thread starts at its free end with the standard's diameter there and its diameters grow into the material (the external major d0 + y/16 at y mm in; the internal minor d1 - y/16). The crests are the cone's: the material outside the external major cone (inside the internal minor cone) along the thread is cut as the die (tap) cuts it. The groove is the sweep of the profile's section, rising P a turn and moving P/32 a turn off the axis, so a point (rho, zeta) of the section at turn t lies at r = rho + c t, z = z0 + zeta + P t, the volume element is 2 pi r dA dt, and the groove removes 2 pi int_0^T (int int r dA over the section within the material) dt, exact while turns don't overlap (Gauss on 400 panels a turn: the integrand is piecewise polynomial in t). the space between the teeth is a groove of straight flanks, its tooth (H - h) tan(half angle) wide at the crest and its groove as wide at the root (the truncations split equally); the standard's crest and root rounds are flats here. ISO 7-1 R 1/2 (Table 1): gauge diameter d = 20.955 a basic gauge length 8.2 from the small end, so d0 = 20.955 - 8.2/16 = 20.4425 at the pipe's end; 14 threads per inch, H = 0.960237 P, h = 0.640327 P; useful thread 13.2. The pipe is ISO 65's 21.3 OD, outside the major cone over the whole thread (21.2675 at its end). It starts at the free top end z = 25 and runs the standard length L = 13.2000 down to z = 11.8000, where it stops square inside the face (the groove's section centred there, the cut below it bounded by the pipe's surface only). V = pi R^2 25 - the ring outside the cone (pi int (R^2 - r_cone^2) where the cone is inside the pipe) - the groove (481.264581). Bbox: the pipe's", + "body_count": 1, + "volume_mm3": 8233.026663883, + "bbox": { + "min": [ + -10.65, + -10.65, + 0 + ], + "max": [ + 10.65, + 10.65, + 25 + ] + }, + "tolerance": { + "rel": 0.0001 + } +} diff --git a/tests/kernel-cases/ladder/06-threads/022-external-r-1-2-taper/recipe.json b/tests/kernel-cases/ladder/06-threads/022-external-r-1-2-taper/recipe.json new file mode 100644 index 000000000..01b2934bb --- /dev/null +++ b/tests/kernel-cases/ladder/06-threads/022-external-r-1-2-taper/recipe.json @@ -0,0 +1,34 @@ +{ + "commands": [ + { + "command": "solid.cylinder", + "params": { + "base": [ + 0, + 0, + 0 + ], + "radius": 10.65, + "height": 25, + "body_name": "Part" + } + }, + { + "command": "solid.thread", + "params": { + "face": [ + 10.65, + 0, + 12.5 + ], + "modeled": true, + "designation": "R 1/2", + "from": [ + 0, + 0, + 25 + ] + } + } + ] +} diff --git a/tests/kernel-cases/ladder/06-threads/023-external-1-2-npt/expected.json b/tests/kernel-cases/ladder/06-threads/023-external-1-2-npt/expected.json new file mode 100644 index 000000000..a831eb6fe --- /dev/null +++ b/tests/kernel-cases/ladder/06-threads/023-external-1-2-npt/expected.json @@ -0,0 +1,23 @@ +{ + "sources": [], + "what": "a modelled 1/2-14 NPT taper pipe thread (ASME B1.20.1, 60 deg, 1 in 16) on its 0.840 in pipe, its effective thread L2 from the end", + "source": "analytic", + "method": "ISO 7-1 / ASME B1.20.1 taper 1 in 16 on the diameter. The thread starts at its free end with the standard's diameter there and its diameters grow into the material (the external major d0 + y/16 at y mm in; the internal minor d1 - y/16). The crests are the cone's: the material outside the external major cone (inside the internal minor cone) along the thread is cut as the die (tap) cuts it. The groove is the sweep of the profile's section, rising P a turn and moving P/32 a turn off the axis, so a point (rho, zeta) of the section at turn t lies at r = rho + c t, z = z0 + zeta + P t, the volume element is 2 pi r dA dt, and the groove removes 2 pi int_0^T (int int r dA over the section within the material) dt, exact while turns don't overlap (Gauss on 400 panels a turn: the integrand is piecewise polynomial in t). ASME B1.20.1 (H28 Table VII.2) 1/2-14 NPT: pipe OD D = 0.840 in, E0 = 0.75843 in the pitch diameter at the small end, h = 0.8 P truncated equally at crest and root (0.033 P each, a 0.038 P flat), so the major at the end is E0 + h = 20.7156 mm, growing 1/16; L2 = 0.5337 in = 13.556. The major cone passes the pipe's OD (10.668) 9.93 mm in, so from there to L2 the crests are the pipe's surface, as the standard's imperfect threads are. It starts at the free top end z = 25 and runs the standard length L = 13.5560 down to z = 11.4440, where it stops square inside the face (the groove's section centred there, the cut below it bounded by the pipe's surface only). V = pi R^2 25 - the ring outside the cone (pi int (R^2 - r_cone^2) where the cone is inside the pipe) - the groove (609.702166). Bbox: the pipe's", + "body_count": 1, + "volume_mm3": 8226.404941856, + "bbox": { + "min": [ + -10.668, + -10.668, + 0 + ], + "max": [ + 10.668, + 10.668, + 25 + ] + }, + "tolerance": { + "rel": 0.0001 + } +} diff --git a/tests/kernel-cases/ladder/06-threads/023-external-1-2-npt/recipe.json b/tests/kernel-cases/ladder/06-threads/023-external-1-2-npt/recipe.json new file mode 100644 index 000000000..feb557cca --- /dev/null +++ b/tests/kernel-cases/ladder/06-threads/023-external-1-2-npt/recipe.json @@ -0,0 +1,34 @@ +{ + "commands": [ + { + "command": "solid.cylinder", + "params": { + "base": [ + 0, + 0, + 0 + ], + "radius": 10.668, + "height": 25, + "body_name": "Part" + } + }, + { + "command": "solid.thread", + "params": { + "face": [ + 10.668, + 0, + 12.5 + ], + "modeled": true, + "designation": "1/2-14 NPT", + "from": [ + 0, + 0, + 25 + ] + } + } + ] +} diff --git a/tests/kernel-cases/ladder/06-threads/024-internal-rc-1-2-taper/expected.json b/tests/kernel-cases/ladder/06-threads/024-internal-rc-1-2-taper/expected.json new file mode 100644 index 000000000..f6cea0f83 --- /dev/null +++ b/tests/kernel-cases/ladder/06-threads/024-internal-rc-1-2-taper/expected.json @@ -0,0 +1,23 @@ +{ + "sources": [], + "what": "a modelled Rc 1/2 internal taper pipe thread (ISO 7-1) in a d17.6 hole (the tap maker's) through a 13.2 mm plate, from its top face", + "source": "analytic", + "method": "ISO 7-1 / ASME B1.20.1 taper 1 in 16 on the diameter. The thread starts at its free end with the standard's diameter there and its diameters grow into the material (the external major d0 + y/16 at y mm in; the internal minor d1 - y/16). The crests are the cone's: the material outside the external major cone (inside the internal minor cone) along the thread is cut as the die (tap) cuts it. The groove is the sweep of the profile's section, rising P a turn and moving P/32 a turn off the axis, so a point (rho, zeta) of the section at turn t lies at r = rho + c t, z = z0 + zeta + P t, the volume element is 2 pi r dA dt, and the groove removes 2 pi int_0^T (int int r dA over the section within the material) dt, exact while turns don't overlap (Gauss on 400 panels a turn: the integrand is piecewise polynomial in t). the space between the teeth is a groove of straight flanks, its tooth (H - h) tan(half angle) wide at the crest and its groove as wide at the root (the truncations split equally); the standard's crest and root rounds are flats here. ISO 7-1 Rc 1/2: the gauge diameter d = 20.955 at the face (z = 13.2), so the minor there is d1 = d - 2h = 18.631, shrinking 1/16 per mm down; the plate is the useful thread 13.2 thick, so the minor cone stays outside the 17.6 hole (17.806 at the bottom). Both faces are free ends, the groove running a pitch past each. V = 40^2 13.2 - pi 8.8^2 13.2 - the ring inside the minor cone (pi int (r_m^2 - 8.8^2), 230.460888) - the groove (460.876764)", + "body_count": 1, + "volume_mm3": 17217.301204408, + "bbox": { + "min": [ + -20, + -20, + 0 + ], + "max": [ + 20, + 20, + 13.2 + ] + }, + "tolerance": { + "rel": 0.0001 + } +} diff --git a/tests/kernel-cases/ladder/06-threads/024-internal-rc-1-2-taper/recipe.json b/tests/kernel-cases/ladder/06-threads/024-internal-rc-1-2-taper/recipe.json new file mode 100644 index 000000000..ce40f933f --- /dev/null +++ b/tests/kernel-cases/ladder/06-threads/024-internal-rc-1-2-taper/recipe.json @@ -0,0 +1,58 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "corner": [ + -20, + -20, + 0 + ], + "length": 40, + "width": 40, + "height": 13.2, + "body_name": "Part" + } + }, + { + "command": "solid.cylinder", + "params": { + "base": [ + 0, + 0, + -1 + ], + "radius": 8.8, + "height": 15.2, + "body_name": "Bore" + } + }, + { + "command": "solid.combine", + "params": { + "target": "Part", + "tools": [ + "Bore" + ], + "operation": "cut" + } + }, + { + "command": "solid.thread", + "params": { + "face": [ + 8.8, + 0, + 6.6 + ], + "modeled": true, + "designation": "Rc 1/2", + "from": [ + 0, + 0, + 13.2 + ] + } + } + ] +} diff --git a/tests/kernel-cases/ladder/06-threads/025-external-s20x4-steep-flank-end-to-shoulder/expected.json b/tests/kernel-cases/ladder/06-threads/025-external-s20x4-steep-flank-end-to-shoulder/expected.json new file mode 100644 index 000000000..aedbb7a80 --- /dev/null +++ b/tests/kernel-cases/ladder/06-threads/025-external-s20x4-steep-flank-end-to-shoulder/expected.json @@ -0,0 +1,23 @@ +{ + "sources": [], + "what": "a modelled S20x4 buttress thread on a d20 shaft down to a d30 shoulder, the steep flank toward the thread's end (up, the default): the 3 deg wall faces the shoulder", + "source": "analytic", + "method": "DIN 513-1 S20x4: 3 deg load flank, 30 deg clearance flank, flats (P - 0.75 P (tan3 + tan30))/2 = 0.26384 P, external minor d3 = d - 2 x 0.86777 P = 13.058. steep_flank end puts the 3 deg wall on the groove's side toward the shoulder (z = 10); the groove stops with its section clear of the shoulder, its centre 0.571741 above it (the section's extent that way at r = 10.2, 0.05 P past the crest, the tool's outer edge), and runs out a pitch past the free top end. V = pi 15^2 10 + pi 10^2 30 - the groove 2 pi int_0^T (int int r dA of the section within the shaft) dt (2507.160140; a straight screw sweep, Pappus turn by turn, with the free end's partial turn integrated). 025 and 026 differ by where the groove stops", + "body_count": 1, + "volume_mm3": 13986.201291602, + "bbox": { + "min": [ + -15, + -15, + 0 + ], + "max": [ + 15, + 15, + 40 + ] + }, + "tolerance": { + "rel": 0.0001 + } +} diff --git a/tests/kernel-cases/ladder/06-threads/025-external-s20x4-steep-flank-end-to-shoulder/recipe.json b/tests/kernel-cases/ladder/06-threads/025-external-s20x4-steep-flank-end-to-shoulder/recipe.json new file mode 100644 index 000000000..82e6fff82 --- /dev/null +++ b/tests/kernel-cases/ladder/06-threads/025-external-s20x4-steep-flank-end-to-shoulder/recipe.json @@ -0,0 +1,46 @@ +{ + "commands": [ + { + "command": "solid.cylinder", + "params": { + "base": [ + 0, + 0, + 0 + ], + "radius": 15, + "height": 10, + "body_name": "Part" + } + }, + { + "command": "solid.cylinder", + "params": { + "base": [ + 0, + 0, + 10 + ], + "radius": 10, + "height": 30, + "operation": "join", + "targets": [ + "Part" + ] + } + }, + { + "command": "solid.thread", + "params": { + "face": [ + 10, + 0, + 25 + ], + "modeled": true, + "designation": "S20x4", + "steep_flank": "end" + } + } + ] +} diff --git a/tests/kernel-cases/ladder/06-threads/026-external-s20x4-steep-flank-start-to-shoulder/expected.json b/tests/kernel-cases/ladder/06-threads/026-external-s20x4-steep-flank-start-to-shoulder/expected.json new file mode 100644 index 000000000..3f73e3ee1 --- /dev/null +++ b/tests/kernel-cases/ladder/06-threads/026-external-s20x4-steep-flank-start-to-shoulder/expected.json @@ -0,0 +1,23 @@ +{ + "sources": [], + "what": "a modelled S20x4 buttress thread on a d20 shaft down to a d30 shoulder, the steep flank toward the thread's start (down): the 30 deg wall faces the shoulder", + "source": "analytic", + "method": "DIN 513-1 S20x4: 3 deg load flank, 30 deg clearance flank, flats (P - 0.75 P (tan3 + tan30))/2 = 0.26384 P, external minor d3 = d - 2 x 0.86777 P = 13.058. steep_flank start puts the 30 deg wall on the groove's side toward the shoulder (z = 10); the groove stops with its section clear of the shoulder, its centre 2.498847 above it (the section's extent that way at r = 10.2, 0.05 P past the crest, the tool's outer edge), and runs out a pitch past the free top end. V = pi 15^2 10 + pi 10^2 30 - the groove 2 pi int_0^T (int int r dA of the section within the shaft) dt (2439.158513; a straight screw sweep, Pappus turn by turn, with the free end's partial turn integrated). 025 and 026 differ by where the groove stops", + "body_count": 1, + "volume_mm3": 14054.202918026, + "bbox": { + "min": [ + -15, + -15, + 0 + ], + "max": [ + 15, + 15, + 40 + ] + }, + "tolerance": { + "rel": 0.0001 + } +} diff --git a/tests/kernel-cases/ladder/06-threads/026-external-s20x4-steep-flank-start-to-shoulder/recipe.json b/tests/kernel-cases/ladder/06-threads/026-external-s20x4-steep-flank-start-to-shoulder/recipe.json new file mode 100644 index 000000000..772b1067c --- /dev/null +++ b/tests/kernel-cases/ladder/06-threads/026-external-s20x4-steep-flank-start-to-shoulder/recipe.json @@ -0,0 +1,46 @@ +{ + "commands": [ + { + "command": "solid.cylinder", + "params": { + "base": [ + 0, + 0, + 0 + ], + "radius": 15, + "height": 10, + "body_name": "Part" + } + }, + { + "command": "solid.cylinder", + "params": { + "base": [ + 0, + 0, + 10 + ], + "radius": 10, + "height": 30, + "operation": "join", + "targets": [ + "Part" + ] + } + }, + { + "command": "solid.thread", + "params": { + "face": [ + 10, + 0, + 25 + ], + "modeled": true, + "designation": "S20x4", + "steep_flank": "start" + } + } + ] +} diff --git a/tests/kernel-cases/ladder/06-threads/027-external-m10-chamfered-start/expected.json b/tests/kernel-cases/ladder/06-threads/027-external-m10-chamfered-start/expected.json new file mode 100644 index 000000000..896655a73 --- /dev/null +++ b/tests/kernel-cases/ladder/06-threads/027-external-m10-chamfered-start/expected.json @@ -0,0 +1,11 @@ +{ + "sources": [], + "what": "001's modelled M10 thread with ISO 4753's chamfered end at the end it starts from only (`tip: start`, from the top)", + "source": "analytic", + "method": "ISO 68-1 basic profile (60 deg, root flat P/4 at d - 5H/4 ... minor d1 = d - 1.0825 P, crest flat P/8): a helical groove of fixed section is a screw motion, so averaged over the turn every meridian half-plane holds the same section and V = 2 pi int int r m(r) dr dz over the stock's section, m the material fraction per pitch; the groove runs out past free ends. Tolerance 0.01%: SMLib's exact screw sweep; as 017 at the top end only: the 45 deg cone down to d3 = d - 2 (17/24) H = 8.160 (ISO 724) at z = 30, cut after the groove, lowers the stock's radius to r_f + (30 - z); the bottom end stays as cut, the groove running out past it", + "body_count": 1, + "volume_mm3": 1949.80017257, + "tolerance": { + "rel": 0.0001 + } +} diff --git a/tests/kernel-cases/ladder/06-threads/027-external-m10-chamfered-start/recipe.json b/tests/kernel-cases/ladder/06-threads/027-external-m10-chamfered-start/recipe.json new file mode 100644 index 000000000..69d2d052c --- /dev/null +++ b/tests/kernel-cases/ladder/06-threads/027-external-m10-chamfered-start/recipe.json @@ -0,0 +1,35 @@ +{ + "commands": [ + { + "command": "solid.cylinder", + "params": { + "base": [ + 0, + 0, + 0 + ], + "radius": 5, + "height": 30, + "body_name": "Part" + } + }, + { + "command": "solid.thread", + "params": { + "face": [ + 5, + 0, + 15 + ], + "modeled": true, + "designation": "M10", + "tip": "start", + "from": [ + 0, + 0, + 30 + ] + } + } + ] +} diff --git a/tests/kernel-cases/ladder/06-threads/028-external-tr20x4-chamfer-30-deg-2.5-deep/expected.json b/tests/kernel-cases/ladder/06-threads/028-external-tr20x4-chamfer-30-deg-2.5-deep/expected.json new file mode 100644 index 000000000..b2bd89565 --- /dev/null +++ b/tests/kernel-cases/ladder/06-threads/028-external-tr20x4-chamfer-30-deg-2.5-deep/expected.json @@ -0,0 +1,11 @@ +{ + "sources": [], + "what": "011's modelled Tr20x4 thread with chamfered ends at its own angle and depth: 30 deg to the axis, 2.5 mm in from the major diameter", + "source": "analytic", + "method": "ISO 2904 Tr20x4 (011): crest flat 0.366 P, minor d3 = 15.5. Averaged over the turn every meridian half-plane holds the same sections (a screw motion), so V = 2 pi int int r m(r) dr dz over the stock's section, m = 1 - w(r)/P the tooth's share of a pitch (1 below the root r 7.75). Both ends are free: the chamfer, axisymmetric and cut after the groove, lowers the stock's radius to 7.5 + y tan30 at y mm from each end (the cone at 30 deg to the axis through d_f = d - 2 x 2.5 = 15, below the root, so a whole ring is left on the end), reaching the major 4.330 mm in", + "body_count": 1, + "volume_mm3": 5769.125597583, + "tolerance": { + "rel": 0.0001 + } +} diff --git a/tests/kernel-cases/ladder/06-threads/028-external-tr20x4-chamfer-30-deg-2.5-deep/recipe.json b/tests/kernel-cases/ladder/06-threads/028-external-tr20x4-chamfer-30-deg-2.5-deep/recipe.json new file mode 100644 index 000000000..3af152364 --- /dev/null +++ b/tests/kernel-cases/ladder/06-threads/028-external-tr20x4-chamfer-30-deg-2.5-deep/recipe.json @@ -0,0 +1,32 @@ +{ + "commands": [ + { + "command": "solid.cylinder", + "params": { + "base": [ + 0, + 0, + 0 + ], + "radius": 10, + "height": 24, + "body_name": "Part" + } + }, + { + "command": "solid.thread", + "params": { + "face": [ + 10, + 0, + 12 + ], + "modeled": true, + "designation": "Tr20x4", + "tip": "both", + "chamfer_angle": "30 deg", + "chamfer_depth": "2.5 mm" + } + } + ] +} diff --git a/tests/kernel-cases/ladder/06-threads/029-external-tr20x4-chamfer-needs-depth/expected.json b/tests/kernel-cases/ladder/06-threads/029-external-tr20x4-chamfer-needs-depth/expected.json new file mode 100644 index 000000000..3fdd5c485 --- /dev/null +++ b/tests/kernel-cases/ladder/06-threads/029-external-tr20x4-chamfer-needs-depth/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "011's Tr20x4 thread with a chamfered tip and no depth: refused, ISO 4753 is for metric threads", + "source": "invariants", + "method": "ISO 4753's chamfered end (d_f at most the external minor diameter, ISO 724's d3) is defined for ISO metric threads only: a trapezoidal thread has no standard chamfer depth, so without `chamfer_depth` there is no right answer and the thread must be refused, naming the depth to give", + "outcome": "refused", + "refusal": "ISO 4753's chamfered end is for ISO metric threads" +} diff --git a/tests/kernel-cases/ladder/06-threads/029-external-tr20x4-chamfer-needs-depth/recipe.json b/tests/kernel-cases/ladder/06-threads/029-external-tr20x4-chamfer-needs-depth/recipe.json new file mode 100644 index 000000000..076f6ab8f --- /dev/null +++ b/tests/kernel-cases/ladder/06-threads/029-external-tr20x4-chamfer-needs-depth/recipe.json @@ -0,0 +1,30 @@ +{ + "commands": [ + { + "command": "solid.cylinder", + "params": { + "base": [ + 0, + 0, + 0 + ], + "radius": 10, + "height": 24, + "body_name": "Part" + } + }, + { + "command": "solid.thread", + "params": { + "face": [ + 10, + 0, + 12 + ], + "modeled": true, + "designation": "Tr20x4", + "tip": "both" + } + } + ] +} diff --git a/tests/kernel-cases/ladder/06-threads/030-square-thread-refused/expected.json b/tests/kernel-cases/ladder/06-threads/030-square-thread-refused/expected.json new file mode 100644 index 000000000..67eedbc4b --- /dev/null +++ b/tests/kernel-cases/ladder/06-threads/030-square-thread-refused/expected.json @@ -0,0 +1,8 @@ +{ + "sources": [], + "what": "a square thread on a d10 x 30 cylinder: refused, no current standard defines one", + "source": "invariants", + "method": "ISO, ASME and DIN define no square thread (Machinery's Handbook gives only historical proportions), so no dimension of it can be taken from a standard: the right answer is a refusal pointing to trapezoidal (ISO 2904) or acme (ASME B1.5)", + "outcome": "refused", + "refusal": "no current standard defines a square thread" +} diff --git a/tests/kernel-cases/ladder/06-threads/030-square-thread-refused/recipe.json b/tests/kernel-cases/ladder/06-threads/030-square-thread-refused/recipe.json new file mode 100644 index 000000000..81e9de60e --- /dev/null +++ b/tests/kernel-cases/ladder/06-threads/030-square-thread-refused/recipe.json @@ -0,0 +1,29 @@ +{ + "commands": [ + { + "command": "solid.cylinder", + "params": { + "base": [ + 0, + 0, + 0 + ], + "radius": 5, + "height": 30, + "body_name": "Part" + } + }, + { + "command": "solid.thread", + "params": { + "face": [ + 5, + 0, + 15 + ], + "modeled": true, + "form": "square" + } + } + ] +} diff --git a/tests/kernel-cases/ladder/ladder.json b/tests/kernel-cases/ladder/ladder.json index 3bc77da54..8d11e47e5 100644 --- a/tests/kernel-cases/ladder/ladder.json +++ b/tests/kernel-cases/ladder/ladder.json @@ -120,7 +120,18 @@ "ladder/06-threads/002-external-m10x1-fine", "ladder/06-threads/017-external-m10-chamfered-tip", "ladder/06-threads/008-multi-start-thread", - "ladder/06-threads/018-external-m10-both-hands" + "ladder/06-threads/018-external-m10-both-hands", + "ladder/06-threads/020-external-g-1-2", + "ladder/06-threads/021-internal-rp-1-2", + "ladder/06-threads/022-external-r-1-2-taper", + "ladder/06-threads/023-external-1-2-npt", + "ladder/06-threads/024-internal-rc-1-2-taper", + "ladder/06-threads/025-external-s20x4-steep-flank-end-to-shoulder", + "ladder/06-threads/026-external-s20x4-steep-flank-start-to-shoulder", + "ladder/06-threads/027-external-m10-chamfered-start", + "ladder/06-threads/028-external-tr20x4-chamfer-30-deg-2.5-deep", + "ladder/06-threads/029-external-tr20x4-chamfer-needs-depth", + "ladder/06-threads/030-square-thread-refused" ], "tier": "06-threads", "what": "modelled threads" diff --git a/tools/kernel-ladder/cases.py b/tools/kernel-ladder/cases.py index 03ad3d2da..9a6b3d49a 100644 --- a/tools/kernel-ladder/cases.py +++ b/tools/kernel-ladder/cases.py @@ -791,6 +791,133 @@ case(T6, "017-external-m10-chamfered-tip", "001's modelled M10 thread with ISO 4 "; the chamfer is axisymmetric and cut after the groove, so it only lowers the stock's outer radius: r <= d_f/2 + distance from the end (45 deg), d_f the external minor diameter d3 = d - 1.226869 P = 8.160 " "(ISO 724; ISO 4753 chamfered end: the end's diameter at most the minor diameter), below the modelled root d1") +# Pipe threads (crates/doc/src/thread_forms.rs, pipe_thread_sizes.rs): ISO 228-1 / ISO 7-1, 55 deg, +# the triangle H truncated to the depth h, equally at crest and root, flats where the standard has +# rounds; ASME B1.20.1 NPT, 60 deg, H = 0.866025 P truncated to h = 0.8 P. +P14 = INCH / 14 +H_PAR, H_TAP, H55 = 0.960491 * P14, 0.960237 * P14, 0.640327 * P14 +t275 = math.tan(math.radians(27.5)) +G12 = 20.955 +PIPE = ("the space between the teeth is a groove of straight flanks, its tooth (H - h) tan(half angle) wide at the crest and its groove as wide at the root (the truncations " + "split equally); the standard's crest and root rounds are flats here. ") +shaft_form("020-external-g-1-2", "a modelled G 1/2 parallel pipe thread (ISO 228-1, 55 deg) on a d20.955 shaft, six turns", "bspp", "G 1/2", G12, P14, + (H_PAR - H55) * t275, 27.5, 27.5, G12 / 2 - H55, + PIPE + "ISO 228-1 G 1/2: d = 20.955, 14 threads per inch, H = 0.960491 P, h = 0.640327 P, so the crest flat (H - h) tan27.5 = 0.16667 P and the minor d1 = d - 2h = 18.631") +r1rp = G12 / 2 - H55 +vrp = 6 * form_turn(P14, (H_PAR - H55) * t275, r1rp, 27.5, 27.5, r1rp, G12 / 2, internal=True) +case(T6, "021-internal-rp-1-2", "a modelled Rp 1/2 parallel internal pipe thread (ISO 7-1) in a d18.631 (its minor) bore through a 40x40 block six turns thick", + [box([-20, -20, 0], 40, 40, 6 * P14, body_name="Part"), cyl([0, 0, -1], r1rp, 6 * P14 + 2, body_name="Bore"), C("solid.combine", target="Part", tools=["Bore"], operation="cut"), + thr([r1rp, 0, 3 * P14], designation="Rp 1/2")], + {"body_count": 1, "volume_mm3": 1600 * 6 * P14 - PI * r1rp ** 2 * 6 * P14 - vrp, "tolerance": TOL_F}, + FMETH.replace("between free ends", "through the block, both ends free") + PIPE + "ISO 7-1 Rp 1/2, the parallel internal thread an R screws into: the ISO 228-1 profile " + "(H = 0.960491 P, h = 0.640327 P) at the gauge diameters, d = 20.955, D1 = d - 2h = 18.631, the bore; the groove from the bore wall out to r 10.4775, " + "w(r) = P - 0.16667 P - (r - 9.3155) 2 tan27.5") + +# Taper pipe threads: a screw sweep whose section moves off the axis 1/32 of its rise (1 in 16 on +# the diameter), the crests cut by the major cone (external) or minor cone (internal) as a die or tap +# cuts them. What a moving section removes is exact by the sweep's Jacobian (sweep_removed). +TAPER = ("ISO 7-1 / ASME B1.20.1 taper 1 in 16 on the diameter. The thread starts at its free end with the standard's diameter there and its diameters grow into the material " + "(the external major d0 + y/16 at y mm in; the internal minor d1 - y/16). The crests are the cone's: the material outside the external major cone (inside the internal " + "minor cone) along the thread is cut as the die (tap) cuts it. The groove is the sweep of the profile's section, rising P a turn and moving P/32 a turn off the axis, so " + "a point (rho, zeta) of the section at turn t lies at r = rho + c t, z = z0 + zeta + P t, the volume element is 2 pi r dA dt, and the groove removes " + "2 pi int_0^T (int int r dA over the section within the material) dt, exact while turns don't overlap (Gauss on 400 panels a turn: the integrand is piecewise polynomial in t). ") +def taper_ext(name, what, desig, d0, L, P, flat, half, h, Rcyl, Ls, extra): + a = Ls - L + cone = lambda z: d0 / 2 + (Ls - z) / 32 + crest_a = cone(a) + sec = groove_section(P, flat, crest_a, half, half, crest_a - h, max(crest_a, Rcyl) + 0.1) + A = [(0, -1, a), (0, 1, -Ls), (1, 1 / 32, -(d0 / 2 + Ls / 32)), (1, 0, -Rcyl)] + B = [(0, 1, -a), (0, -1, 0), (1, 0, -Rcyl)] + turns = (L + P) / P + groove_v = sweep_removed(sec, a, P, turns, -P / 32, [A, B]) + env = PI * quad_split(lambda z: max(0.0, Rcyl ** 2 - cone(z) ** 2), a, Ls, 200, 8) + v = PI * Rcyl ** 2 * Ls - env - groove_v + case(T6, name, what, [cyl([0, 0, 0], Rcyl, Ls, body_name="Part"), thr([Rcyl, 0, Ls / 2], designation=desig, **{"from": [0, 0, Ls]})], + {"body_count": 1, "volume_mm3": v, "bbox": {"min": [-Rcyl, -Rcyl, 0], "max": [Rcyl, Rcyl, Ls]}, "tolerance": TOL_F}, + TAPER + extra + " It starts at the free top end z = %g and runs the standard length L = %.4f down to z = %.4f, where it stops square inside the face (the groove's section centred " + "there, the cut below it bounded by the pipe's surface only). V = pi R^2 %g - the ring outside the cone (pi int (R^2 - r_cone^2) where the cone is inside the pipe) " + "- the groove (%.6f). Bbox: the pipe's" % (Ls, L, a, Ls, groove_v)) +taper_ext("022-external-r-1-2-taper", "a modelled R 1/2 taper pipe thread (ISO 7-1, 55 deg, 1 in 16) on a 21.3 mm pipe (ISO 65), its standard 13.2 mm from the pipe's end", + "R 1/2", G12 - 8.2 / 16, 13.2, P14, (H_TAP - H55) * t275, 27.5, H55, 21.3 / 2, 25, + PIPE + "ISO 7-1 R 1/2 (Table 1): gauge diameter d = 20.955 a basic gauge length 8.2 from the small end, so d0 = 20.955 - 8.2/16 = 20.4425 at the pipe's end; " + "14 threads per inch, H = 0.960237 P, h = 0.640327 P; useful thread 13.2. The pipe is ISO 65's 21.3 OD, outside the major cone over the whole thread (21.2675 at its end).") +E0, L1, L2 = 0.75843, 0.320, 0.5337 +taper_ext("023-external-1-2-npt", "a modelled 1/2-14 NPT taper pipe thread (ASME B1.20.1, 60 deg, 1 in 16) on its 0.840 in pipe, its effective thread L2 from the end", + "1/2-14 NPT", (E0 + 0.8 / 14) * INCH, L2 * INCH, P14, (0.866025 - 0.8) * P14 * math.tan(math.radians(30)), 30.0, 0.8 * P14, 0.840 * INCH / 2, 25, + "ASME B1.20.1 (H28 Table VII.2) 1/2-14 NPT: pipe OD D = 0.840 in, E0 = 0.75843 in the pitch diameter at the small end, h = 0.8 P truncated equally at crest and root " + "(0.033 P each, a 0.038 P flat), so the major at the end is E0 + h = 20.7156 mm, growing 1/16; L2 = 0.5337 in = 13.556. The major cone passes the pipe's OD " + "(10.668) 9.93 mm in, so from there to L2 the crests are the pipe's surface, as the standard's imperfect threads are.") +# Rc internal: the minor cone shrinks into the hole from the face (the gauge plane, ISO 7-1: the +# internal thread's reference diameter is at its face). +Lrc, rb = 13.2, 8.8 +m0 = (G12 - 2 * H55) / 2 +rm = lambda z: m0 - (Lrc - z) / 32 +sec_rc = groove_section(P14, (H_TAP - H55) * t275, rm(-P14), 27.5, 27.5, rm(-P14) + H55, rb - 0.2, internal=True) +g_rc = sweep_removed(sec_rc, -P14, P14, (Lrc + 2 * P14) / P14, P14 / 32, [[(0, -1, 0), (0, 1, -Lrc), (-1, 1 / 32, m0 - Lrc / 32), (1, 0, -19)]]) +env_rc = PI * quad_split(lambda z: rm(z) ** 2 - rb ** 2, 0, Lrc, 200, 8) +case(T6, "024-internal-rc-1-2-taper", "a modelled Rc 1/2 internal taper pipe thread (ISO 7-1) in a d17.6 hole (the tap maker's) through a 13.2 mm plate, from its top face", + [box([-20, -20, 0], 40, 40, Lrc, body_name="Part"), cyl([0, 0, -1], rb, Lrc + 2, body_name="Bore"), C("solid.combine", target="Part", tools=["Bore"], operation="cut"), + thr([rb, 0, Lrc / 2], designation="Rc 1/2", **{"from": [0, 0, Lrc]})], + {"body_count": 1, "volume_mm3": 1600 * Lrc - PI * rb ** 2 * Lrc - env_rc - g_rc, "bbox": {"min": [-20, -20, 0], "max": [20, 20, Lrc]}, "tolerance": TOL_F}, + TAPER + PIPE + "ISO 7-1 Rc 1/2: the gauge diameter d = 20.955 at the face (z = 13.2), so the minor there is d1 = d - 2h = 18.631, shrinking 1/16 per mm down; " + "the plate is the useful thread 13.2 thick, so the minor cone stays outside the 17.6 hole (17.806 at the bottom). Both faces are free ends, the groove running a pitch " + "past each. V = 40^2 13.2 - pi 8.8^2 13.2 - the ring inside the minor cone (pi int (r_m^2 - 8.8^2), %.6f) - the groove (%.6f)" % (env_rc, g_rc)) + +# A buttress thread's steep flank (DIN 513-1, 3 deg): which way it faces decides how near the shoulder +# the groove may come, since it stops with its whole section clear of it (004's rule): the section's +# extent toward the shoulder at the tool's outer edge (0.05 P past the crest) is the 3 deg flank's or +# the 30 deg one's. +PS, dS = 4.0, 20.0 +tS3, tS30 = math.tan(math.radians(3)), math.tan(math.radians(30)) +flatS = (PS - 0.75 * PS * (tS3 + tS30)) / 2 +r3S = dS / 2 - 0.86777 * PS +for name, steep, lo, hi, what in [("025-external-s20x4-steep-flank-end-to-shoulder", "end", 3, 30, "the steep flank toward the thread's end (up, the default): the 3 deg wall faces the shoulder"), + ("026-external-s20x4-steep-flank-start-to-shoulder", "start", 30, 3, "the steep flank toward the thread's start (down): the 30 deg wall faces the shoulder")]: + sec = groove_section(PS, flatS, dS / 2, lo, hi, r3S, dS / 2 + 0.05 * PS) + w_lo = -min(z for _, z in sec) + s0 = 10 + w_lo + g = sweep_removed(sec, s0, PS, (40 + PS - s0) / PS, 0.0, [[(0, -1, 10), (0, 1, -40), (1, 0, -10)], [(0, 1, -10), (0, -1, 0), (1, 0, -15)]]) + case(T6, name, "a modelled S20x4 buttress thread on a d20 shaft down to a d30 shoulder, " + what, + [cyl([0, 0, 0], 15, 10, body_name="Part"), cyl([0, 0, 10], 10, 30, operation="join", targets=["Part"]), thr([10, 0, 25], designation="S20x4", steep_flank=steep)], + {"body_count": 1, "volume_mm3": PI * 225 * 10 + PI * 100 * 30 - g, "bbox": {"min": [-15, -15, 0], "max": [15, 15, 40]}, "tolerance": TOL_F}, + "DIN 513-1 S20x4: 3 deg load flank, 30 deg clearance flank, flats (P - 0.75 P (tan3 + tan30))/2 = 0.26384 P, external minor d3 = d - 2 x 0.86777 P = 13.058. " + "steep_flank %s puts the %d deg wall on the groove's side toward the shoulder (z = 10); the groove stops with its section clear of the shoulder, its centre " + "%.6f above it (the section's extent that way at r = 10.2, 0.05 P past the crest, the tool's outer edge), and runs out a pitch past the free top end. " + "V = pi 15^2 10 + pi 10^2 30 - the groove 2 pi int_0^T (int int r dA of the section within the shaft) dt (%.6f; a straight screw sweep, Pappus turn by turn, " + "with the free end's partial turn integrated). 025 and 026 differ by where the groove stops" % (steep, lo, w_lo, g), base=None) + +# The tip options (ISO 4753 chamfered end): none is 001, both is 017. +case(T6, "027-external-m10-chamfered-start", "001's modelled M10 thread with ISO 4753's chamfered end at the end it starts from only (`tip: start`, from the top)", + cylT + [thr([5, 0, 15], designation="M10", tip="start", **{"from": [0, 0, 30]})], + {"body_count": 1, "volume_mm3": ext_volume(10, 1.5, [(0, 25 + rf10, lambda z: 5), (25 + rf10, 30, lambda z: rf10 + 30 - z)]), "tolerance": {"rel": 1e-4}}, + TMETH.replace("Tolerance 0.5%: solid.thread cuts faceted by design (chords within P/200 on the body, P/100 on the tool)", "Tolerance 0.01%: SMLib's exact screw sweep") + + "; as 017 at the top end only: the 45 deg cone down to d3 = d - 2 (17/24) H = 8.160 (ISO 724) at z = 30, cut after the groove, lowers the stock's radius to r_f + (30 - z); " + "the bottom end stays as cut, the groove running out past it") +cT = 2.5 / math.tan(math.radians(30)) +def tr_volume(sections, P=4.0, crest=10.0, r3=7.75): + flat = P / 2 * (1 - t15) + m = lambda r: 1.0 if r <= r3 else 1 - (P - flat - (crest - r) * 2 * t15) / P + def ring(R): + return quad(lambda r: r, 0, min(R, r3)) + (quad(lambda r: r * m(r), r3, R, 64) if R > r3 else 0.0) + return 2 * PI * sum(quad(lambda z: ring(f(z)), z0, z1, 64) for z0, z1, f in sections) +trS = [cyl([0, 0, 0], 10, 24, body_name="Part")] +case(T6, "028-external-tr20x4-chamfer-30-deg-2.5-deep", "011's modelled Tr20x4 thread with chamfered ends at its own angle and depth: 30 deg to the axis, 2.5 mm in from the major diameter", + trS + [thr([10, 0, 12], designation="Tr20x4", tip="both", chamfer_angle="30 deg", chamfer_depth="2.5 mm")], + {"body_count": 1, "volume_mm3": tr_volume([(0, cT, lambda z: 7.5 + z * math.tan(math.radians(30))), (cT, 24 - cT, lambda z: 10.0), + (24 - cT, 24, lambda z: 7.5 + (24 - z) * math.tan(math.radians(30)))]), "tolerance": TOL_F}, + "ISO 2904 Tr20x4 (011): crest flat 0.366 P, minor d3 = 15.5. Averaged over the turn every meridian half-plane holds the same sections (a screw motion), so " + "V = 2 pi int int r m(r) dr dz over the stock's section, m = 1 - w(r)/P the tooth's share of a pitch (1 below the root r 7.75). Both ends are free: the chamfer, " + "axisymmetric and cut after the groove, lowers the stock's radius to 7.5 + y tan30 at y mm from each end (the cone at 30 deg to the axis through d_f = d - 2 x 2.5 = 15, " + "below the root, so a whole ring is left on the end), reaching the major 4.330 mm in") +case(T6, "029-external-tr20x4-chamfer-needs-depth", "011's Tr20x4 thread with a chamfered tip and no depth: refused, ISO 4753 is for metric threads", + trS + [thr([10, 0, 12], designation="Tr20x4", tip="both")], {"outcome": "refused", "refusal": "ISO 4753's chamfered end is for ISO metric threads"}, + "ISO 4753's chamfered end (d_f at most the external minor diameter, ISO 724's d3) is defined for ISO metric threads only: a trapezoidal thread has no standard chamfer depth, " + "so without `chamfer_depth` there is no right answer and the thread must be refused, naming the depth to give", source="invariants") +case(T6, "030-square-thread-refused", "a square thread on a d10 x 30 cylinder: refused, no current standard defines one", + cylT + [thr([5, 0, 15], form="square")], {"outcome": "refused", "refusal": "no current standard defines a square thread"}, + "ISO, ASME and DIN define no square thread (Machinery's Handbook gives only historical proportions), so no dimension of it can be taken from a standard: the right answer " + "is a refusal pointing to trapezoidal (ISO 2904) or acme (ASME B1.5)", source="invariants") + # ---------------------------------------------------------------- 07 fillets F = lambda edges, r, **p: C("solid.fillet", edges=edges, radius=r, **p) case(T7, "001-single-edge-r5", "an r5 round on the stock's top front edge", [F([[30, 0, 20]], 5)], diff --git a/tools/kernel-ladder/ladder_lib.py b/tools/kernel-ladder/ladder_lib.py index 406b4814d..714523c26 100644 --- a/tools/kernel-ladder/ladder_lib.py +++ b/tools/kernel-ladder/ladder_lib.py @@ -182,3 +182,62 @@ def cyclic_spline(P): (P[j][k] - P[i][k]) / h[i] + (-(3 * a * a - 1) * M[k][i] + (3 * c * c - 1) * M[k][j]) * h[i] / 6) for k in range(2)) return h[i], f return [span(i) for i in range(n)] + +def clip_half(poly, a, b, c): + """The part of a convex polygon [(x, y)] where a x + b y + c <= 0 (Sutherland-Hodgman).""" + out = [] + n = len(poly) + for i in range(n): + p, q = poly[i], poly[(i + 1) % n] + fp, fq = a * p[0] + b * p[1] + c, a * q[0] + b * q[1] + c + if fp <= 0: + out.append(p) + if (fp < 0 < fq) or (fq < 0 < fp): + s = fp / (fp - fq) + out.append((p[0] + s * (q[0] - p[0]), p[1] + s * (q[1] - p[1]))) + return out + +def moment_r(poly): + """int int r dA over a polygon in the (r, z) half-plane: what a ring of that section holds, over 2 pi.""" + m = 0.0 + for i in range(len(poly)): + (x0, y0), (x1, y1) = poly[i], poly[(i + 1) % len(poly)] + m += (x0 + x1) * (x0 * y1 - x1 * y0) + return abs(m) / 6 + +def sweep_removed(section, z0, lead, turns, rate, regions, panels_per_turn=400): + """What a screw sweep removes from an axisymmetric solid: `section` [(r, dz)] (convex, about the + axial position z0), carried `turns` turns rising `lead` a turn and moving `rate` mm a turn off + the axis (a taper); the solid is the union of disjoint convex `regions`, each a list of + half-planes (a, b, c): a r + b z + c <= 0. A point (rho, zeta) of the section at turn t is at + r = rho + rate t, z = z0 + zeta + lead t, so the volume element is 2 pi r dA dt (the map's + Jacobian), and V = 2 pi int_0^turns (int int_{section_t within the solid} r dA) dt, exact while + successive turns don't overlap (the groove is narrower than the lead). Gauss-Legendre on + panels: the integrand is piecewise polynomial in t.""" + def at(t): + placed = [(r + rate * t, z0 + dz + lead * t) for r, dz in section] + total = 0.0 + for hp in regions: + p = placed + for a, b, c in hp: + p = clip_half(p, a, b, c) + if len(p) < 3: + break + if len(p) >= 3: + total += moment_r(p) + return total + pieces = max(1, int(math.ceil(turns * panels_per_turn))) + return 2 * PI * quad_split(at, 0.0, turns, pieces, 6) + +def groove_section(P, flat, crest, flank_lo, flank_hi, r_root, r_far, internal=False): + """A thread groove's axial section [(r, dz)] between r_root (its root) and r_far (past the crest, + out of the material), its root flat centred on dz = 0: the tooth is `flat` wide at the crest + radius and both walls are straight flanks (flank_lo toward -z, flank_hi toward +z, degrees + from the radial).""" + tl, th = math.tan(math.radians(flank_lo)), math.tan(math.radians(flank_hi)) + w_root = P - flat - abs(crest - r_root) * (tl + th) + def ext(r): + d = abs(r - r_root) + return w_root / 2 + d * tl, w_root / 2 + d * th + (l0, h0), (l1, h1) = ext(r_root), ext(r_far) + return [(r_root, -l0), (r_far, -l1), (r_far, h1), (r_root, h0)] From 014a9eced527f4b4e9dda49085cbc0a6894a2689 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:48:54 -0400 Subject: [PATCH 094/108] Kernel rig: a flat_pattern field grades a sheet metal case's flat pattern From the script's last sheet.flat_pattern result: the outline's size, its area less the cut-outs', and the bend lines, each matched to its own one of the result's either way round. Co-Authored-By: Claude Opus 5.5 --- apps/solidcraft-cli/src/kernel_cases.rs | 81 +++++++++++++++++++++++++ tests/kernel-cases/README.md | 3 +- 2 files changed, 83 insertions(+), 1 deletion(-) diff --git a/apps/solidcraft-cli/src/kernel_cases.rs b/apps/solidcraft-cli/src/kernel_cases.rs index 563294759..12fd7c339 100644 --- a/apps/solidcraft-cli/src/kernel_cases.rs +++ b/apps/solidcraft-cli/src/kernel_cases.rs @@ -583,6 +583,61 @@ fn case_name(dir: &str) -> (String, String) { (name(p.parent()), name(Some(p))) } +/// The area a polygon of `[x, y]` points encloses (shoelace), unsigned. +fn polygon_area(points: &Value) -> f64 { + let pts: Vec<(f64, f64)> = points.as_array().into_iter().flatten().filter_map(|p| Some((p.get(0)?.as_f64()?, p.get(1)?.as_f64()?))).collect(); + pts.iter().zip(pts.iter().cycle().skip(1)).map(|(a, b)| a.0 * b.1 - b.0 * a.1).sum::().abs() / 2.0 +} + +/// The `flat_pattern` check, against the script's last `sheet.flat_pattern` result: `size_mm` +/// ([w, h] of the outline), `area_mm2` (the outline loops' area less the cut-outs') and +/// `bend_lines` ([[x, y], [x, y]] each, the bends' centre lines in flat coordinates, every one +/// matched to its own one of the result's, either way round, and as many of them). +fn flat_pattern_checks(c: &mut Checks, want: &Value, results: &[Value], rel: f64, abs: f64) { + let Some(got) = results.iter().rev().find(|r| r.get("flat_size_mm").is_some()) else { + c.push("flat_pattern", json!("no sheet.flat_pattern result"), want.clone(), false); + return; + }; + if let Some(w) = want.get("size_mm").and_then(Value::as_array) { + let g = &got["flat_size_mm"]; + let ok = w.len() == 2 + && (0..2).all(|k| match (g.get(k).and_then(Value::as_f64), w.get(k).and_then(Value::as_f64)) { + (Some(g), Some(w)) => (g - w).abs() <= abs, + _ => false, + }); + c.push("flat_pattern.size_mm", json!([g.get(0), g.get(1)]), json!(w), ok); + } + if let Some(w) = want.get("area_mm2").and_then(Value::as_f64) { + let loops = |k: &str| got[k].as_array().into_iter().flatten().map(polygon_area).sum::(); + c.rel("flat_pattern.area_mm2", loops("outline") - loops("cutouts"), Some(w), rel); + } + if let Some(w) = want.get("bend_lines").and_then(Value::as_array) { + let line = |v: &Value| -> Option<[f64; 4]> { + let (a, b) = (v.get(0)?, v.get(1)?); + Some([a.get(0)?.as_f64()?, a.get(1)?.as_f64()?, b.get(0)?.as_f64()?, b.get(1)?.as_f64()?]) + }; + let mut left: Vec<[f64; 4]> = got["bends"] + .as_array() + .into_iter() + .flatten() + .filter_map(|b| line(&json!([b["start"], b["end"]]))) + .collect(); + let got_lines = json!(left.iter().map(|l| [[l[0], l[1]], [l[2], l[3]]]).collect::>()); + let near = |p: [f64; 4], q: [f64; 4]| (0..4).all(|k| (p[k] - q[k]).abs() <= abs); + let mut ok = left.len() == w.len(); + for l in w.iter().map(line) { + let found = l.and_then(|l| left.iter().position(|g| near(*g, l) || near(*g, [l[2], l[3], l[0], l[1]]))); + match found { + Some(i) => { + left.swap_remove(i); + } + None => ok = false, + } + } + c.push("flat_pattern.bend_lines", got_lines, json!(w), ok); + } +} + fn check_case(dir: &str, dumps: Option<&std::path::Path>) -> Value { let (area, name) = case_name(dir); let mut out = json!({"case": name, "area": area, "kernel": kernel()}); @@ -852,6 +907,9 @@ fn check_case(dir: &str, dumps: Option<&std::path::Path>) -> Value { if has("construction") { check_construction(&s, &want["construction"], pos_tol, &mut c); } + if has("flat_pattern") { + flat_pattern_checks(&mut c, &want["flat_pattern"], &answers, rel, abs); + } out["status"] = json!(if c.pass { "pass" } else { "fail" }); out["checks"] = json!(c.list); out @@ -1111,4 +1169,27 @@ mod tests { assert!(script(&a, "/scratch", &r).unwrap_err().contains("deeper than")); let _ = std::fs::remove_dir_all(&root); } + + /// The flat pattern is graded on the last `sheet.flat_pattern` result: its size, its outline's + /// area less the cut-outs', and its bend lines matched either way round, one for one. + #[test] + fn flat_pattern_grades_size_area_and_bend_lines() { + let flat = json!({"flat_size_mm": [10.0, 4.0, 2.0], + "outline": [[[0.0, 0.0], [10.0, 0.0], [10.0, 4.0], [0.0, 4.0]]], "cutouts": [[[1.0, 1.0], [2.0, 1.0], [2.0, 2.0], [1.0, 2.0]]], + "bends": [{"start": [5.0, 0.0], "end": [5.0, 4.0]}]}); + let results = [json!({"volume_mm3": 1.0}), flat]; + let grade = |want: Value| { + let mut c = Checks { list: Vec::new(), pass: true }; + flat_pattern_checks(&mut c, &want, &results, 1e-3, 1e-3); + c.pass + }; + assert!(grade(json!({"size_mm": [10.0, 4.0], "area_mm2": 39.0, "bend_lines": [[[5.0, 4.0], [5.0, 0.0]]]}))); + assert!(!grade(json!({"area_mm2": 40.0})), "the cut-out is not material"); + assert!(!grade(json!({"size_mm": [10.0, 5.0]}))); + assert!(!grade(json!({"bend_lines": [[[5.0, 0.0], [5.0, 4.0]], [[5.0, 0.0], [5.0, 4.0]]]})), "one bend line matches one only"); + assert!(!grade(json!({"bend_lines": [[[6.0, 0.0], [6.0, 4.0]]]}))); + let mut c = Checks { list: Vec::new(), pass: true }; + flat_pattern_checks(&mut c, &json!({"area_mm2": 1.0}), &results[..1], 1e-3, 1e-3); + assert!(!c.pass, "no flat pattern was made"); + } } diff --git a/tests/kernel-cases/README.md b/tests/kernel-cases/README.md index f993d12fc..1c2209c6c 100644 --- a/tests/kernel-cases/README.md +++ b/tests/kernel-cases/README.md @@ -105,6 +105,7 @@ the frozen truck-geometry PRs, a `kernel-paused` PR), for the report's coverage | `surface_types` | The set of kinds the faces' surfaces are, over every body, as the records hold them: `plane`, `cylinder`, `cone`, `sphere`, `torus`, `bspline` (a B-spline or NURBS surface) or `revolution` (a revolved curve). Exact: none missing, none extra. | | `splines` | `[{degree: [p, q], spans?: [m, n]}, …]`: one entry per B-spline face, each matching one face (directions in either order); `spans`, the distinct knot intervals each way, only where the construction fixes them. | | `boundary_edges` | The edges only one face uses (a sheet's free boundary), over every body, as the records hold them; exact or `[min, max]`. | +| `flat_pattern` | A sheet metal case's flat pattern, from the script's last `sheet.flat_pattern` result: `size_mm` ([w, h] of the outline), `area_mm2` (the outline's area less the cut-outs', relative tolerance as volume) and `bend_lines` (each `[[x, y], [x, y]]`, a bend's centre line in flat coordinates, matched one for one, either way round, and as many as the result has), positions within the box-diagonal tolerance. | | `watertight` | `true`: each body's display mesh (chord tolerance `tolerance.mesh_mm`, default 0.01 mm) has no open and no over-shared edges, with vertices closer than `tolerance.weld_mm` (default 1e-4 mm) taken as one. | | `timeout_s` | A longer timeout for this case than the run's (at most 1800 s), for cases that are slow by nature. A case that only needs it on a loaded machine shouldn't set it. | | `tolerance` | Optional overrides: `rel`, `abs_mm`, `mesh_mm`, `weld_mm`. | @@ -188,7 +189,7 @@ check on any change to `crates/engine/src/cmd/`, a recipe or `EXEMPT`, even when `ladder/` orders kernel operations by complexity instead of by where they went wrong: tiers from primitives through degenerate booleans, analytic and spline profiles, holes and taps, threads, -fillets, chamfers, shells, patterns, to whole parts. Later tiers build on earlier tiers' shapes (a +fillets, chamfers, shells, patterns, whole parts, and sheet metal. Later tiers build on earlier tiers' shapes (a running part grows one tier at a time through `base`), so the last case carries everything. - `ladder///`: cases in the format above, each a test with its own answer. From 779532f63a71372b93d564a77ef91e4d3b798a1e Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:48:54 -0400 Subject: [PATCH 095/108] Ladder 12: sheet metal, from a base flange to a bracket with a lip, each answer from its flat area Base flange; an edge flange at 90 deg; four made together, the corners closed on the mitre plane with the rule's gap, at 90, 72 (leaning out, the ends run on along a slant) and 108 deg (leaning in, cut back); round, rectangular and tear reliefs; a hem; a fold, unfolded and refolded; the tray's flat pattern (outline size and area, bend lines); a bracket with a hole and a flange on a flange. K = 0.5, so every volume is T x the flat area. The 108 deg tray is a sheet-metal rig case too. Co-Authored-By: Claude Opus 5.5 --- .../001-base-flange/expected.json | 24 +++ .../001-base-flange/recipe.json | 46 ++++++ .../002-edge-flange-90/expected.json | 21 +++ .../002-edge-flange-90/recipe.json | 20 +++ .../expected.json | 20 +++ .../recipe.json | 36 +++++ .../expected.json | 20 +++ .../recipe.json | 35 +++++ .../expected.json | 20 +++ .../recipe.json | 35 +++++ .../006-corner-relief-round/expected.json | 20 +++ .../006-corner-relief-round/recipe.json | 37 +++++ .../expected.json | 20 +++ .../007-corner-relief-rectangular/recipe.json | 37 +++++ .../008-corner-relief-tear/expected.json | 20 +++ .../008-corner-relief-tear/recipe.json | 36 +++++ .../009-hem-on-the-back-edge/expected.json | 20 +++ .../009-hem-on-the-back-edge/recipe.json | 19 +++ .../12-sheet-metal/010-fold-90/expected.json | 21 +++ .../12-sheet-metal/010-fold-90/recipe.json | 23 +++ .../011-fold-unfolded/expected.json | 20 +++ .../011-fold-unfolded/recipe.json | 9 ++ .../012-fold-refolded/expected.json | 21 +++ .../012-fold-refolded/recipe.json | 9 ++ .../013-flat-pattern/expected.json | 57 +++++++ .../013-flat-pattern/recipe.json | 9 ++ .../12-sheet-metal/014-bracket/expected.json | 20 +++ .../12-sheet-metal/014-bracket/recipe.json | 46 ++++++ tests/kernel-cases/ladder/ladder.json | 20 +++ .../expected.json | 20 +++ .../recipe.json | 76 ++++++++++ tools/kernel-ladder/cases.py | 141 +++++++++++++++++- 32 files changed, 976 insertions(+), 2 deletions(-) create mode 100644 tests/kernel-cases/ladder/12-sheet-metal/001-base-flange/expected.json create mode 100644 tests/kernel-cases/ladder/12-sheet-metal/001-base-flange/recipe.json create mode 100644 tests/kernel-cases/ladder/12-sheet-metal/002-edge-flange-90/expected.json create mode 100644 tests/kernel-cases/ladder/12-sheet-metal/002-edge-flange-90/recipe.json create mode 100644 tests/kernel-cases/ladder/12-sheet-metal/003-four-flanges-90-closed-corners/expected.json create mode 100644 tests/kernel-cases/ladder/12-sheet-metal/003-four-flanges-90-closed-corners/recipe.json create mode 100644 tests/kernel-cases/ladder/12-sheet-metal/004-four-flanges-72-leaning-out/expected.json create mode 100644 tests/kernel-cases/ladder/12-sheet-metal/004-four-flanges-72-leaning-out/recipe.json create mode 100644 tests/kernel-cases/ladder/12-sheet-metal/005-four-flanges-108-leaning-in/expected.json create mode 100644 tests/kernel-cases/ladder/12-sheet-metal/005-four-flanges-108-leaning-in/recipe.json create mode 100644 tests/kernel-cases/ladder/12-sheet-metal/006-corner-relief-round/expected.json create mode 100644 tests/kernel-cases/ladder/12-sheet-metal/006-corner-relief-round/recipe.json create mode 100644 tests/kernel-cases/ladder/12-sheet-metal/007-corner-relief-rectangular/expected.json create mode 100644 tests/kernel-cases/ladder/12-sheet-metal/007-corner-relief-rectangular/recipe.json create mode 100644 tests/kernel-cases/ladder/12-sheet-metal/008-corner-relief-tear/expected.json create mode 100644 tests/kernel-cases/ladder/12-sheet-metal/008-corner-relief-tear/recipe.json create mode 100644 tests/kernel-cases/ladder/12-sheet-metal/009-hem-on-the-back-edge/expected.json create mode 100644 tests/kernel-cases/ladder/12-sheet-metal/009-hem-on-the-back-edge/recipe.json create mode 100644 tests/kernel-cases/ladder/12-sheet-metal/010-fold-90/expected.json create mode 100644 tests/kernel-cases/ladder/12-sheet-metal/010-fold-90/recipe.json create mode 100644 tests/kernel-cases/ladder/12-sheet-metal/011-fold-unfolded/expected.json create mode 100644 tests/kernel-cases/ladder/12-sheet-metal/011-fold-unfolded/recipe.json create mode 100644 tests/kernel-cases/ladder/12-sheet-metal/012-fold-refolded/expected.json create mode 100644 tests/kernel-cases/ladder/12-sheet-metal/012-fold-refolded/recipe.json create mode 100644 tests/kernel-cases/ladder/12-sheet-metal/013-flat-pattern/expected.json create mode 100644 tests/kernel-cases/ladder/12-sheet-metal/013-flat-pattern/recipe.json create mode 100644 tests/kernel-cases/ladder/12-sheet-metal/014-bracket/expected.json create mode 100644 tests/kernel-cases/ladder/12-sheet-metal/014-bracket/recipe.json create mode 100644 tests/kernel-cases/sheet-metal/cov-flange-four-edges-leaning-in-108-closed/expected.json create mode 100644 tests/kernel-cases/sheet-metal/cov-flange-four-edges-leaning-in-108-closed/recipe.json diff --git a/tests/kernel-cases/ladder/12-sheet-metal/001-base-flange/expected.json b/tests/kernel-cases/ladder/12-sheet-metal/001-base-flange/expected.json new file mode 100644 index 000000000..319b75d6e --- /dev/null +++ b/tests/kernel-cases/ladder/12-sheet-metal/001-base-flange/expected.json @@ -0,0 +1,24 @@ +{ + "sources": [], + "what": "a 100 x 60 base flange, 2 mm sheet", + "source": "analytic", + "method": "the sketch's rectangle extruded the rule's 2 mm up: V = 100 60 2, A = 2 (100 60 + 100 2 + 60 2); a box's 6 faces, 12 edges, 8 vertices", + "body_count": 1, + "volume_mm3": 12000.0, + "area_mm2": 12640.0, + "faces": 6, + "edges": 12, + "vertices": 8, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 100.0, + 60.0, + 2.0 + ] + } +} diff --git a/tests/kernel-cases/ladder/12-sheet-metal/001-base-flange/recipe.json b/tests/kernel-cases/ladder/12-sheet-metal/001-base-flange/recipe.json new file mode 100644 index 000000000..1a550e3d1 --- /dev/null +++ b/tests/kernel-cases/ladder/12-sheet-metal/001-base-flange/recipe.json @@ -0,0 +1,46 @@ +{ + "commands": [ + { + "command": "sheet.manage_rules", + "params": { + "name": "Sheet 2 mm", + "thickness": "2 mm", + "active": true, + "bend_radius": "1 mm", + "k_factor": 0.5, + "gap": "0.5 mm" + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Base" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 100.0, + 60.0 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "sheet.flange", + "params": { + "type": "base", + "sketch": "Base" + } + } + ] +} diff --git a/tests/kernel-cases/ladder/12-sheet-metal/002-edge-flange-90/expected.json b/tests/kernel-cases/ladder/12-sheet-metal/002-edge-flange-90/expected.json new file mode 100644 index 000000000..35dc12d86 --- /dev/null +++ b/tests/kernel-cases/ladder/12-sheet-metal/002-edge-flange-90/expected.json @@ -0,0 +1,21 @@ +{ + "sources": [], + "what": "a 20 mm 90 deg edge flange along the base's front edge", + "source": "analytic", + "method": "T = 2, R = 1, K = 0.5, the corner gap g = 0.5. A bend zone is BA = theta (R + K T) wide in the flat; folded it is an annular sector holding theta T (R + T/2) a mm of bend, T BA with K = 0.5, and every panel moves rigidly, so V = T x the flat area. An edge flange's outer virtual sharp is on the picked edge: the base is cut back s0 = (R + T) tan(theta/2), the bend starts there, and its panel is H - s0 long (H from the sharp along the outer face). At 90 deg s0 = 3 and BA = pi: the base keeps 100 x 57, the bend pi x 100, the panel 17 x 100; V = 2 (5700 + 100 pi + 1700). The flange's outer face is flush with the edge (y = 0) and reaches z = 20. Faces: base top and bottom, its three free ends, the bend's two cylinders, the flange's inner and outer faces and its top: 10, each end of the L (x = 0, x = 100) one plane", + "body_count": 1, + "volume_mm3": 15428.318530718, + "faces": 10, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 100.0, + 60.0, + 20.0 + ] + } +} diff --git a/tests/kernel-cases/ladder/12-sheet-metal/002-edge-flange-90/recipe.json b/tests/kernel-cases/ladder/12-sheet-metal/002-edge-flange-90/recipe.json new file mode 100644 index 000000000..bbfdf4561 --- /dev/null +++ b/tests/kernel-cases/ladder/12-sheet-metal/002-edge-flange-90/recipe.json @@ -0,0 +1,20 @@ +{ + "base": "../../12-sheet-metal/001-base-flange", + "commands": [ + { + "command": "sheet.flange", + "params": { + "type": "edge", + "edges": [ + [ + 50.0, + 0, + 2.0 + ] + ], + "height": 20.0, + "angle": 90 + } + } + ] +} diff --git a/tests/kernel-cases/ladder/12-sheet-metal/003-four-flanges-90-closed-corners/expected.json b/tests/kernel-cases/ladder/12-sheet-metal/003-four-flanges-90-closed-corners/expected.json new file mode 100644 index 000000000..82cf7c661 --- /dev/null +++ b/tests/kernel-cases/ladder/12-sheet-metal/003-four-flanges-90-closed-corners/expected.json @@ -0,0 +1,20 @@ +{ + "sources": [], + "what": "20 mm 90 deg flanges on all four edges, made together: the corners close with the rule's gap, notch relief", + "source": "analytic", + "method": "T = 2, R = 1, K = 0.5, the corner gap g = 0.5. A bend zone is BA = theta (R + K T) wide in the flat; folded it is an annular sector holding theta T (R + T/2) a mm of bend, T BA with K = 0.5, and every panel moves rigidly, so V = T x the flat area. An edge flange's outer virtual sharp is on the picked edge: the base is cut back s0 = (R + T) tan(theta/2), the bend starts there, and its panel is H - s0 long (H from the sharp along the outer face). Closing a corner (sheet.rs close_corner): every point of a panel's end keeps g/2 from the plane halving the two flanges' inner faces. For the flange on y = 0, its bend along x from the corner (s0, s0), a point s up its panel (rigid, turned theta about the bend axis T + R up) on the face z of the sheet keeps that distance from x = s0 - R sin(theta) - s cos(theta) + g/sqrt2 + (T - z) sin(theta) on; the inner face z = T needs least, so the end is the line x = s0 - e - s cos(theta), e = R sin(theta) - g/sqrt2: the panel runs on e past its bend's end at its foot and a further cos(theta) per mm up it (outward below 90 deg, cut back above). Each panel is the trapezoid leg x (L + 2e + leg cos(theta)), its bend BA x L, L the base's edge less 2 s0 (the bend ends square at the corner). At 90 deg: s0 = 3, BA = pi, leg 17, e = 1 - g/sqrt2 = 0.646447 (the panel ends T + g/sqrt2 short of the other's outer face line, gap g between the inner edges), no slant. Base 94 x 54, bends pi (2 94 + 2 54), panels 17 (2 (94 + 2e) + 2 (54 + 2e)); V = 2 x that = 22251.656329. The walls' outer faces stand on the edges: bbox 100 x 60 x 20. The notch relief cuts nothing: the bends end square at the corners", + "body_count": 1, + "volume_mm3": 22251.656328684, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 100.0, + 60.0, + 20.0 + ] + } +} diff --git a/tests/kernel-cases/ladder/12-sheet-metal/003-four-flanges-90-closed-corners/recipe.json b/tests/kernel-cases/ladder/12-sheet-metal/003-four-flanges-90-closed-corners/recipe.json new file mode 100644 index 000000000..9d61187c0 --- /dev/null +++ b/tests/kernel-cases/ladder/12-sheet-metal/003-four-flanges-90-closed-corners/recipe.json @@ -0,0 +1,36 @@ +{ + "base": "../../12-sheet-metal/001-base-flange", + "commands": [ + { + "command": "sheet.flange", + "params": { + "type": "edge", + "edges": [ + [ + 50.0, + 0, + 2.0 + ], + [ + 100.0, + 30.0, + 2.0 + ], + [ + 50.0, + 60.0, + 2.0 + ], + [ + 0, + 30.0, + 2.0 + ] + ], + "height": 20.0, + "angle": 90, + "corner_relief_shape": "notch" + } + } + ] +} diff --git a/tests/kernel-cases/ladder/12-sheet-metal/004-four-flanges-72-leaning-out/expected.json b/tests/kernel-cases/ladder/12-sheet-metal/004-four-flanges-72-leaning-out/expected.json new file mode 100644 index 000000000..a54ea6d01 --- /dev/null +++ b/tests/kernel-cases/ladder/12-sheet-metal/004-four-flanges-72-leaning-out/expected.json @@ -0,0 +1,20 @@ +{ + "sources": [], + "what": "20 mm flanges at 72 deg on all four edges, made together and closed at the corners, leaning out: the panel ends run on along a slant", + "source": "analytic", + "method": "T = 2, R = 1, K = 0.5, the corner gap g = 0.5. A bend zone is BA = theta (R + K T) wide in the flat; folded it is an annular sector holding theta T (R + T/2) a mm of bend, T BA with K = 0.5, and every panel moves rigidly, so V = T x the flat area. An edge flange's outer virtual sharp is on the picked edge: the base is cut back s0 = (R + T) tan(theta/2), the bend starts there, and its panel is H - s0 long (H from the sharp along the outer face). Closing a corner (sheet.rs close_corner): every point of a panel's end keeps g/2 from the plane halving the two flanges' inner faces. For the flange on y = 0, its bend along x from the corner (s0, s0), a point s up its panel (rigid, turned theta about the bend axis T + R up) on the face z of the sheet keeps that distance from x = s0 - R sin(theta) - s cos(theta) + g/sqrt2 + (T - z) sin(theta) on; the inner face z = T needs least, so the end is the line x = s0 - e - s cos(theta), e = R sin(theta) - g/sqrt2: the panel runs on e past its bend's end at its foot and a further cos(theta) per mm up it (outward below 90 deg, cut back above). Each panel is the trapezoid leg x (L + 2e + leg cos(theta)), its bend BA x L, L the base's edge less 2 s0 (the bend ends square at the corner). At 72 deg: s0 = 3 tan36 = 2.179628, BA = 2.513274, leg 17.820372, e = 0.597503, the slant cos(theta) = 0.309017 a mm up. V = 2 x the flat area = 23902.891082. Bbox: the walls lean out: the outer face's far edge is H cos(theta) = 6.180340 outside each edge, and the inner face's far edge is highest, H sin(theta) + T cos(theta)", + "body_count": 1, + "volume_mm3": 23902.891082184, + "bbox": { + "min": [ + -6.180339887498949, + -6.180339887498949, + 0 + ], + "max": [ + 106.18033988749895, + 66.18033988749895, + 19.639164314652966 + ] + } +} diff --git a/tests/kernel-cases/ladder/12-sheet-metal/004-four-flanges-72-leaning-out/recipe.json b/tests/kernel-cases/ladder/12-sheet-metal/004-four-flanges-72-leaning-out/recipe.json new file mode 100644 index 000000000..91ded8e71 --- /dev/null +++ b/tests/kernel-cases/ladder/12-sheet-metal/004-four-flanges-72-leaning-out/recipe.json @@ -0,0 +1,35 @@ +{ + "base": "../../12-sheet-metal/001-base-flange", + "commands": [ + { + "command": "sheet.flange", + "params": { + "type": "edge", + "edges": [ + [ + 50.0, + 0, + 2.0 + ], + [ + 100.0, + 30.0, + 2.0 + ], + [ + 50.0, + 60.0, + 2.0 + ], + [ + 0, + 30.0, + 2.0 + ] + ], + "height": 20.0, + "angle": 72 + } + } + ] +} diff --git a/tests/kernel-cases/ladder/12-sheet-metal/005-four-flanges-108-leaning-in/expected.json b/tests/kernel-cases/ladder/12-sheet-metal/005-four-flanges-108-leaning-in/expected.json new file mode 100644 index 000000000..ff5f32d82 --- /dev/null +++ b/tests/kernel-cases/ladder/12-sheet-metal/005-four-flanges-108-leaning-in/expected.json @@ -0,0 +1,20 @@ +{ + "sources": [], + "what": "20 mm flanges at 108 deg on all four edges, made together and closed at the corners, leaning in over the base: the panel ends are cut back along a slant where they would overlap", + "source": "analytic", + "method": "T = 2, R = 1, K = 0.5, the corner gap g = 0.5. A bend zone is BA = theta (R + K T) wide in the flat; folded it is an annular sector holding theta T (R + T/2) a mm of bend, T BA with K = 0.5, and every panel moves rigidly, so V = T x the flat area. An edge flange's outer virtual sharp is on the picked edge: the base is cut back s0 = (R + T) tan(theta/2), the bend starts there, and its panel is H - s0 long (H from the sharp along the outer face). Closing a corner (sheet.rs close_corner): every point of a panel's end keeps g/2 from the plane halving the two flanges' inner faces. For the flange on y = 0, its bend along x from the corner (s0, s0), a point s up its panel (rigid, turned theta about the bend axis T + R up) on the face z of the sheet keeps that distance from x = s0 - R sin(theta) - s cos(theta) + g/sqrt2 + (T - z) sin(theta) on; the inner face z = T needs least, so the end is the line x = s0 - e - s cos(theta), e = R sin(theta) - g/sqrt2: the panel runs on e past its bend's end at its foot and a further cos(theta) per mm up it (outward below 90 deg, cut back above). Each panel is the trapezoid leg x (L + 2e + leg cos(theta)), its bend BA x L, L the base's edge less 2 s0 (the bend ends square at the corner). At 108 deg: s0 = 3 tan54 = 4.129146, BA = 3.769911, leg 15.870854, e = 0.597503, the slant cos(theta) = -0.309017 a mm up. V = 2 x the flat area = 20295.276640. Bbox: the walls lean in: what reaches furthest out is each bend's outer face a quarter turn in, s0 - (R + T) = 1.129146 inside the edge, and the outer face's far edge is highest, H sin(theta)", + "body_count": 1, + "volume_mm3": 20295.276640444, + "bbox": { + "min": [ + 1.1291457614135192, + 1.1291457614135192, + 0 + ], + "max": [ + 98.87085423858647, + 58.87085423858648, + 19.021130325903073 + ] + } +} diff --git a/tests/kernel-cases/ladder/12-sheet-metal/005-four-flanges-108-leaning-in/recipe.json b/tests/kernel-cases/ladder/12-sheet-metal/005-four-flanges-108-leaning-in/recipe.json new file mode 100644 index 000000000..824fdae34 --- /dev/null +++ b/tests/kernel-cases/ladder/12-sheet-metal/005-four-flanges-108-leaning-in/recipe.json @@ -0,0 +1,35 @@ +{ + "base": "../../12-sheet-metal/001-base-flange", + "commands": [ + { + "command": "sheet.flange", + "params": { + "type": "edge", + "edges": [ + [ + 50.0, + 0, + 2.0 + ], + [ + 100.0, + 30.0, + 2.0 + ], + [ + 50.0, + 60.0, + 2.0 + ], + [ + 0, + 30.0, + 2.0 + ] + ], + "height": 20.0, + "angle": 108 + } + } + ] +} diff --git a/tests/kernel-cases/ladder/12-sheet-metal/006-corner-relief-round/expected.json b/tests/kernel-cases/ladder/12-sheet-metal/006-corner-relief-round/expected.json new file mode 100644 index 000000000..54506ccea --- /dev/null +++ b/tests/kernel-cases/ladder/12-sheet-metal/006-corner-relief-round/expected.json @@ -0,0 +1,20 @@ +{ + "sources": [], + "what": "003's tray with a round corner relief 4 mm across at each corner", + "source": "analytic", + "method": "T = 2, R = 1, K = 0.5, the corner gap g = 0.5. A bend zone is BA = theta (R + K T) wide in the flat; folded it is an annular sector holding theta T (R + T/2) a mm of bend, T BA with K = 0.5, and every panel moves rigidly, so V = T x the flat area. An edge flange's outer virtual sharp is on the picked edge: the base is cut back s0 = (R + T) tan(theta/2), the bend starts there, and its panel is H - s0 long (H from the sharp along the outer face). A corner relief (sheet.rs plan_relief) is cut from the base at the corner of the bends, size/2 = r along both edges: a quarter disc (round) or an r x r square (rectangular) at a square corner; both bends then start r from the corner, and the panels keep the ends the closing gave them. r = 2: each corner takes pi r^2/4 = pi of the base and 2 mm of each of its two bends (2 BA = 2 pi); V = 2 (003's flat area - 4 x that - 8 x 2 pi)", + "body_count": 1, + "volume_mm3": 22125.99262254, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 100.0, + 60.0, + 20.0 + ] + } +} diff --git a/tests/kernel-cases/ladder/12-sheet-metal/006-corner-relief-round/recipe.json b/tests/kernel-cases/ladder/12-sheet-metal/006-corner-relief-round/recipe.json new file mode 100644 index 000000000..6a72ee25a --- /dev/null +++ b/tests/kernel-cases/ladder/12-sheet-metal/006-corner-relief-round/recipe.json @@ -0,0 +1,37 @@ +{ + "base": "../../12-sheet-metal/001-base-flange", + "commands": [ + { + "command": "sheet.flange", + "params": { + "type": "edge", + "edges": [ + [ + 50.0, + 0, + 2.0 + ], + [ + 100.0, + 30.0, + 2.0 + ], + [ + 50.0, + 60.0, + 2.0 + ], + [ + 0, + 30.0, + 2.0 + ] + ], + "height": 20.0, + "angle": 90, + "corner_relief_shape": "round", + "corner_relief": "4 mm" + } + } + ] +} diff --git a/tests/kernel-cases/ladder/12-sheet-metal/007-corner-relief-rectangular/expected.json b/tests/kernel-cases/ladder/12-sheet-metal/007-corner-relief-rectangular/expected.json new file mode 100644 index 000000000..3e550a311 --- /dev/null +++ b/tests/kernel-cases/ladder/12-sheet-metal/007-corner-relief-rectangular/expected.json @@ -0,0 +1,20 @@ +{ + "sources": [], + "what": "003's tray with a rectangular corner relief 4 mm across at each corner", + "source": "analytic", + "method": "T = 2, R = 1, K = 0.5, the corner gap g = 0.5. A bend zone is BA = theta (R + K T) wide in the flat; folded it is an annular sector holding theta T (R + T/2) a mm of bend, T BA with K = 0.5, and every panel moves rigidly, so V = T x the flat area. An edge flange's outer virtual sharp is on the picked edge: the base is cut back s0 = (R + T) tan(theta/2), the bend starts there, and its panel is H - s0 long (H from the sharp along the outer face). A corner relief (sheet.rs plan_relief) is cut from the base at the corner of the bends, size/2 = r along both edges: a quarter disc (round) or an r x r square (rectangular) at a square corner; both bends then start r from the corner, and the panels keep the ends the closing gave them. r = 2: each corner takes r^2 = 4 of the base and 2 mm of each of its two bends (2 BA = 2 pi); V = 2 (003's flat area - 4 x that - 8 x 2 pi)", + "body_count": 1, + "volume_mm3": 22119.125363769, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 100.0, + 60.0, + 20.0 + ] + } +} diff --git a/tests/kernel-cases/ladder/12-sheet-metal/007-corner-relief-rectangular/recipe.json b/tests/kernel-cases/ladder/12-sheet-metal/007-corner-relief-rectangular/recipe.json new file mode 100644 index 000000000..c5c74b429 --- /dev/null +++ b/tests/kernel-cases/ladder/12-sheet-metal/007-corner-relief-rectangular/recipe.json @@ -0,0 +1,37 @@ +{ + "base": "../../12-sheet-metal/001-base-flange", + "commands": [ + { + "command": "sheet.flange", + "params": { + "type": "edge", + "edges": [ + [ + 50.0, + 0, + 2.0 + ], + [ + 100.0, + 30.0, + 2.0 + ], + [ + 50.0, + 60.0, + 2.0 + ], + [ + 0, + 30.0, + 2.0 + ] + ], + "height": 20.0, + "angle": 90, + "corner_relief_shape": "rectangular", + "corner_relief": "4 mm" + } + } + ] +} diff --git a/tests/kernel-cases/ladder/12-sheet-metal/008-corner-relief-tear/expected.json b/tests/kernel-cases/ladder/12-sheet-metal/008-corner-relief-tear/expected.json new file mode 100644 index 000000000..9a2634f29 --- /dev/null +++ b/tests/kernel-cases/ladder/12-sheet-metal/008-corner-relief-tear/expected.json @@ -0,0 +1,20 @@ +{ + "sources": [], + "what": "003's tray with torn corners: the bends run to the corner and each end is cut straight, in the flat, to where its panel's end starts", + "source": "analytic", + "method": "T = 2, R = 1, K = 0.5, the corner gap g = 0.5. A bend zone is BA = theta (R + K T) wide in the flat; folded it is an annular sector holding theta T (R + T/2) a mm of bend, T BA with K = 0.5, and every panel moves rigidly, so V = T x the flat area. An edge flange's outer virtual sharp is on the picked edge: the base is cut back s0 = (R + T) tan(theta/2), the bend starts there, and its panel is H - s0 long (H from the sharp along the outer face). A torn corner (sheet.rs tear_corner) cuts nothing from the base: each bend zone's end runs straight from the corner, on its start line, to the panel's end at its far edge, e = 0.646447 further along (003's closing), so each torn end adds the triangle BA e / 2 to the bend zone; folded, the end is a helix and the column of sheet under each flat point still holds T of material (K = 0.5). V = 2 (003's flat area + 8 pi e / 2)", + "body_count": 1, + "volume_mm3": 22267.903304036, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 100.0, + 60.0, + 20.0 + ] + } +} diff --git a/tests/kernel-cases/ladder/12-sheet-metal/008-corner-relief-tear/recipe.json b/tests/kernel-cases/ladder/12-sheet-metal/008-corner-relief-tear/recipe.json new file mode 100644 index 000000000..cf3de279c --- /dev/null +++ b/tests/kernel-cases/ladder/12-sheet-metal/008-corner-relief-tear/recipe.json @@ -0,0 +1,36 @@ +{ + "base": "../../12-sheet-metal/001-base-flange", + "commands": [ + { + "command": "sheet.flange", + "params": { + "type": "edge", + "edges": [ + [ + 50.0, + 0, + 2.0 + ], + [ + 100.0, + 30.0, + 2.0 + ], + [ + 50.0, + 60.0, + 2.0 + ], + [ + 0, + 30.0, + 2.0 + ] + ], + "height": 20.0, + "angle": 90, + "corner_relief_shape": "tear" + } + } + ] +} diff --git a/tests/kernel-cases/ladder/12-sheet-metal/009-hem-on-the-back-edge/expected.json b/tests/kernel-cases/ladder/12-sheet-metal/009-hem-on-the-back-edge/expected.json new file mode 100644 index 000000000..16bd75a5c --- /dev/null +++ b/tests/kernel-cases/ladder/12-sheet-metal/009-hem-on-the-back-edge/expected.json @@ -0,0 +1,20 @@ +{ + "sources": [], + "what": "002's L with an 8 mm hem on the base's back edge, folded under it with a 1 mm inner radius", + "source": "analytic", + "method": "T = 2, R = 1, K = 0.5, the corner gap g = 0.5. A bend zone is BA = theta (R + K T) wide in the flat; folded it is an annular sector holding theta T (R + T/2) a mm of bend, T BA with K = 0.5, and every panel moves rigidly, so V = T x the flat area. An edge flange's outer virtual sharp is on the picked edge: the base is cut back s0 = (R + T) tan(theta/2), the bend starts there, and its panel is H - s0 long (H from the sharp along the outer face). A hem (sheet.rs add_hem) is a 180 deg bend starting at the edge, its inner radius the gap, folded under the face it is picked on (the top here, so down), its length to the outer face: the leg is 8 - (1 + 2) = 5 and BA = pi (1 + 1) = 2 pi. V = 2 (002's flat area + 100 (2 pi + 5)). Bbox: the bend's outer face reaches R + T = 3 past the edge (y 63) and, a half turn round its axis 1 mm under the base, down to z = -(2 R + T) = -4", + "body_count": 1, + "volume_mm3": 17684.955592154, + "bbox": { + "min": [ + 0, + 0, + -4.0 + ], + "max": [ + 100.0, + 63.0, + 20.0 + ] + } +} diff --git a/tests/kernel-cases/ladder/12-sheet-metal/009-hem-on-the-back-edge/recipe.json b/tests/kernel-cases/ladder/12-sheet-metal/009-hem-on-the-back-edge/recipe.json new file mode 100644 index 000000000..989de423b --- /dev/null +++ b/tests/kernel-cases/ladder/12-sheet-metal/009-hem-on-the-back-edge/recipe.json @@ -0,0 +1,19 @@ +{ + "base": "../../12-sheet-metal/002-edge-flange-90", + "commands": [ + { + "command": "sheet.hem", + "params": { + "edges": [ + [ + 50.0, + 60.0, + 2.0 + ] + ], + "length": 8.0, + "gap": 1.0 + } + } + ] +} diff --git a/tests/kernel-cases/ladder/12-sheet-metal/010-fold-90/expected.json b/tests/kernel-cases/ladder/12-sheet-metal/010-fold-90/expected.json new file mode 100644 index 000000000..0a4d4e1c2 --- /dev/null +++ b/tests/kernel-cases/ladder/12-sheet-metal/010-fold-90/expected.json @@ -0,0 +1,21 @@ +{ + "sources": [], + "what": "001's base folded 90 deg up along a sketch line across it at x = 70", + "source": "analytic", + "method": "T = 2, R = 1, K = 0.5, the corner gap g = 0.5. A bend zone is BA = theta (R + K T) wide in the flat; folded it is an annular sector holding theta T (R + T/2) a mm of bend, T BA with K = 0.5, and every panel moves rigidly, so V = T x the flat area. An edge flange's outer virtual sharp is on the picked edge: the base is cut back s0 = (R + T) tan(theta/2), the bend starts there, and its panel is H - s0 long (H from the sharp along the outer face). A fold (sheet.rs add_fold) takes its bend zone out of the sheet, so the flat stays 100 x 60 and V = 2 x 6000 = 12000. Centred on the line x = 70 the zone runs from 70 - pi/2; the larger side stays, the 30 mm side folds up 90 deg about the axis at x = 70 - pi/2, z = T + R: its outer face (the flat bottom) stands at x = 70 - pi/2 + R + T = 71.429204 and its panel, 30 - pi/2 long, rises from z = R + T to 31.429204. Faces as 002's L: 10", + "body_count": 1, + "volume_mm3": 12000.0, + "faces": 10, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 71.42920367320511, + 60.0, + 31.4292036732051 + ] + } +} diff --git a/tests/kernel-cases/ladder/12-sheet-metal/010-fold-90/recipe.json b/tests/kernel-cases/ladder/12-sheet-metal/010-fold-90/recipe.json new file mode 100644 index 000000000..59c7002f6 --- /dev/null +++ b/tests/kernel-cases/ladder/12-sheet-metal/010-fold-90/recipe.json @@ -0,0 +1,23 @@ +{ + "base": "../../12-sheet-metal/001-base-flange", + "commands": [ + { + "command": "sheet.fold", + "params": { + "points": [ + [ + 70, + 0, + 2.0 + ], + [ + 70, + 60.0, + 2.0 + ] + ], + "angle": 90 + } + } + ] +} diff --git a/tests/kernel-cases/ladder/12-sheet-metal/011-fold-unfolded/expected.json b/tests/kernel-cases/ladder/12-sheet-metal/011-fold-unfolded/expected.json new file mode 100644 index 000000000..5afba5caa --- /dev/null +++ b/tests/kernel-cases/ladder/12-sheet-metal/011-fold-unfolded/expected.json @@ -0,0 +1,20 @@ +{ + "sources": [], + "what": "010's fold unfolded: the flat 100 x 60 plate again", + "source": "analytic", + "method": "T = 2, R = 1, K = 0.5, the corner gap g = 0.5. A bend zone is BA = theta (R + K T) wide in the flat; folded it is an annular sector holding theta T (R + T/2) a mm of bend, T BA with K = 0.5, and every panel moves rigidly, so V = T x the flat area. An edge flange's outer virtual sharp is on the picked edge: the base is cut back s0 = (R + T) tan(theta/2), the bend starts there, and its panel is H - s0 long (H from the sharp along the outer face). A fold (sheet.rs add_fold) takes its bend zone out of the sheet, so the flat stays 100 x 60 and V = 2 x 6000 = 12000. Centred on the line x = 70 the zone runs from 70 - pi/2; the larger side stays, the 30 mm side folds up 90 deg about the axis at x = 70 - pi/2, z = T + R: its outer face (the flat bottom) stands at x = 70 - pi/2 + R + T = 71.429204 and its panel, 30 - pi/2 long, rises from z = R + T to 31.429204. Unfolded every panel lies in the base's plane where it was cut from: the 100 x 60 x 2 plate, the base in its place", + "body_count": 1, + "volume_mm3": 12000.0, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 100.0, + 60.0, + 2.0 + ] + } +} diff --git a/tests/kernel-cases/ladder/12-sheet-metal/011-fold-unfolded/recipe.json b/tests/kernel-cases/ladder/12-sheet-metal/011-fold-unfolded/recipe.json new file mode 100644 index 000000000..7333e020f --- /dev/null +++ b/tests/kernel-cases/ladder/12-sheet-metal/011-fold-unfolded/recipe.json @@ -0,0 +1,9 @@ +{ + "base": "../../12-sheet-metal/010-fold-90", + "commands": [ + { + "command": "sheet.unfold", + "params": {} + } + ] +} diff --git a/tests/kernel-cases/ladder/12-sheet-metal/012-fold-refolded/expected.json b/tests/kernel-cases/ladder/12-sheet-metal/012-fold-refolded/expected.json new file mode 100644 index 000000000..9e8a35e2a --- /dev/null +++ b/tests/kernel-cases/ladder/12-sheet-metal/012-fold-refolded/expected.json @@ -0,0 +1,21 @@ +{ + "sources": [], + "what": "011's flat refolded: 010's part again", + "source": "analytic", + "method": "T = 2, R = 1, K = 0.5, the corner gap g = 0.5. A bend zone is BA = theta (R + K T) wide in the flat; folded it is an annular sector holding theta T (R + T/2) a mm of bend, T BA with K = 0.5, and every panel moves rigidly, so V = T x the flat area. An edge flange's outer virtual sharp is on the picked edge: the base is cut back s0 = (R + T) tan(theta/2), the bend starts there, and its panel is H - s0 long (H from the sharp along the outer face). A fold (sheet.rs add_fold) takes its bend zone out of the sheet, so the flat stays 100 x 60 and V = 2 x 6000 = 12000. Centred on the line x = 70 the zone runs from 70 - pi/2; the larger side stays, the 30 mm side folds up 90 deg about the axis at x = 70 - pi/2, z = T + R: its outer face (the flat bottom) stands at x = 70 - pi/2 + R + T = 71.429204 and its panel, 30 - pi/2 long, rises from z = R + T to 31.429204. Refolding gives the folded part back: 010's numbers", + "body_count": 1, + "volume_mm3": 12000.0, + "faces": 10, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 71.42920367320511, + 60.0, + 31.4292036732051 + ] + } +} diff --git a/tests/kernel-cases/ladder/12-sheet-metal/012-fold-refolded/recipe.json b/tests/kernel-cases/ladder/12-sheet-metal/012-fold-refolded/recipe.json new file mode 100644 index 000000000..6c11a6947 --- /dev/null +++ b/tests/kernel-cases/ladder/12-sheet-metal/012-fold-refolded/recipe.json @@ -0,0 +1,9 @@ +{ + "base": "../../12-sheet-metal/011-fold-unfolded", + "commands": [ + { + "command": "sheet.refold", + "params": {} + } + ] +} diff --git a/tests/kernel-cases/ladder/12-sheet-metal/013-flat-pattern/expected.json b/tests/kernel-cases/ladder/12-sheet-metal/013-flat-pattern/expected.json new file mode 100644 index 000000000..e920ba735 --- /dev/null +++ b/tests/kernel-cases/ladder/12-sheet-metal/013-flat-pattern/expected.json @@ -0,0 +1,57 @@ +{ + "sources": [], + "what": "the flat pattern of 003's tray: its outline's size and area, and its four bend lines", + "source": "analytic", + "method": "T = 2, R = 1, K = 0.5, the corner gap g = 0.5. A bend zone is BA = theta (R + K T) wide in the flat; folded it is an annular sector holding theta T (R + T/2) a mm of bend, T BA with K = 0.5, and every panel moves rigidly, so V = T x the flat area. An edge flange's outer virtual sharp is on the picked edge: the base is cut back s0 = (R + T) tan(theta/2), the bend starts there, and its panel is H - s0 long (H from the sharp along the outer face). The flat pattern is drawn in the base's frame (the base in its place). Each flange lies flat past its edge: s0 back from it, then BA and the leg, so it reaches H - s0 + BA - s0 = 20 - BD = 17.141593 past the edge (BD = 2 (R + T) tan45 - BA = 6 - pi): the outline is (100 + 2 x that) x (60 + 2 x that), its area 003's flat area (11125.828164, the notched corners open). The bend lines are the bend zones' centre lines, BA/2 out from the cut-back edges: y = 3 - pi/2 and 57 + pi/2 from x = 3 to 97, x = 3 - pi/2 and 97 + pi/2 from y = 3 to 57", + "body_count": 1, + "volume_mm3": 22251.656328684, + "flat_pattern": { + "size_mm": [ + 134.2831853071796, + 94.2831853071796 + ], + "area_mm2": 11125.828164341892, + "bend_lines": [ + [ + [ + 2.9999999999999996, + 1.429203673205103 + ], + [ + 97.0, + 1.429203673205103 + ] + ], + [ + [ + 98.57079632679489, + 2.9999999999999996 + ], + [ + 98.57079632679489, + 57.0 + ] + ], + [ + [ + 2.9999999999999996, + 58.5707963267949 + ], + [ + 97.0, + 58.5707963267949 + ] + ], + [ + [ + 1.429203673205103, + 2.9999999999999996 + ], + [ + 1.429203673205103, + 57.0 + ] + ] + ] + } +} diff --git a/tests/kernel-cases/ladder/12-sheet-metal/013-flat-pattern/recipe.json b/tests/kernel-cases/ladder/12-sheet-metal/013-flat-pattern/recipe.json new file mode 100644 index 000000000..cd754ca9f --- /dev/null +++ b/tests/kernel-cases/ladder/12-sheet-metal/013-flat-pattern/recipe.json @@ -0,0 +1,9 @@ +{ + "base": "../../12-sheet-metal/003-four-flanges-90-closed-corners", + "commands": [ + { + "command": "sheet.flat_pattern", + "params": {} + } + ] +} diff --git a/tests/kernel-cases/ladder/12-sheet-metal/014-bracket/expected.json b/tests/kernel-cases/ladder/12-sheet-metal/014-bracket/expected.json new file mode 100644 index 000000000..4eab4fd12 --- /dev/null +++ b/tests/kernel-cases/ladder/12-sheet-metal/014-bracket/expected.json @@ -0,0 +1,20 @@ +{ + "sources": [], + "what": "a bracket: a 30 mm flange on the front edge, a 10 mm lip turned out on its far edge, a d10 hole through the base", + "source": "analytic", + "method": "T = 2, R = 1, K = 0.5, the corner gap g = 0.5. A bend zone is BA = theta (R + K T) wide in the flat; folded it is an annular sector holding theta T (R + T/2) a mm of bend, T BA with K = 0.5, and every panel moves rigidly, so V = T x the flat area. An edge flange's outer virtual sharp is on the picked edge: the base is cut back s0 = (R + T) tan(theta/2), the bend starts there, and its panel is H - s0 long (H from the sharp along the outer face). The flange (as 002, H 30) stands on y = 0 up to z = 30. The lip is picked on that flange's far edge on its outer face (y = 0), the panel's bottom face, so it bends down there, turning out over y < 0; its outer virtual sharp is on the edge (z = 30, y = 2, the flange's top-face plane), so the flange's panel is cut back s0 = 3 more (30 - 3 - 3 = 24) and the lip's outer face is the plane z = 30, its panel 10 - 3 = 7, reaching y = 2 - 10 = -8. The hole (d10 at (50, 35)) is a cut-out of the flat. V = 2 (100 57 + 100 pi + 100 24 + 100 pi + 100 7 - 25 pi). Bbox: x 0..100, y -8..60, z 0..30", + "body_count": 1, + "volume_mm3": 18699.557428756, + "bbox": { + "min": [ + 0, + -8.0, + 0 + ], + "max": [ + 100.0, + 60.0, + 30.0 + ] + } +} diff --git a/tests/kernel-cases/ladder/12-sheet-metal/014-bracket/recipe.json b/tests/kernel-cases/ladder/12-sheet-metal/014-bracket/recipe.json new file mode 100644 index 000000000..2228d2432 --- /dev/null +++ b/tests/kernel-cases/ladder/12-sheet-metal/014-bracket/recipe.json @@ -0,0 +1,46 @@ +{ + "base": "../../12-sheet-metal/001-base-flange", + "commands": [ + { + "command": "sheet.flange", + "params": { + "type": "edge", + "edges": [ + [ + 50.0, + 0, + 2.0 + ] + ], + "height": 30.0, + "angle": 90 + } + }, + { + "command": "sheet.flange", + "params": { + "type": "edge", + "edges": [ + [ + 50.0, + 0, + 30.0 + ] + ], + "height": 10.0, + "angle": 90 + } + }, + { + "command": "solid.hole", + "params": { + "position": [ + 50.0, + 35, + 2.0 + ], + "diameter": 10 + } + } + ] +} diff --git a/tests/kernel-cases/ladder/ladder.json b/tests/kernel-cases/ladder/ladder.json index 8d11e47e5..8f3002110 100644 --- a/tests/kernel-cases/ladder/ladder.json +++ b/tests/kernel-cases/ladder/ladder.json @@ -219,6 +219,26 @@ ], "tier": "11-cumulative-parts", "what": "parts combining every tier" + }, + { + "cases": [ + "ladder/12-sheet-metal/001-base-flange", + "ladder/12-sheet-metal/002-edge-flange-90", + "ladder/12-sheet-metal/003-four-flanges-90-closed-corners", + "ladder/12-sheet-metal/004-four-flanges-72-leaning-out", + "ladder/12-sheet-metal/005-four-flanges-108-leaning-in", + "ladder/12-sheet-metal/006-corner-relief-round", + "ladder/12-sheet-metal/007-corner-relief-rectangular", + "ladder/12-sheet-metal/008-corner-relief-tear", + "ladder/12-sheet-metal/009-hem-on-the-back-edge", + "ladder/12-sheet-metal/010-fold-90", + "ladder/12-sheet-metal/011-fold-unfolded", + "ladder/12-sheet-metal/012-fold-refolded", + "ladder/12-sheet-metal/013-flat-pattern", + "ladder/12-sheet-metal/014-bracket" + ], + "tier": "12-sheet-metal", + "what": "sheet metal: flanges, closed corners, reliefs, hems, folds and the flat pattern" } ], "what": "the kernel complexity ladder: tiers in order of complexity, each building on the shapes before it; cases within a tier in order of measured time (cargo xtask kernel-cases --ladder --record)" diff --git a/tests/kernel-cases/sheet-metal/cov-flange-four-edges-leaning-in-108-closed/expected.json b/tests/kernel-cases/sheet-metal/cov-flange-four-edges-leaning-in-108-closed/expected.json new file mode 100644 index 000000000..6a25495d8 --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-flange-four-edges-leaning-in-108-closed/expected.json @@ -0,0 +1,20 @@ +{ + "sources": [], + "what": "a 100 x 60 tray with four 20 mm flanges at 108 degrees (leaning in over the base), closed at the corners: the panel ends are cut back on a slant where they would overlap", + "source": "analytic", + "method": "T = 2, R = 1, K = 0.5, the corner gap g = 0.5. A bend zone is BA = theta (R + K T) wide in the flat; folded it is an annular sector holding theta T (R + T/2) a mm of bend, T BA with K = 0.5, and every panel moves rigidly, so V = T x the flat area. An edge flange's outer virtual sharp is on the picked edge: the base is cut back s0 = (R + T) tan(theta/2), the bend starts there, and its panel is H - s0 long (H from the sharp along the outer face). Closing a corner (sheet.rs close_corner): every point of a panel's end keeps g/2 from the plane halving the two flanges' inner faces. For the flange on y = 0, its bend along x from the corner (s0, s0), a point s up its panel (rigid, turned theta about the bend axis T + R up) on the face z of the sheet keeps that distance from x = s0 - R sin(theta) - s cos(theta) + g/sqrt2 + (T - z) sin(theta) on; the inner face z = T needs least, so the end is the line x = s0 - e - s cos(theta), e = R sin(theta) - g/sqrt2: the panel runs on e past its bend's end at its foot and a further cos(theta) per mm up it (outward below 90 deg, cut back above). Each panel is the trapezoid leg x (L + 2e + leg cos(theta)), its bend BA x L, L the base's edge less 2 s0 (the bend ends square at the corner). At 108 deg: s0 = 3 tan54 = 4.129146, BA = 3.769911, leg 15.870854, e = 0.597503, the slant cos(theta) = -0.309017 a mm up. V = 2 x the flat area = 20295.276640. Bbox: the walls lean in: what reaches furthest out is each bend's outer face a quarter turn in, s0 - (R + T) = 1.129146 inside the edge, and the outer face's far edge is highest, H sin(theta)", + "body_count": 1, + "volume_mm3": 20295.276640444, + "bbox": { + "min": [ + 1.1291457614135192, + 1.1291457614135192, + 0 + ], + "max": [ + 98.87085423858647, + 58.87085423858648, + 19.021130325903073 + ] + } +} diff --git a/tests/kernel-cases/sheet-metal/cov-flange-four-edges-leaning-in-108-closed/recipe.json b/tests/kernel-cases/sheet-metal/cov-flange-four-edges-leaning-in-108-closed/recipe.json new file mode 100644 index 000000000..6aa1254b0 --- /dev/null +++ b/tests/kernel-cases/sheet-metal/cov-flange-four-edges-leaning-in-108-closed/recipe.json @@ -0,0 +1,76 @@ +{ + "commands": [ + { + "command": "sheet.manage_rules", + "params": { + "name": "Sheet 2 mm", + "thickness": "2 mm", + "active": true, + "bend_radius": "1 mm", + "k_factor": 0.5, + "gap": "0.5 mm" + } + }, + { + "command": "sketch.create", + "params": { + "plane": "XY", + "name": "Base" + } + }, + { + "command": "sketch.rectangle.two_point", + "params": { + "p0": [ + 0, + 0 + ], + "p1": [ + 100.0, + 60.0 + ] + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "sheet.flange", + "params": { + "type": "base", + "sketch": "Base" + } + }, + { + "command": "sheet.flange", + "params": { + "type": "edge", + "edges": [ + [ + 50.0, + 0, + 2.0 + ], + [ + 100.0, + 30.0, + 2.0 + ], + [ + 50.0, + 60.0, + 2.0 + ], + [ + 0, + 30.0, + 2.0 + ] + ], + "height": 20.0, + "angle": 108 + } + } + ] +} diff --git a/tools/kernel-ladder/cases.py b/tools/kernel-ladder/cases.py index 9a6b3d49a..de836c8a2 100644 --- a/tools/kernel-ladder/cases.py +++ b/tools/kernel-ladder/cases.py @@ -1282,14 +1282,151 @@ case(T11, "004-housing", "the running part with every tier: back wall, boss, slo "10/008 less the M16 groove on the boss: its cylinder runs from the r1 root round (z 21, a shoulder: the groove stops w = %.6f clear of it) to the 1 mm top chamfer " "(z 29, run out through it, a free end); the groove's root r 6.917 stays outside the boss's 1.5 wall's inside (r 6.5), so it cuts the wall only. Bbox: the part's" % w16, base=C10) +# ---------------------------------------------------------------- 12 sheet metal +# A sheet body is its flat pattern (crates/doc/src/sheet.rs): the base, and per flange a bend zone +# BA = theta (R + K T) wide and its panel. Folded, a panel moves rigidly and a bend zone of +# thickness T becomes an annular sector, theta/2 ((R + T)^2 - R^2) per mm = theta T (R + T/2): with +# K = 0.5 that is T x BA, so the folded part holds exactly the flat area x T. Rule: T = 2, R = 1, +# K = 0.5, corner gap g = 0.5. An edge flange at the default position has its outer virtual sharp on +# the picked edge: the base is cut back s0 = (R + T) tan(theta/2) and the bend starts there; its +# height H runs from that sharp along the outer face, so the panel past the bend is H - s0 long. +T12 = "12-sheet-metal" +TS, RS, KS, GS = 2.0, 1.0, 0.5, 0.5 +WS, DS, HS = 100.0, 60.0, 20.0 +SQ2 = math.sqrt(2) +RULE = C("sheet.manage_rules", name="Sheet 2 mm", thickness="2 mm", active=True, bend_radius="1 mm", k_factor=KS, gap="0.5 mm") +def sm_ba(deg): + return math.radians(deg) * (RS + KS * TS) +def sm_s0(deg): + return (RS + TS) * math.tan(math.radians(deg) / 2) +SMETH = ("T = 2, R = 1, K = 0.5, the corner gap g = 0.5. A bend zone is BA = theta (R + K T) wide in the flat; folded it is an annular sector holding theta T (R + T/2) a mm " + "of bend, T BA with K = 0.5, and every panel moves rigidly, so V = T x the flat area. An edge flange's outer virtual sharp is on the picked edge: the base is cut " + "back s0 = (R + T) tan(theta/2), the bend starts there, and its panel is H - s0 long (H from the sharp along the outer face). ") +case(T12, "001-base-flange", "a 100 x 60 base flange, 2 mm sheet", [RULE] + sketch("XY", C("sketch.rectangle.two_point", p0=[0, 0], p1=[WS, DS]), name="Base") + + [C("sheet.flange", type="base", sketch="Base")], + {"body_count": 1, "volume_mm3": WS * DS * TS, "area_mm2": 2 * (WS * DS + WS * TS + DS * TS), "faces": 6, "edges": 12, "vertices": 8, + "bbox": {"min": [0, 0, 0], "max": [WS, DS, TS]}}, + "the sketch's rectangle extruded the rule's 2 mm up: V = 100 60 2, A = 2 (100 60 + 100 2 + 60 2); a box's 6 faces, 12 edges, 8 vertices") +S1 = up(T12, "001-base-flange") +ba90, s90 = sm_ba(90), sm_s0(90) +A2 = WS * (DS - s90) + WS * ba90 + WS * (HS - s90) +case(T12, "002-edge-flange-90", "a 20 mm 90 deg edge flange along the base's front edge", + [C("sheet.flange", type="edge", edges=[[WS / 2, 0, TS]], height=HS, angle=90)], + {"body_count": 1, "volume_mm3": TS * A2, "faces": 10, "bbox": {"min": [0, 0, 0], "max": [WS, DS, HS]}}, + SMETH + "At 90 deg s0 = 3 and BA = pi: the base keeps 100 x 57, the bend pi x 100, the panel 17 x 100; V = 2 (5700 + 100 pi + 1700). The flange's outer face is flush " + "with the edge (y = 0) and reaches z = 20. Faces: base top and bottom, its three free ends, the bend's two cylinders, the flange's inner and outer faces and its top: 10, " + "each end of the L (x = 0, x = 100) one plane", base=S1) +S2 = up(T12, "002-edge-flange-90") +FOUR = [[WS / 2, 0, TS], [WS, DS / 2, TS], [WS / 2, DS, TS], [0, DS / 2, TS]] +def tray_area(deg): + """The flat area of 001 with flanges H high at `deg` on all four edges, closed at the corners: each + panel end runs on (or is cut back) on the mitre plane halving the two inner faces, g/2 clear of it.""" + th = math.radians(deg) + s0, ba, leg = sm_s0(deg), sm_ba(deg), HS - sm_s0(deg) + ext = RS * math.sin(th) - GS / SQ2 + lens = [WS - 2 * s0, DS - 2 * s0] * 2 + base = (WS - 2 * s0) * (DS - 2 * s0) + return base + sum(ba * L + leg * (L + 2 * ext + leg * math.cos(th)) for L in lens), ext, s0, ba, leg +CORNER = ("Closing a corner (sheet.rs close_corner): every point of a panel's end keeps g/2 from the plane halving the two flanges' inner faces. For the flange on y = 0, " + "its bend along x from the corner (s0, s0), a point s up its panel (rigid, turned theta about the bend axis T + R up) on the face z of the sheet keeps that distance from " + "x = s0 - R sin(theta) - s cos(theta) + g/sqrt2 + (T - z) sin(theta) on; the inner face z = T needs least, so the end is the line x = s0 - e - s cos(theta), " + "e = R sin(theta) - g/sqrt2: the panel runs on e past its bend's end at its foot and a further cos(theta) per mm up it (outward below 90 deg, cut back above). " + "Each panel is the trapezoid leg x (L + 2e + leg cos(theta)), its bend BA x L, L the base's edge less 2 s0 (the bend ends square at the corner). ") +a3, e3, *_ = tray_area(90) +case(T12, "003-four-flanges-90-closed-corners", "20 mm 90 deg flanges on all four edges, made together: the corners close with the rule's gap, notch relief", + [C("sheet.flange", type="edge", edges=FOUR, height=HS, angle=90, corner_relief_shape="notch")], + {"body_count": 1, "volume_mm3": TS * a3, "bbox": {"min": [0, 0, 0], "max": [WS, DS, HS]}}, + SMETH + CORNER + "At 90 deg: s0 = 3, BA = pi, leg 17, e = 1 - g/sqrt2 = 0.646447 (the panel ends T + g/sqrt2 short of the other's outer face line, gap g between the " + "inner edges), no slant. Base 94 x 54, bends pi (2 94 + 2 54), panels 17 (2 (94 + 2e) + 2 (54 + 2e)); V = 2 x that = %.6f. The walls' outer faces stand on the " + "edges: bbox 100 x 60 x 20. The notch relief cuts nothing: the bends end square at the corners" % (TS * a3), base=S1) +S3 = up(T12, "003-four-flanges-90-closed-corners") +for name, deg, what in [("004-four-flanges-72-leaning-out", 72, "leaning out: the panel ends run on along a slant"), + ("005-four-flanges-108-leaning-in", 108, "leaning in over the base: the panel ends are cut back along a slant where they would overlap")]: + th = math.radians(deg) + a, e, s0, ba, leg = tray_area(deg) + if deg < 90: + lo, zmax = -HS * math.cos(th), HS * math.sin(th) + TS * math.cos(th) + bb = "the walls lean out: the outer face's far edge is H cos(theta) = %.6f outside each edge, and the inner face's far edge is highest, H sin(theta) + T cos(theta)" % -lo + else: + lo, zmax = s0 - (RS + TS), HS * math.sin(th) + bb = ("the walls lean in: what reaches furthest out is each bend's outer face a quarter turn in, s0 - (R + T) = %.6f inside the edge, and the outer face's far edge " + "is highest, H sin(theta)" % lo) + case(T12, name, "20 mm flanges at %d deg on all four edges, made together and closed at the corners, " % deg + what, + [C("sheet.flange", type="edge", edges=FOUR, height=HS, angle=deg)], + {"body_count": 1, "volume_mm3": TS * a, "bbox": {"min": [lo, lo, 0], "max": [WS - lo, DS - lo, zmax]}}, + SMETH + CORNER + "At %d deg: s0 = 3 tan%g = %.6f, BA = %.6f, leg %.6f, e = %.6f, the slant cos(theta) = %.6f a mm up. V = 2 x the flat area = %.6f. Bbox: %s" % + (deg, deg / 2, s0, ba, leg, e, math.cos(th), TS * a, bb), base=S1) +RELIEF = ("A corner relief (sheet.rs plan_relief) is cut from the base at the corner of the bends, size/2 = r along both edges: a quarter disc (round) or an r x r square " + "(rectangular) at a square corner; both bends then start r from the corner, and the panels keep the ends the closing gave them. ") +for name, shape, take, how in [("006-corner-relief-round", "round", PI * 4 / 4, "pi r^2/4 = pi"), ("007-corner-relief-rectangular", "rectangular", 4.0, "r^2 = 4")]: + case(T12, name, "003's tray with a %s corner relief 4 mm across at each corner" % shape, + [C("sheet.flange", type="edge", edges=FOUR, height=HS, angle=90, corner_relief_shape=shape, corner_relief="4 mm")], + {"body_count": 1, "volume_mm3": TS * (a3 - 4 * take - 8 * 2 * ba90), "bbox": {"min": [0, 0, 0], "max": [WS, DS, HS]}}, + SMETH + RELIEF + "r = 2: each corner takes %s of the base and 2 mm of each of its two bends (2 BA = 2 pi); V = 2 (003's flat area - 4 x that - 8 x 2 pi)" % how, base=S1) +case(T12, "008-corner-relief-tear", "003's tray with torn corners: the bends run to the corner and each end is cut straight, in the flat, to where its panel's end starts", + [C("sheet.flange", type="edge", edges=FOUR, height=HS, angle=90, corner_relief_shape="tear")], + {"body_count": 1, "volume_mm3": TS * (a3 + 4 * ba90 * e3), "bbox": {"min": [0, 0, 0], "max": [WS, DS, HS]}}, + SMETH + "A torn corner (sheet.rs tear_corner) cuts nothing from the base: each bend zone's end runs straight from the corner, on its start line, to the panel's end at its " + "far edge, e = %.6f further along (003's closing), so each torn end adds the triangle BA e / 2 to the bend zone; folded, the end is a helix and the column of sheet under each " + "flat point still holds T of material (K = 0.5). V = 2 (003's flat area + 8 pi e / 2)" % e3, base=S1) +hem_len, hem_gap = 8.0, 1.0 +hem_leg = hem_len - (hem_gap + TS) +case(T12, "009-hem-on-the-back-edge", "002's L with an 8 mm hem on the base's back edge, folded under it with a 1 mm inner radius", + [C("sheet.hem", edges=[[WS / 2, DS, TS]], length=hem_len, gap=hem_gap)], + {"body_count": 1, "volume_mm3": TS * (A2 + WS * (PI * (hem_gap + KS * TS) + hem_leg)), "bbox": {"min": [0, 0, -(2 * hem_gap + TS)], "max": [WS, DS + hem_gap + TS, HS]}}, + SMETH + "A hem (sheet.rs add_hem) is a 180 deg bend starting at the edge, its inner radius the gap, folded under the face it is picked on (the top here, so down), " + "its length to the outer face: the leg is 8 - (1 + 2) = 5 and BA = pi (1 + 1) = 2 pi. V = 2 (002's flat area + 100 (2 pi + 5)). Bbox: the bend's outer face reaches " + "R + T = 3 past the edge (y 63) and, a half turn round its axis 1 mm under the base, down to z = -(2 R + T) = -4", base=S2) +FL = [C("sheet.fold", points=[[70, 0, TS], [70, DS, TS]], angle=90)] +fleg = WS - 70 - ba90 / 2 +FOLDB = {"min": [0, 0, 0], "max": [70 - ba90 / 2 + RS + TS, DS, RS + TS + fleg]} +FMETH12 = ("A fold (sheet.rs add_fold) takes its bend zone out of the sheet, so the flat stays 100 x 60 and V = 2 x 6000 = 12000. Centred on the line x = 70 the zone runs " + "from 70 - pi/2; the larger side stays, the 30 mm side folds up 90 deg about the axis at x = 70 - pi/2, z = T + R: its outer face (the flat bottom) stands at " + "x = 70 - pi/2 + R + T = %.6f and its panel, 30 - pi/2 long, rises from z = R + T to %.6f. " % (FOLDB["max"][0], FOLDB["max"][2])) +case(T12, "010-fold-90", "001's base folded 90 deg up along a sketch line across it at x = 70", FL, + {"body_count": 1, "volume_mm3": WS * DS * TS, "faces": 10, "bbox": FOLDB}, + SMETH + FMETH12 + "Faces as 002's L: 10", base=S1) +case(T12, "011-fold-unfolded", "010's fold unfolded: the flat 100 x 60 plate again", [C("sheet.unfold")], + {"body_count": 1, "volume_mm3": WS * DS * TS, "bbox": {"min": [0, 0, 0], "max": [WS, DS, TS]}}, + SMETH + FMETH12 + "Unfolded every panel lies in the base's plane where it was cut from: the 100 x 60 x 2 plate, the base in its place", base=up(T12, "010-fold-90")) +case(T12, "012-fold-refolded", "011's flat refolded: 010's part again", [C("sheet.refold")], + {"body_count": 1, "volume_mm3": WS * DS * TS, "faces": 10, "bbox": FOLDB}, + SMETH + FMETH12 + "Refolding gives the folded part back: 010's numbers", base=up(T12, "011-fold-unfolded")) +# The flat pattern of 003's tray: its outline (the size and the area) and its four bend lines, the +# centre lines of the bend zones, half BA out from the base's cut-back edges. +reach = HS - s90 + ba90 - s90 +cl = s90 - ba90 / 2 +case(T12, "013-flat-pattern", "the flat pattern of 003's tray: its outline's size and area, and its four bend lines", [C("sheet.flat_pattern")], + {"body_count": 1, "volume_mm3": TS * a3, + "flat_pattern": {"size_mm": [WS + 2 * reach, DS + 2 * reach], "area_mm2": a3, + "bend_lines": [[[s90, cl], [WS - s90, cl]], [[WS - cl, s90], [WS - cl, DS - s90]], [[s90, DS - cl], [WS - s90, DS - cl]], [[cl, s90], [cl, DS - s90]]]}}, + SMETH + "The flat pattern is drawn in the base's frame (the base in its place). Each flange lies flat past its edge: s0 back from it, then BA and the leg, so it reaches " + "H - s0 + BA - s0 = 20 - BD = %.6f past the edge (BD = 2 (R + T) tan45 - BA = 6 - pi): the outline is (100 + 2 x that) x (60 + 2 x that), its area 003's flat area " + "(%.6f, the notched corners open). The bend lines are the bend zones' centre lines, BA/2 out from the cut-back edges: y = 3 - pi/2 and 57 + pi/2 from x = 3 to 97, " + "x = 3 - pi/2 and 97 + pi/2 from y = 3 to 57" % (reach, a3), base=S3) +# A bracket: a flange, a lip on that flange's far edge, and a hole through the base. +H1, H2 = 30.0, 10.0 +leg1 = H1 - s90 - s90 +leg2 = H2 - s90 +A14 = WS * (DS - s90) + WS * ba90 + WS * leg1 + WS * ba90 + WS * leg2 - PI * 25 +case(T12, "014-bracket", "a bracket: a 30 mm flange on the front edge, a 10 mm lip turned out on its far edge, a d10 hole through the base", + [C("sheet.flange", type="edge", edges=[[WS / 2, 0, TS]], height=H1, angle=90), + C("sheet.flange", type="edge", edges=[[WS / 2, 0, H1]], height=H2, angle=90), + H(position=[WS / 2, 35, TS], diameter=10)], + {"body_count": 1, "volume_mm3": TS * A14, "bbox": {"min": [0, -(H2 - TS), 0], "max": [WS, DS, H1]}}, + SMETH + "The flange (as 002, H 30) stands on y = 0 up to z = 30. The lip is picked on that flange's far edge on its outer face (y = 0), the panel's bottom face, so it " + "bends down there, turning out over y < 0; its outer virtual sharp is on the edge (z = 30, y = 2, the flange's top-face plane), so the flange's panel is cut back s0 = 3 " + "more (30 - 3 - 3 = 24) and the lip's outer face is the plane z = 30, its panel 10 - 3 = 7, reaching y = 2 - 10 = -8. The hole (d10 at (50, 35)) is a cut-out of the " + "flat. V = 2 (100 57 + 100 pi + 100 24 + 100 pi + 100 7 - 25 pi). Bbox: x 0..100, y -8..60, z 0..30", base=S1) + # manifest: tiers in order, cases in authoring order until --record sorts them by time WHAT = { T1: "primitives with closed-form volumes", T2: "booleans in the degeneracy classes, and cuts that end in a single line", T3: "extrudes and revolves of line-and-arc profiles", T4: "spline profiles, sweeps and lofts", T5: "holes and tapped holes", T6: "modelled threads", T7: "constant, variable and corner fillets", T8: "chamfers", T9: "shells and offsets", - T10: "patterns and mirrors", T11: "parts combining every tier"} + T10: "patterns and mirrors", T11: "parts combining every tier", T12: "sheet metal: flanges, closed corners, reliefs, hems, folds and the flat pattern"} mpath = os.path.join(ROOT, "ladder.json") -order = [T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11] +order = [T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12] try: with open(mpath) as f: listed = {t["tier"]: t["cases"] for t in json.load(f)["tiers"]} From 023017747ba187f6939b80fafbbf2bb22da6bda2 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 17:58:06 -0400 Subject: [PATCH 096/108] Ladder: the golden recorded on SMLib 60b1c6a with tiers 05, 06 and 12's new cases 167/168: every new case passes against its hand answer but 06/023 (1/2-14 NPT external), whose groove stops 0.015 mm past the crest at its section's middle, under the crest cone on the section's deeper side, so a sliver of each tooth's flank stays (0.94 mm3, 1.1e-4). The 139 cases before keep their statuses and counts; their volumes and areas re-measure within 2e-6 on this SMLib. Co-Authored-By: Claude Opus 5.5 --- docs/kernel-ladder.md | 301 ++++--- tests/kernel-cases/ladder/golden.json | 1126 ++++++++++++++++--------- tests/kernel-cases/ladder/ladder.json | 152 ++-- 3 files changed, 971 insertions(+), 608 deletions(-) diff --git a/docs/kernel-ladder.md b/docs/kernel-ladder.md index ea1595273..6d939489d 100644 --- a/docs/kernel-ladder.md +++ b/docs/kernel-ladder.md @@ -12,13 +12,14 @@ The **frontier** is the first case of a tier, in ladder order, that fails (fail, | 02-booleans | booleans in the degeneracy classes, and cuts that end in a single line | 25 | 25 pass | – | | 03-analytic-profiles | extrudes and revolves of line-and-arc profiles | 10 | 10 pass | – | | 04-spline-profiles | spline profiles, sweeps and lofts | 12 | 12 pass | – | -| 05-holes-and-taps | holes and tapped holes | 13 | 13 pass | – | -| 06-threads | modelled threads | 19 | 19 pass | – | -| 07-fillets | constant, variable and corner fillets | 18 | 17 pass, 1 unsupported | – | +| 05-holes-and-taps | holes and tapped holes | 17 | 17 pass | – | +| 06-threads | modelled threads | 30 | 1 fail, 29 pass | 023-external-1-2-npt | +| 07-fillets | constant, variable and corner fillets | 19 | 19 pass | – | | 08-chamfers | chamfers | 8 | 8 pass | – | | 09-shells-and-offsets | shells and offsets | 15 | 15 pass | – | | 10-patterns-and-mirrors | patterns and mirrors | 8 | 8 pass | – | | 11-cumulative-parts | parts combining every tier | 4 | 4 pass | – | +| 12-sheet-metal | sheet metal: flanges, closed corners, reliefs, hems, folds and the flat pattern | 14 | 14 pass | – | Cases where SMLib's check gave no verdict on a body (SMLib can't take the record yet), so only the record's checks graded validity: 0. @@ -28,141 +29,171 @@ Times are the commands' own, in seconds, from the case's process; **golden** is | Case | What | Answer | Result | s | golden s | changes | |---|---|---|---|---|---|---| -| ladder/01-primitives/005-sphere | a sphere r10 | analytic | pass | 0.003 | 0.003 | | | ladder/01-primitives/001-box | a 60x40x20 box: the stock every later tier starts from | analytic | pass | 0.004 | 0.004 | | -| ladder/01-primitives/004-frustum | a cone frustum r10 -> r5, h20 (revolved trapezoid) | analytic | pass | 0.017 | 0.017 | | -| ladder/01-primitives/003-cone | a cone r10 h30 (no cone primitive: a revolved right triangle, its axis a sketch line) | analytic | pass | 0.025 | 0.025 | | -| ladder/01-primitives/002-cylinder | a cylinder r10 h30 | analytic | pass | 0.032 | 0.032 | | -| ladder/01-primitives/006-torus | a torus R20 r5 | analytic | pass | 0.575 | 0.575 | | -| ladder/02-booleans/001-coincident-face-join | a 60x40x10 box joined exactly on the stock's top face: one 60x40x30 box | analytic | pass | 0.006 | 0.006 | | -| ladder/02-booleans/019-notch-flush-with-end-face | a notch 40x20 through the height, its end flush with the stock's end face: a U | analytic | pass | 0.007 | 0.007 | | -| ladder/02-booleans/004-edge-on-edge-no-overlap | a cut tool that shares only the top front edge of the stock | analytic | pass | 0.010 | 0.010 | | -| ladder/02-booleans/015-knife-edge-wedge-cut | a triangular prism cut whose slope meets the bottom face along one line (a knife edge), its other faces on the stock's | analytic | pass | 0.011 | 0.011 | | -| ladder/02-booleans/014-cut-through-sphere-pole | a 4x4 square post cut off the top of a sphere r10 through its pole | analytic | pass | 0.012 | 0.012 | | -| ladder/02-booleans/016-v-groove-pinches-bottom-to-line | a V groove whose apex touches the bottom face along a line, cut through: two pieces | analytic | pass | 0.012 | 0.012 | | -| ladder/02-booleans/020-part-back-wall | the running part: a 60x10x15 back wall joined on the stock's top, flush with its back and ends | analytic | pass | 0.013 | 0.013 | | +| ladder/01-primitives/005-sphere | a sphere r10 | analytic | pass | 0.005 | 0.005 | | +| ladder/01-primitives/003-cone | a cone r10 h30 (no cone primitive: a revolved right triangle, its axis a sketch line) | analytic | pass | 0.037 | 0.037 | | +| ladder/01-primitives/004-frustum | a cone frustum r10 -> r5, h20 (revolved trapezoid) | analytic | pass | 0.041 | 0.041 | | +| ladder/01-primitives/002-cylinder | a cylinder r10 h30 | analytic | pass | 0.043 | 0.043 | | +| ladder/01-primitives/006-torus | a torus R20 r5 | analytic | pass | 0.172 | 0.172 | | +| ladder/02-booleans/004-edge-on-edge-no-overlap | a cut tool that shares only the top front edge of the stock | analytic | pass | 0.011 | 0.011 | | +| ladder/02-booleans/015-knife-edge-wedge-cut | a triangular prism cut whose slope meets the bottom face along one line (a knife edge), its other faces on the stock's | analytic | pass | 0.012 | 0.012 | | +| ladder/02-booleans/001-coincident-face-join | a 60x40x10 box joined exactly on the stock's top face: one 60x40x30 box | analytic | pass | 0.012 | 0.012 | | +| ladder/02-booleans/016-v-groove-pinches-bottom-to-line | a V groove whose apex touches the bottom face along a line, cut through: two pieces | analytic | pass | 0.013 | 0.013 | | | ladder/02-booleans/003-pocket-flush-with-top | a 20x20x10 pocket whose tool's top is the stock's top face | analytic | pass | 0.013 | 0.013 | | -| ladder/02-booleans/002-coplanar-overlap-join | two 60x40x20 boxes overlapping 30x20 in plan, tops and bottoms coplanar | analytic | pass | 0.013 | 0.013 | | -| ladder/02-booleans/006-tangent-along-line-no-overlap | a cylinder r10 along X lying on the top face (tangent along a line), cut | analytic | pass | 0.016 | 0.016 | | -| ladder/02-booleans/017-cylinder-tangent-top-and-bottom | a cylinder r10 along X tangent to both the top and bottom faces, cut: two pieces with zero-angle cusps | analytic | pass | 0.023 | 0.023 | | -| ladder/02-booleans/018-hole-tangent-to-side-face | a through hole r10 tangent to the front face: the front face pinched to a line | analytic | pass | 0.026 | 0.026 | | -| ladder/02-booleans/008-near-tangent-gap-1e-6 | a cylinder r10 along X 1e-6 mm above the top face, cut | analytic | pass | 0.028 | 0.028 | | -| ladder/02-booleans/010-near-tangent-overlap-1e-6 | a cylinder r10 along X dipping 1e-6 mm into the top face, cut | invariants | pass | 0.029 | 0.029 | | -| ladder/02-booleans/011-tangent-along-circle-through-hole | a sphere r10 sitting in a through hole r10 at the top edge (tangent along the hole's top circle), cut | analytic | pass | 0.035 | 0.035 | | -| ladder/02-booleans/005-vertex-on-face-no-overlap | an inverted cone whose apex touches the middle of the top face, cut | analytic | pass | 0.043 | 0.043 | | -| ladder/02-booleans/007-near-tangent-gap-1e-3 | a cylinder r10 along X 1e-3 mm above the top face, cut | analytic | pass | 0.044 | 0.044 | | -| ladder/02-booleans/009-near-tangent-overlap-1e-3 | a cylinder r10 along X dipping 1e-3 mm into the top face, cut: a groove 1e-3 deep | analytic | pass | 0.048 | 0.048 | | -| ladder/02-booleans/013-cut-across-cylinder-seam | a 10x4 notch through a cylinder r10 across its +X side (where the seam lies) | analytic | pass | 0.050 | 0.050 | | -| ladder/02-booleans/021-holes-touching-at-a-point | two through holes r5 whose circles touch at one point (30, 20) | analytic | pass | 0.055 | 0.055 | | -| ladder/02-booleans/012-tangent-along-circle-bowl | a blind hole r10 10 deep, then a sphere r10 centred on its floor: the floor disk vanishes exactly | analytic | pass | 0.060 | 0.060 | | -| ladder/02-booleans/022-cylinder-grazing-a-hole-edge | a corner piece (square column minus a quarter disc r1.5, 0.0003 off the axis) cut out of a part with a blind r1.6 hole on the same axis: the tool's r1.5 face sits 0.1 mm inside the hole wall; 'no result' | analytic | pass | 0.061 | 0.061 | | -| ladder/02-booleans/023-lips-1e-4-off-the-walls-joined | two half-annulus lips (r 4..5, from z=2 to 20) joined onto a stadium-ring base (z 0..2, r 3..5 arcs, centres 20 apart) with their cylinder walls 0.0001 mm off the base's: the lip cap touches the base top, leaving a 0.0001 mm crescent overhang. Layout is a hand-built variant of the PR's public reproduction | analytic | pass | 0.132 | 0.132 | | -| ladder/02-booleans/024-wall-halves-merged-into-a-flange | the flange top annulus of a freshly revolved hub (z = 6, r 18..30) picked by a point and extruded 5 mm (the pick found a third of the face: "the selected planar face no longer exists") | analytic | pass | 0.237 | 0.237 | | -| ladder/02-booleans/025-flush-chord-layers-joined | a join of flush layers: a disc r37 (z -1.2..0) carrying 15 of the 19 regions of a sketch of 18 chords (z -3.6..-1.2; four bands left out), on an annulus r35..37 (z -5.6..-3.6) joined to a disc of all the chord regions (z -8..-5.6): SMLib's result came back with 'loop encloses no (u, v) area' though both operands are valid | analytic | pass | 1.355 | 1.355 | | -| ladder/03-analytic-profiles/001-extrude-rect-with-arc-end | a 60x40 profile with a semicircular end r20, extruded 20 | analytic | pass | 0.013 | 0.013 | | -| ladder/03-analytic-profiles/007-revolve-180-touching-axis | a 15x20 rectangle on the axis revolved 180 deg: a half cylinder | analytic | pass | 0.014 | 0.014 | | -| ladder/03-analytic-profiles/006-revolve-partial-90 | a 10x10 rectangle 10 mm off the axis revolved 90 deg | analytic | pass | 0.016 | 0.016 | | -| ladder/03-analytic-profiles/008-extrude-slot | a slot (centres 40 apart, width 20) extruded 10 | analytic | pass | 0.023 | 0.023 | | -| ladder/03-analytic-profiles/003-extrude-tapered-circle | a circle r10 extruded 20 with a -5 deg taper (inward): a cone frustum | analytic | pass | 0.050 | 0.050 | | -| ladder/03-analytic-profiles/002-extrude-annulus | an annulus r20/r10 extruded 15 | analytic | pass | 0.059 | 0.059 | | -| ladder/03-analytic-profiles/004-revolve-full-off-axis | a 10x30 rectangle 10 mm off the Z axis revolved 360 deg: a tube | analytic | pass | 0.065 | 0.065 | | -| ladder/03-analytic-profiles/005-revolve-touching-axis-hemisphere | a quarter disk r20 with an edge on the Z axis revolved 360 deg: a hemisphere | analytic | pass | 0.070 | 0.070 | | -| ladder/03-analytic-profiles/009-part-boss-and-slot | the running part: a revolved boss r8 h10 joined on the top, a slot 15x8 cut through the base | analytic | pass | 0.124 | 0.124 | | -| ladder/03-analytic-profiles/010-revolve-horn-torus-270 | the half disc of radius 14 on the far side of a diameter 14 mm from the axis (the full circle would touch the axis: a horn torus) revolved 270 degrees | analytic | pass | 0.136 | 0.136 | | -| ladder/04-spline-profiles/005-loft-square-frustum | a loft between a 40 square at z=0 and a 20 square at z=30 | analytic | pass | 0.011 | 0.011 | | -| ladder/04-spline-profiles/001-extrude-bezier-arch | a profile closed by a cubic Bezier arch (control-point spline, 4 points), extruded 10 | analytic | pass | 0.015 | 0.015 | | -| ladder/04-spline-profiles/008-loft-square-to-circle | a loft from a 40 square at z=0 to a circle r10 at z=30 | analytic | pass | 0.027 | 0.027 | | -| ladder/04-spline-profiles/009-extrude-periodic-fit-spline | a closed periodic fit-point spline through 6 points, extruded 10 | analytic | pass | 0.035 | 0.035 | | -| ladder/04-spline-profiles/004-sweep-square-along-bezier | a 4x4 square swept along the same Bezier path | analytic | pass | 0.042 | 0.042 | | -| ladder/04-spline-profiles/006-loft-circle-frustum | a loft between circles r20 at z=0 and r10 at z=30 | analytic | pass | 0.059 | 0.059 | | -| ladder/04-spline-profiles/007-loft-three-circles | a smooth loft through circles r20, r10, r20 at z = 0, 20, 40 | analytic | pass | 0.072 | 0.072 | | -| ladder/04-spline-profiles/002-revolve-bezier-profile | a profile with a Bezier side (r from 20 to 15 over z 0..30) revolved 360 deg about Z | analytic | pass | 0.084 | 0.084 | | -| ladder/04-spline-profiles/010-part-bezier-window | the running part: a Bezier-arched window cut through the back wall | analytic | pass | 0.131 | 0.131 | | -| ladder/04-spline-profiles/003-pipe-along-bezier | a pipe d4 along a planar Bezier path | analytic | pass | 0.141 | 0.141 | | -| ladder/04-spline-profiles/012-loft-ribs-joined-to-a-rounded-pad | the same without the top flange: the join fails with 'boolean Union: no result' | analytic | pass | 0.681 | 0.681 | | -| ladder/04-spline-profiles/011-crossing-pleated-loft-skins-joined | a join of two pleated skins (lofts between 24-pleat star outlines, less the same loft moved in 1.1 mm) that cross along a ring near their bottoms: truck panicked ('tolerance must be no less than 1e-6') or gave no result | analytic | pass | 1.376 | 1.376 | | -| ladder/05-holes-and-taps/006-tapped-m6-through | an M6 tapped hole through: the tap drill d5 (major - pitch), cosmetic thread | analytic | pass | 0.017 | 0.017 | | -| ladder/05-holes-and-taps/001-simple-through | a d10 through hole in the stock's top | analytic | pass | 0.033 | 0.033 | | -| ladder/05-holes-and-taps/009-hole-0.5-from-edge | a d10 through hole whose wall is 0.5 mm from the end face | analytic | pass | 0.034 | 0.034 | | -| ladder/05-holes-and-taps/010-hole-tangent-to-end-face | a d10 through hole tangent to the end face x=0 | analytic | pass | 0.036 | 0.036 | | -| ladder/05-holes-and-taps/003-drilled-blind-118 | a d10 drilled hole 10 deep to the shoulder with a 118 deg point | analytic | pass | 0.044 | 0.044 | | -| ladder/05-holes-and-taps/007-tapped-m8-blind | an M8 tapped blind hole 12 deep with a 118 deg drill point | analytic | pass | 0.045 | 0.045 | | -| ladder/05-holes-and-taps/002-simple-blind-flat | a d10 blind hole 10 deep, flat bottom | analytic | pass | 0.046 | 0.046 | | -| ladder/05-holes-and-taps/004-counterbore | a counterbored hole: d6.6 through, d11 x 6.4 counterbore | analytic | pass | 0.051 | 0.051 | | -| ladder/05-holes-and-taps/005-countersink | a countersunk hole: d6.6 through, d12 x 90 deg countersink | analytic | pass | 0.089 | 0.089 | | -| ladder/05-holes-and-taps/011-crossing-holes-steinmetz | two d10 through holes whose axes cross: vertical and along Y at z=10 | analytic | pass | 0.102 | 0.102 | | -| ladder/05-holes-and-taps/012-crossing-tapped-holes-offset | two M6 tapped holes (d5) crossing with axes 2 mm apart | analytic | pass | 0.113 | 0.113 | | -| ladder/05-holes-and-taps/008-tapped-m5-into-curved-face | an M5 tapped hole drilled radially through a cylinder r20 lying along X | analytic | pass | 0.130 | 0.130 | | -| ladder/05-holes-and-taps/013-part-holes | the running part: an M6 tapped through hole, an M5 tapped blind hole in the boss, a d3.3 hole down through wall and base | analytic | pass | 0.280 | 0.280 | | -| ladder/06-threads/012-external-acme-3-4-6 | a modelled 3/4-6 ACME thread (ASME B1.5, general purpose) on a 3/4 in shaft, six turns | analytic | pass | 0.839 | 0.839 | | -| ladder/06-threads/013-external-s20x4 | a modelled metric buttress S20x4 thread (DIN 513, 3/30 deg) on a d20 shaft, six turns | analytic | pass | 0.945 | 0.945 | | -| ladder/06-threads/011-external-tr20x4 | a modelled trapezoidal Tr20x4 thread (ISO 2904) on a d20 shaft, six turns | analytic | pass | 0.956 | 0.956 | | -| ladder/06-threads/003-external-m10-partial-length | a modelled M10 thread over 15 of the 30 mm from the top end (`from`): it stops square in the middle of the face | analytic | pass | 1.088 | 1.088 | | -| ladder/06-threads/015-internal-tr20x4-nut | a modelled internal Tr20x4 thread in a d16 (D1 = d - P) bore through a 40x40x24 block | analytic | pass | 1.200 | 1.200 | | -| ladder/06-threads/014-external-buttress-asme-1.5-8 | a modelled 1.5-8 buttress thread (ASME B1.9 basic profile, 7/45 deg) on a 1.5 in shaft, six turns | analytic | pass | 1.347 | 1.347 | | -| ladder/06-threads/010-part-threaded-boss | the running part with a modelled M16 thread on its d16 boss | analytic | pass | 1.462 | 1.462 | | -| ladder/06-threads/016-external-m10-left-hand | 001's modelled M10 thread, left-handed: the same volume, turning the other way | analytic | pass | 1.690 | 1.690 | | -| ladder/06-threads/019-external-tr40x14-p7-two-start | a modelled two-start trapezoidal Tr40x14(P7) thread (ISO 2904, ISO 2903) on a d40 shaft, three leads long | analytic | pass | 1.831 | 1.831 | | -| ladder/06-threads/005-internal-m10-through | a modelled internal M10 thread in a d8.5 (tap drill) hole through a 30x30x20 block | analytic | pass | 1.872 | 1.872 | | -| ladder/06-threads/006-external-m10-into-chamfer | a d10 x 30 cylinder with a 1 mm chamfer on top, then a modelled M10 thread over its cylinder face, running out through the chamfer | analytic | pass | 1.920 | 1.920 | | -| ladder/06-threads/007-external-m10-at-filleted-shoulder | a modelled M10 thread on a d10 shaft whose root at the d16 shoulder has an r1 fillet: it stops clear of the fillet | analytic | pass | 1.964 | 1.964 | | -| ladder/06-threads/001-external-m10-full | a modelled M10 thread over the whole of a d10 x 30 cylinder | analytic | pass | 2.128 | 2.128 | | -| ladder/06-threads/004-external-m10-to-shoulder | a modelled M10 thread on a d10 shaft running down to a d16 shoulder: it stops clear of it, the collar whole | analytic | pass | 2.144 | 2.144 | | -| ladder/06-threads/009-thread-runout-length | 004's M10 thread run from the free top end, vanishing over a 3 mm (2 P) runout before the d16 shoulder | analytic | pass | 2.203 | 2.203 | | -| ladder/06-threads/002-external-m10x1-fine | a modelled fine M10x1 thread over a d10 x 30 cylinder | analytic | pass | 2.626 | 2.626 | | -| ladder/06-threads/017-external-m10-chamfered-tip | 001's modelled M10 thread with ISO 4753's chamfered end at both free ends: a 45 deg cone down to the minor diameter, cut after the groove | analytic | pass | 3.485 | 3.485 | | -| ladder/06-threads/008-multi-start-thread | a two-start M10 thread (lead 3, pitch 1.5) over a d10 x 30 cylinder | analytic | pass | 3.706 | 3.706 | | -| ladder/06-threads/018-external-m10-both-hands | 001's modelled M10 thread cut both ways: a right- and a left-handed groove crossing on a d10 x 30 cylinder | analytic | pass | 7.756 | 7.756 | | -| ladder/07-fillets/015-corner-g2-patch | three r5 rounds at a corner with the g2 corner patch | invariants | not supported yet: step 2 (solid.fillet): invalid input: not supported yet: a fillet with G2 corner patches with the SMLib kernel | 0.003 | 0.003 | | -| ladder/07-fillets/006-variable-r5-to-zero | a variable round on the top front edge, r5 at x=0 down to 0 at the x=60 vertex | analytic | pass | 0.009 | 0.009 | | -| ladder/07-fillets/001-single-edge-r5 | an r5 round on the stock's top front edge | analytic | pass | 0.016 | 0.016 | | -| ladder/07-fillets/007-variable-r5-to-1e-3 | a variable round on the top front edge, r5 down to 1e-3 mm | analytic | pass | 0.018 | 0.018 | | -| ladder/07-fillets/011-chain-ending-at-corner | r5 rounds on two top edges meeting at a corner whose vertical edge stays sharp | analytic | pass | 0.019 | 0.019 | | +| ladder/02-booleans/020-part-back-wall | the running part: a 60x10x15 back wall joined on the stock's top, flush with its back and ends | analytic | pass | 0.013 | 0.013 | | +| ladder/02-booleans/019-notch-flush-with-end-face | a notch 40x20 through the height, its end flush with the stock's end face: a U | analytic | pass | 0.014 | 0.014 | | +| ladder/02-booleans/002-coplanar-overlap-join | two 60x40x20 boxes overlapping 30x20 in plan, tops and bottoms coplanar | analytic | pass | 0.014 | 0.014 | | +| ladder/02-booleans/014-cut-through-sphere-pole | a 4x4 square post cut off the top of a sphere r10 through its pole | analytic | pass | 0.025 | 0.025 | | +| ladder/02-booleans/007-near-tangent-gap-1e-3 | a cylinder r10 along X 1e-3 mm above the top face, cut | analytic | pass | 0.033 | 0.033 | | +| ladder/02-booleans/006-tangent-along-line-no-overlap | a cylinder r10 along X lying on the top face (tangent along a line), cut | analytic | pass | 0.036 | 0.036 | | +| ladder/02-booleans/010-near-tangent-overlap-1e-6 | a cylinder r10 along X dipping 1e-6 mm into the top face, cut | invariants | pass | 0.037 | 0.037 | | +| ladder/02-booleans/008-near-tangent-gap-1e-6 | a cylinder r10 along X 1e-6 mm above the top face, cut | analytic | pass | 0.037 | 0.037 | | +| ladder/02-booleans/009-near-tangent-overlap-1e-3 | a cylinder r10 along X dipping 1e-3 mm into the top face, cut: a groove 1e-3 deep | analytic | pass | 0.041 | 0.041 | | +| ladder/02-booleans/005-vertex-on-face-no-overlap | an inverted cone whose apex touches the middle of the top face, cut | analytic | pass | 0.045 | 0.045 | | +| ladder/02-booleans/017-cylinder-tangent-top-and-bottom | a cylinder r10 along X tangent to both the top and bottom faces, cut: two pieces with zero-angle cusps | analytic | pass | 0.052 | 0.052 | | +| ladder/02-booleans/018-hole-tangent-to-side-face | a through hole r10 tangent to the front face: the front face pinched to a line | analytic | pass | 0.059 | 0.059 | | +| ladder/02-booleans/013-cut-across-cylinder-seam | a 10x4 notch through a cylinder r10 across its +X side (where the seam lies) | analytic | pass | 0.059 | 0.059 | | +| ladder/02-booleans/012-tangent-along-circle-bowl | a blind hole r10 10 deep, then a sphere r10 centred on its floor: the floor disk vanishes exactly | analytic | pass | 0.069 | 0.069 | | +| ladder/02-booleans/011-tangent-along-circle-through-hole | a sphere r10 sitting in a through hole r10 at the top edge (tangent along the hole's top circle), cut | analytic | pass | 0.076 | 0.076 | | +| ladder/02-booleans/022-cylinder-grazing-a-hole-edge | a corner piece (square column minus a quarter disc r1.5, 0.0003 off the axis) cut out of a part with a blind r1.6 hole on the same axis: the tool's r1.5 face sits 0.1 mm inside the hole wall; 'no result' | analytic | pass | 0.087 | 0.087 | | +| ladder/02-booleans/021-holes-touching-at-a-point | two through holes r5 whose circles touch at one point (30, 20) | analytic | pass | 0.131 | 0.131 | | +| ladder/02-booleans/024-wall-halves-merged-into-a-flange | the flange top annulus of a freshly revolved hub (z = 6, r 18..30) picked by a point and extruded 5 mm (the pick found a third of the face: "the selected planar face no longer exists") | analytic | pass | 0.182 | 0.182 | | +| ladder/02-booleans/023-lips-1e-4-off-the-walls-joined | two half-annulus lips (r 4..5, from z=2 to 20) joined onto a stadium-ring base (z 0..2, r 3..5 arcs, centres 20 apart) with their cylinder walls 0.0001 mm off the base's: the lip cap touches the base top, leaving a 0.0001 mm crescent overhang. Layout is a hand-built variant of the PR's public reproduction | analytic | pass | 0.201 | 0.201 | | +| ladder/02-booleans/025-flush-chord-layers-joined | a join of flush layers: a disc r37 (z -1.2..0) carrying 15 of the 19 regions of a sketch of 18 chords (z -3.6..-1.2; four bands left out), on an annulus r35..37 (z -5.6..-3.6) joined to a disc of all the chord regions (z -8..-5.6): SMLib's result came back with 'loop encloses no (u, v) area' though both operands are valid | analytic | pass | 1.559 | 1.559 | | +| ladder/03-analytic-profiles/006-revolve-partial-90 | a 10x10 rectangle 10 mm off the axis revolved 90 deg | analytic | pass | 0.010 | 0.010 | | +| ladder/03-analytic-profiles/007-revolve-180-touching-axis | a 15x20 rectangle on the axis revolved 180 deg: a half cylinder | analytic | pass | 0.010 | 0.010 | | +| ladder/03-analytic-profiles/008-extrude-slot | a slot (centres 40 apart, width 20) extruded 10 | analytic | pass | 0.011 | 0.011 | | +| ladder/03-analytic-profiles/001-extrude-rect-with-arc-end | a 60x40 profile with a semicircular end r20, extruded 20 | analytic | pass | 0.015 | 0.015 | | +| ladder/03-analytic-profiles/003-extrude-tapered-circle | a circle r10 extruded 20 with a -5 deg taper (inward): a cone frustum | analytic | pass | 0.024 | 0.024 | | +| ladder/03-analytic-profiles/002-extrude-annulus | an annulus r20/r10 extruded 15 | analytic | pass | 0.024 | 0.024 | | +| ladder/03-analytic-profiles/005-revolve-touching-axis-hemisphere | a quarter disk r20 with an edge on the Z axis revolved 360 deg: a hemisphere | analytic | pass | 0.031 | 0.031 | | +| ladder/03-analytic-profiles/004-revolve-full-off-axis | a 10x30 rectangle 10 mm off the Z axis revolved 360 deg: a tube | analytic | pass | 0.042 | 0.042 | | +| ladder/03-analytic-profiles/009-part-boss-and-slot | the running part: a revolved boss r8 h10 joined on the top, a slot 15x8 cut through the base | analytic | pass | 0.060 | 0.060 | | +| ladder/03-analytic-profiles/010-revolve-horn-torus-270 | the half disc of radius 14 on the far side of a diameter 14 mm from the axis (the full circle would touch the axis: a horn torus) revolved 270 degrees | analytic | pass | 0.060 | 0.060 | | +| ladder/04-spline-profiles/005-loft-square-frustum | a loft between a 40 square at z=0 and a 20 square at z=30 | analytic | pass | 0.010 | 0.010 | | +| ladder/04-spline-profiles/001-extrude-bezier-arch | a profile closed by a cubic Bezier arch (control-point spline, 4 points), extruded 10 | analytic | pass | 0.020 | 0.020 | | +| ladder/04-spline-profiles/008-loft-square-to-circle | a loft from a 40 square at z=0 to a circle r10 at z=30 | analytic | pass | 0.021 | 0.021 | | +| ladder/04-spline-profiles/009-extrude-periodic-fit-spline | a closed periodic fit-point spline through 6 points, extruded 10 | analytic | pass | 0.031 | 0.031 | | +| ladder/04-spline-profiles/006-loft-circle-frustum | a loft between circles r20 at z=0 and r10 at z=30 | analytic | pass | 0.036 | 0.036 | | +| ladder/04-spline-profiles/007-loft-three-circles | a smooth loft through circles r20, r10, r20 at z = 0, 20, 40 | analytic | pass | 0.037 | 0.037 | | +| ladder/04-spline-profiles/004-sweep-square-along-bezier | a 4x4 square swept along the same Bezier path | analytic | pass | 0.039 | 0.039 | | +| ladder/04-spline-profiles/002-revolve-bezier-profile | a profile with a Bezier side (r from 20 to 15 over z 0..30) revolved 360 deg about Z | analytic | pass | 0.069 | 0.069 | | +| ladder/04-spline-profiles/010-part-bezier-window | the running part: a Bezier-arched window cut through the back wall | analytic | pass | 0.099 | 0.099 | | +| ladder/04-spline-profiles/003-pipe-along-bezier | a pipe d4 along a planar Bezier path | analytic | pass | 0.110 | 0.110 | | +| ladder/04-spline-profiles/012-loft-ribs-joined-to-a-rounded-pad | the same without the top flange: the join fails with 'boolean Union: no result' | analytic | pass | 0.463 | 0.463 | | +| ladder/04-spline-profiles/011-crossing-pleated-loft-skins-joined | a join of two pleated skins (lofts between 24-pleat star outlines, less the same loft moved in 1.1 mm) that cross along a ring near their bottoms: truck panicked ('tolerance must be no less than 1e-6') or gave no result | analytic | pass | 1.323 | 1.323 | | +| ladder/05-holes-and-taps/001-simple-through | a d10 through hole in the stock's top | analytic | pass | 0.023 | 0.023 | | +| ladder/05-holes-and-taps/010-hole-tangent-to-end-face | a d10 through hole tangent to the end face x=0 | analytic | pass | 0.024 | 0.024 | | +| ladder/05-holes-and-taps/006-tapped-m6-through | an M6 tapped hole through: the tap drill d5 (major - pitch), cosmetic thread | analytic | pass | 0.026 | 0.026 | | +| ladder/05-holes-and-taps/017-tapped-1-4-npt-through | a 1/4-18 NPT tapped hole through the stock (ASME B1.20.1): a straight hole at the tap maker's 10.85 mm, cosmetic thread | analytic | pass | 0.028 | 0.028 | | +| ladder/05-holes-and-taps/016-tapped-rc-1-2-through | an Rc 1/2 tapped hole through the stock (ISO 7-1 internal taper): a straight hole at the tap maker's 17.6 mm, cosmetic thread | analytic | pass | 0.028 | 0.028 | | +| ladder/05-holes-and-taps/002-simple-blind-flat | a d10 blind hole 10 deep, flat bottom | analytic | pass | 0.029 | 0.029 | | +| ladder/05-holes-and-taps/003-drilled-blind-118 | a d10 drilled hole 10 deep to the shoulder with a 118 deg point | analytic | pass | 0.030 | 0.030 | | +| ladder/05-holes-and-taps/007-tapped-m8-blind | an M8 tapped blind hole 12 deep with a 118 deg drill point | analytic | pass | 0.032 | 0.032 | | +| ladder/05-holes-and-taps/015-tapped-1-4-28-unf-blind | a 1/4-28 UNF tapped blind hole 10 deep, flat bottom: drilled 5.45 mm, cosmetic thread | analytic | pass | 0.034 | 0.034 | | +| ladder/05-holes-and-taps/009-hole-0.5-from-edge | a d10 through hole whose wall is 0.5 mm from the end face | analytic | pass | 0.036 | 0.036 | | +| ladder/05-holes-and-taps/014-tapped-1-4-20-unc-through | a 1/4-20 UNC tapped hole through the stock: drilled #7 (0.201 in), cosmetic thread | analytic | pass | 0.041 | 0.041 | | +| ladder/05-holes-and-taps/004-counterbore | a counterbored hole: d6.6 through, d11 x 6.4 counterbore | analytic | pass | 0.049 | 0.049 | | +| ladder/05-holes-and-taps/005-countersink | a countersunk hole: d6.6 through, d12 x 90 deg countersink | analytic | pass | 0.059 | 0.059 | | +| ladder/05-holes-and-taps/011-crossing-holes-steinmetz | two d10 through holes whose axes cross: vertical and along Y at z=10 | analytic | pass | 0.078 | 0.078 | | +| ladder/05-holes-and-taps/012-crossing-tapped-holes-offset | two M6 tapped holes (d5) crossing with axes 2 mm apart | analytic | pass | 0.127 | 0.127 | | +| ladder/05-holes-and-taps/008-tapped-m5-into-curved-face | an M5 tapped hole drilled radially through a cylinder r20 lying along X | analytic | pass | 0.134 | 0.134 | | +| ladder/05-holes-and-taps/013-part-holes | the running part: an M6 tapped through hole, an M5 tapped blind hole in the boss, a d3.3 hole down through wall and base | analytic | pass | 0.256 | 0.256 | | +| ladder/06-threads/030-square-thread-refused | a square thread on a d10 x 30 cylinder: refused, no current standard defines one | invariants | pass | 0.018 | 0.018 | | +| ladder/06-threads/012-external-acme-3-4-6 | a modelled 3/4-6 ACME thread (ASME B1.5, general purpose) on a 3/4 in shaft, six turns | analytic | pass | 0.634 | 0.634 | | +| ladder/06-threads/011-external-tr20x4 | a modelled trapezoidal Tr20x4 thread (ISO 2904) on a d20 shaft, six turns | analytic | pass | 0.648 | 0.648 | | +| ladder/06-threads/029-external-tr20x4-chamfer-needs-depth | 011's Tr20x4 thread with a chamfered tip and no depth: refused, ISO 4753 is for metric threads | invariants | pass | 0.657 | 0.657 | | +| ladder/06-threads/013-external-s20x4 | a modelled metric buttress S20x4 thread (DIN 513, 3/30 deg) on a d20 shaft, six turns | analytic | pass | 0.665 | 0.665 | | +| ladder/06-threads/021-internal-rp-1-2 | a modelled Rp 1/2 parallel internal pipe thread (ISO 7-1) in a d18.631 (its minor) bore through a 40x40 block six turns thick | analytic | pass | 0.685 | 0.685 | | +| ladder/06-threads/020-external-g-1-2 | a modelled G 1/2 parallel pipe thread (ISO 228-1, 55 deg) on a d20.955 shaft, six turns | analytic | pass | 0.695 | 0.695 | | +| ladder/06-threads/015-internal-tr20x4-nut | a modelled internal Tr20x4 thread in a d16 (D1 = d - P) bore through a 40x40x24 block | analytic | pass | 0.695 | 0.695 | | +| ladder/06-threads/014-external-buttress-asme-1.5-8 | a modelled 1.5-8 buttress thread (ASME B1.9 basic profile, 7/45 deg) on a 1.5 in shaft, six turns | analytic | pass | 0.716 | 0.716 | | +| ladder/06-threads/026-external-s20x4-steep-flank-start-to-shoulder | a modelled S20x4 buttress thread on a d20 shaft down to a d30 shoulder, the steep flank toward the thread's start (down): the 30 deg wall faces the shoulder | analytic | pass | 0.746 | 0.746 | | +| ladder/06-threads/010-part-threaded-boss | the running part with a modelled M16 thread on its d16 boss | analytic | pass | 0.774 | 0.774 | | +| ladder/06-threads/025-external-s20x4-steep-flank-end-to-shoulder | a modelled S20x4 buttress thread on a d20 shaft down to a d30 shoulder, the steep flank toward the thread's end (up, the default): the 3 deg wall faces the shoulder | analytic | pass | 0.776 | 0.776 | | +| ladder/06-threads/003-external-m10-partial-length | a modelled M10 thread over 15 of the 30 mm from the top end (`from`): it stops square in the middle of the face | analytic | pass | 0.855 | 0.855 | | +| ladder/06-threads/005-internal-m10-through | a modelled internal M10 thread in a d8.5 (tap drill) hole through a 30x30x20 block | analytic | pass | 1.161 | 1.161 | | +| ladder/06-threads/019-external-tr40x14-p7-two-start | a modelled two-start trapezoidal Tr40x14(P7) thread (ISO 2904, ISO 2903) on a d40 shaft, three leads long | analytic | pass | 1.196 | 1.196 | | +| ladder/06-threads/028-external-tr20x4-chamfer-30-deg-2.5-deep | 011's modelled Tr20x4 thread with chamfered ends at its own angle and depth: 30 deg to the axis, 2.5 mm in from the major diameter | analytic | pass | 1.311 | 1.311 | | +| ladder/06-threads/022-external-r-1-2-taper | a modelled R 1/2 taper pipe thread (ISO 7-1, 55 deg, 1 in 16) on a 21.3 mm pipe (ISO 65), its standard 13.2 mm from the pipe's end | analytic | pass | 1.344 | 1.344 | | +| ladder/06-threads/024-internal-rc-1-2-taper | a modelled Rc 1/2 internal taper pipe thread (ISO 7-1) in a d17.6 hole (the tap maker's) through a 13.2 mm plate, from its top face | analytic | pass | 1.383 | 1.383 | | +| ladder/06-threads/004-external-m10-to-shoulder | a modelled M10 thread on a d10 shaft running down to a d16 shoulder: it stops clear of it, the collar whole | analytic | pass | 1.403 | 1.403 | | +| ladder/06-threads/007-external-m10-at-filleted-shoulder | a modelled M10 thread on a d10 shaft whose root at the d16 shoulder has an r1 fillet: it stops clear of the fillet | analytic | pass | 1.437 | 1.437 | | +| ladder/06-threads/009-thread-runout-length | 004's M10 thread run from the free top end, vanishing over a 3 mm (2 P) runout before the d16 shoulder | analytic | pass | 1.439 | 1.439 | | +| ladder/06-threads/023-external-1-2-npt | a modelled 1/2-14 NPT taper pipe thread (ASME B1.20.1, 60 deg, 1 in 16) on its 0.840 in pipe, its effective thread L2 from the end | analytic | **FAIL**: volume_mm3 8227.346353 (want 8226.404942) | 1.619 | 1.619 | | +| ladder/06-threads/016-external-m10-left-hand | 001's modelled M10 thread, left-handed: the same volume, turning the other way | analytic | pass | 1.626 | 1.626 | | +| ladder/06-threads/001-external-m10-full | a modelled M10 thread over the whole of a d10 x 30 cylinder | analytic | pass | 1.690 | 1.690 | | +| ladder/06-threads/006-external-m10-into-chamfer | a d10 x 30 cylinder with a 1 mm chamfer on top, then a modelled M10 thread over its cylinder face, running out through the chamfer | analytic | pass | 1.713 | 1.713 | | +| ladder/06-threads/027-external-m10-chamfered-start | 001's modelled M10 thread with ISO 4753's chamfered end at the end it starts from only (`tip: start`, from the top) | analytic | pass | 2.526 | 2.526 | | +| ladder/06-threads/002-external-m10x1-fine | a modelled fine M10x1 thread over a d10 x 30 cylinder | analytic | pass | 2.534 | 2.534 | | +| ladder/06-threads/008-multi-start-thread | a two-start M10 thread (lead 3, pitch 1.5) over a d10 x 30 cylinder | analytic | pass | 3.074 | 3.074 | | +| ladder/06-threads/017-external-m10-chamfered-tip | 001's modelled M10 thread with ISO 4753's chamfered end at both free ends: a 45 deg cone down to the external minor diameter d3, cut after the groove | analytic | pass | 3.340 | 3.340 | | +| ladder/06-threads/018-external-m10-both-hands | 001's modelled M10 thread cut both ways: a right- and a left-handed groove crossing on a d10 x 30 cylinder | analytic | pass | 6.515 | 6.515 | | +| ladder/07-fillets/001-single-edge-r5 | an r5 round on the stock's top front edge | analytic | pass | 0.008 | 0.008 | | +| ladder/07-fillets/007-variable-r5-to-1e-3 | a variable round on the top front edge, r5 down to 1e-3 mm | analytic | pass | 0.009 | 0.009 | | +| ladder/07-fillets/011-chain-ending-at-corner | r5 rounds on two top edges meeting at a corner whose vertical edge stays sharp | analytic | pass | 0.011 | 0.011 | | +| ladder/07-fillets/002-four-vertical-edges-r5 | r5 rounds on the four vertical edges | analytic | pass | 0.017 | 0.017 | | +| ladder/07-fillets/006-variable-r5-to-zero | a variable round on the top front edge, r5 at x=0 down to 0 at the x=60 vertex | analytic | pass | 0.017 | 0.017 | | +| ladder/07-fillets/008-constant-r1e-3 | a constant 1e-3 mm round on the top front edge | analytic | pass | 0.019 | 0.019 | | | ladder/07-fillets/005-variable-r5-to-r1 | a variable round on the top front edge, r5 at x=0 to r1 at x=60 | analytic | pass | 0.020 | 0.020 | | -| ladder/07-fillets/004-convex-and-concave-r5 | an L block: r5 on its inner (concave) vertical edge and on an outer (convex) one | analytic | pass | 0.021 | 0.021 | | -| ladder/07-fillets/009-corner-three-equal-r5 | r5 rounds on the three edges meeting at the corner (60,40,20): a sphere corner | analytic | pass | 0.023 | 0.023 | | -| ladder/07-fillets/008-constant-r1e-3 | a constant 1e-3 mm round on the top front edge | analytic | pass | 0.024 | 0.024 | | -| ladder/07-fillets/002-four-vertical-edges-r5 | r5 rounds on the four vertical edges | analytic | pass | 0.027 | 0.027 | | -| ladder/07-fillets/010-corner-unequal-r7-r3 | an r7 vertical round at a corner, then r3 along a top edge, which runs on round the r7 arc to the other top edge | analytic | pass | 0.037 | 0.037 | | -| ladder/07-fillets/016-corner-three-sequential-r5-r3-r7 | rounds r5 and r3 on the two top edges at a corner, then r7 on the vertical edge under them: refused, the r7 cannot exist | invariants | pass | 0.046 | 0.046 | | -| ladder/07-fillets/012-variable-into-rounded-corner | a vertical r5 round, then a variable round r1 -> r5 along the top back edge into it | analytic | pass | 0.060 | 0.060 | | -| ladder/07-fillets/014-curved-edge-r2 | an r2 round on the top edge of a cylinder r10 h20 | analytic | pass | 0.078 | 0.078 | | -| ladder/07-fillets/018-corner-three-sequential-r5-r3-r2 | rounds r5 and r3 on the two top edges at a corner, then r2 on the vertical edge under them, run on up into the corner | invariants | pass | 0.080 | 0.080 | | -| ladder/07-fillets/003-tangent-chain-r3 | an r3 round all round the top of the box with r5 vertical rounds: a tangent chain of lines and arcs | analytic | pass | 0.080 | 0.080 | | -| ladder/07-fillets/013-corner-setback | three r5 rounds at the corner (60,40,20) with setbacks of 8 mm along each edge | invariants | pass | 0.117 | 0.117 | | -| ladder/07-fillets/017-part-rounds | the running part: r5 on the front vertical edges, r3 on the back wall's top front edge, r1 where the boss meets the top | analytic | pass | 0.690 | 0.690 | | -| ladder/08-chamfers/005-corner-two-mitred-3 | 3 mm chamfers on two top edges meeting at a corner (mitred) | analytic | pass | 0.008 | 0.008 | | -| ladder/08-chamfers/004-corner-three-equal-3 | 3 mm chamfers on the three edges meeting at a corner | analytic | pass | 0.009 | 0.009 | | -| ladder/08-chamfers/003-distance-angle-5-30 | a chamfer 5 mm at 30 deg on the top front edge | analytic | pass | 0.012 | 0.012 | | +| ladder/07-fillets/010-corner-unequal-r7-r3 | an r7 vertical round at a corner, then r3 along a top edge, which runs on round the r7 arc to the other top edge | analytic | pass | 0.024 | 0.024 | | +| ladder/07-fillets/004-convex-and-concave-r5 | an L block: r5 on its inner (concave) vertical edge and on an outer (convex) one | analytic | pass | 0.025 | 0.025 | | +| ladder/07-fillets/009-corner-three-equal-r5 | r5 rounds on the three edges meeting at the corner (60,40,20): a sphere corner | analytic | pass | 0.032 | 0.032 | | +| ladder/07-fillets/014-curved-edge-r2 | an r2 round on the top edge of a cylinder r10 h20 | analytic | pass | 0.048 | 0.048 | | +| ladder/07-fillets/012-variable-into-rounded-corner | a vertical r5 round, then a variable round r1 -> r5 along the top back edge into it | analytic | pass | 0.051 | 0.051 | | +| ladder/07-fillets/016-corner-three-sequential-r5-r3-r7 | rounds r5 and r3 on the two top edges at a corner, then r7 on the vertical edge under them: refused, the r7 cannot exist | invariants | pass | 0.053 | 0.053 | | +| ladder/07-fillets/018-corner-three-sequential-r5-r3-r2 | rounds r5 and r3 on the two top edges at a corner, then r2 on the vertical edge under them, run on up into the corner | invariants | pass | 0.061 | 0.061 | | +| ladder/07-fillets/013-corner-setback | three r5 rounds at the corner (60,40,20) with setbacks of 8 mm along each edge | invariants | pass | 0.062 | 0.062 | | +| ladder/07-fillets/003-tangent-chain-r3 | an r3 round all round the top of the box with r5 vertical rounds: a tangent chain of lines and arcs | analytic | pass | 0.075 | 0.075 | | +| ladder/07-fillets/017-part-rounds | the running part: r5 on the front vertical edges, r3 on the back wall's top front edge, r1 where the boss meets the top | analytic | pass | 0.480 | 0.480 | | +| ladder/07-fillets/019-concave-corner-g2-patch | three concave r5 rounds at the inner corner of a 20x20x10 notch, with the g2 corner patch | invariants | pass | 2.084 | 2.084 | | +| ladder/07-fillets/015-corner-g2-patch | three r5 rounds at a corner with the g2 corner patch | invariants | pass | 2.173 | 2.173 | | | ladder/08-chamfers/001-equal-5 | a 5 mm chamfer on the top front edge | analytic | pass | 0.012 | 0.012 | | -| ladder/08-chamfers/002-two-distances-5-3 | a 5 x 3 chamfer on the top front edge | analytic | pass | 0.024 | 0.024 | | -| ladder/08-chamfers/007-chamfer-then-fillets | a 3 mm chamfer on the top front edge, then r2 rounds on the front vertical edges that meet it | analytic | pass | 0.029 | 0.029 | | -| ladder/08-chamfers/006-curved-edge-2 | a 2 mm chamfer on the top edge of a cylinder r10 h20 | analytic | pass | 0.070 | 0.070 | | -| ladder/08-chamfers/008-part-chamfers | the running part: 1 mm on the boss top edge, 2 mm on the back wall's top back edge | analytic | pass | 0.749 | 0.749 | | -| ladder/09-shells-and-offsets/007-offset-top-face-5 | the stock's top face offset 5 mm | analytic | pass | 0.016 | 0.016 | | -| ladder/09-shells-and-offsets/001-box-open-top-t2 | the stock shelled 2 mm, open at the top | analytic | pass | 0.017 | 0.017 | | +| ladder/08-chamfers/003-distance-angle-5-30 | a chamfer 5 mm at 30 deg on the top front edge | analytic | pass | 0.012 | 0.012 | | +| ladder/08-chamfers/002-two-distances-5-3 | a 5 x 3 chamfer on the top front edge | analytic | pass | 0.012 | 0.012 | | +| ladder/08-chamfers/005-corner-two-mitred-3 | 3 mm chamfers on two top edges meeting at a corner (mitred) | analytic | pass | 0.015 | 0.015 | | +| ladder/08-chamfers/004-corner-three-equal-3 | 3 mm chamfers on the three edges meeting at a corner | analytic | pass | 0.018 | 0.018 | | +| ladder/08-chamfers/007-chamfer-then-fillets | a 3 mm chamfer on the top front edge, then r2 rounds on the front vertical edges that meet it | analytic | pass | 0.031 | 0.031 | | +| ladder/08-chamfers/006-curved-edge-2 | a 2 mm chamfer on the top edge of a cylinder r10 h20 | analytic | pass | 0.060 | 0.060 | | +| ladder/08-chamfers/008-part-chamfers | the running part: 1 mm on the boss top edge, 2 mm on the back wall's top back edge | analytic | pass | 0.681 | 0.681 | | +| ladder/09-shells-and-offsets/001-box-open-top-t2 | the stock shelled 2 mm, open at the top | analytic | pass | 0.009 | 0.009 | | +| ladder/09-shells-and-offsets/003-tube-two-open-faces | the stock shelled 2 mm, open top and bottom | analytic | pass | 0.009 | 0.009 | | +| ladder/09-shells-and-offsets/007-offset-top-face-5 | the stock's top face offset 5 mm | analytic | pass | 0.017 | 0.017 | | | ladder/09-shells-and-offsets/004-thin-wall-0.2 | the stock shelled 0.2 mm, open at the top | analytic | pass | 0.017 | 0.017 | | -| ladder/09-shells-and-offsets/003-tube-two-open-faces | the stock shelled 2 mm, open top and bottom | analytic | pass | 0.018 | 0.018 | | -| ladder/09-shells-and-offsets/012-closed-shell-sealed-void | the stock shelled 2 mm with no face open: a closed body with a sealed void | analytic | pass | 0.018 | 0.018 | | -| ladder/09-shells-and-offsets/009-shell-outside-t2 | the stock shelled 2 mm outward, open at the top | analytic | pass | 0.038 | 0.038 | | -| ladder/09-shells-and-offsets/006-shell-rounds-r1-thinner-than-t2 | the box with r1 vertical rounds shelled 2 mm: the inner corners close sharp | analytic | pass | 0.060 | 0.060 | | -| ladder/09-shells-and-offsets/008-offset-cylinder-wall-2 | a cylinder r10 h20 with its side face offset 2 mm | analytic | pass | 0.075 | 0.075 | | -| ladder/09-shells-and-offsets/002-cylinder-open-top-t1 | a cylinder r10 h30 shelled 1 mm, open at the top | analytic | pass | 0.102 | 0.102 | | -| ladder/09-shells-and-offsets/010-shell-under-rounded-top | the stock with r3 rounds on its four top edges, shelled 2 mm open at the bottom | analytic | pass | 0.105 | 0.105 | | -| ladder/09-shells-and-offsets/014-drafted-box-with-rounds-shelled | a 120x80x40 box drafted 5 degrees with 4 mm rounds on the sloping corners, shelled 2 mm open at the top: the inner rounds' edges must lie on their faces (#3573 reports the same design) | analytic | pass | 0.124 | 0.124 | | -| ladder/09-shells-and-offsets/005-shell-rounds-r5-t2 | the box with r5 vertical rounds shelled 2 mm open at the top: the inner corners r3 | analytic | pass | 0.174 | 0.174 | | -| ladder/09-shells-and-offsets/013-dome-shelled-from-base | a dome r20 shelled 2 mm, open at its flat base: the rim is the circle r18 where the inner sphere meets the base plane | analytic | pass | 0.236 | 0.236 | | -| ladder/09-shells-and-offsets/015-shelled-dome-ring-joined-back | a dome (a quarter disc r20 revolved) shelled 2 mm from its flat base, then the base ring (r 18..20) face-extruded 10 mm back into the dome as a join: ~120 s, then 'boolean Union: no result' | analytic | pass | 0.922 | 0.922 | | -| ladder/09-shells-and-offsets/011-part-shell | the running part shelled 1.5 mm open at the bottom | analytic | pass | 1.078 | 1.078 | | -| ladder/10-patterns-and-mirrors/007-pattern-bodies | a pin r3 h10 patterned 4 times at 10 mm as bodies | analytic | pass | 0.031 | 0.031 | | -| ladder/10-patterns-and-mirrors/004-mirror-body-joined | a 30x40x20 half with a d10 hole mirrored about x=30 and joined: the faces at x=30 coincide | analytic | pass | 0.067 | 0.067 | | +| ladder/09-shells-and-offsets/012-closed-shell-sealed-void | the stock shelled 2 mm with no face open: a closed body with a sealed void | analytic | pass | 0.017 | 0.017 | | +| ladder/09-shells-and-offsets/009-shell-outside-t2 | the stock shelled 2 mm outward, open at the top | analytic | pass | 0.017 | 0.017 | | +| ladder/09-shells-and-offsets/006-shell-rounds-r1-thinner-than-t2 | the box with r1 vertical rounds shelled 2 mm: the inner corners close sharp | analytic | pass | 0.040 | 0.040 | | +| ladder/09-shells-and-offsets/008-offset-cylinder-wall-2 | a cylinder r10 h20 with its side face offset 2 mm | analytic | pass | 0.057 | 0.057 | | +| ladder/09-shells-and-offsets/005-shell-rounds-r5-t2 | the box with r5 vertical rounds shelled 2 mm open at the top: the inner corners r3 | analytic | pass | 0.071 | 0.071 | | +| ladder/09-shells-and-offsets/002-cylinder-open-top-t1 | a cylinder r10 h30 shelled 1 mm, open at the top | analytic | pass | 0.077 | 0.077 | | +| ladder/09-shells-and-offsets/014-drafted-box-with-rounds-shelled | a 120x80x40 box drafted 5 degrees with 4 mm rounds on the sloping corners, shelled 2 mm open at the top: the inner rounds' edges must lie on their faces (#3573 reports the same design) | analytic | pass | 0.077 | 0.077 | | +| ladder/09-shells-and-offsets/010-shell-under-rounded-top | the stock with r3 rounds on its four top edges, shelled 2 mm open at the bottom | analytic | pass | 0.079 | 0.079 | | +| ladder/09-shells-and-offsets/013-dome-shelled-from-base | a dome r20 shelled 2 mm, open at its flat base: the rim is the circle r18 where the inner sphere meets the base plane | analytic | pass | 0.112 | 0.112 | | +| ladder/09-shells-and-offsets/015-shelled-dome-ring-joined-back | a dome (a quarter disc r20 revolved) shelled 2 mm from its flat base, then the base ring (r 18..20) face-extruded 10 mm back into the dome as a join: ~120 s, then 'boolean Union: no result' | analytic | pass | 0.696 | 0.696 | | +| ladder/09-shells-and-offsets/011-part-shell | the running part shelled 1.5 mm open at the bottom | analytic | pass | 0.965 | 0.965 | | +| ladder/10-patterns-and-mirrors/007-pattern-bodies | a pin r3 h10 patterned 4 times at 10 mm as bodies | analytic | pass | 0.035 | 0.035 | | +| ladder/10-patterns-and-mirrors/004-mirror-body-joined | a 30x40x20 half with a d10 hole mirrored about x=30 and joined: the faces at x=30 coincide | analytic | pass | 0.047 | 0.047 | | | ladder/10-patterns-and-mirrors/005-mirror-feature | a d10 hole in the stock mirrored about x=30 as a feature | analytic | pass | 0.074 | 0.074 | | -| ladder/10-patterns-and-mirrors/001-rect-pattern-holes | a d5 hole patterned 3 x 2 at 20 mm in a 60x40x10 plate | analytic | pass | 0.175 | 0.175 | | -| ladder/10-patterns-and-mirrors/003-overlapping-pattern-leaves-core | six r5 cuts patterned round a circle r6 in a disk r20: they overlap and cut a core free | analytic | pass | 0.315 | 0.315 | | -| ladder/10-patterns-and-mirrors/002-circular-pattern-holes | a d6 hole patterned 8 times round a disk r30 h10 | analytic | pass | 0.351 | 0.351 | | -| ladder/10-patterns-and-mirrors/006-circular-pattern-counterbores | a counterbored hole (d5, d9 x 3) patterned 6 times round a disk r30 h10 | analytic | pass | 0.855 | 0.855 | | -| ladder/10-patterns-and-mirrors/008-part-vents | the running part with a d3 vent hole in its top patterned 4 times at 5 mm | analytic | pass | 1.765 | 1.765 | | -| ladder/11-cumulative-parts/001-bracket | an L bracket: concave r5 round, 5 mm outer chamfer, a hole in each leg | analytic | pass | 0.088 | 0.088 | | -| ladder/11-cumulative-parts/002-flange | a revolved flange and hub with a bore, six bolt holes, a hub chamfer and a hub-root round | analytic | pass | 0.618 | 0.618 | | -| ladder/11-cumulative-parts/003-threaded-flange | the flange with a modelled M30 thread on its hub, between the round and the chamfer, and M8 tapped holes in the disk | analytic | pass | 1.821 | 1.821 | | -| ladder/11-cumulative-parts/004-housing | the running part with every tier: back wall, boss, slot, spline window, tapped holes, rounds, chamfers, shell, vents, and a modelled M16 thread on the boss | analytic | pass | 2.307 | 2.307 | | +| ladder/10-patterns-and-mirrors/001-rect-pattern-holes | a d5 hole patterned 3 x 2 at 20 mm in a 60x40x10 plate | analytic | pass | 0.239 | 0.239 | | +| ladder/10-patterns-and-mirrors/003-overlapping-pattern-leaves-core | six r5 cuts patterned round a circle r6 in a disk r20: they overlap and cut a core free | analytic | pass | 0.299 | 0.299 | | +| ladder/10-patterns-and-mirrors/002-circular-pattern-holes | a d6 hole patterned 8 times round a disk r30 h10 | analytic | pass | 0.484 | 0.484 | | +| ladder/10-patterns-and-mirrors/006-circular-pattern-counterbores | a counterbored hole (d5, d9 x 3) patterned 6 times round a disk r30 h10 | analytic | pass | 0.758 | 0.758 | | +| ladder/10-patterns-and-mirrors/008-part-vents | the running part with a d3 vent hole in its top patterned 4 times at 5 mm | analytic | pass | 1.590 | 1.590 | | +| ladder/11-cumulative-parts/001-bracket | an L bracket: concave r5 round, 5 mm outer chamfer, a hole in each leg | analytic | pass | 0.089 | 0.089 | | +| ladder/11-cumulative-parts/002-flange | a revolved flange and hub with a bore, six bolt holes, a hub chamfer and a hub-root round | analytic | pass | 0.673 | 0.673 | | +| ladder/11-cumulative-parts/003-threaded-flange | the flange with a modelled M30 thread on its hub, between the round and the chamfer, and M8 tapped holes in the disk | analytic | pass | 2.166 | 2.166 | | +| ladder/11-cumulative-parts/004-housing | the running part with every tier: back wall, boss, slot, spline window, tapped holes, rounds, chamfers, shell, vents, and a modelled M16 thread on the boss | analytic | pass | 2.313 | 2.313 | | +| ladder/12-sheet-metal/001-base-flange | a 100 x 60 base flange, 2 mm sheet | analytic | pass | 0.002 | 0.002 | | +| ladder/12-sheet-metal/002-edge-flange-90 | a 20 mm 90 deg edge flange along the base's front edge | analytic | pass | 0.005 | 0.005 | | +| ladder/12-sheet-metal/010-fold-90 | 001's base folded 90 deg up along a sketch line across it at x = 70 | analytic | pass | 0.005 | 0.005 | | +| ladder/12-sheet-metal/009-hem-on-the-back-edge | 002's L with an 8 mm hem on the base's back edge, folded under it with a 1 mm inner radius | analytic | pass | 0.006 | 0.006 | | +| ladder/12-sheet-metal/012-fold-refolded | 011's flat refolded: 010's part again | analytic | pass | 0.008 | 0.008 | | +| ladder/12-sheet-metal/007-corner-relief-rectangular | 003's tray with a rectangular corner relief 4 mm across at each corner | analytic | pass | 0.008 | 0.008 | | +| ladder/12-sheet-metal/011-fold-unfolded | 010's fold unfolded: the flat 100 x 60 plate again | analytic | pass | 0.010 | 0.010 | | +| ladder/12-sheet-metal/004-four-flanges-72-leaning-out | 20 mm flanges at 72 deg on all four edges, made together and closed at the corners, leaning out: the panel ends run on along a slant | analytic | pass | 0.014 | 0.014 | | +| ladder/12-sheet-metal/003-four-flanges-90-closed-corners | 20 mm 90 deg flanges on all four edges, made together: the corners close with the rule's gap, notch relief | analytic | pass | 0.014 | 0.014 | | +| ladder/12-sheet-metal/005-four-flanges-108-leaning-in | 20 mm flanges at 108 deg on all four edges, made together and closed at the corners, leaning in over the base: the panel ends are cut back along a slant where they would overlap | analytic | pass | 0.014 | 0.014 | | +| ladder/12-sheet-metal/006-corner-relief-round | 003's tray with a round corner relief 4 mm across at each corner | analytic | pass | 0.017 | 0.017 | | +| ladder/12-sheet-metal/013-flat-pattern | the flat pattern of 003's tray: its outline's size and area, and its four bend lines | analytic | pass | 0.032 | 0.032 | | +| ladder/12-sheet-metal/008-corner-relief-tear | 003's tray with torn corners: the bends run to the corner and each end is cut straight, in the flat, to where its panel's end starts | analytic | pass | 0.071 | 0.071 | | +| ladder/12-sheet-metal/014-bracket | a bracket: a 30 mm flange on the front edge, a 10 mm lip turned out on its far edge, a d10 hole through the base | analytic | pass | 0.092 | 0.092 | | diff --git a/tests/kernel-cases/ladder/golden.json b/tests/kernel-cases/ladder/golden.json index b102ff3ca..13c200d8b 100644 --- a/tests/kernel-cases/ladder/golden.json +++ b/tests/kernel-cases/ladder/golden.json @@ -9,67 +9,67 @@ "vertices": 8, "volume_mm3": 48000.0 }, - "seconds": 0.003599988, + "seconds": 0.004062439, "status": "pass" }, "ladder/01-primitives/002-cylinder": { "measured": { - "area_mm2": 2513.27408091628, + "area_mm2": 2513.2741228740038, "body_count": 1, "edges": 3, "faces": 3, "vertices": 2, - "volume_mm3": 9424.777353639352 + "volume_mm3": 9424.777960803078 }, - "seconds": 0.031665293, + "seconds": 0.043371433, "status": "pass" }, "ladder/01-primitives/003-cone": { "measured": { - "area_mm2": 1307.6181023117074, + "area_mm2": 1307.6180919431065, "body_count": 1, "edges": 3, "faces": 2, "vertices": 3, - "volume_mm3": 3141.59242697122 + "volume_mm3": 3141.592653566665 }, - "seconds": 0.024871256, + "seconds": 0.03683274, "status": "pass" }, "ladder/01-primitives/004-frustum": { "measured": { - "area_mm2": 1364.1829847648855, + "area_mm2": 1364.1829574594403, "body_count": 1, "edges": 3, "faces": 3, "vertices": 2, - "volume_mm3": 3665.191341582638 + "volume_mm3": 3665.1914291694306 }, - "seconds": 0.016772876, + "seconds": 0.040579849, "status": "pass" }, "ladder/01-primitives/005-sphere": { "measured": { - "area_mm2": 1256.6371531595494, + "area_mm2": 1256.6370614485081, "body_count": 1, "edges": 1, "faces": 1, "vertices": 2, - "volume_mm3": 4188.791896913583 + "volume_mm3": 4188.790205011419 }, - "seconds": 0.002894944, + "seconds": 0.005130222, "status": "pass" }, "ladder/01-primitives/006-torus": { "measured": { - "area_mm2": 3947.8419806693646, + "area_mm2": 3947.841760474683, "body_count": 1, "edges": 1, "faces": 1, "vertices": 1, - "volume_mm3": 9869.61010099745 + "volume_mm3": 9869.604401217126 }, - "seconds": 0.57458714, + "seconds": 0.172193392, "status": "pass" }, "ladder/02-booleans/001-coincident-face-join": { @@ -81,7 +81,7 @@ "vertices": 8, "volume_mm3": 72000.0 }, - "seconds": 0.006455716, + "seconds": 0.012248454, "status": "pass" }, "ladder/02-booleans/002-coplanar-overlap-join": { @@ -93,19 +93,19 @@ "vertices": 16, "volume_mm3": 84000.0 }, - "seconds": 0.013407577, + "seconds": 0.01398496, "status": "pass" }, "ladder/02-booleans/003-pocket-flush-with-top": { "measured": { - "area_mm2": 9600.000000000002, + "area_mm2": 9600.0, "body_count": 1, "edges": 24, "faces": 11, "vertices": 16, "volume_mm3": 44000.0 }, - "seconds": 0.012900423, + "seconds": 0.013073515, "status": "pass" }, "ladder/02-booleans/004-edge-on-edge-no-overlap": { @@ -117,7 +117,7 @@ "vertices": 8, "volume_mm3": 48000.0 }, - "seconds": 0.010369929, + "seconds": 0.010931311, "status": "pass" }, "ladder/02-booleans/005-vertex-on-face-no-overlap": { @@ -129,7 +129,7 @@ "vertices": 8, "volume_mm3": 48000.0 }, - "seconds": 0.043089276, + "seconds": 0.044740497, "status": "pass" }, "ladder/02-booleans/006-tangent-along-line-no-overlap": { @@ -141,7 +141,7 @@ "vertices": 8, "volume_mm3": 48000.0 }, - "seconds": 0.015702342, + "seconds": 0.03648693, "status": "pass" }, "ladder/02-booleans/007-near-tangent-gap-1e-3": { @@ -153,7 +153,7 @@ "vertices": 8, "volume_mm3": 48000.0 }, - "seconds": 0.044085553, + "seconds": 0.032671004, "status": "pass" }, "ladder/02-booleans/008-near-tangent-gap-1e-6": { @@ -165,19 +165,19 @@ "vertices": 8, "volume_mm3": 48000.0 }, - "seconds": 0.028412443, + "seconds": 0.037264262, "status": "pass" }, "ladder/02-booleans/009-near-tangent-overlap-1e-3": { "measured": { - "area_mm2": 8800.00018857595, + "area_mm2": 8800.000188575948, "body_count": 1, "edges": 18, "faces": 8, "vertices": 12, - "volume_mm3": 47999.9886864612 + "volume_mm3": 47999.98868646121 }, - "seconds": 0.0481886, + "seconds": 0.041053197, "status": "pass" }, "ladder/02-booleans/010-near-tangent-overlap-1e-6": { @@ -189,67 +189,67 @@ "vertices": 8, "volume_mm3": 48000.0 }, - "seconds": 0.029025343, + "seconds": 0.037161622, "status": "pass" }, "ladder/02-booleans/011-tangent-along-circle-through-hole": { "measured": { - "area_mm2": 9428.318515408751, + "area_mm2": 9428.318530719811, "body_count": 1, "edges": 15, "faces": 7, "vertices": 10, - "volume_mm3": 41716.81450698026 + "volume_mm3": 41716.814692852844 }, - "seconds": 0.034977279, + "seconds": 0.076309047, "status": "pass" }, "ladder/02-booleans/012-tangent-along-circle-bowl": { "measured": { - "area_mm2": 9742.477897359224, + "area_mm2": 9742.477796081346, "body_count": 1, "edges": 17, "faces": 8, "vertices": 12, - "volume_mm3": 42764.01195654861 + "volume_mm3": 42764.01224382856 }, - "seconds": 0.059898023, + "seconds": 0.068907004, "status": "pass" }, "ladder/02-booleans/013-cut-across-cylinder-seam": { "measured": { - "area_mm2": 2036.8673139138011, + "area_mm2": 2036.867362638954, "body_count": 1, "edges": 12, "faces": 6, "vertices": 8, - "volume_mm3": 5888.550569284607 + "volume_mm3": 5888.551106723224 }, - "seconds": 0.049629232, + "seconds": 0.059478055, "status": "pass" }, "ladder/02-booleans/014-cut-through-sphere-pole": { "measured": { - "area_mm2": 1332.0893143869712, + "area_mm2": 1332.0892833422135, "body_count": 1, "edges": 14, "faces": 6, "vertices": 10, - "volume_mm3": 4110.944533826848 + "volume_mm3": 4110.943748776394 }, - "seconds": 0.011976898, + "seconds": 0.024782143, "status": "pass" }, "ladder/02-booleans/015-knife-edge-wedge-cut": { "measured": { - "area_mm2": 6929.822128134708, + "area_mm2": 6929.822128134705, "body_count": 1, "edges": 9, "faces": 5, "vertices": 6, - "volume_mm3": 24000.000000000007 + "volume_mm3": 24000.000000000015 }, - "seconds": 0.011093645, + "seconds": 0.011570083, "status": "pass" }, "ladder/02-booleans/016-v-groove-pinches-bottom-to-line": { @@ -259,45 +259,45 @@ "edges": 24, "faces": 12, "vertices": 16, - "volume_mm3": 38400.000000000015 + "volume_mm3": 38400.00000000002 }, - "seconds": 0.012047634, + "seconds": 0.012730153, "status": "pass" }, "ladder/02-booleans/017-cylinder-tangent-top-and-bottom": { "measured": { - "area_mm2": 11941.592611921053, + "area_mm2": 11941.59265358626, "body_count": 2, "edges": 24, "faces": 12, "vertices": 16, - "volume_mm3": 29150.438046445848 + "volume_mm3": 29150.444078121756 }, - "seconds": 0.023171327, + "seconds": 0.051785514, "status": "pass" }, "ladder/02-booleans/018-hole-tangent-to-side-face": { "measured": { - "area_mm2": 9428.31829497222, + "area_mm2": 9428.31853067088, "body_count": 1, "edges": 17, "faces": 7, "vertices": 10, - "volume_mm3": 41716.81209239218 + "volume_mm3": 41716.814692298256 }, - "seconds": 0.026474081, + "seconds": 0.058955827, "status": "pass" }, "ladder/02-booleans/019-notch-flush-with-end-face": { "measured": { - "area_mm2": 8800.000000000002, + "area_mm2": 8800.0, "body_count": 1, "edges": 24, "faces": 10, "vertices": 16, - "volume_mm3": 32000.000000000015 + "volume_mm3": 32000.000000000007 }, - "seconds": 0.007169783, + "seconds": 0.013683135, "status": "pass" }, "ladder/02-booleans/020-part-back-wall": { @@ -307,973 +307,1137 @@ "edges": 18, "faces": 8, "vertices": 12, - "volume_mm3": 57000.0 + "volume_mm3": 57000.000000000015 }, - "seconds": 0.012571045, + "seconds": 0.013224396, "status": "pass" }, "ladder/02-booleans/021-holes-touching-at-a-point": { "measured": { - "area_mm2": 9742.477564676688, + "area_mm2": 9742.477796064206, "body_count": 1, "edges": 17, "faces": 8, "vertices": 10, - "volume_mm3": 44858.40494270982 + "volume_mm3": 44858.40734615085 }, - "seconds": 0.0549919, + "seconds": 0.131438324, "status": "pass" }, "ladder/02-booleans/022-cylinder-grazing-a-hole-edge": { "measured": { - "area_mm2": 576.0597799448259, + "area_mm2": 576.0597790152967, "body_count": 1, "edges": 24, "faces": 11, "vertices": 16, - "volume_mm3": 700.1694600993085 + "volume_mm3": 700.1694662123119 }, - "seconds": 0.060724347, + "seconds": 0.087311782, "status": "pass" }, "ladder/02-booleans/023-lips-1e-4-off-the-walls-joined": { "measured": { - "area_mm2": 1610.939957683726, + "area_mm2": 1610.9399495961893, "body_count": 1, "edges": 54, "faces": 22, "vertices": 34, - "volume_mm3": 769.4693261952389 + "volume_mm3": 769.4689746947504 }, - "seconds": 0.132173954, + "seconds": 0.201061748, "status": "pass" }, "ladder/02-booleans/024-wall-halves-merged-into-a-flange": { "measured": { - "area_mm2": 9676.104640800102, + "area_mm2": 9676.105373078572, "body_count": 1, "edges": 9, "faces": 6, "vertices": 6, - "volume_mm3": 37875.03682260403 + "volume_mm3": 37875.04103167573 }, - "seconds": 0.236700862, + "seconds": 0.18248673, "status": "pass" }, "ladder/02-booleans/025-flush-chord-layers-joined": { "measured": { - "area_mm2": 19848.963867303115, + "area_mm2": 19848.964251059107, "body_count": 1, "edges": 86, "faces": 30, "vertices": 52, - "volume_mm3": 24340.93465191528 + "volume_mm3": 24340.93580402055 }, - "seconds": 1.355214364, + "seconds": 1.558780498, "status": "pass" }, "ladder/03-analytic-profiles/001-extrude-rect-with-arc-end": { "measured": { - "area_mm2": 10513.274682103463, + "area_mm2": 10513.274122905643, "body_count": 1, "edges": 12, "faces": 6, "vertices": 8, - "volume_mm3": 60566.37574264513 + "volume_mm3": 60566.37061462199 }, - "seconds": 0.013373513, + "seconds": 0.014670293, "status": "pass" }, "ladder/03-analytic-profiles/002-extrude-annulus": { "measured": { - "area_mm2": 4712.3888135105635, + "area_mm2": 4712.388980399636, "body_count": 1, "edges": 6, "faces": 4, "vertices": 4, - "volume_mm3": 14137.165496409769 + "volume_mm3": 14137.166941179268 }, - "seconds": 0.05877949, + "seconds": 0.024407565, "status": "pass" }, "ladder/03-analytic-profiles/003-extrude-tapered-circle": { "measured": { - "area_mm2": 1679.0714571133199, + "area_mm2": 1679.071423483643, "body_count": 1, "edges": 3, "faces": 3, "vertices": 2, - "volume_mm3": 5247.894417424099 + "volume_mm3": 5247.894567674972 }, - "seconds": 0.050194162, + "seconds": 0.024023754, "status": "pass" }, "ladder/03-analytic-profiles/004-revolve-full-off-axis": { "measured": { - "area_mm2": 7539.82227780291, + "area_mm2": 7539.822368642646, "body_count": 1, "edges": 6, "faces": 4, "vertices": 4, - "volume_mm3": 28274.33099281954 + "volume_mm3": 28274.333882357845 }, - "seconds": 0.064997043, + "seconds": 0.041726832, "status": "pass" }, "ladder/03-analytic-profiles/005-revolve-touching-axis-hemisphere": { "measured": { - "area_mm2": 3769.911189319725, + "area_mm2": 3769.9111843164546, "body_count": 1, "edges": 2, "faces": 2, "vertices": 2, - "volume_mm3": 16755.16137194915 + "volume_mm3": 16755.160819221863 }, - "seconds": 0.069528252, + "seconds": 0.030852929, "status": "pass" }, "ladder/03-analytic-profiles/006-revolve-partial-90": { "measured": { - "area_mm2": 1142.4774823972846, + "area_mm2": 1142.4777960589026, "body_count": 1, "edges": 12, "faces": 6, "vertices": 8, - "volume_mm3": 2356.1929112075295 + "volume_mm3": 2356.1944900996414 }, - "seconds": 0.015891639, + "seconds": 0.010035898, "status": "pass" }, "ladder/03-analytic-profiles/007-revolve-180-touching-axis": { "measured": { - "area_mm2": 2249.3361006094165, + "area_mm2": 2249.336143135075, "body_count": 1, "edges": 6, "faces": 4, "vertices": 4, - "volume_mm3": 7068.582941859537 + "volume_mm3": 7068.583470572731 }, - "seconds": 0.014438734, + "seconds": 0.010468652, "status": "pass" }, "ladder/03-analytic-profiles/008-extrude-slot": { "measured": { - "area_mm2": 3656.63741233849, + "area_mm2": 3656.6370614755815, "body_count": 1, "edges": 12, "faces": 6, "vertices": 8, - "volume_mm3": 11141.594404248584 + "volume_mm3": 11141.592653770153 }, - "seconds": 0.023430736, + "seconds": 0.011493074, "status": "pass" }, "ladder/03-analytic-profiles/009-part-boss-and-slot": { "measured": { - "area_mm2": 12164.778448487314, + "area_mm2": 12164.778684210796, "body_count": 1, "edges": 33, "faces": 14, "vertices": 22, - "volume_mm3": 55605.309277598055 + "volume_mm3": 55605.309649084316 }, - "seconds": 0.123637859, + "seconds": 0.060111465, "status": "pass" }, "ladder/03-analytic-profiles/010-revolve-horn-torus-270": { "measured": { - "area_mm2": 7211.92921002673, + "area_mm2": 7211.928814696445, "body_count": 1, "edges": 6, "faces": 4, "vertices": 4, - "volume_mm3": 28932.185072957283 + "volume_mm3": 28932.17610036333 }, - "seconds": 0.136088136, + "seconds": 0.060332475, "status": "pass" }, "ladder/04-spline-profiles/001-extrude-bezier-arch": { "measured": { - "area_mm2": 2766.836543476887, + "area_mm2": 2766.836554300913, "body_count": 1, "edges": 12, "faces": 6, "vertices": 8, - "volume_mm3": 8200.0 + "volume_mm3": 8200.000000000002 }, - "seconds": 0.015382084, + "seconds": 0.019786321, "status": "pass" }, "ladder/04-spline-profiles/002-revolve-bezier-profile": { "measured": { - "area_mm2": 5856.9826422553115, + "area_mm2": 5856.982454483079, "body_count": 1, "edges": 3, "faces": 3, "vertices": 2, - "volume_mm3": 34131.153548347604 + "volume_mm3": 34131.16018617699 }, - "seconds": 0.083683818, + "seconds": 0.069129293, "status": "pass" }, "ladder/04-spline-profiles/003-pipe-along-bezier": { "measured": { - "area_mm2": 605.9576565517693, + "area_mm2": 605.9576227938425, "body_count": 1, "edges": 3, "faces": 3, "vertices": 2, - "volume_mm3": 580.8255293341258 + "volume_mm3": 580.8248814439473 }, - "seconds": 0.141310005, + "seconds": 0.110451419, "status": "pass" }, "ladder/04-spline-profiles/004-sweep-square-along-bezier": { "measured": { - "area_mm2": 771.5291970478809, + "area_mm2": 771.529196914377, "body_count": 1, "edges": 12, "faces": 6, "vertices": 8, - "volume_mm3": 739.5292097504819 + "volume_mm3": 739.5292098648478 }, - "seconds": 0.041785332, + "seconds": 0.038770414, "status": "pass" }, "ladder/04-spline-profiles/005-loft-square-frustum": { "measured": { - "area_mm2": 5794.733192202055, + "area_mm2": 5794.733192202057, "body_count": 1, "edges": 12, "faces": 6, "vertices": 8, - "volume_mm3": 28000.000000000007 + "volume_mm3": 28000.0 }, - "seconds": 0.01135179, + "seconds": 0.010337564, "status": "pass" }, "ladder/04-spline-profiles/006-loft-circle-frustum": { "measured": { - "area_mm2": 4551.172885600089, + "area_mm2": 4551.172806545445, "body_count": 1, "edges": 3, "faces": 3, "vertices": 2, - "volume_mm3": 21991.14802951055 + "volume_mm3": 21991.148575014995 }, - "seconds": 0.058913074, + "seconds": 0.036088144, "status": "pass" }, "ladder/04-spline-profiles/007-loft-three-circles": { "measured": { - "area_mm2": 6453.967221806411, + "area_mm2": 6453.967215410327, "body_count": 1, "edges": 3, "faces": 3, "vertices": 2, - "volume_mm3": 23457.221256199402 + "volume_mm3": 23457.225146359866 }, - "seconds": 0.072000761, + "seconds": 0.036542851, "status": "pass" }, "ladder/04-spline-profiles/008-loft-square-to-circle": { "measured": { - "area_mm2": 5454.34068438542, + "area_mm2": 5454.34057365124, "body_count": 1, "edges": 12, "faces": 6, "vertices": 8, - "volume_mm3": 26310.54362092466 + "volume_mm3": 26310.543837045305 }, - "seconds": 0.027190644, + "seconds": 0.021237898, "status": "pass" }, "ladder/04-spline-profiles/009-extrude-periodic-fit-spline": { "measured": { - "area_mm2": 3698.6023993383496, + "area_mm2": 3698.6024347856, "body_count": 1, "edges": 18, "faces": 8, "vertices": 12, - "volume_mm3": 12281.011858436344 + "volume_mm3": 12281.012021749822 }, - "seconds": 0.035405874, + "seconds": 0.030974162, "status": "pass" }, "ladder/04-spline-profiles/010-part-bezier-window": { "measured": { - "area_mm2": 12389.018284526814, + "area_mm2": 12389.018511230937, "body_count": 1, "edges": 39, "faces": 16, "vertices": 26, - "volume_mm3": 54273.309277598055 + "volume_mm3": 54273.309649084316 }, - "seconds": 0.130843499, + "seconds": 0.09852879, "status": "pass" }, "ladder/04-spline-profiles/011-crossing-pleated-loft-skins-joined": { "measured": { - "area_mm2": 121420.35300591686, + "area_mm2": 121420.3527659641, "body_count": 1, "edges": 1096, "faces": 388, "vertices": 584, - "volume_mm3": 44443.494125231206 + "volume_mm3": 44443.49783386934 }, - "seconds": 1.375785917, + "seconds": 1.323453666, "status": "pass" }, "ladder/04-spline-profiles/012-loft-ribs-joined-to-a-rounded-pad": { "measured": { - "area_mm2": 13275.843011957519, + "area_mm2": 13275.842713594542, "body_count": 1, "edges": 86, "faces": 31, "vertices": 57, - "volume_mm3": 100193.008857701 + "volume_mm3": 100193.003036287 }, - "seconds": 0.681137226, + "seconds": 0.462630738, "status": "pass" }, "ladder/05-holes-and-taps/001-simple-through": { "measured": { - "area_mm2": 9271.23888918968, + "area_mm2": 9271.238898031577, "body_count": 1, "edges": 15, "faces": 7, "vertices": 10, - "volume_mm3": 46429.20345247036 + "volume_mm3": 46429.203673141754 }, - "seconds": 0.032915588, + "seconds": 0.023289285, "status": "pass" }, "ladder/05-holes-and-taps/002-simple-blind-flat": { "measured": { - "area_mm2": 9114.159273842968, + "area_mm2": 9114.159265368047, "body_count": 1, "edges": 15, "faces": 8, "vertices": 10, - "volume_mm3": 47214.60167821204 + "volume_mm3": 47214.60183659343 }, - "seconds": 0.045874139, + "seconds": 0.028718021, "status": "pass" }, "ladder/05-holes-and-taps/003-drilled-blind-118": { "measured": { - "area_mm2": 9127.246594228827, + "area_mm2": 9127.24662177053, "body_count": 1, "edges": 17, "faces": 8, "vertices": 12, - "volume_mm3": 47135.94953558977 + "volume_mm3": 47135.94936549673 }, - "seconds": 0.044029664, + "seconds": 0.029737147, "status": "pass" }, "ladder/05-holes-and-taps/004-counterbore": { "measured": { - "area_mm2": 9234.733473850809, + "area_mm2": 9234.733591415143, "body_count": 1, "edges": 18, "faces": 9, "vertices": 12, - "volume_mm3": 46926.50439234107 + "volume_mm3": 46926.50522394999 }, - "seconds": 0.050545684, + "seconds": 0.048951001, "status": "pass" }, "ladder/05-holes-and-taps/005-countersink": { "measured": { - "area_mm2": 9122.958530910642, + "area_mm2": 9122.958560242205, "body_count": 1, "edges": 18, "faces": 8, "vertices": 12, - "volume_mm3": 47219.57154291447 + "volume_mm3": 47219.57183623009 }, - "seconds": 0.088605524, + "seconds": 0.058968434, "status": "pass" }, "ladder/05-holes-and-taps/006-tapped-m6-through": { "measured": { - "area_mm2": 9074.889289958897, + "area_mm2": 9074.889357183944, "body_count": 1, "edges": 15, "faces": 7, "vertices": 10, - "volume_mm3": 47607.30072936878 + "volume_mm3": 47607.30091826685 }, - "seconds": 0.017341919, + "seconds": 0.025773972, "status": "pass" }, "ladder/05-holes-and-taps/007-tapped-m8-blind": { "measured": { - "area_mm2": 9062.405544647674, + "area_mm2": 9062.405554141464, "body_count": 1, "edges": 17, "faces": 8, "vertices": 12, - "volume_mm3": 47539.467162202374 + "volume_mm3": 47539.467413300634 }, - "seconds": 0.057993293, + "seconds": 0.031634357, "status": "pass" }, "ladder/05-holes-and-taps/008-tapped-m5-into-curved-face": { "measured": { - "area_mm2": 10551.678983923912, + "area_mm2": 10551.679156127118, "body_count": 1, "edges": 6, "faces": 4, "vertices": 4, - "volume_mm3": 74844.80869901458 + "volume_mm3": 74844.81205246755 }, - "seconds": 0.130425609, + "seconds": 0.134095986, "status": "pass" }, "ladder/05-holes-and-taps/009-hole-0.5-from-edge": { "measured": { - "area_mm2": 9271.238661980013, + "area_mm2": 9271.238898086272, "body_count": 1, "edges": 15, "faces": 7, "vertices": 10, - "volume_mm3": 46429.20147858148 + "volume_mm3": 46429.203673578886 }, - "seconds": 0.034376012, + "seconds": 0.036219136, "status": "pass" }, "ladder/05-holes-and-taps/010-hole-tangent-to-end-face": { "measured": { - "area_mm2": 9271.238824131646, + "area_mm2": 9271.238898072632, "body_count": 1, "edges": 17, "faces": 7, "vertices": 10, - "volume_mm3": 46429.202650315056 + "volume_mm3": 46429.20367342494 }, - "seconds": 0.035765667, + "seconds": 0.024374668, "status": "pass" }, "ladder/05-holes-and-taps/011-crossing-holes-steinmetz": { "measured": { - "area_mm2": 9970.796002655847, + "area_mm2": 9970.796457943112, "body_count": 1, "edges": 27, "faces": 10, "vertices": 17, - "volume_mm3": 43954.275881084504 + "volume_mm3": 43954.27736739679 }, - "seconds": 0.102376271, + "seconds": 0.078283505, "status": "pass" }, "ladder/05-holes-and-taps/012-crossing-tapped-holes-offset": { "measured": { - "area_mm2": 9586.62063280522, + "area_mm2": 9586.620653596627, "body_count": 1, "edges": 21, "faces": 8, "vertices": 14, - "volume_mm3": 46870.21851307568 + "volume_mm3": 46870.21907684049 }, - "seconds": 0.112783624, + "seconds": 0.127043113, "status": "pass" }, "ladder/05-holes-and-taps/013-part-holes": { "measured": { - "area_mm2": 13115.21289450834, + "area_mm2": 13115.213361131606, "body_count": 1, "edges": 48, "faces": 20, "vertices": 32, - "volume_mm3": 53470.419311175334 + "volume_mm3": 53470.420668720755 }, - "seconds": 0.279797849, + "seconds": 0.256105118, + "status": "pass" + }, + "ladder/05-holes-and-taps/014-tapped-1-4-20-unc-through": { + "measured": { + "area_mm2": 9079.83876494227, + "body_count": 1, + "edges": 15, + "faces": 7, + "vertices": 10, + "volume_mm3": 47590.57022271537 + }, + "seconds": 0.040846202, + "status": "pass" + }, + "ladder/05-holes-and-taps/015-tapped-1-4-28-unf-blind": { + "measured": { + "area_mm2": 8971.216799624277, + "body_count": 1, + "edges": 15, + "faces": 8, + "vertices": 10, + "volume_mm3": 47766.71711050138 + }, + "seconds": 0.033597905, + "status": "pass" + }, + "ladder/05-holes-and-taps/016-tapped-rc-1-2-through": { + "measured": { + "area_mm2": 9419.270743873743, + "body_count": 1, + "edges": 15, + "faces": 7, + "vertices": 10, + "volume_mm3": 43134.30129811671 + }, + "seconds": 0.028470867, + "status": "pass" + }, + "ladder/05-holes-and-taps/017-tapped-1-4-npt-through": { + "measured": { + "area_mm2": 9296.807535241649, + "body_count": 1, + "edges": 15, + "faces": 7, + "vertices": 10, + "volume_mm3": 46150.81929413248 + }, + "seconds": 0.027692751, "status": "pass" }, "ladder/06-threads/001-external-m10-full": { "measured": { - "area_mm2": 1528.998539117189, + "area_mm2": 1528.9985505873308, "body_count": 1, "edges": 252, "faces": 86, "vertices": 168, - "volume_mm3": 1954.2449542776249 + "volume_mm3": 1954.2452430647338 }, - "seconds": 2.12811212, + "seconds": 1.689697866, "status": "pass" }, "ladder/06-threads/002-external-m10x1-fine": { "measured": { - "area_mm2": 1581.5205208524822, + "area_mm2": 1581.5205078417318, "body_count": 1, "edges": 372, "faces": 126, "vertices": 248, - "volume_mm3": 2081.899948214229 + "volume_mm3": 2081.9002076225224 }, - "seconds": 2.625646547, + "seconds": 2.534402291, "status": "pass" }, "ladder/06-threads/003-external-m10-partial-length": { "measured": { - "area_mm2": 1314.9630494174853, + "area_mm2": 1314.9630292496186, "body_count": 1, "edges": 132, "faces": 46, "vertices": 88, - "volume_mm3": 2155.2201253347134 + "volume_mm3": 2155.219871329352 }, - "seconds": 1.088309306, + "seconds": 0.85471988, "status": "pass" }, "ladder/06-threads/004-external-m10-to-shoulder": { "measured": { - "area_mm2": 2047.0228358498966, + "area_mm2": 2047.0229459058442, "body_count": 1, "edges": 213, "faces": 74, "vertices": 142, - "volume_mm3": 3648.5291584977404 + "volume_mm3": 3648.5299273785768 }, - "seconds": 2.143927615, + "seconds": 1.403150704, "status": "pass" }, "ladder/06-threads/005-internal-m10-through": { "measured": { - "area_mm2": 4978.101312600045, + "area_mm2": 4978.101312130874, "body_count": 1, "edges": 186, "faces": 64, "vertices": 124, - "volume_mm3": 16688.181727949996 + "volume_mm3": 16688.18167960171 }, - "seconds": 1.871629553, + "seconds": 1.161250254, "status": "pass" }, "ladder/06-threads/006-external-m10-into-chamfer": { "measured": { - "area_mm2": 1508.108891537519, + "area_mm2": 1508.108885047644, "body_count": 1, "edges": 252, "faces": 86, "vertices": 168, - "volume_mm3": 1948.6927071991595 + "volume_mm3": 1948.6927173387744 }, - "seconds": 1.919749317, + "seconds": 1.712647333, "status": "pass" }, "ladder/06-threads/007-external-m10-at-filleted-shoulder": { "measured": { - "area_mm2": 2018.7759360368239, + "area_mm2": 2018.7759934430132, "body_count": 1, "edges": 203, "faces": 71, "vertices": 135, - "volume_mm3": 3668.9704031534766 + "volume_mm3": 3668.971306096839 }, - "seconds": 1.964063929, + "seconds": 1.437495352, "status": "pass" }, "ladder/06-threads/008-multi-start-thread": { "measured": { - "area_mm2": 1532.2853732955155, + "area_mm2": 1532.2853638958047, "body_count": 1, "edges": 264, "faces": 90, "vertices": 176, - "volume_mm3": 1954.245227235153 + "volume_mm3": 1954.2452070488298 }, - "seconds": 3.706373342, + "seconds": 3.07364605, "status": "pass" }, "ladder/06-threads/009-thread-runout-length": { "measured": { - "area_mm2": 2023.0564304737718, + "area_mm2": 2023.0586516883154, "body_count": 1, "edges": 214, "faces": 77, "vertices": 140, - "volume_mm3": 3673.436434421382 + "volume_mm3": 3673.4420095262312 }, - "seconds": 2.202591408, + "seconds": 1.43947478, "status": "pass" }, "ladder/06-threads/010-part-threaded-boss": { "measured": { - "area_mm2": 13318.76579174848, + "area_mm2": 13318.766396825838, "body_count": 1, "edges": 111, "faces": 41, "vertices": 74, - "volume_mm3": 53208.187629619366 + "volume_mm3": 53208.19063020747 }, - "seconds": 1.462190101, + "seconds": 0.774176125, "status": "pass" }, "ladder/06-threads/011-external-tr20x4": { "measured": { - "area_mm2": 3008.5109289311276, + "area_mm2": 3008.510981905842, "body_count": 1, "edges": 84, "faces": 30, "vertices": 56, - "volume_mm3": 6065.464162834598 + "volume_mm3": 6065.464859905014 }, - "seconds": 0.955700965, + "seconds": 0.647622949, "status": "pass" }, "ladder/06-threads/012-external-acme-3-4-6": { "measured": { - "area_mm2": 2943.7315602592976, + "area_mm2": 2943.7315979562527, "body_count": 1, "edges": 84, "faces": 30, "vertices": 56, - "volume_mm3": 5689.271052485101 + "volume_mm3": 5689.271646531861 }, - "seconds": 0.83862527, + "seconds": 0.634242439, "status": "pass" }, "ladder/06-threads/013-external-s20x4": { "measured": { - "area_mm2": 3376.925753383339, + "area_mm2": 3376.925747881656, "body_count": 1, "edges": 87, "faces": 31, "vertices": 58, - "volume_mm3": 5454.578654614414 + "volume_mm3": 5454.5786474564175 }, - "seconds": 0.945493006, + "seconds": 0.664539235, "status": "pass" }, "ladder/06-threads/014-external-buttress-asme-1.5-8": { "measured": { - "area_mm2": 5916.2769083388575, + "area_mm2": 5916.276939068178, "body_count": 1, "edges": 87, "faces": 31, "vertices": 58, - "volume_mm3": 19631.080967830752 + "volume_mm3": 19631.08121878226 }, - "seconds": 1.347177632, + "seconds": 0.715733395, "status": "pass" }, "ladder/06-threads/015-internal-tr20x4-nut": { "measured": { - "area_mm2": 9076.623586009078, + "area_mm2": 9076.623628295467, "body_count": 1, "edges": 96, "faces": 34, "vertices": 64, - "volume_mm3": 32097.519799715614 + "volume_mm3": 32097.52028280751 }, - "seconds": 1.199732826, + "seconds": 0.69492115, "status": "pass" }, "ladder/06-threads/016-external-m10-left-hand": { "measured": { - "area_mm2": 1528.998538562401, + "area_mm2": 1528.9985498697533, "body_count": 1, "edges": 252, "faces": 86, "vertices": 168, - "volume_mm3": 1954.2449602433921 + "volume_mm3": 1954.2452430252965 }, - "seconds": 1.689990672, + "seconds": 1.625940272, "status": "pass" }, "ladder/06-threads/017-external-m10-chamfered-tip": { "measured": { - "area_mm2": 1492.9858770288445, + "area_mm2": 1492.9858778452715, "body_count": 1, "edges": 258, "faces": 88, "vertices": 172, - "volume_mm3": 1945.3543465077544 + "volume_mm3": 1945.3544847128642 }, - "seconds": 3.048846709, + "seconds": 3.340196035, "status": "pass" }, "ladder/06-threads/018-external-m10-both-hands": { "measured": { - "area_mm2": 1418.5862919067272, + "area_mm2": 1418.5863348764333, "body_count": 1, "edges": 486, "faces": 204, "vertices": 324, - "volume_mm3": 1804.9238443319966 + "volume_mm3": 1804.9241321476034 }, - "seconds": 7.75550865, + "seconds": 6.515191917, "status": "pass" }, "ladder/06-threads/019-external-tr40x14-p7-two-start": { "measured": { - "area_mm2": 11049.102083229865, + "area_mm2": 11049.102020992848, "body_count": 1, "edges": 96, "faces": 34, "vertices": 64, - "volume_mm3": 43534.483316522135 + "volume_mm3": 43534.4823482271 }, - "seconds": 1.830871199, + "seconds": 1.195948426, + "status": "pass" + }, + "ladder/06-threads/020-external-g-1-2": { + "measured": { + "area_mm2": 1819.8329652683872, + "body_count": 1, + "edges": 84, + "faces": 30, + "vertices": 56, + "volume_mm3": 3355.922715408856 + }, + "seconds": 0.694554731, + "status": "pass" + }, + "ladder/06-threads/021-internal-rp-1-2": { + "measured": { + "area_mm2": 5528.399867579505, + "body_count": 1, + "edges": 96, + "faces": 34, + "vertices": 64, + "volume_mm3": 14061.220084540242 + }, + "seconds": 0.684860518, + "status": "pass" + }, + "ladder/06-threads/022-external-r-1-2-taper": { + "measured": { + "area_mm2": 2892.93092831753, + "body_count": 1, + "edges": 122, + "faces": 52, + "vertices": 72, + "volume_mm3": 8233.025967847225 + }, + "seconds": 1.3442539230000001, + "status": "pass" + }, + "ladder/06-threads/023-external-1-2-npt": { + "measured": { + "area_mm2": 3317.0130177354845, + "body_count": 1, + "edges": 144, + "faces": 63, + "vertices": 83, + "volume_mm3": 8227.34635260655 + }, + "seconds": 1.619294352, + "status": "fail" + }, + "ladder/06-threads/024-internal-rc-1-2-taper": { + "measured": { + "area_mm2": 6149.480584088805, + "body_count": 1, + "edges": 130, + "faces": 55, + "vertices": 77, + "volume_mm3": 17217.301948586937 + }, + "seconds": 1.382961955, + "status": "pass" + }, + "ladder/06-threads/025-external-s20x4-steep-flank-end-to-shoulder": { + "measured": { + "area_mm2": 5883.04322341494, + "body_count": 1, + "edges": 102, + "faces": 37, + "vertices": 68, + "volume_mm3": 13986.200402957777 + }, + "seconds": 0.776015625, + "status": "pass" + }, + "ladder/06-threads/026-external-s20x4-steep-flank-start-to-shoulder": { + "measured": { + "area_mm2": 5793.40788472209, + "body_count": 1, + "edges": 99, + "faces": 36, + "vertices": 66, + "volume_mm3": 14054.201948388452 + }, + "seconds": 0.745645116, + "status": "pass" + }, + "ladder/06-threads/027-external-m10-chamfered-start": { + "measured": { + "area_mm2": 1510.9922210921723, + "body_count": 1, + "edges": 255, + "faces": 87, + "vertices": 170, + "volume_mm3": 1949.7999227857772 + }, + "seconds": 2.525970287, + "status": "pass" + }, + "ladder/06-threads/028-external-tr20x4-chamfer-30-deg-2.5-deep": { + "measured": { + "area_mm2": 2626.5766115173265, + "body_count": 1, + "edges": 90, + "faces": 32, + "vertices": 60, + "volume_mm3": 5769.1287901433325 + }, + "seconds": 1.310968707, + "status": "pass" + }, + "ladder/06-threads/029-external-tr20x4-chamfer-needs-depth": { + "seconds": 0.656914247, + "status": "pass" + }, + "ladder/06-threads/030-square-thread-refused": { + "seconds": 0.017698501, "status": "pass" }, "ladder/07-fillets/001-single-edge-r5": { "measured": { - "area_mm2": 8660.508890351646, + "area_mm2": 8660.508806219164, "body_count": 1, "edges": 15, "faces": 7, "vertices": 10, - "volume_mm3": 47678.09530101598 + "volume_mm3": 47678.09724513767 }, - "seconds": 0.016262088, + "seconds": 0.008276702, "status": "pass" }, "ladder/07-fillets/002-four-vertical-edges-r5": { "measured": { - "area_mm2": 8585.398552475748, + "area_mm2": 8585.398163537797, "body_count": 1, "edges": 24, "faces": 10, "vertices": 16, - "volume_mm3": 47570.79943563683 + "volume_mm3": 47570.796327937685 }, - "seconds": 0.026656146, + "seconds": 0.016656302, "status": "pass" }, "ladder/07-fillets/003-tangent-chain-r3": { "measured": { - "area_mm2": 8334.925890321756, + "area_mm2": 8334.925469219002, "body_count": 1, "edges": 40, "faces": 18, "vertices": 24, - "volume_mm3": 47209.22370148293 + "volume_mm3": 47209.224453421455 }, - "seconds": 0.080296774, + "seconds": 0.075259768, "status": "pass" }, "ladder/07-fillets/004-convex-and-concave-r5": { "measured": { - "area_mm2": 4514.159503196192, + "area_mm2": 4514.159265383247, "body_count": 1, "edges": 24, "faces": 10, "vertices": 16, - "volume_mm3": 14000.002049410516 + "volume_mm3": 14000.000000143285 }, - "seconds": 0.020970963, + "seconds": 0.025016285, "status": "pass" }, "ladder/07-fillets/005-variable-r5-to-r1": { "measured": { - "area_mm2": 8717.217924043853, + "area_mm2": 8717.217924050128, "body_count": 1, "edges": 15, "faces": 7, "vertices": 10, - "volume_mm3": 47866.93985730924 + "volume_mm3": 47866.939865273875 }, - "seconds": 0.020180862, + "seconds": 0.020330867, "status": "pass" }, "ladder/07-fillets/006-variable-r5-to-zero": { "measured": { - "area_mm2": 8730.326099374339, + "area_mm2": 8730.326099306438, "body_count": 1, "edges": 14, "faces": 7, "vertices": 9, - "volume_mm3": 47892.693434961286 + "volume_mm3": 47892.69344121365 }, - "seconds": 0.009438084, + "seconds": 0.01733797, "status": "pass" }, "ladder/07-fillets/007-variable-r5-to-1e-3": { "measured": { - "area_mm2": 8730.313207916415, + "area_mm2": 8730.313207922401, "body_count": 1, "edges": 15, "faces": 7, "vertices": 10, - "volume_mm3": 47892.67196922709 + "volume_mm3": 47892.671975647136 }, - "seconds": 0.018291972, + "seconds": 0.009474805, "status": "pass" }, "ladder/07-fillets/008-constant-r1e-3": { "measured": { - "area_mm2": 8799.9742473454, + "area_mm2": 8799.974247350745, "body_count": 1, "edges": 15, "faces": 7, "vertices": 10, - "volume_mm3": 47999.99997963964 + "volume_mm3": 47999.99998708315 }, - "seconds": 0.023888675, + "seconds": 0.018851642, "status": "pass" }, "ladder/07-fillets/009-corner-three-equal-r5": { "measured": { - "area_mm2": 8522.843213284448, + "area_mm2": 8522.842842060318, "body_count": 1, "edges": 21, "faces": 10, "vertices": 13, - "volume_mm3": 47377.122731304844 + "volume_mm3": 47377.12002653465 }, - "seconds": 0.022659899, + "seconds": 0.031523042, "status": "pass" }, "ladder/07-fillets/010-corner-unequal-r7-r3": { "measured": { - "area_mm2": 8589.124659133073, + "area_mm2": 8589.124242980084, "body_count": 1, "edges": 22, "faces": 10, "vertices": 14, - "volume_mm3": 47604.38618238413 + "volume_mm3": 47604.38434765742 }, - "seconds": 0.037027754, + "seconds": 0.024238201, "status": "pass" }, "ladder/07-fillets/011-chain-ending-at-corner": { "measured": { - "area_mm2": 8571.128308024523, + "area_mm2": 8571.12825048213, "body_count": 1, "edges": 17, "faces": 8, "vertices": 11, - "volume_mm3": 47475.477375283306 + "volume_mm3": 47475.4793194927 }, - "seconds": 0.018757607, + "seconds": 0.011257216, "status": "pass" }, "ladder/07-fillets/012-variable-into-rounded-corner": { "measured": { - "area_mm2": 8665.870632567001, + "area_mm2": 8665.870097489847, "body_count": 1, "edges": 18, "faces": 8, "vertices": 12, - "volume_mm3": 47754.87775109653 + "volume_mm3": 47754.87240844197 }, - "seconds": 0.059642694, + "seconds": 0.050985104, "status": "pass" }, "ladder/07-fillets/013-corner-setback": { "measured": { - "area_mm2": 8509.311157473603, + "area_mm2": 8509.310862681297, "body_count": 1, "edges": 36, "faces": 15, "vertices": 23, - "volume_mm3": 47325.93695835596 + "volume_mm3": 47325.93514010273 }, - "seconds": 0.116555677, + "seconds": 0.062429472, "status": "pass" }, "ladder/07-fillets/014-curved-edge-r2": { "measured": { - "area_mm2": 1829.240960227803, + "area_mm2": 1829.2409621331146, "body_count": 1, "edges": 5, "faces": 4, "vertices": 3, - "volume_mm3": 6231.659066701741 + "volume_mm3": 6231.659467501777 }, - "seconds": 0.078144443, + "seconds": 0.047797086, "status": "pass" }, "ladder/07-fillets/015-corner-g2-patch": { "measured": { - "area_mm2": 8520.38925544218, + "area_mm2": 8520.388941406904, "body_count": 1, "edges": 24, "faces": 10, "vertices": 16, - "volume_mm3": 47370.10741440046 + "volume_mm3": 47370.10556764398 }, - "seconds": 2.184099933, - "status": "pass" - }, - "ladder/07-fillets/019-concave-corner-g2-patch": { - "measured": { - "area_mm2": 8702.800595617835, - "body_count": 1, - "edges": 33, - "faces": 13, - "vertices": 22, - "volume_mm3": 44254.3419135911 - }, - "seconds": 2.217877403, + "seconds": 2.172589317, "status": "pass" }, "ladder/07-fillets/016-corner-three-sequential-r5-r3-r7": { - "seconds": 0.045599545, + "seconds": 0.053107612, "status": "pass" }, "ladder/07-fillets/017-part-rounds": { "measured": { - "area_mm2": 12905.663516135399, + "area_mm2": 12905.663645271128, "body_count": 1, "edges": 59, "faces": 24, "vertices": 39, - "volume_mm3": 53151.0192291965 + "volume_mm3": 53151.022090002196 }, - "seconds": 0.689812087, + "seconds": 0.479855299, "status": "pass" }, "ladder/07-fillets/018-corner-three-sequential-r5-r3-r2": { "measured": { - "area_mm2": 8591.675261485441, + "area_mm2": 8591.675008996122, "body_count": 1, "edges": 24, "faces": 11, "vertices": 15, - "volume_mm3": 47589.770109309655 + "volume_mm3": 47589.770467263734 }, - "seconds": 0.080235318, + "seconds": 0.06135609, + "status": "pass" + }, + "ladder/07-fillets/019-concave-corner-g2-patch": { + "measured": { + "area_mm2": 8702.800522231322, + "body_count": 1, + "edges": 33, + "faces": 13, + "vertices": 22, + "volume_mm3": 44254.34116127434 + }, + "seconds": 2.083591798, "status": "pass" }, "ladder/08-chamfers/001-equal-5": { "measured": { - "area_mm2": 8599.264068703942, + "area_mm2": 8599.26406871193, "body_count": 1, "edges": 15, "faces": 7, "vertices": 10, - "volume_mm3": 47250.000000000015 + "volume_mm3": 47249.99999999999 }, - "seconds": 0.011586527, + "seconds": 0.011874723, "status": "pass" }, "ladder/08-chamfers/002-two-distances-5-3": { "measured": { - "area_mm2": 8654.857113680613, + "area_mm2": 8654.857113690718, "body_count": 1, "edges": 15, "faces": 7, "vertices": 10, - "volume_mm3": 47550.00000001157 + "volume_mm3": 47549.99999999999 }, - "seconds": 0.023819586, + "seconds": 0.012467878, "status": "pass" }, "ladder/08-chamfers/003-distance-angle-5-30": { "measured": { - "area_mm2": 8658.771324025132, + "area_mm2": 8658.771324027146, "body_count": 1, "edges": 15, "faces": 7, "vertices": 10, - "volume_mm3": 47566.987298072774 + "volume_mm3": 47566.98729810778 }, - "seconds": 0.011581759, + "seconds": 0.011893235, "status": "pass" }, "ladder/08-chamfers/004-corner-three-equal-3": { @@ -1285,7 +1449,7 @@ "vertices": 14, "volume_mm3": 47480.25 }, - "seconds": 0.009050177, + "seconds": 0.018004693, "status": "pass" }, "ladder/08-chamfers/005-corner-two-mitred-3": { @@ -1295,69 +1459,69 @@ "edges": 17, "faces": 8, "vertices": 11, - "volume_mm3": 47559.0 + "volume_mm3": 47558.99999999999 }, - "seconds": 0.008041451, + "seconds": 0.014861284, "status": "pass" }, "ladder/08-chamfers/006-curved-edge-2": { "measured": { - "area_mm2": 1806.138314620597, + "area_mm2": 1806.1383362576198, "body_count": 1, "edges": 5, "faces": 4, "vertices": 3, - "volume_mm3": 6165.898978570243 + "volume_mm3": 6165.899181475064 }, - "seconds": 0.069695981, + "seconds": 0.059633056, "status": "pass" }, "ladder/08-chamfers/007-chamfer-then-fillets": { "measured": { - "area_mm2": 8652.794170649633, + "area_mm2": 8652.79420663156, "body_count": 1, "edges": 21, "faces": 9, "vertices": 14, - "volume_mm3": 47700.04681392183 + "volume_mm3": 47700.04718731957 }, - "seconds": 0.029079455, + "seconds": 0.031264128, "status": "pass" }, "ladder/08-chamfers/008-part-chamfers": { "measured": { - "area_mm2": 12800.622976693989, + "area_mm2": 12800.623144562962, "body_count": 1, "edges": 64, "faces": 26, "vertices": 42, - "volume_mm3": 53006.93294467868 + "volume_mm3": 53006.936546270575 }, - "seconds": 0.749081818, + "seconds": 0.681389055, "status": "pass" }, "ladder/09-shells-and-offsets/001-box-open-top-t2": { "measured": { - "area_mm2": 12112.000000000002, + "area_mm2": 12112.0, "body_count": 1, "edges": 24, "faces": 11, "vertices": 16, "volume_mm3": 11712.00000000001 }, - "seconds": 0.017030877, + "seconds": 0.008805361, "status": "pass" }, "ladder/09-shells-and-offsets/002-cylinder-open-top-t1": { "measured": { - "area_mm2": 4153.185490793196, + "area_mm2": 4153.185488045601, "body_count": 1, "edges": 6, "faces": 5, "vertices": 4, - "volume_mm3": 2045.1781194378996 + "volume_mm3": 2045.1768174685462 }, - "seconds": 0.102052253, + "seconds": 0.077255283, "status": "pass" }, "ladder/09-shells-and-offsets/003-tube-two-open-faces": { @@ -1367,69 +1531,69 @@ "edges": 24, "faces": 10, "vertices": 16, - "volume_mm3": 7680.000000000007 + "volume_mm3": 7680.0000000000055 }, - "seconds": 0.017605072, + "seconds": 0.008893778, "status": "pass" }, "ladder/09-shells-and-offsets/004-thin-wall-0.2": { "measured": { - "area_mm2": 12728.320000000002, + "area_mm2": 12728.32, "body_count": 1, "edges": 24, "faces": 11, "vertices": 16, - "volume_mm3": 1268.8319999999949 + "volume_mm3": 1268.8319999999985 }, - "seconds": 0.017360494, + "seconds": 0.017061888, "status": "pass" }, "ladder/09-shells-and-offsets/005-shell-rounds-r5-t2": { "measured": { - "area_mm2": 11804.69049328623, + "area_mm2": 11804.690170097561, "body_count": 1, "edges": 48, "faces": 19, "vertices": 32, - "volume_mm3": 11421.860960200946 + "volume_mm3": 11421.858317494805 }, - "seconds": 0.173842021, + "seconds": 0.070876927, "status": "pass" }, "ladder/09-shells-and-offsets/006-shell-rounds-r1-thinner-than-t2": { "measured": { - "area_mm2": 12075.946992402418, + "area_mm2": 12075.946891509966, "body_count": 1, "edges": 36, "faces": 15, "vertices": 24, - "volume_mm3": 11694.832919801527 + "volume_mm3": 11694.831853512045 }, - "seconds": 0.059772023, + "seconds": 0.039572847, "status": "pass" }, "ladder/09-shells-and-offsets/007-offset-top-face-5": { "measured": { - "area_mm2": 9800.000000000004, + "area_mm2": 9800.000000000025, "body_count": 1, "edges": 12, "faces": 6, "vertices": 8, - "volume_mm3": 60000.00000000002 + "volume_mm3": 60000.00000000003 }, - "seconds": 0.016440553, + "seconds": 0.01670219, "status": "pass" }, "ladder/09-shells-and-offsets/008-offset-cylinder-wall-2": { "measured": { - "area_mm2": 2412.743113705001, + "area_mm2": 2412.743157962007, "body_count": 1, "edges": 3, "faces": 3, "vertices": 2, - "volume_mm3": 9047.786411660763 + "volume_mm3": 9047.786842389623 }, - "seconds": 0.075273098, + "seconds": 0.056818192, "status": "pass" }, "ladder/09-shells-and-offsets/009-shell-outside-t2": { @@ -1439,33 +1603,33 @@ "edges": 24, "faces": 11, "vertices": 16, - "volume_mm3": 13952.000000000015 + "volume_mm3": 13951.999999999996 }, - "seconds": 0.037942031, + "seconds": 0.017403634, "status": "pass" }, "ladder/09-shells-and-offsets/010-shell-under-rounded-top": { "measured": { - "area_mm2": 11769.84062599412, + "area_mm2": 11769.840596765922, "body_count": 1, "edges": 40, "faces": 19, "vertices": 24, - "volume_mm3": 11375.174354868088 + "volume_mm3": 11375.174413984334 }, - "seconds": 0.10510739, + "seconds": 0.078774667, "status": "pass" }, "ladder/09-shells-and-offsets/011-part-shell": { "measured": { - "area_mm2": 20922.653935613285, + "area_mm2": 20922.655884939035, "body_count": 1, "edges": 140, "faces": 55, "vertices": 92, - "volume_mm3": 15397.69748736967 + "volume_mm3": 15397.700273419785 }, - "seconds": 1.077868685, + "seconds": 0.965141641, "status": "pass" }, "ladder/09-shells-and-offsets/012-closed-shell-sealed-void": { @@ -1475,191 +1639,359 @@ "edges": 24, "faces": 12, "vertices": 16, - "volume_mm3": 15743.999999999998 + "volume_mm3": 15744.0 }, - "seconds": 0.018255444, + "seconds": 0.017151441, "status": "pass" }, "ladder/09-shells-and-offsets/013-dome-shelled-from-base": { "measured": { - "area_mm2": 4787.787342099054, + "area_mm2": 4787.7872041001665, "body_count": 1, "edges": 4, "faces": 3, "vertices": 4, - "volume_mm3": 4540.648982326449 + "volume_mm3": 4540.648582054095 }, - "seconds": 0.235684567, + "seconds": 0.112463321, "status": "pass" }, "ladder/09-shells-and-offsets/014-drafted-box-with-rounds-shelled": { "measured": { - "area_mm2": 48232.25453283639, + "area_mm2": 48232.25377351871, "body_count": 1, "edges": 48, "faces": 19, "vertices": 32, - "volume_mm3": 47497.57000224123 + "volume_mm3": 47497.55678038107 }, - "seconds": 0.123522195, + "seconds": 0.077272355, "status": "pass" }, "ladder/09-shells-and-offsets/015-shelled-dome-ring-joined-back": { "measured": { - "area_mm2": 5332.688306886705, + "area_mm2": 5332.688157880919, "body_count": 1, "edges": 7, "faces": 6, "vertices": 7, - "volume_mm3": 5540.613076260847 + "volume_mm3": 5540.61199574002 }, - "seconds": 0.922183804, + "seconds": 0.695622861, "status": "pass" }, "ladder/10-patterns-and-mirrors/001-rect-pattern-holes": { "measured": { - "area_mm2": 7506.857613724541, + "area_mm2": 7506.858347027459, "body_count": 1, "edges": 30, "faces": 12, "vertices": 20, - "volume_mm3": 22821.901949174513 + "volume_mm3": 22821.902754590934 }, - "seconds": 0.17511958, + "seconds": 0.238580543, "status": "pass" }, "ladder/10-patterns-and-mirrors/002-circular-pattern-holes": { "measured": { - "area_mm2": 8595.396203488179, + "area_mm2": 8595.39750023962, "body_count": 1, "edges": 27, "faces": 11, "vertices": 18, - "volume_mm3": 26012.383532001513 + "volume_mm3": 26012.387171703303 }, - "seconds": 0.350811307, + "seconds": 0.483548993, "status": "pass" }, "ladder/10-patterns-and-mirrors/003-overlapping-pattern-leaves-core": { "measured": { - "area_mm2": 3868.0116581684933, + "area_mm2": 3868.011849606836, "body_count": 2, "edges": 39, "faces": 17, "vertices": 26, - "volume_mm3": 9195.866260243196 + "volume_mm3": 9195.867288043119 }, - "seconds": 0.315056057, + "seconds": 0.299450421, "status": "pass" }, "ladder/10-patterns-and-mirrors/004-mirror-body-joined": { "measured": { - "area_mm2": 9742.47737488009, + "area_mm2": 9742.477796051942, "body_count": 1, "edges": 18, "faces": 8, "vertices": 12, - "volume_mm3": 44858.40293082078 + "volume_mm3": 44858.40734613875 }, - "seconds": 0.066688428, + "seconds": 0.047100825, "status": "pass" }, "ladder/10-patterns-and-mirrors/005-mirror-feature": { "measured": { - "area_mm2": 9742.477396690481, + "area_mm2": 9742.477796086725, "body_count": 1, "edges": 18, "faces": 8, "vertices": 12, - "volume_mm3": 44858.4039421837 + "volume_mm3": 44858.40734637524 }, - "seconds": 0.074462135, + "seconds": 0.073737999, "status": "pass" }, "ladder/10-patterns-and-mirrors/006-circular-pattern-counterbores": { "measured": { - "area_mm2": 8472.87515433848, + "area_mm2": 8472.875386822696, "body_count": 1, "edges": 39, "faces": 21, "vertices": 26, - "volume_mm3": 26304.552440002004 + "volume_mm3": 26304.55528840379 }, - "seconds": 0.854954268, + "seconds": 0.75764951, "status": "pass" }, "ladder/10-patterns-and-mirrors/007-pattern-bodies": { "measured": { - "area_mm2": 980.1768925219793, + "area_mm2": 980.1769079213999, "body_count": 4, "edges": 12, "faces": 12, "vertices": 8, - "volume_mm3": 1130.973281262568 + "volume_mm3": 1130.973355299363 }, - "seconds": 0.030954617, + "seconds": 0.034578003, "status": "pass" }, "ladder/10-patterns-and-mirrors/008-part-vents": { "measured": { - "area_mm2": 20922.653960454496, + "area_mm2": 20922.655884935477, "body_count": 1, "edges": 152, "faces": 59, "vertices": 100, - "volume_mm3": 15355.286014502955 + "volume_mm3": 15355.288772614174 }, - "seconds": 1.764667122, + "seconds": 1.5896883499999999, "status": "pass" }, "ladder/11-cumulative-parts/001-bracket": { "measured": { - "area_mm2": 10415.793632553658, + "area_mm2": 10415.793999431555, "body_count": 1, "edges": 30, "faces": 12, "vertices": 20, - "volume_mm3": 31550.35228808287 + "volume_mm3": 31550.35411758737 }, - "seconds": 0.087923968, + "seconds": 0.089256502, "status": "pass" }, "ladder/11-cumulative-parts/002-flange": { "measured": { - "area_mm2": 16258.85231664228, + "area_mm2": 16258.852952953679, "body_count": 1, "edges": 31, "faces": 14, "vertices": 20, - "volume_mm3": 55442.52558072023 + "volume_mm3": 55442.53182457834 }, - "seconds": 0.618163039, + "seconds": 0.672579846, "status": "pass" }, "ladder/11-cumulative-parts/003-threaded-flange": { "measured": { - "area_mm2": 17357.35813902275, + "area_mm2": 17357.35940342288, "body_count": 1, "edges": 104, "faces": 38, "vertices": 69, - "volume_mm3": 52962.08974469333 + "volume_mm3": 52962.09746083463 }, - "seconds": 2.199779541, + "seconds": 2.165888799, "status": "pass" }, "ladder/11-cumulative-parts/004-housing": { "measured": { - "area_mm2": 21105.285520302223, + "area_mm2": 21105.28755123865, "body_count": 1, "edges": 210, "faces": 78, "vertices": 139, - "volume_mm3": 15138.516074654483 + "volume_mm3": 15138.51984646152 }, - "seconds": 2.307493908, + "seconds": 2.313084051, + "status": "pass" + }, + "ladder/12-sheet-metal/001-base-flange": { + "measured": { + "area_mm2": 12640.0, + "body_count": 1, + "edges": 12, + "faces": 6, + "vertices": 8, + "volume_mm3": 12000.0 + }, + "seconds": 0.002311005, + "status": "pass" + }, + "ladder/12-sheet-metal/002-edge-flange-90": { + "measured": { + "area_mm2": 16136.884901330357, + "body_count": 1, + "edges": 24, + "faces": 10, + "vertices": 16, + "volume_mm3": 15428.318530998597 + }, + "seconds": 0.005208205, + "status": "pass" + }, + "ladder/12-sheet-metal/003-four-flanges-90-closed-corners": { + "measured": { + "area_mm2": 23186.608102624614, + "body_count": 1, + "edges": 100, + "faces": 46, + "vertices": 56, + "volume_mm3": 22251.65632905223 + }, + "seconds": 0.013824846, + "status": "pass" + }, + "ladder/12-sheet-metal/004-four-flanges-72-leaning-out": { + "measured": { + "area_mm2": 24953.88745958142, + "body_count": 1, + "edges": 100, + "faces": 46, + "vertices": 56, + "volume_mm3": 23902.891080131303 + }, + "seconds": 0.013688925, + "status": "pass" + }, + "ladder/12-sheet-metal/005-four-flanges-108-leaning-in": { + "measured": { + "area_mm2": 21135.960695887396, + "body_count": 1, + "edges": 100, + "faces": 46, + "vertices": 56, + "volume_mm3": 20295.27663998377 + }, + "seconds": 0.014171471, + "status": "pass" + }, + "ladder/12-sheet-metal/006-corner-relief-round": { + "measured": { + "area_mm2": 23118.077137837114, + "body_count": 1, + "edges": 112, + "faces": 50, + "vertices": 64, + "volume_mm3": 22125.992622723512 + }, + "seconds": 0.017297633, + "status": "pass" + }, + "ladder/12-sheet-metal/007-corner-relief-rectangular": { + "measured": { + "area_mm2": 23118.077137708584, + "body_count": 1, + "edges": 116, + "faces": 46, + "vertices": 72, + "volume_mm3": 22119.125363817402 + }, + "seconds": 0.008106542, + "status": "pass" + }, + "ladder/12-sheet-metal/008-corner-relief-tear": { + "measured": { + "area_mm2": 23193.661881433123, + "body_count": 1, + "edges": 76, + "faces": 38, + "vertices": 40, + "volume_mm3": 22267.903289987218 + }, + "seconds": 0.070922958, + "status": "pass" + }, + "ladder/12-sheet-metal/009-hem-on-the-back-edge": { + "measured": { + "area_mm2": 18438.654703981796, + "body_count": 1, + "edges": 36, + "faces": 14, + "vertices": 24, + "volume_mm3": 17684.955592012873 + }, + "seconds": 0.005880081, + "status": "pass" + }, + "ladder/12-sheet-metal/010-fold-90": { + "measured": { + "area_mm2": 12640.000000002789, + "body_count": 1, + "edges": 24, + "faces": 10, + "vertices": 16, + "volume_mm3": 12000.000000267475 + }, + "seconds": 0.005451935, + "status": "pass" + }, + "ladder/12-sheet-metal/011-fold-unfolded": { + "measured": { + "area_mm2": 12639.999999949136, + "body_count": 1, + "edges": 12, + "faces": 6, + "vertices": 8, + "volume_mm3": 11999.999999950776 + }, + "seconds": 0.010428666, + "status": "pass" + }, + "ladder/12-sheet-metal/012-fold-refolded": { + "measured": { + "area_mm2": 12640.000000002789, + "body_count": 1, + "edges": 24, + "faces": 10, + "vertices": 16, + "volume_mm3": 12000.000000267475 + }, + "seconds": 0.007827708, + "status": "pass" + }, + "ladder/12-sheet-metal/013-flat-pattern": { + "measured": { + "area_mm2": 23186.608102624614, + "body_count": 1, + "edges": 100, + "faces": 46, + "vertices": 56, + "volume_mm3": 22251.65632905223 + }, + "seconds": 0.032328181, + "status": "pass" + }, + "ladder/12-sheet-metal/014-bracket": { + "measured": { + "area_mm2": 19539.522023125195, + "body_count": 1, + "edges": 38, + "faces": 15, + "vertices": 26, + "volume_mm3": 18699.55742984613 + }, + "seconds": 0.091808771, "status": "pass" } }, - "reason": "SMLib a15b5a2: corner setbacks, the ball-fit refusal before the corners, the graded vacuous cases and the two thread cases" + "reason": "SMLib 60b1c6a: tiers 05 and 06 take the UNC, UNF, Rc and NPT tapped holes, the pipe threads, the steep flank and the tip options, tier 12 (sheet metal) is new; the 139 cases before keep their statuses and counts, their volumes and areas re-measured within 2e-6" } diff --git a/tests/kernel-cases/ladder/ladder.json b/tests/kernel-cases/ladder/ladder.json index 8f3002110..dab9df7ed 100644 --- a/tests/kernel-cases/ladder/ladder.json +++ b/tests/kernel-cases/ladder/ladder.json @@ -2,10 +2,10 @@ "tiers": [ { "cases": [ - "ladder/01-primitives/005-sphere", "ladder/01-primitives/001-box", - "ladder/01-primitives/004-frustum", + "ladder/01-primitives/005-sphere", "ladder/01-primitives/003-cone", + "ladder/01-primitives/004-frustum", "ladder/01-primitives/002-cylinder", "ladder/01-primitives/006-torus" ], @@ -14,30 +14,30 @@ }, { "cases": [ - "ladder/02-booleans/001-coincident-face-join", - "ladder/02-booleans/019-notch-flush-with-end-face", "ladder/02-booleans/004-edge-on-edge-no-overlap", "ladder/02-booleans/015-knife-edge-wedge-cut", - "ladder/02-booleans/014-cut-through-sphere-pole", + "ladder/02-booleans/001-coincident-face-join", "ladder/02-booleans/016-v-groove-pinches-bottom-to-line", - "ladder/02-booleans/020-part-back-wall", "ladder/02-booleans/003-pocket-flush-with-top", + "ladder/02-booleans/020-part-back-wall", + "ladder/02-booleans/019-notch-flush-with-end-face", "ladder/02-booleans/002-coplanar-overlap-join", + "ladder/02-booleans/014-cut-through-sphere-pole", + "ladder/02-booleans/007-near-tangent-gap-1e-3", "ladder/02-booleans/006-tangent-along-line-no-overlap", + "ladder/02-booleans/010-near-tangent-overlap-1e-6", + "ladder/02-booleans/008-near-tangent-gap-1e-6", + "ladder/02-booleans/009-near-tangent-overlap-1e-3", + "ladder/02-booleans/005-vertex-on-face-no-overlap", "ladder/02-booleans/017-cylinder-tangent-top-and-bottom", "ladder/02-booleans/018-hole-tangent-to-side-face", - "ladder/02-booleans/008-near-tangent-gap-1e-6", - "ladder/02-booleans/010-near-tangent-overlap-1e-6", - "ladder/02-booleans/011-tangent-along-circle-through-hole", - "ladder/02-booleans/005-vertex-on-face-no-overlap", - "ladder/02-booleans/007-near-tangent-gap-1e-3", - "ladder/02-booleans/009-near-tangent-overlap-1e-3", "ladder/02-booleans/013-cut-across-cylinder-seam", - "ladder/02-booleans/021-holes-touching-at-a-point", "ladder/02-booleans/012-tangent-along-circle-bowl", + "ladder/02-booleans/011-tangent-along-circle-through-hole", "ladder/02-booleans/022-cylinder-grazing-a-hole-edge", - "ladder/02-booleans/023-lips-1e-4-off-the-walls-joined", + "ladder/02-booleans/021-holes-touching-at-a-point", "ladder/02-booleans/024-wall-halves-merged-into-a-flange", + "ladder/02-booleans/023-lips-1e-4-off-the-walls-joined", "ladder/02-booleans/025-flush-chord-layers-joined" ], "tier": "02-booleans", @@ -45,14 +45,14 @@ }, { "cases": [ - "ladder/03-analytic-profiles/001-extrude-rect-with-arc-end", - "ladder/03-analytic-profiles/007-revolve-180-touching-axis", "ladder/03-analytic-profiles/006-revolve-partial-90", + "ladder/03-analytic-profiles/007-revolve-180-touching-axis", "ladder/03-analytic-profiles/008-extrude-slot", + "ladder/03-analytic-profiles/001-extrude-rect-with-arc-end", "ladder/03-analytic-profiles/003-extrude-tapered-circle", "ladder/03-analytic-profiles/002-extrude-annulus", - "ladder/03-analytic-profiles/004-revolve-full-off-axis", "ladder/03-analytic-profiles/005-revolve-touching-axis-hemisphere", + "ladder/03-analytic-profiles/004-revolve-full-off-axis", "ladder/03-analytic-profiles/009-part-boss-and-slot", "ladder/03-analytic-profiles/010-revolve-horn-torus-270" ], @@ -65,9 +65,9 @@ "ladder/04-spline-profiles/001-extrude-bezier-arch", "ladder/04-spline-profiles/008-loft-square-to-circle", "ladder/04-spline-profiles/009-extrude-periodic-fit-spline", - "ladder/04-spline-profiles/004-sweep-square-along-bezier", "ladder/04-spline-profiles/006-loft-circle-frustum", "ladder/04-spline-profiles/007-loft-three-circles", + "ladder/04-spline-profiles/004-sweep-square-along-bezier", "ladder/04-spline-profiles/002-revolve-bezier-profile", "ladder/04-spline-profiles/010-part-bezier-window", "ladder/04-spline-profiles/003-pipe-along-bezier", @@ -79,95 +79,95 @@ }, { "cases": [ - "ladder/05-holes-and-taps/006-tapped-m6-through", "ladder/05-holes-and-taps/001-simple-through", - "ladder/05-holes-and-taps/009-hole-0.5-from-edge", "ladder/05-holes-and-taps/010-hole-tangent-to-end-face", - "ladder/05-holes-and-taps/003-drilled-blind-118", + "ladder/05-holes-and-taps/006-tapped-m6-through", + "ladder/05-holes-and-taps/017-tapped-1-4-npt-through", + "ladder/05-holes-and-taps/016-tapped-rc-1-2-through", "ladder/05-holes-and-taps/002-simple-blind-flat", - "ladder/05-holes-and-taps/004-counterbore", + "ladder/05-holes-and-taps/003-drilled-blind-118", "ladder/05-holes-and-taps/007-tapped-m8-blind", + "ladder/05-holes-and-taps/015-tapped-1-4-28-unf-blind", + "ladder/05-holes-and-taps/009-hole-0.5-from-edge", + "ladder/05-holes-and-taps/014-tapped-1-4-20-unc-through", + "ladder/05-holes-and-taps/004-counterbore", "ladder/05-holes-and-taps/005-countersink", "ladder/05-holes-and-taps/011-crossing-holes-steinmetz", "ladder/05-holes-and-taps/012-crossing-tapped-holes-offset", "ladder/05-holes-and-taps/008-tapped-m5-into-curved-face", - "ladder/05-holes-and-taps/013-part-holes", - "ladder/05-holes-and-taps/014-tapped-1-4-20-unc-through", - "ladder/05-holes-and-taps/015-tapped-1-4-28-unf-blind", - "ladder/05-holes-and-taps/016-tapped-rc-1-2-through", - "ladder/05-holes-and-taps/017-tapped-1-4-npt-through" + "ladder/05-holes-and-taps/013-part-holes" ], "tier": "05-holes-and-taps", "what": "holes and tapped holes" }, { "cases": [ + "ladder/06-threads/030-square-thread-refused", "ladder/06-threads/012-external-acme-3-4-6", - "ladder/06-threads/013-external-s20x4", "ladder/06-threads/011-external-tr20x4", - "ladder/06-threads/003-external-m10-partial-length", + "ladder/06-threads/029-external-tr20x4-chamfer-needs-depth", + "ladder/06-threads/013-external-s20x4", + "ladder/06-threads/021-internal-rp-1-2", + "ladder/06-threads/020-external-g-1-2", "ladder/06-threads/015-internal-tr20x4-nut", "ladder/06-threads/014-external-buttress-asme-1.5-8", - "ladder/06-threads/010-part-threaded-boss", - "ladder/06-threads/016-external-m10-left-hand", - "ladder/06-threads/019-external-tr40x14-p7-two-start", - "ladder/06-threads/005-internal-m10-through", - "ladder/06-threads/006-external-m10-into-chamfer", - "ladder/06-threads/007-external-m10-at-filleted-shoulder", - "ladder/06-threads/001-external-m10-full", - "ladder/06-threads/004-external-m10-to-shoulder", - "ladder/06-threads/009-thread-runout-length", - "ladder/06-threads/002-external-m10x1-fine", - "ladder/06-threads/017-external-m10-chamfered-tip", - "ladder/06-threads/008-multi-start-thread", - "ladder/06-threads/018-external-m10-both-hands", - "ladder/06-threads/020-external-g-1-2", - "ladder/06-threads/021-internal-rp-1-2", - "ladder/06-threads/022-external-r-1-2-taper", - "ladder/06-threads/023-external-1-2-npt", - "ladder/06-threads/024-internal-rc-1-2-taper", - "ladder/06-threads/025-external-s20x4-steep-flank-end-to-shoulder", "ladder/06-threads/026-external-s20x4-steep-flank-start-to-shoulder", - "ladder/06-threads/027-external-m10-chamfered-start", + "ladder/06-threads/010-part-threaded-boss", + "ladder/06-threads/025-external-s20x4-steep-flank-end-to-shoulder", + "ladder/06-threads/003-external-m10-partial-length", + "ladder/06-threads/005-internal-m10-through", + "ladder/06-threads/019-external-tr40x14-p7-two-start", "ladder/06-threads/028-external-tr20x4-chamfer-30-deg-2.5-deep", - "ladder/06-threads/029-external-tr20x4-chamfer-needs-depth", - "ladder/06-threads/030-square-thread-refused" + "ladder/06-threads/022-external-r-1-2-taper", + "ladder/06-threads/024-internal-rc-1-2-taper", + "ladder/06-threads/004-external-m10-to-shoulder", + "ladder/06-threads/007-external-m10-at-filleted-shoulder", + "ladder/06-threads/009-thread-runout-length", + "ladder/06-threads/023-external-1-2-npt", + "ladder/06-threads/016-external-m10-left-hand", + "ladder/06-threads/001-external-m10-full", + "ladder/06-threads/006-external-m10-into-chamfer", + "ladder/06-threads/027-external-m10-chamfered-start", + "ladder/06-threads/002-external-m10x1-fine", + "ladder/06-threads/008-multi-start-thread", + "ladder/06-threads/017-external-m10-chamfered-tip", + "ladder/06-threads/018-external-m10-both-hands" ], "tier": "06-threads", "what": "modelled threads" }, { "cases": [ - "ladder/07-fillets/015-corner-g2-patch", - "ladder/07-fillets/019-concave-corner-g2-patch", - "ladder/07-fillets/006-variable-r5-to-zero", "ladder/07-fillets/001-single-edge-r5", "ladder/07-fillets/007-variable-r5-to-1e-3", "ladder/07-fillets/011-chain-ending-at-corner", + "ladder/07-fillets/002-four-vertical-edges-r5", + "ladder/07-fillets/006-variable-r5-to-zero", + "ladder/07-fillets/008-constant-r1e-3", "ladder/07-fillets/005-variable-r5-to-r1", + "ladder/07-fillets/010-corner-unequal-r7-r3", "ladder/07-fillets/004-convex-and-concave-r5", "ladder/07-fillets/009-corner-three-equal-r5", - "ladder/07-fillets/008-constant-r1e-3", - "ladder/07-fillets/002-four-vertical-edges-r5", - "ladder/07-fillets/010-corner-unequal-r7-r3", - "ladder/07-fillets/016-corner-three-sequential-r5-r3-r7", - "ladder/07-fillets/012-variable-into-rounded-corner", "ladder/07-fillets/014-curved-edge-r2", + "ladder/07-fillets/012-variable-into-rounded-corner", + "ladder/07-fillets/016-corner-three-sequential-r5-r3-r7", "ladder/07-fillets/018-corner-three-sequential-r5-r3-r2", - "ladder/07-fillets/003-tangent-chain-r3", "ladder/07-fillets/013-corner-setback", - "ladder/07-fillets/017-part-rounds" + "ladder/07-fillets/003-tangent-chain-r3", + "ladder/07-fillets/017-part-rounds", + "ladder/07-fillets/019-concave-corner-g2-patch", + "ladder/07-fillets/015-corner-g2-patch" ], "tier": "07-fillets", "what": "constant, variable and corner fillets" }, { "cases": [ + "ladder/08-chamfers/001-equal-5", + "ladder/08-chamfers/003-distance-angle-5-30", + "ladder/08-chamfers/002-two-distances-5-3", "ladder/08-chamfers/005-corner-two-mitred-3", "ladder/08-chamfers/004-corner-three-equal-3", - "ladder/08-chamfers/003-distance-angle-5-30", - "ladder/08-chamfers/001-equal-5", - "ladder/08-chamfers/002-two-distances-5-3", "ladder/08-chamfers/007-chamfer-then-fillets", "ladder/08-chamfers/006-curved-edge-2", "ladder/08-chamfers/008-part-chamfers" @@ -177,18 +177,18 @@ }, { "cases": [ - "ladder/09-shells-and-offsets/007-offset-top-face-5", "ladder/09-shells-and-offsets/001-box-open-top-t2", - "ladder/09-shells-and-offsets/004-thin-wall-0.2", "ladder/09-shells-and-offsets/003-tube-two-open-faces", + "ladder/09-shells-and-offsets/007-offset-top-face-5", + "ladder/09-shells-and-offsets/004-thin-wall-0.2", "ladder/09-shells-and-offsets/012-closed-shell-sealed-void", "ladder/09-shells-and-offsets/009-shell-outside-t2", "ladder/09-shells-and-offsets/006-shell-rounds-r1-thinner-than-t2", "ladder/09-shells-and-offsets/008-offset-cylinder-wall-2", - "ladder/09-shells-and-offsets/002-cylinder-open-top-t1", - "ladder/09-shells-and-offsets/010-shell-under-rounded-top", - "ladder/09-shells-and-offsets/014-drafted-box-with-rounds-shelled", "ladder/09-shells-and-offsets/005-shell-rounds-r5-t2", + "ladder/09-shells-and-offsets/002-cylinder-open-top-t1", + "ladder/09-shells-and-offsets/014-drafted-box-with-rounds-shelled", + "ladder/09-shells-and-offsets/010-shell-under-rounded-top", "ladder/09-shells-and-offsets/013-dome-shelled-from-base", "ladder/09-shells-and-offsets/015-shelled-dome-ring-joined-back", "ladder/09-shells-and-offsets/011-part-shell" @@ -224,17 +224,17 @@ "cases": [ "ladder/12-sheet-metal/001-base-flange", "ladder/12-sheet-metal/002-edge-flange-90", - "ladder/12-sheet-metal/003-four-flanges-90-closed-corners", + "ladder/12-sheet-metal/010-fold-90", + "ladder/12-sheet-metal/009-hem-on-the-back-edge", + "ladder/12-sheet-metal/012-fold-refolded", + "ladder/12-sheet-metal/007-corner-relief-rectangular", + "ladder/12-sheet-metal/011-fold-unfolded", "ladder/12-sheet-metal/004-four-flanges-72-leaning-out", + "ladder/12-sheet-metal/003-four-flanges-90-closed-corners", "ladder/12-sheet-metal/005-four-flanges-108-leaning-in", "ladder/12-sheet-metal/006-corner-relief-round", - "ladder/12-sheet-metal/007-corner-relief-rectangular", - "ladder/12-sheet-metal/008-corner-relief-tear", - "ladder/12-sheet-metal/009-hem-on-the-back-edge", - "ladder/12-sheet-metal/010-fold-90", - "ladder/12-sheet-metal/011-fold-unfolded", - "ladder/12-sheet-metal/012-fold-refolded", "ladder/12-sheet-metal/013-flat-pattern", + "ladder/12-sheet-metal/008-corner-relief-tear", "ladder/12-sheet-metal/014-bracket" ], "tier": "12-sheet-metal", From 6af622978a953d42fa7ea0064b37de8605cb66a9 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 18:40:16 -0400 Subject: [PATCH 097/108] Threads: a taper thread's groove follows its crest cone across the section, so no sliver of the flanks is left The groove's section was cut square a fixed margin past the crest. The crest cone changes 1 in 32 along the axis across the section's own width, so for NPT (margin 0.015 mm against a 0.028 mm rise) the section's deeper corner stopped under the cone and each tooth kept a sliver of its flank: 0.94 mm3 too much on a 1/2-14 NPT. The section's edge now follows the cone at the same margin. Co-Authored-By: Claude Opus 5.5 --- crates/doc/src/eval_thread.rs | 62 ++++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 22 deletions(-) diff --git a/crates/doc/src/eval_thread.rs b/crates/doc/src/eval_thread.rs index 0ceaf8733..b4427be8c 100644 --- a/crates/doc/src/eval_thread.rs +++ b/crates/doc/src/eval_thread.rs @@ -461,21 +461,44 @@ fn thread_grooves( format!("this {shown} mm shaft is too thin for a modelled {m} thread: {cut}; make the shaft {} mm for {m}{alt}", show_mm(d)) })); } - // The section's radial span: from the root out past the surface (external), or from inside - // the hole wall out to the root (internal), so the cut leaves no skin. + // The section: from the root out past the surface (external), or from inside the hole wall + // out to the root (internal), so the cut leaves no skin, its flanks the groove's. // A taper thread's crests are cut by its major cone (external) or minor cone (internal), - // as the die or tap cuts them ([`taper_envelope`]): its groove reaches just past the crest, - // by as much as narrows the tooth's crest flat by a quarter (NPT's flat is 0.038 P). - let past = |g: &crate::thread_forms::GrooveProfile| 0.25 * g.crest_flat / (g.flank_lo.tan() + g.flank_hi.tan()); - let span = |g: &crate::thread_forms::GrooveProfile| match (taper.is_some(), t.internal) { - (true, true) => (g.crest_r - past(g), g.root_r), - (true, false) => (g.root_r, g.crest_r + past(g)), - (false, true) => (radius.min(g.crest_r) - 0.1 * p, g.root_r), - (false, false) => (g.root_r, radius.max(d / 2.0) + 0.05 * p), + // as the die or tap cuts them ([`taper_envelope`]): its groove reaches past the crest by as + // much as narrows the tooth's crest flat by a quarter (NPT's flat is 0.038 P). The cone + // changes 1 in 32 along the axis (`major_at`) across the section's own width, so its edge + // there follows the cone at that margin rather than being cut square: square, its deeper + // corner stops short of the cone and leaves a sliver of each flank. + let cone = taper.map_or(0.0, |_| (major_at(t.start + 1.0) - major_at(t.start)) / 2.0); + let section_of = |g: &crate::thread_forms::GrooveProfile| -> (Vec, f64) { + let (tl, th) = (g.flank_lo.tan(), g.flank_hi.tan()); + if taper.is_none() { + let (r0, r1) = if t.internal { + (radius.min(g.crest_r) - 0.1 * p, g.root_r) + } else { + (g.root_r, radius.max(d / 2.0) + 0.05 * p) + }; + let ((lo0, hi0), (lo1, hi1)) = (g.extents(p, r0), g.extents(p, r1)); + let wide = g.width(p, if t.internal { r0 } else { r1 }); + return (vec![Vec2::new(r0, -lo0), Vec2::new(r1, -lo1), Vec2::new(r1, hi1), Vec2::new(r0, hi0)], wide); + } + // Depth from the root, out towards the crest: d(z) = dc + q·z along the edge, which + // meets the flanks z = −(h + d·tl) and z = h + d·th. + let o = if t.internal { -1.0 } else { 1.0 }; + let q = o * cone; + let h = g.width(p, g.root_r) / 2.0; + let dc = o * (g.crest_r - g.root_r) + 0.25 * g.crest_flat / (tl + th); + let (z_lo, z_hi) = (-(h + dc * tl) / (1.0 + q * tl), (h + dc * th) / (1.0 - q * th)); + let r = |z: f64| g.root_r + o * (dc + q * z); + let (root, edge) = ([Vec2::new(g.root_r, -h), Vec2::new(g.root_r, h)], [Vec2::new(r(z_lo), z_lo), Vec2::new(r(z_hi), z_hi)]); + // In the order the square section has: the inner radius's corners first. + let pts = if t.internal { vec![edge[0], root[0], root[1], edge[1]] } else { vec![root[0], edge[0], edge[1], root[1]] }; + (pts, z_hi - z_lo) }; - let (r0, r1) = span(&g); - let wide = if t.internal { r0 } else { r1 }; - if g.width(p, wide) >= p * 0.98 { + let (mut section, wide) = section_of(&g); + let radii = |s: &[Vec2]| s.iter().fold((f64::INFINITY, f64::NEG_INFINITY), |(a, b), v| (a.min(v.x), b.max(v.x))); + let (r0, r1) = radii(§ion); + if wide >= p * 0.98 { // The groove would be wider than a pitch: the face is far inside the thread (a hole // narrower than its minor diameter, a shaft thicker than its major one, #2688). let (m, dia) = (&t.designation, 2.0 * radius); @@ -488,9 +511,6 @@ fn thread_grooves( format!("this {shown} mm shaft is too thick for a modelled {m} thread; make the shaft {} mm for {m}{alt}", show_mm(d)) })); } - let (lo0, hi0) = g.extents(p, r0); - let (lo1, hi1) = g.extents(p, r1); - let mut section = vec![Vec2::new(r0, -lo0), Vec2::new(r1, -lo1), Vec2::new(r1, hi1), Vec2::new(r0, hi0)]; if !(r0.is_finite() && r1.is_finite() && r0 > 0.0) { return Err(DocError::Invalid("thread dimensions are out of range".into())); } @@ -503,7 +523,8 @@ fn thread_grooves( // the material (an external thread's away from the axis, past the surface; an internal // one's towards it, into the hole) as it turns. It lies past the full-form length, up to the // shoulder's clearance; at a free end, inside the face, the groove reaching nothing there. - let (w_lo, w_hi) = (lo0.max(lo1), hi0.max(hi1)); + // How far the section reaches each way along the axis. + let (w_lo, w_hi) = section.iter().fold((0.0_f64, 0.0_f64), |(a, b), v| (a.max(-v.y), b.max(v.y))); let s0 = match (ends[0], ease[0] > 0.0) { (End::Free, false) => t.start - p, (End::Free, true) => t.start, @@ -528,11 +549,8 @@ fn thread_grooves( let mut r0 = r0; let taper_rate = match taper { Some(_) => { - let gb = profile(major_at(s0)); - let (a, b) = span(&gb); - let ((l0, h0), (l1, h1)) = (gb.extents(p, a), gb.extents(p, b)); - section = vec![Vec2::new(a, -l0), Vec2::new(b, -l1), Vec2::new(b, h1), Vec2::new(a, h0)]; - r0 = a; + section = section_of(&profile(major_at(s0))).0; + r0 = radii(§ion).0; (major_at(s0 + lead) - major_at(s0)) / 2.0 } None => 0.0, From 3f5efdf70f2b4012d3dcb30566959fded29d1712 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 18:44:15 -0400 Subject: [PATCH 098/108] Kernel rig: one results check, each {step, pointer?, json, rel?, abs_mm?} Two branches added a results field in different forms ({step, json} and {command, pointer, value}). The grader keeps one: a 1-based step, an optional JSON pointer into its answer, and the value matched as files are, with an optional relative or absolute tolerance. The construction and inspect cases are rewritten to it. Co-Authored-By: Claude Opus 5.5 --- tests/kernel-cases/README.md | 3 +- .../expected.json | 16 ++++----- .../cov-center-of-mass-box/expected.json | 8 ++--- .../expected.json | 24 ++++++------- .../expected.json | 8 ++--- .../expected.json | 8 ++--- .../cov-compare-identical-boxes/expected.json | 12 +++---- .../cov-compare-taller-box/expected.json | 36 +++++++++---------- .../expected.json | 20 +++++------ .../expected.json | 28 +++++++-------- .../expected.json | 16 ++++----- .../expected.json | 8 ++--- .../expected.json | 12 +++---- .../expected.json | 8 ++--- .../expected.json | 24 ++++++------- .../cov-isocurve-cube-top/expected.json | 16 ++++----- .../expected.json | 4 +-- .../expected.json | 4 +-- .../expected.json | 4 +-- .../expected.json | 4 +-- 20 files changed, 131 insertions(+), 132 deletions(-) diff --git a/tests/kernel-cases/README.md b/tests/kernel-cases/README.md index 1c2209c6c..9421d09f1 100644 --- a/tests/kernel-cases/README.md +++ b/tests/kernel-cases/README.md @@ -110,9 +110,8 @@ the frozen truck-geometry PRs, a `kernel-paused` PR), for the report's coverage | `timeout_s` | A longer timeout for this case than the run's (at most 1800 s), for cases that are slow by nature. A case that only needs it on a loaded machine shouldn't set it. | | `tolerance` | Optional overrides: `rel`, `abs_mm`, `mesh_mm`, `weld_mm`. | | `files` | The files the case wrote to `$OUT`, each `{path, json \| csv \| dxf}`, matched as a part of what is there: every key the case gives, an array item by item and as long, a whole number exactly, any other number within `rel`. `json`: the file's JSON; `csv`: its rows, as objects keyed by the header row; `dxf`: per layer of its ENTITIES section, how many of each entity (`{"CUT": {"CIRCLE": 1, "ELLIPSE": 0, "length_mm": 31.416}}`; a count may be a range `[min, max]`) and `length_mm`, the total length of its lines, arcs, circles, ellipses and polylines. | -| `results` | The commands' own answers, each `{step, json}`: the answer of the `step`th command (from 1) matched as `files` matches JSON (a flat pattern's bends, a rule's values). | +| `results` | The commands' own answers, each `{step, pointer?, json, rel?, abs_mm?}`: the answer of the `step`th command (from 1, base commands included), or its part at the JSON `pointer` (RFC 6901), matched as `files` matches JSON: a whole number exactly (a count), another within `rel` (the case's relative tolerance unless given) or `abs_mm`, lists item by item. | | `construction` | `{name: spec}`, a spec being `{point: [x,y,z]}`, `{axis: {through, dir}}` or `{plane: {through, normal}}`: each named construction point, axis or plane as the timeline evaluated it. A point within the position tolerance (`tolerance.abs_mm`, else 1e-3 of the box diagonal, of 1 mm where there is no body); an axis whose direction is parallel to `dir` (either way, sine of the angle at most 1e-6) and whose line passes within it of `through`; a plane likewise with `normal`. An axis or plane is graded as the line or plane it is, not by the origin it keeps. | -| `results` | `[{command, pointer, value, rel?, abs_mm?}]`: values in the commands' own replies (an inspect command's numbers). The reply of the script's `command`-th command (from 0, base commands included), at the JSON `pointer`, is `value`: a number within the relative tolerance, `[x, y, z]` within the position tolerance, anything else (a string, a bool, null, a list) equal. | | `missing` | A capability SolidCraft has no command or parameter for yet (`"solid.thread has no start count"`): the case is reported **not supported yet** without running, so the gap stays visible. | ## The kernel rig gate diff --git a/tests/kernel-cases/inspect/cov-center-of-mass-box-and-cylinder/expected.json b/tests/kernel-cases/inspect/cov-center-of-mass-box-and-cylinder/expected.json index ba0e92e09..c20f419e4 100644 --- a/tests/kernel-cases/inspect/cov-center-of-mass-box-and-cylinder/expected.json +++ b/tests/kernel-cases/inspect/cov-center-of-mass-box-and-cylinder/expected.json @@ -5,32 +5,32 @@ "method": "box 40 x 30 x 20 with a corner at the origin (V 24000 at (20,15,10)) and a cylinder r 5, h 10 on (60,0,0) (V 250 pi = 785.40 at (60,0,5)): the volume-weighted mean (21.2675, 14.5247, 9.8416), V = 24000 + 250 pi", "results": [ { - "command": 2, + "step": 3, "pointer": "/center", - "value": [ + "json": [ 21.267517524987444, 14.524680928129708, 9.84156030937657 ] }, { - "command": 2, + "step": 3, "pointer": "/volume", - "value": 24785.398163397447 + "json": 24785.398163397447 }, { - "command": 2, + "step": 3, "pointer": "/bodies/1/center", - "value": [ + "json": [ 60, 0, 5 ] }, { - "command": 2, + "step": 3, "pointer": "/bodies/1/volume", - "value": 785.3981633974482 + "json": 785.3981633974482 } ] } diff --git a/tests/kernel-cases/inspect/cov-center-of-mass-box/expected.json b/tests/kernel-cases/inspect/cov-center-of-mass-box/expected.json index a40b16dd7..b6d028993 100644 --- a/tests/kernel-cases/inspect/cov-center-of-mass-box/expected.json +++ b/tests/kernel-cases/inspect/cov-center-of-mass-box/expected.json @@ -5,18 +5,18 @@ "method": "box 40 x 30 x 20 with a corner at the origin: the middle (20,15,10), V = 40 x 30 x 20 = 24000", "results": [ { - "command": 1, + "step": 2, "pointer": "/center", - "value": [ + "json": [ 20, 15, 10 ] }, { - "command": 1, + "step": 2, "pointer": "/volume", - "value": 24000.0 + "json": 24000.0 } ] } 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 index af414d55b..108cd41fb 100644 --- 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 @@ -5,38 +5,38 @@ "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, + "step": 3, "pointer": "/overlaps", - "value": [] + "json": [] }, { - "command": 2, + "step": 3, "pointer": "/near/0/a", - "value": "A" + "json": "A" }, { - "command": 2, + "step": 3, "pointer": "/near/0/b", - "value": "B" + "json": "B" }, { - "command": 2, + "step": 3, "pointer": "/near/0/distance_mm", - "value": 10.0 + "json": 10.0 }, { - "command": 2, + "step": 3, "pointer": "/near/0/from", - "value": [ + "json": [ 5, 0, 0 ] }, { - "command": 2, + "step": 3, "pointer": "/near/0/to", - "value": [ + "json": [ 15, 0, 0 diff --git a/tests/kernel-cases/inspect/cov-clearance-overlapping-spheres/expected.json b/tests/kernel-cases/inspect/cov-clearance-overlapping-spheres/expected.json index 07c05664d..16f8a2a5e 100644 --- a/tests/kernel-cases/inspect/cov-clearance-overlapping-spheres/expected.json +++ b/tests/kernel-cases/inspect/cov-clearance-overlapping-spheres/expected.json @@ -5,14 +5,14 @@ "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, + "step": 3, "pointer": "/overlaps/0/volume_mm3", - "value": 29.321531433504735 + "json": 29.321531433504735 }, { - "command": 2, + "step": 3, "pointer": "/overlaps/0/center", - "value": [ + "json": [ 4, 0, 0 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 index 8f4b8e3af..71e960ac5 100644 --- 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 @@ -5,14 +5,14 @@ "method": "spheres r 5 on (0,0,0) and (20,0,0) are 10 apart; closer than 5 asked: none", "results": [ { - "command": 2, + "step": 3, "pointer": "/overlaps", - "value": [] + "json": [] }, { - "command": 2, + "step": 3, "pointer": "/near", - "value": [] + "json": [] } ] } diff --git a/tests/kernel-cases/inspect/cov-compare-identical-boxes/expected.json b/tests/kernel-cases/inspect/cov-compare-identical-boxes/expected.json index e1d52a15b..39a7ac301 100644 --- a/tests/kernel-cases/inspect/cov-compare-identical-boxes/expected.json +++ b/tests/kernel-cases/inspect/cov-compare-identical-boxes/expected.json @@ -5,19 +5,19 @@ "method": "boxes 40 x 30 x 20 on the same corner: identical, no region, B - A = 0", "results": [ { - "command": 2, + "step": 3, "pointer": "/identical", - "value": true + "json": true }, { - "command": 2, + "step": 3, "pointer": "/regions", - "value": [] + "json": [] }, { - "command": 2, + "step": 3, "pointer": "/difference/volume_mm3", - "value": 0.0 + "json": 0.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 index fb9f6b54a..016be182f 100644 --- a/tests/kernel-cases/inspect/cov-compare-taller-box/expected.json +++ b/tests/kernel-cases/inspect/cov-compare-taller-box/expected.json @@ -5,49 +5,49 @@ "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, + "step": 3, "pointer": "/a/volume_mm3", - "value": 24000.0 + "json": 24000.0 }, { - "command": 2, + "step": 3, "pointer": "/b/volume_mm3", - "value": 30000.0 + "json": 30000.0 }, { - "command": 2, + "step": 3, "pointer": "/difference/volume_mm3", - "value": 6000.0 + "json": 6000.0 }, { - "command": 2, + "step": 3, "pointer": "/identical", - "value": false + "json": false }, { - "command": 2, + "step": 3, "pointer": "/regions/0/side", - "value": "only_in_b" + "json": "only_in_b" }, { - "command": 2, + "step": 3, "pointer": "/regions/0/volume_mm3", - "value": 6000.0 + "json": 6000.0 }, { - "command": 2, + "step": 3, "pointer": "/only_in_b/volume_mm3", - "value": 6000.0 + "json": 6000.0 }, { - "command": 2, + "step": 3, "pointer": "/only_in_a/volume_mm3", - "value": 0.0 + "json": 0.0 }, { - "command": 2, + "step": 3, "pointer": "/deviation/max_mm", - "value": 5.0 + "json": 5.0 } ] } diff --git a/tests/kernel-cases/inspect/cov-continuity-box-edge-is-sharp/expected.json b/tests/kernel-cases/inspect/cov-continuity-box-edge-is-sharp/expected.json index 1468968e9..4b9ac2aa8 100644 --- a/tests/kernel-cases/inspect/cov-continuity-box-edge-is-sharp/expected.json +++ b/tests/kernel-cases/inspect/cov-continuity-box-edge-is-sharp/expected.json @@ -5,29 +5,29 @@ "method": "box 40 x 30 x 20 with a corner at the origin: the faces y = 0 and z = 0 meet at 90 deg along their edge: g0, sharp, normal angle 90", "results": [ { - "command": 1, + "step": 2, "pointer": "/summary/edges", - "value": 1 + "json": 1 }, { - "command": 1, + "step": 2, "pointer": "/bodies/0/edges/0/order", - "value": "g0" + "json": "g0" }, { - "command": 1, + "step": 2, "pointer": "/bodies/0/edges/0/verdict", - "value": "sharp" + "json": "sharp" }, { - "command": 1, + "step": 2, "pointer": "/bodies/0/edges/0/normal_angle_deg/value", - "value": 90.0 + "json": 90.0 }, { - "command": 1, + "step": 2, "pointer": "/bodies/0/edges/0/gap_mm/value", - "value": 0.0, + "json": 0.0, "rel": 1e-06 } ] diff --git a/tests/kernel-cases/inspect/cov-continuity-fillet-seams-are-g1/expected.json b/tests/kernel-cases/inspect/cov-continuity-fillet-seams-are-g1/expected.json index 9a93b77dc..a0a667f5f 100644 --- a/tests/kernel-cases/inspect/cov-continuity-fillet-seams-are-g1/expected.json +++ b/tests/kernel-cases/inspect/cov-continuity-fillet-seams-are-g1/expected.json @@ -5,39 +5,39 @@ "method": "box 40 x 30 x 20 with a corner at the origin, its top-front edge (y 0, z 20) rounded r 3: the round meets the top (at y 3) and the front (at z 17) tangent, curvature jumping 0 to 1/3: g1, jump 1/3 per mm", "results": [ { - "command": 2, + "step": 3, "pointer": "/summary/edges", - "value": 2 + "json": 2 }, { - "command": 2, + "step": 3, "pointer": "/bodies/0/edges/0/order", - "value": "g1" + "json": "g1" }, { - "command": 2, + "step": 3, "pointer": "/bodies/0/edges/1/order", - "value": "g1" + "json": "g1" }, { - "command": 2, + "step": 3, "pointer": "/bodies/0/edges/0/curvature_jump_per_mm/value", - "value": 0.3333333333333333 + "json": 0.3333333333333333 }, { - "command": 2, + "step": 3, "pointer": "/bodies/0/edges/1/curvature_jump_per_mm/value", - "value": 0.3333333333333333 + "json": 0.3333333333333333 }, { - "command": 2, + "step": 3, "pointer": "/bodies/0/edges/0/verdict", - "value": "curvature_jump" + "json": "curvature_jump" }, { - "command": 2, + "step": 3, "pointer": "/bodies/0/edges/1/verdict", - "value": "curvature_jump" + "json": "curvature_jump" } ] } 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 index 285efa83e..e41a902e2 100644 --- 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 @@ -5,24 +5,24 @@ "method": "circle r 7: curvature 1/7 everywhere, radius 7; a line: straight, no radius", "results": [ { - "command": 4, + "step": 5, "pointer": "/combs/0/min_radius", - "value": 7.0 + "json": 7.0 }, { - "command": 4, + "step": 5, "pointer": "/combs/0/max_curvature", - "value": 0.14285714285714285 + "json": 0.14285714285714285 }, { - "command": 4, + "step": 5, "pointer": "/combs/1/min_radius", - "value": null + "json": null }, { - "command": 4, + "step": 5, "pointer": "/combs/1/max_curvature", - "value": 0.0 + "json": 0.0 } ] } 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 index 2af9c42d8..ed69c9e01 100644 --- a/tests/kernel-cases/inspect/cov-curvature-comb-cylinder-edge/expected.json +++ b/tests/kernel-cases/inspect/cov-curvature-comb-cylinder-edge/expected.json @@ -5,14 +5,14 @@ "method": "a cylinder r 5 on (60,0,0): its top edge is a circle of r 5, curvature 1/5", "results": [ { - "command": 1, + "step": 2, "pointer": "/combs/0/min_radius", - "value": 5.0 + "json": 5.0 }, { - "command": 1, + "step": 2, "pointer": "/combs/0/max_curvature", - "value": 0.2 + "json": 0.2 } ] } diff --git a/tests/kernel-cases/inspect/cov-interference-box-inside-a-box/expected.json b/tests/kernel-cases/inspect/cov-interference-box-inside-a-box/expected.json index c56e1ed3e..3c1afa071 100644 --- a/tests/kernel-cases/inspect/cov-interference-box-inside-a-box/expected.json +++ b/tests/kernel-cases/inspect/cov-interference-box-inside-a-box/expected.json @@ -5,19 +5,19 @@ "method": "box 40 x 30 x 20 with a corner at the origin and a box 10 x 10 x 10 from (5,5,5) inside it: the overlap is the small box: V 1000, centre (10,10,10)", "results": [ { - "command": 2, + "step": 3, "pointer": "/count", - "value": 1 + "json": 1 }, { - "command": 2, + "step": 3, "pointer": "/interferences/0/volume_mm3", - "value": 1000.0 + "json": 1000.0 }, { - "command": 2, + "step": 3, "pointer": "/interferences/0/center", - "value": [ + "json": [ 10, 10, 10 diff --git a/tests/kernel-cases/inspect/cov-interference-boxes-touching-face-to-face/expected.json b/tests/kernel-cases/inspect/cov-interference-boxes-touching-face-to-face/expected.json index 07812ac63..abe4ac5ea 100644 --- a/tests/kernel-cases/inspect/cov-interference-boxes-touching-face-to-face/expected.json +++ b/tests/kernel-cases/inspect/cov-interference-boxes-touching-face-to-face/expected.json @@ -5,14 +5,14 @@ "method": "box 40 x 30 x 20 with a corner at the origin and a box 40 x 30 x 20 from (40,0,0): they share the face x = 40 and no volume: no interference", "results": [ { - "command": 2, + "step": 3, "pointer": "/count", - "value": 0 + "json": 0 }, { - "command": 2, + "step": 3, "pointer": "/interferences", - "value": [] + "json": [] } ] } diff --git a/tests/kernel-cases/inspect/cov-interference-overlapping-boxes/expected.json b/tests/kernel-cases/inspect/cov-interference-overlapping-boxes/expected.json index f76118d01..1feba5a2b 100644 --- a/tests/kernel-cases/inspect/cov-interference-overlapping-boxes/expected.json +++ b/tests/kernel-cases/inspect/cov-interference-overlapping-boxes/expected.json @@ -5,42 +5,42 @@ "method": "box 40 x 30 x 20 with a corner at the origin and a box 40 x 30 x 20 from (30,20,10): they share the cube x 30..40, y 20..30, z 10..20: V 1000, A 600, centre (35,25,15)", "results": [ { - "command": 2, + "step": 3, "pointer": "/count", - "value": 1 + "json": 1 }, { - "command": 2, + "step": 3, "pointer": "/interferences/0/volume_mm3", - "value": 1000.0 + "json": 1000.0 }, { - "command": 2, + "step": 3, "pointer": "/interferences/0/area_mm2", - "value": 600.0 + "json": 600.0 }, { - "command": 2, + "step": 3, "pointer": "/interferences/0/center", - "value": [ + "json": [ 35, 25, 15 ] }, { - "command": 2, + "step": 3, "pointer": "/interferences/0/bbox/min", - "value": [ + "json": [ 30, 20, 10 ] }, { - "command": 2, + "step": 3, "pointer": "/interferences/0/bbox/max", - "value": [ + "json": [ 40, 30, 20 diff --git a/tests/kernel-cases/inspect/cov-isocurve-cube-top/expected.json b/tests/kernel-cases/inspect/cov-isocurve-cube-top/expected.json index 04b6119aa..46ccc59d7 100644 --- a/tests/kernel-cases/inspect/cov-isocurve-cube-top/expected.json +++ b/tests/kernel-cases/inspect/cov-isocurve-cube-top/expected.json @@ -5,24 +5,24 @@ "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, + "step": 2, "pointer": "/faces/0/body", - "value": "Cube" + "json": "Cube" }, { - "command": 1, + "step": 2, "pointer": "/faces/0/count", - "value": 3 + "json": 3 }, { - "command": 1, + "step": 2, "pointer": "/faces/0/u_curves", - "value": 3 + "json": 3 }, { - "command": 1, + "step": 2, "pointer": "/faces/0/v_curves", - "value": 3 + "json": 3 } ] } diff --git a/tests/kernel-cases/inspect/cov-minimum-radius-of-a-box-is-none/expected.json b/tests/kernel-cases/inspect/cov-minimum-radius-of-a-box-is-none/expected.json index 36d5b98c4..0e459a0c8 100644 --- a/tests/kernel-cases/inspect/cov-minimum-radius-of-a-box-is-none/expected.json +++ b/tests/kernel-cases/inspect/cov-minimum-radius-of-a-box-is-none/expected.json @@ -5,9 +5,9 @@ "method": "box 40 x 30 x 20 with a corner at the origin: every face is flat: no radius (null)", "results": [ { - "command": 1, + "step": 2, "pointer": "/min_radius", - "value": null + "json": null } ] } diff --git a/tests/kernel-cases/inspect/cov-minimum-radius-of-a-circular-edge/expected.json b/tests/kernel-cases/inspect/cov-minimum-radius-of-a-circular-edge/expected.json index c3f5fc8ef..72740f9a1 100644 --- a/tests/kernel-cases/inspect/cov-minimum-radius-of-a-circular-edge/expected.json +++ b/tests/kernel-cases/inspect/cov-minimum-radius-of-a-circular-edge/expected.json @@ -5,9 +5,9 @@ "method": "a cylinder r 5 on (60,0,0): its top edge is a circle of r 5", "results": [ { - "command": 1, + "step": 2, "pointer": "/min_radius", - "value": 5.0 + "json": 5.0 } ] } diff --git a/tests/kernel-cases/inspect/cov-minimum-radius-of-a-fillet/expected.json b/tests/kernel-cases/inspect/cov-minimum-radius-of-a-fillet/expected.json index 72f5a8208..f58d68f9e 100644 --- a/tests/kernel-cases/inspect/cov-minimum-radius-of-a-fillet/expected.json +++ b/tests/kernel-cases/inspect/cov-minimum-radius-of-a-fillet/expected.json @@ -5,9 +5,9 @@ "method": "box 40 x 30 x 20 with a corner at the origin, its top-front edge (y 0, z 20) rounded r 3: the flat faces have none, the round is a cylinder of r 3: the smallest radius is 3", "results": [ { - "command": 2, + "step": 3, "pointer": "/min_radius", - "value": 3.0 + "json": 3.0 } ] } diff --git a/tests/kernel-cases/inspect/cov-minimum-radius-of-an-ellipse/expected.json b/tests/kernel-cases/inspect/cov-minimum-radius-of-an-ellipse/expected.json index 3c8dd17bf..c7cbe1043 100644 --- a/tests/kernel-cases/inspect/cov-minimum-radius-of-an-ellipse/expected.json +++ b/tests/kernel-cases/inspect/cov-minimum-radius-of-an-ellipse/expected.json @@ -5,9 +5,9 @@ "method": "ellipse a 10, b 4: tightest at the ends of the major axis, b^2 / a = 1.6, at (+-10, 0)", "results": [ { - "command": 3, + "step": 4, "pointer": "/min_radius", - "value": 1.6 + "json": 1.6 } ] } From dc093b0cb4e901e7744889b80ffbae9f44319a49 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 19:10:38 -0400 Subject: [PATCH 099/108] Kernel rig: a symmetric surface extrude with no convention is the total distance (#9091); the per-side reading is its own case Co-Authored-By: Claude Opus 5.5 --- .../expected.json | 26 ++++++++ .../recipe.json | 60 +++++++++++++++++++ .../cov-extrude-line-symmetric/expected.json | 10 ++-- 3 files changed, 91 insertions(+), 5 deletions(-) create mode 100644 tests/kernel-cases/surfaces/cov-extrude-line-symmetric-legacy-per-side/expected.json create mode 100644 tests/kernel-cases/surfaces/cov-extrude-line-symmetric-legacy-per-side/recipe.json diff --git a/tests/kernel-cases/surfaces/cov-extrude-line-symmetric-legacy-per-side/expected.json b/tests/kernel-cases/surfaces/cov-extrude-line-symmetric-legacy-per-side/expected.json new file mode 100644 index 000000000..a936fdfc5 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-extrude-line-symmetric-legacy-per-side/expected.json @@ -0,0 +1,26 @@ +{ + "sources": [], + "what": "a line extruded symmetric 10 as a surface with the legacy per-side convention: 10 each way", + "source": "analytic", + "method": "convention legacy_per_side gives the distance on each side: the plane y = 0, x 0..10, z -10..10, area 200, 4 free edges", + "valid": false, + "body_count": 1, + "faces": 1, + "boundary_edges": 4, + "area_mm2": 200.0, + "surface_types": [ + "plane" + ], + "bbox": { + "min": [ + 0, + 0, + -10 + ], + "max": [ + 10, + 0, + 10 + ] + } +} diff --git a/tests/kernel-cases/surfaces/cov-extrude-line-symmetric-legacy-per-side/recipe.json b/tests/kernel-cases/surfaces/cov-extrude-line-symmetric-legacy-per-side/recipe.json new file mode 100644 index 000000000..feefe2b84 --- /dev/null +++ b/tests/kernel-cases/surfaces/cov-extrude-line-symmetric-legacy-per-side/recipe.json @@ -0,0 +1,60 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": { + "origin": [ + 0, + 0, + 0 + ], + "x_dir": [ + 1, + 0, + 0 + ], + "y_dir": [ + 0, + 1, + 0 + ] + }, + "name": "S" + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 0, + 0 + ], + [ + 10, + 0 + ] + ], + "infer": false + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "surface.extrude", + "params": { + "sketch": "S", + "curves": [ + "l1" + ], + "distance": 10, + "direction": "symmetric", + "body_name": "Wall", + "convention": "legacy_per_side" + } + } + ] +} diff --git a/tests/kernel-cases/surfaces/cov-extrude-line-symmetric/expected.json b/tests/kernel-cases/surfaces/cov-extrude-line-symmetric/expected.json index 4538a7ab6..e70b66fe1 100644 --- a/tests/kernel-cases/surfaces/cov-extrude-line-symmetric/expected.json +++ b/tests/kernel-cases/surfaces/cov-extrude-line-symmetric/expected.json @@ -1,13 +1,13 @@ { "sources": [], - "what": "a line extruded symmetric 10 as a surface: surface.extrude's distance is per side (its legacy convention, kept by default), so 10 each way", + "what": "a line extruded symmetric 10 as a surface with no convention: the total, 5 each side of the sketch plane, as for a solid extrude (#9091)", "source": "analytic", - "method": "surface.extrude without `convention` keeps legacy_per_side (crates/engine/src/cmd/features.rs, extrude_convention_tests): the plane y = 0, x 0..10, z -10..10, area 200, 4 free edges", + "method": "surface.extrude without `convention` reads the distance as the total (default_extrude_convention): the plane y = 0, x 0..10, z -5..5, area 100, 4 free edges", "valid": false, "body_count": 1, "faces": 1, "boundary_edges": 4, - "area_mm2": 200.0, + "area_mm2": 100.0, "surface_types": [ "plane" ], @@ -15,12 +15,12 @@ "min": [ 0, 0, - -10 + -5 ], "max": [ 10, 0, - 10 + 5 ] } } From 55338e139e9ad2c7eda9f5f668f26ec63f427971 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 19:11:21 -0400 Subject: [PATCH 100/108] Kernel rig: each area's PATHS names only its own files, and EXEMPT lists only commands no case uses The shared core (crates/smlib, the grader, doc eval.rs, engine features.rs and the kernel's core) is in PATHS-ALL; the new areas' copies of it are dropped, so an area reruns on its own files and the core reruns them all. sheet-metal also watches the sheet commands, the sheet document and the DXF writer. 116 commands a case now uses leave EXEMPT; 25 geometry commands are still to cover. Co-Authored-By: Claude Opus 5.5 --- tests/kernel-cases/EXEMPT | 116 -------------------------- tests/kernel-cases/construction/PATHS | 1 - tests/kernel-cases/frames/PATHS | 3 - tests/kernel-cases/history/PATHS | 2 - tests/kernel-cases/inspect/PATHS | 3 - tests/kernel-cases/plastic/PATHS | 8 -- tests/kernel-cases/sheet-metal/PATHS | 2 + tests/kernel-cases/solids/PATHS | 5 -- tests/kernel-cases/surfaces/PATHS | 7 -- 9 files changed, 2 insertions(+), 145 deletions(-) diff --git a/tests/kernel-cases/EXEMPT b/tests/kernel-cases/EXEMPT index 5bd7ed2b3..8dcef8701 100644 --- a/tests/kernel-cases/EXEMPT +++ b/tests/kernel-cases/EXEMPT @@ -39,7 +39,6 @@ component.rename a component name component.replace_with_link component links component.unlock component locking component.update_links component links -contact.list a listing of contact sets diagnostics.crash_report crash reports diagnostics.crash_reports crash reports diagnostics.crash_reports.clear crash reports @@ -59,10 +58,8 @@ edit.restore_checkpoint undo, redo and checkpoints: an earlier state r edit.undo undo, redo and checkpoints: an earlier state restored, no new geometry engine.commands the command registry itself engine.describe the command registry itself -explode.create exploded views: display offsets explode.delete exploded views: display offsets explode.list exploded views: display offsets -explode.show exploded views: display offsets expr.evaluate expression evaluation file.open_in_easyprint hands the file to another program file.save saving the design @@ -78,7 +75,6 @@ inspect.curvature_map display analysis: shading inspect.environment_map display analysis: shading inspect.silhouette display analysis: outline inspect.zebra display analysis: shading -joint.list a listing of joints library.apply material and appearance libraries library.export material and appearance libraries library.inspect material and appearance libraries @@ -97,8 +93,6 @@ motion.delete removes a motion study motion.export writes a study's results to a file motion.export_animation writes an animation motion.list a listing of motion studies -motion.play plays a study in the view -occurrence.properties occurrence properties parameters.comment parameter bookkeeping; a value change that rebuilds is parameters.change, which cases use parameters.complete parameter bookkeeping; a value change that rebuilds is parameters.change, which cases use parameters.delete parameter bookkeeping; a value change that rebuilds is parameters.change, which cases use @@ -111,7 +105,6 @@ parameters.move parameter bookkeeping; a value change that reb parameters.rename parameter bookkeeping; a value change that rebuilds is parameters.change, which cases use parameters.users parameter bookkeeping; a value change that rebuilds is parameters.change, which cases use parts.library a listing of the parts library -plastic.rules a listing of plastic rules render.aging.describe rendering: images, cameras, stages render.backends rendering: images, cameras, stages render.camera.fit rendering: images, cameras, stages @@ -265,97 +258,17 @@ view.visual_style the view: camera, layout, display # that a case uses), and a new geometry command gets a case, not a line here. [to cover] body.repair repair: the solid a refused or open part becomes -component.copy_bodies assemblies: bodies copied into a component -component.extract assemblies: bodies extracted to a design -component.from_bodies assemblies: a component made from bodies -component.insert_design assemblies: a design inserted -component.move_bodies assemblies: bodies moved between components component.move_sketches assemblies: sketches moved between components -component.paste_new assemblies: a pasted new component component.revert_position assemblies: a placement reverted -config.activate configurations: a configured part rebuilt per row -config.column configurations: a configured part rebuilt per row -config.configure configurations: a configured part rebuilt per row -config.preview configurations: a configured part rebuilt per row -config.row configurations: a configured part rebuilt per row -config.rule configurations: a configured part rebuilt per row -config.rules configurations: a configured part rebuilt per row -config.table configurations: a configured part rebuilt per row -construct.axis.edge construction: the plane, axis or point exactly -construct.axis.normal_to_face construction: the plane, axis or point exactly -construct.axis.through_cylinder construction: the plane, axis or point exactly -construct.axis.two_planes construction: the plane, axis or point exactly -construct.plane.at_angle construction: the plane, axis or point exactly -construct.plane.midplane construction: the plane, axis or point exactly -construct.plane.perpendicular construction: the plane, axis or point exactly -construct.plane.tangent construction: the plane, axis or point exactly -construct.plane.three_points construction: the plane, axis or point exactly -construct.plane.two_edges construction: the plane, axis or point exactly -construct.point.along_path construction: the plane, axis or point exactly -construct.point.center construction: the plane, axis or point exactly -construct.point.edge_plane construction: the plane, axis or point exactly -construct.point.three_planes construction: the plane, axis or point exactly -construct.point.two_edges construction: the plane, axis or point exactly -construct.point.vertex construction: the plane, axis or point exactly -contact.check assemblies: contact sets and what they report -contact.create assemblies: contact sets and what they report -contact.disable_all assemblies: contact sets and what they report -contact.edit assemblies: contact sets and what they report -contact.enable_all assemblies: contact sets and what they report -contact.enable_sets assemblies: contact sets and what they report file.export_view_dxf drawings: the projection of the model a view DXF holds -frame.member frames: member bodies -frame.profile.insert frames: member bodies -inspect.center_of_mass inspect: the number or curves it reports -inspect.clearance inspect: the number or curves it reports -inspect.compare inspect: the number or curves it reports -inspect.continuity inspect: the number or curves it reports -inspect.curvature_comb inspect: the number or curves it reports inspect.draft inspect: the number or curves it reports -inspect.interference inspect: the number or curves it reports -inspect.isocurve inspect: the number or curves it reports -inspect.minimum_radius inspect: the number or curves it reports inspect.parameter_sweep inspect: results rebuilt over a parameter range inspect.section inspect: the number or curves it reports -joint.as_built assemblies: joint placements and values -joint.cam assemblies: joint placements and values -joint.create assemblies: joint placements and values -joint.delete assemblies: joint placements and values -joint.drive assemblies: joint placements and values -joint.edit assemblies: joint placements and values -joint.gear assemblies: joint placements and values -joint.inspect assemblies: joint placements and values -joint.limits assemblies: joint placements and values -joint.motion_link assemblies: joint placements and values -joint.origin assemblies: joint placements and values -joint.rack_pinion assemblies: joint placements and values -joint.reach assemblies: joint placements and values -joint.rigid_group assemblies: joint placements and values -joint.screw assemblies: joint placements and values -joint.solve assemblies: joint placements and values -joint.sweep assemblies: joint placements and values -motion.interference assemblies: motion results -motion.plot assemblies: motion results -motion.study assemblies: motion results -motion.trace assemblies: motion results motion.trace.edit assemblies: motion results motion.trace.keep assemblies: motion results -occurrence.copy assemblies: an occurrence copied -occurrence.drag assemblies: an occurrence dragged to a placement -occurrence.reparent assemblies: an occurrence moved in the tree parts.fastener standard parts: a fastener body parts.insert standard parts: a part body parts.resize standard parts: a part resized -plastic.assign_rule plastic: the feature body -plastic.boss plastic: the feature body -plastic.lip plastic: the feature body -plastic.manage_rules plastic: rules that rebuild the features using them -plastic.rest plastic: the feature body -sheet.export_bend_table sheet metal: the bend table of a flat pattern -sheet.export_dxf sheet metal: the flat pattern as DXF -sheet.hem sheet metal: the feature body -sheet.path_flange sheet metal: the feature body -sheet.perforate sheet metal: the feature body sketch.arc3d sketch: a curve kind no case profiles yet sketch.auto_project sketch from the model: curves the kernel computes from bodies sketch.conic sketch: a curve kind no case profiles yet @@ -364,36 +277,7 @@ sketch.include_3d sketch from the model: curves the kernel compu sketch.intersect sketch from the model: curves the kernel computes from bodies sketch.intersection_curve sketch from the model: curves the kernel computes from bodies sketch.isoparametric_curve sketch from the model: curves the kernel computes from bodies -sketch.project sketch from the model: curves the kernel computes from bodies sketch.project_to_surface sketch from the model: curves the kernel computes from bodies sketch.spline.control_point_5 sketch: a curve kind no case profiles yet sketch.spline3d sketch: a curve kind no case profiles yet sketch.spun_profile sketch from the model: curves the kernel computes from bodies -solid.align solid modelling: the body it makes -solid.boundary_fill solid modelling: the body it makes -solid.bounding_solid solid modelling: the body it makes -solid.cone solid modelling: the body it makes -solid.pattern.path solid modelling: the body it makes -solid.replace_face solid modelling: the body it makes -solid.scale solid modelling: the body it makes -solid.web solid modelling: the body it makes -surface.blend surfaces: the surface body it makes -surface.boundary surfaces: the surface body it makes -surface.fair surfaces: the surface body it makes -surface.match surfaces: the surface body it makes -surface.offset surfaces: the surface body it makes -surface.reverse_normal surfaces: the surface body it makes -surface.ruled surfaces: the surface body it makes -surface.unstitch surfaces: the surface body it makes -surface.untrim surfaces: the surface body it makes -timeline.compute_all timeline: the bodies after the rebuild -timeline.delete timeline: the bodies after the rebuild -timeline.edit timeline: the bodies after the rebuild -timeline.group timeline: the bodies after the rebuild -timeline.move_many timeline: the bodies after the rebuild -timeline.move_to_group timeline: the bodies after the rebuild -timeline.reorder timeline: the bodies after the rebuild -timeline.reorder_many timeline: the bodies after the rebuild -timeline.roll_to timeline: the bodies after the rebuild -timeline.suppress timeline: the bodies after the rebuild -timeline.ungroup timeline: the bodies after the rebuild diff --git a/tests/kernel-cases/construction/PATHS b/tests/kernel-cases/construction/PATHS index cf0265725..e90299883 100644 --- a/tests/kernel-cases/construction/PATHS +++ b/tests/kernel-cases/construction/PATHS @@ -1,7 +1,6 @@ # Source files whose change must rerun the construction area: one git pathspec glob a line. # The construct.* commands (the plane at an angle and offset plane live in features.rs). crates/engine/src/cmd/construct.rs -crates/engine/src/cmd/features.rs # How a construction reference resolves, and the planes the document resolves. crates/doc/src/construct.rs crates/doc/src/document.rs diff --git a/tests/kernel-cases/frames/PATHS b/tests/kernel-cases/frames/PATHS index f09de15ae..affabd44f 100644 --- a/tests/kernel-cases/frames/PATHS +++ b/tests/kernel-cases/frames/PATHS @@ -1,9 +1,6 @@ # Source files whose change must rerun the frames area (frame members, inserted profiles). -apps/solidcraft-cli/src/kernel_cases.rs crates/doc/src/eval_frame.rs crates/doc/src/frame.rs crates/engine/src/cmd/frame.rs crates/engine/src/cmd/sketch.rs -crates/kernel/src/** -crates/smlib/** tests/kernel-cases/frames/** diff --git a/tests/kernel-cases/history/PATHS b/tests/kernel-cases/history/PATHS index 786e62457..bdaac7f4c 100644 --- a/tests/kernel-cases/history/PATHS +++ b/tests/kernel-cases/history/PATHS @@ -11,7 +11,5 @@ crates/doc/src/config_rules.rs crates/doc/src/params.rs crates/doc/src/expr.rs # Rebuilding the timeline, and the results it keeps between rebuilds. -crates/doc/src/eval.rs -crates/doc/src/model_cache.rs # The cases themselves. tests/kernel-cases/history/** diff --git a/tests/kernel-cases/inspect/PATHS b/tests/kernel-cases/inspect/PATHS index faec9db6b..855eccb8b 100644 --- a/tests/kernel-cases/inspect/PATHS +++ b/tests/kernel-cases/inspect/PATHS @@ -10,11 +10,8 @@ crates/engine/src/cmd/compare.rs crates/engine/src/cmd/inspect.rs # What they measure with: the comparison of two surfaces, a face's isocurves, seam continuity, # body distance and mass properties. -crates/geom/src/compare.rs -crates/doc/src/eval.rs crates/kernel/src/iso.rs crates/kernel/src/continuity.rs crates/kernel/src/continuity_order.rs crates/kernel/src/distance.rs -crates/kernel/src/measure.rs tests/kernel-cases/inspect/** diff --git a/tests/kernel-cases/plastic/PATHS b/tests/kernel-cases/plastic/PATHS index 47435b15c..2f0a64849 100644 --- a/tests/kernel-cases/plastic/PATHS +++ b/tests/kernel-cases/plastic/PATHS @@ -4,17 +4,9 @@ crates/engine/src/cmd/plastic.rs crates/doc/src/plastic.rs # The features' evaluation (plastic_eval and its helpers) and the join and cut they apply. crates/doc/src/eval_more.rs -crates/doc/src/eval.rs # The kernel operations they build with: extrude, tapered extrude, the lip's raised band and the # groove's rim band, booleans (ops) and the shell the lip cases # start from, and SMLib underneath. -crates/kernel/src/build.rs crates/kernel/src/lip.rs -crates/kernel/src/ops.rs -crates/kernel/src/boolean_record.rs -crates/kernel/src/native.rs -crates/kernel/src/shell_groups.rs -crates/smlib/** # The cases and the rig itself. tests/kernel-cases/plastic/** -apps/solidcraft-cli/src/kernel_cases.rs diff --git a/tests/kernel-cases/sheet-metal/PATHS b/tests/kernel-cases/sheet-metal/PATHS index 7bc3beaf4..99fd668ca 100644 --- a/tests/kernel-cases/sheet-metal/PATHS +++ b/tests/kernel-cases/sheet-metal/PATHS @@ -13,3 +13,5 @@ crates/engine/src/cmd/sheet.rs crates/kernel/src/offset_backend.rs crates/kernel/src/polyhedron.rs crates/kernel/src/sew.rs +crates/doc/src/eval_more.rs +crates/io/src/dxf_out.rs diff --git a/tests/kernel-cases/solids/PATHS b/tests/kernel-cases/solids/PATHS index 7b538874c..a7ec66f0e 100644 --- a/tests/kernel-cases/solids/PATHS +++ b/tests/kernel-cases/solids/PATHS @@ -1,9 +1,4 @@ # Source files whose change must rerun the solids area (cones, scale, align, bounding solids). -apps/solidcraft-cli/src/kernel_cases.rs -crates/doc/src/eval.rs crates/doc/src/eval_more.rs -crates/engine/src/cmd/features.rs crates/engine/src/cmd/features_more.rs -crates/kernel/src/** -crates/smlib/** tests/kernel-cases/solids/** diff --git a/tests/kernel-cases/surfaces/PATHS b/tests/kernel-cases/surfaces/PATHS index c9f751bb6..fc93ede83 100644 --- a/tests/kernel-cases/surfaces/PATHS +++ b/tests/kernel-cases/surfaces/PATHS @@ -6,7 +6,6 @@ crates/engine/src/cmd/surface_match.rs crates/engine/src/params.rs # Their evaluation. crates/doc/src/eval_surface.rs -crates/doc/src/eval.rs # The kernel code they call. crates/kernel/src/boundary.rs crates/kernel/src/boundary_network.rs @@ -15,7 +14,6 @@ crates/kernel/src/fair.rs crates/kernel/src/fill*.rs crates/kernel/src/loft*.rs crates/kernel/src/matchsurf.rs -crates/kernel/src/native.rs crates/kernel/src/surface_extend.rs crates/kernel/src/surface_offset.rs crates/kernel/src/surface_ruled.rs @@ -23,10 +21,5 @@ crates/kernel/src/surface_trim.rs crates/kernel/src/surface_untrim.rs crates/kernel/src/surfaces.rs crates/kernel/src/sweep*.rs -crates/kernel/src/smlib_sweeps.rs -crates/geom/src/fill*.rs -crates/geom/src/network*.rs # SMLib and the rig itself. -crates/smlib/** -apps/solidcraft-cli/src/kernel_cases.rs tests/kernel-cases/surfaces/** From 80d08659f31d0b64a0c8abb6f847c2d6a6156012 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 19:13:10 -0400 Subject: [PATCH 101/108] Kernel rig: the booleans, import and threads lists name the 5 cases that fail on the pinned SMLib Co-Authored-By: Claude Opus 5.5 --- tests/kernel-cases/booleans/KNOWN_FAILING | 5 ++++- tests/kernel-cases/import/KNOWN_FAILING | 3 ++- tests/kernel-cases/threads/KNOWN_FAILING | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/kernel-cases/booleans/KNOWN_FAILING b/tests/kernel-cases/booleans/KNOWN_FAILING index 01f33ea2a..c0a6f2dbe 100644 --- a/tests/kernel-cases/booleans/KNOWN_FAILING +++ b/tests/kernel-cases/booleans/KNOWN_FAILING @@ -1,4 +1,7 @@ # The booleans cases that fail today, one a line: ` `. Sorted. The kernel # rig gate (.github/workflows/kernel-rig.yml) fails on a case that fails and is not listed here, # and on a listed case that passes: a fix removes its line in the same pull request. -# Baseline: not seeded yet; seeded from a develop run after the SMLib pin bump. +# Baseline: develop 5ada4fc8a with SMLib 90aabff (the run on 60b1c6a, aarch64 Linux). +3604-cut-with-g2-swept-tool-along-projected-edge step 12 (solid.sweep): the path curves are not connected end to end +3830-split-cup-by-extended-spline-surface not supported yet: surface.extend of a surface of more than one face (this one has 3) +5126-join-menger-sponge-level-3 step 561 (solid.combine): unknown planar source comparison budget exceeded diff --git a/tests/kernel-cases/import/KNOWN_FAILING b/tests/kernel-cases/import/KNOWN_FAILING index 636c9e35e..8266c0a4c 100644 --- a/tests/kernel-cases/import/KNOWN_FAILING +++ b/tests/kernel-cases/import/KNOWN_FAILING @@ -1,4 +1,5 @@ # The import cases that fail today, one a line: ` `. Sorted. The kernel # rig gate (.github/workflows/kernel-rig.yml) fails on a case that fails and is not listed here, # and on a listed case that passes: a fix removes its line in the same pull request. -# Baseline: not seeded yet; seeded from a develop run after the SMLib pin bump. +# Baseline: develop 5ada4fc8a with SMLib 90aabff (the run on 60b1c6a, aarch64 Linux). +4561-convert-box-mesh-with-a-zero-area-triangle step 3 (mesh.convert): a zero-area triangle is refused as degenerate where the case expects it dropped diff --git a/tests/kernel-cases/threads/KNOWN_FAILING b/tests/kernel-cases/threads/KNOWN_FAILING index 07e2659a7..bf482e927 100644 --- a/tests/kernel-cases/threads/KNOWN_FAILING +++ b/tests/kernel-cases/threads/KNOWN_FAILING @@ -1,4 +1,5 @@ # The threads cases that fail today, one a line: ` `. Sorted. The kernel # rig gate (.github/workflows/kernel-rig.yml) fails on a case that fails and is not listed here, # and on a listed case that passes: a fix removes its line in the same pull request. -# Baseline: not seeded yet; seeded from a develop run after the SMLib pin bump. +# Baseline: develop 5ada4fc8a with SMLib 90aabff (the run on 60b1c6a, aarch64 Linux). +2369-m8-thread-in-6.3mm-hole-refused refused for the right reason, but the message differs from the one the case names From 5c45570c91526bd8c96b89d4da168f486c3bc4f9 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 19:44:26 -0400 Subject: [PATCH 102/108] Kernel rig: rustfmt; measured values in results are decimals, within tolerance; the ladder records 06/023 passing The single results form compares a whole number exactly (a count). The construction and inspect cases gave positions and volumes as whole numbers, which the form they were written for compared within tolerance; they are decimals now. The NPT groove fix makes ladder 06/023 pass: its golden entry is the passing run (51 faces, 8226.4042 mm3). Co-Authored-By: Claude Opus 5.5 --- apps/solidcraft-cli/src/kernel_cases.rs | 7 +------ crates/doc/src/eval_thread.rs | 6 +----- .../expected.json | 6 +++--- .../cov-center-of-mass-box/expected.json | 6 +++--- .../expected.json | 12 ++++++------ .../expected.json | 6 +++--- .../expected.json | 6 +++--- .../expected.json | 18 +++++++++--------- .../cov-isocurve-cube-top/expected.json | 4 ++-- tests/kernel-cases/ladder/golden.json | 16 ++++++++-------- xtask/src/kernel_ladder.rs | 3 ++- 11 files changed, 41 insertions(+), 49 deletions(-) diff --git a/apps/solidcraft-cli/src/kernel_cases.rs b/apps/solidcraft-cli/src/kernel_cases.rs index 12fd7c339..d07d8ca17 100644 --- a/apps/solidcraft-cli/src/kernel_cases.rs +++ b/apps/solidcraft-cli/src/kernel_cases.rs @@ -616,12 +616,7 @@ fn flat_pattern_checks(c: &mut Checks, want: &Value, results: &[Value], rel: f64 let (a, b) = (v.get(0)?, v.get(1)?); Some([a.get(0)?.as_f64()?, a.get(1)?.as_f64()?, b.get(0)?.as_f64()?, b.get(1)?.as_f64()?]) }; - let mut left: Vec<[f64; 4]> = got["bends"] - .as_array() - .into_iter() - .flatten() - .filter_map(|b| line(&json!([b["start"], b["end"]]))) - .collect(); + let mut left: Vec<[f64; 4]> = got["bends"].as_array().into_iter().flatten().filter_map(|b| line(&json!([b["start"], b["end"]]))).collect(); let got_lines = json!(left.iter().map(|l| [[l[0], l[1]], [l[2], l[3]]]).collect::>()); let near = |p: [f64; 4], q: [f64; 4]| (0..4).all(|k| (p[k] - q[k]).abs() <= abs); let mut ok = left.len() == w.len(); diff --git a/crates/doc/src/eval_thread.rs b/crates/doc/src/eval_thread.rs index b4427be8c..9bc4d941e 100644 --- a/crates/doc/src/eval_thread.rs +++ b/crates/doc/src/eval_thread.rs @@ -473,11 +473,7 @@ fn thread_grooves( let section_of = |g: &crate::thread_forms::GrooveProfile| -> (Vec, f64) { let (tl, th) = (g.flank_lo.tan(), g.flank_hi.tan()); if taper.is_none() { - let (r0, r1) = if t.internal { - (radius.min(g.crest_r) - 0.1 * p, g.root_r) - } else { - (g.root_r, radius.max(d / 2.0) + 0.05 * p) - }; + let (r0, r1) = if t.internal { (radius.min(g.crest_r) - 0.1 * p, g.root_r) } else { (g.root_r, radius.max(d / 2.0) + 0.05 * p) }; let ((lo0, hi0), (lo1, hi1)) = (g.extents(p, r0), g.extents(p, r1)); let wide = g.width(p, if t.internal { r0 } else { r1 }); return (vec![Vec2::new(r0, -lo0), Vec2::new(r1, -lo1), Vec2::new(r1, hi1), Vec2::new(r0, hi0)], wide); diff --git a/tests/kernel-cases/inspect/cov-center-of-mass-box-and-cylinder/expected.json b/tests/kernel-cases/inspect/cov-center-of-mass-box-and-cylinder/expected.json index c20f419e4..a80f222f4 100644 --- a/tests/kernel-cases/inspect/cov-center-of-mass-box-and-cylinder/expected.json +++ b/tests/kernel-cases/inspect/cov-center-of-mass-box-and-cylinder/expected.json @@ -22,9 +22,9 @@ "step": 3, "pointer": "/bodies/1/center", "json": [ - 60, - 0, - 5 + 60.0, + 0.0, + 5.0 ] }, { diff --git a/tests/kernel-cases/inspect/cov-center-of-mass-box/expected.json b/tests/kernel-cases/inspect/cov-center-of-mass-box/expected.json index b6d028993..655d3ef01 100644 --- a/tests/kernel-cases/inspect/cov-center-of-mass-box/expected.json +++ b/tests/kernel-cases/inspect/cov-center-of-mass-box/expected.json @@ -8,9 +8,9 @@ "step": 2, "pointer": "/center", "json": [ - 20, - 15, - 10 + 20.0, + 15.0, + 10.0 ] }, { 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 index 108cd41fb..fefc66e17 100644 --- 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 @@ -28,18 +28,18 @@ "step": 3, "pointer": "/near/0/from", "json": [ - 5, - 0, - 0 + 5.0, + 0.0, + 0.0 ] }, { "step": 3, "pointer": "/near/0/to", "json": [ - 15, - 0, - 0 + 15.0, + 0.0, + 0.0 ] } ] diff --git a/tests/kernel-cases/inspect/cov-clearance-overlapping-spheres/expected.json b/tests/kernel-cases/inspect/cov-clearance-overlapping-spheres/expected.json index 16f8a2a5e..10c4e5007 100644 --- a/tests/kernel-cases/inspect/cov-clearance-overlapping-spheres/expected.json +++ b/tests/kernel-cases/inspect/cov-clearance-overlapping-spheres/expected.json @@ -13,9 +13,9 @@ "step": 3, "pointer": "/overlaps/0/center", "json": [ - 4, - 0, - 0 + 4.0, + 0.0, + 0.0 ] } ] diff --git a/tests/kernel-cases/inspect/cov-interference-box-inside-a-box/expected.json b/tests/kernel-cases/inspect/cov-interference-box-inside-a-box/expected.json index 3c1afa071..1c71afeb5 100644 --- a/tests/kernel-cases/inspect/cov-interference-box-inside-a-box/expected.json +++ b/tests/kernel-cases/inspect/cov-interference-box-inside-a-box/expected.json @@ -18,9 +18,9 @@ "step": 3, "pointer": "/interferences/0/center", "json": [ - 10, - 10, - 10 + 10.0, + 10.0, + 10.0 ] } ] diff --git a/tests/kernel-cases/inspect/cov-interference-overlapping-boxes/expected.json b/tests/kernel-cases/inspect/cov-interference-overlapping-boxes/expected.json index 1feba5a2b..7983b736f 100644 --- a/tests/kernel-cases/inspect/cov-interference-overlapping-boxes/expected.json +++ b/tests/kernel-cases/inspect/cov-interference-overlapping-boxes/expected.json @@ -23,27 +23,27 @@ "step": 3, "pointer": "/interferences/0/center", "json": [ - 35, - 25, - 15 + 35.0, + 25.0, + 15.0 ] }, { "step": 3, "pointer": "/interferences/0/bbox/min", "json": [ - 30, - 20, - 10 + 30.0, + 20.0, + 10.0 ] }, { "step": 3, "pointer": "/interferences/0/bbox/max", "json": [ - 40, - 30, - 20 + 40.0, + 30.0, + 20.0 ] } ] diff --git a/tests/kernel-cases/inspect/cov-isocurve-cube-top/expected.json b/tests/kernel-cases/inspect/cov-isocurve-cube-top/expected.json index 46ccc59d7..ff38fb408 100644 --- a/tests/kernel-cases/inspect/cov-isocurve-cube-top/expected.json +++ b/tests/kernel-cases/inspect/cov-isocurve-cube-top/expected.json @@ -17,12 +17,12 @@ { "step": 2, "pointer": "/faces/0/u_curves", - "json": 3 + "json": 3.0 }, { "step": 2, "pointer": "/faces/0/v_curves", - "json": 3 + "json": 3.0 } ] } diff --git a/tests/kernel-cases/ladder/golden.json b/tests/kernel-cases/ladder/golden.json index 13c200d8b..55ccea7e7 100644 --- a/tests/kernel-cases/ladder/golden.json +++ b/tests/kernel-cases/ladder/golden.json @@ -1106,15 +1106,15 @@ }, "ladder/06-threads/023-external-1-2-npt": { "measured": { - "area_mm2": 3317.0130177354845, + "area_mm2": 3023.0574338103247, "body_count": 1, - "edges": 144, - "faces": 63, - "vertices": 83, - "volume_mm3": 8227.34635260655 + "edges": 119, + "faces": 51, + "vertices": 70, + "volume_mm3": 8226.404188726101 }, - "seconds": 1.619294352, - "status": "fail" + "seconds": 1.41498452, + "status": "pass" }, "ladder/06-threads/024-internal-rc-1-2-taper": { "measured": { @@ -1993,5 +1993,5 @@ "status": "pass" } }, - "reason": "SMLib 60b1c6a: tiers 05 and 06 take the UNC, UNF, Rc and NPT tapped holes, the pipe threads, the steep flank and the tip options, tier 12 (sheet metal) is new; the 139 cases before keep their statuses and counts, their volumes and areas re-measured within 2e-6" + "reason": "06/023 (1/2-14 NPT) passes: a taper thread's groove follows its crest cone, so no sliver of the flanks is left (volume 8226.4042 against the standard's 8226.4049); the other cases as recorded on SMLib 60b1c6a" } diff --git a/xtask/src/kernel_ladder.rs b/xtask/src/kernel_ladder.rs index 5e384c7a5..7ea61f219 100644 --- a/xtask/src/kernel_ladder.rs +++ b/xtask/src/kernel_ladder.rs @@ -318,7 +318,8 @@ mod tests { "ladder/01-a/001-x": {"status": "pass", "seconds": 1.0, "measured": {"faces": 6}}, "ladder/01-a/002-y": {"status": "fail", "seconds": 1.0} }}); - let run = |x: Value, y: Value| gate(&t, &BTreeMap::from([("ladder/01-a/001-x".to_string(), x), ("ladder/01-a/002-y".to_string(), y)]), &golden); + let run = + |x: Value, y: Value| gate(&t, &BTreeMap::from([("ladder/01-a/001-x".to_string(), x), ("ladder/01-a/002-y".to_string(), y)]), &golden); // Ten times slower is the machine, not a change. assert!(run(json!({"status": "pass", "seconds": 10.0, "measured": {"faces": 6}}), json!({"status": "fail"})).is_ok()); let fixed = run(json!({"status": "pass", "measured": {"faces": 6}}), json!({"status": "pass"})).unwrap_err(); From 393a9aab66da7f39fd6d202ca07486831a422af5 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 19:44:27 -0400 Subject: [PATCH 103/108] CI: native and reference tests stay on pushes until develop is green They fail on develop today (4 native tests, 8 of 83 reference cases), so running them on pull requests would fail every pull request. Back on pull requests once develop is green. Reverts 0cdc25094. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 41 ++++++++++++---------------------------- 1 file changed, 12 insertions(+), 29 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cac0919e7..740ab4c94 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,9 +12,8 @@ # checks (no archive to upload and download). The GPU path tracer's tests run one at a time # (.config/nextest.toml), so they have a job of their own in four shards (GPU path tests). A few # heavy tests (see .config/nextest.toml) are skipped on pull requests and run on pushes to main and -# nightly. The reference tests run on a pull request that selects solidcraft-cli (they replay -# recipes through it). The doc tests run in the merge queue, on main and nightly, not on pull -# requests (the fast lane, in Select checks); a break there is fixed forward on main. The +# nightly. The reference tests and the doc tests run in the merge queue, on main and nightly, not +# on pull requests (the fast lane, in Select checks); a break there is fixed forward on main. The # Windows jobs (D3D12 shaders and app startup) run nightly, and in the merge queue only for a group # that changes what they exercise. Only main saves the build caches; pull requests restore them. # sccache is on a Blacksmith sticky disk that only main commits. @@ -22,9 +21,8 @@ # commit, or when nothing a build reads changed since the last push to main whose run passed. # Otherwise it runs everything. # Heavy checks wait for review: a pull request without the `approved-for-ci` label runs only -# Select checks, the format and repository checks and a quick compile, unless its author is an -# owner, member or collaborator of the repository (they could push the code to a branch here -# anyway). Adding the label (after review) runs everything above, and every later push to the PR does too, except a push that only +# Select checks, the format and repository checks and a quick compile. Adding the label (after +# review) runs everything above, and every later push to the PR does too, except a push that only # merges main into a change that already passed (scripts/ci/main_merge.py): it carries that # result and runs the repository checks. Merge groups, the nightly run and Run workflow are not # pull requests and always run the full suite. @@ -33,8 +31,6 @@ # `ci` job still runs and reports the commit's real result (see the `ci` job): the merge queue # reads `ci` from the newest run of a commit, so a run without it would block a PR that passed. # Cross-compilation is opt-in through Run workflow; release builds remain in release.yml. -# The release gate (release-gate.yml) calls this workflow (workflow_call) as a Run workflow with -# cross-compilation on. # Every Linux job runs on Blacksmith's Ubuntu 24.04 runners (blacksmith-vcpu-ubuntu-2404), sized # per job: 32 vCPU for the tests, 16 for Clippy, the GPU path tests, the archive build (nightly) and the merge queue's, 8 for compiles, doc and reference tests, 4 for the light checks, 2 for Select checks and ci. # The Windows shader job runs on Blacksmith's Windows Server 2025 runners (blacksmith-8vcpu-windows-2025); @@ -68,14 +64,6 @@ on: description: "Also check WebAssembly and RISC-V (before a release)" type: boolean default: false - # The release gate (release-gate.yml): the event stays the caller's (workflow_dispatch), so a - # call runs exactly what Run workflow runs. - workflow_call: - inputs: - cross_compile: - description: "Also check WebAssembly and RISC-V (before a release)" - type: boolean - default: false permissions: contents: read @@ -149,9 +137,6 @@ jobs: HEAD_REF: ${{ github.event.pull_request.head.ref }} REPO: ${{ github.repository }} APPROVED: ${{ contains(github.event.pull_request.labels.*.name, 'approved-for-ci') }} - # An owner, member or collaborator could push the change to a branch here: their pull - # requests need no label. - TRUSTED: ${{ contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association) }} GH_TOKEN: ${{ github.token }} run: | native=false @@ -245,18 +230,16 @@ jobs: if [ "$EVENT_NAME" = pull_request ] && [ "$full" != true ]; then case " $packages " in *" solidcraft-cli "*) ;; *) oracle=false ;; esac fi - # The pull request fast lane: Windows and the doc tests run on main (and the nightly), - # not on every pull request push; a break there is fixed forward on main. Over three - # days of pull requests the doc tests were the only failing job 3 times in about 7,900 - # runner-minutes. The reference tests run when solidcraft-cli is selected (above): a - # kernel change that broke them went unseen until a full run on develop. + # The pull request fast lane: Windows, the reference tests and the doc tests run on main + # (and the nightly), not on every pull request push; a break there is fixed forward on + # main. Over three days of pull requests the doc tests were the only failing job 3 times + # in about 7,900 runner-minutes, and the reference tests never were. doctests=$native - if [ "$EVENT_NAME" = pull_request ]; then windows=false; doctests=false; fi - # Until a maintainer adds approved-for-ci, a pull request from outside the repository's - # owners, members and collaborators gets a quick compile instead of Clippy, the tests, - # the reference tests and the doc tests. + if [ "$EVENT_NAME" = pull_request ]; then windows=false; oracle=false; doctests=false; fi + # Until a maintainer adds approved-for-ci, a pull request gets a quick compile instead of + # Clippy, the tests and the doc tests. quick=false - if [ "$EVENT_NAME" = pull_request ] && [ "$APPROVED" != true ] && [ "$TRUSTED" != true ]; then + if [ "$EVENT_NAME" = pull_request ] && [ "$APPROVED" != true ]; then quick=$native native=false oracle=false From 322ac2592a74180ea6aff468082b19802fb037c3 Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 19:53:29 -0400 Subject: [PATCH 104/108] CI: the release gate still calls ci.yml (workflow_call) Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 740ab4c94..0d3531e47 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,6 +31,8 @@ # `ci` job still runs and reports the commit's real result (see the `ci` job): the merge queue # reads `ci` from the newest run of a commit, so a run without it would block a PR that passed. # Cross-compilation is opt-in through Run workflow; release builds remain in release.yml. +# The release gate (release-gate.yml) calls this workflow (workflow_call) as a Run workflow with +# cross-compilation on. # Every Linux job runs on Blacksmith's Ubuntu 24.04 runners (blacksmith-vcpu-ubuntu-2404), sized # per job: 32 vCPU for the tests, 16 for Clippy, the GPU path tests, the archive build (nightly) and the merge queue's, 8 for compiles, doc and reference tests, 4 for the light checks, 2 for Select checks and ci. # The Windows shader job runs on Blacksmith's Windows Server 2025 runners (blacksmith-8vcpu-windows-2025); @@ -64,6 +66,14 @@ on: description: "Also check WebAssembly and RISC-V (before a release)" type: boolean default: false + # The release gate (release-gate.yml): the event stays the caller's (workflow_dispatch), so a + # call runs exactly what Run workflow runs. + workflow_call: + inputs: + cross_compile: + description: "Also check WebAssembly and RISC-V (before a release)" + type: boolean + default: false permissions: contents: read From eca7aec7ffed7f113ced23bc4928e9d570c17d60 Mon Sep 17 00:00:00 2001 From: Brett Lawson Date: Fri, 30 Oct 2026 02:26:23 +0100 Subject: [PATCH 105/108] smlib tests: SMLib now drafts a cylinder side and offsets a closed sheet (develop's SMLib 90aabff, fixes #27 and #17) The C++ kernel at develop's pin (9d0fb564) builds both cases that expected a refusal; each now expects its closed form: - offset_sheet_a_solid (tangency-labs/smlib#17): the 30 x 20 x 10 block, every face moved out d = 1, convex edges extended: (a + 2d)(b + 2d)(c + 2d) = 32 * 22 * 12 = 8448, bounds (-1, -1, -1) to (31, 21, 11), six planes. - draft_a_curved_face (tangency-labs/smlib#27): the cylinder R = 5, h = 10 drafted 0.1 rad about its base, leaning in, is the frustum of radii R and r = R - h tan 0.1: V = pi h (R^2 + R r + r^2) / 3 = 638.3350153968712 (a cone and two planes). C++ meets both within the file's 1e-9 relative. The solidcore side of each is ignored: core/offset.rs still makes the old capi's refusals (a closed solid in offset_sheet, planes only in draft). With the offset_sheet refusal dropped, solidcore gives the block exactly; solidcore has Cone::lean_cylinder (solidcore#1545) for the draft. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01MNXLXkZLQ6T7TSi4wswcmk --- crates/smlib/src/core/offset_tests.rs | 31 ++++++++++++++++++++------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/crates/smlib/src/core/offset_tests.rs b/crates/smlib/src/core/offset_tests.rs index e1b26ddc7..e07568671 100644 --- a/crates/smlib/src/core/offset_tests.rs +++ b/crates/smlib/src/core/offset_tests.rs @@ -97,6 +97,8 @@ enum Expect { Volume(f64), /// A solid of this volume whose bounds along z are these. Slab(f64, f64, f64), + /// A solid of this volume (relative 1e-9) whose bounds are these. + Solid(f64, [f64; 3], [f64; 3]), /// A sheet of this area (relative 1e-9) whose bounds are these. Sheet(f64, [f64; 3], [f64; 3]), /// This error. @@ -154,7 +156,10 @@ fn case(name: &str) -> Case { // The quarter cylinder moved 2 along its normal (outward: the arc's tangent swept along // z): radius 7, area (π/2) 7 · 10. "offset_sheet_quarter_cylinder" => c(Op::OffsetSheet(QUARTER, 2.0), Expect::Sheet(PI / 2.0 * 7.0 * 10.0, [0.0, 0.0, 0.0], [7.0, 7.0, 10.0])), - "offset_sheet_a_solid" => c(Op::OffsetSheet(BLOCK, 1.0), Expect::Fails(Error::Argument)), + // A closed sheet offsets as an open one (tangency-labs/smlib fix #17, develop 9d0fb564): + // each face moved out 1 along its normal, the convex edges extended, gives the block + // (a + 2d)(b + 2d)(c + 2d) of six planes, from -d to (a, b, c) + d. + "offset_sheet_a_solid" => c(Op::OffsetSheet(BLOCK, 1.0), Expect::Solid(32.0 * 22.0 * 12.0, [-1.0, -1.0, -1.0], [31.0, 21.0, 11.0])), // The top moved out 2: abc + d·ab. "offset_faces_top_out" => c(Op::OffsetFaces(BLOCK, vec![TOP], 2.0), Expect::Volume(ABC + 2.0 * 600.0)), // The top moved in 10, as deep as the block: nothing left behind it. @@ -188,11 +193,17 @@ fn case(name: &str) -> Case { let s = (5.0f64).to_radians().tan(); c(Op::Draft(BLOCK, vec![FRONT], [0.0, 0.0, 10.0], Z, Z, 5f64.to_radians()), Expect::Volume(ABC + 30.0 * 100.0 * s / 2.0)) } - // A cylinder's side is not flat. - "draft_a_curved_face" => c( - Op::Draft(Shape::Cylinder([0.0; 3], 5.0, 10.0), vec![[5.0, 0.0, 5.0]], [0.0; 3], [0.0, 0.0, 1.0], [0.0, 0.0, 1.0], 0.1), - Expect::Fails(Error::Unsupported), - ), + // A cylinder along the pull drafts to a cone (tangency-labs/smlib fix #27, develop + // 9d0fb564): R = 5, h = 10, θ = 0.1 about the bottom, leaning in: a frustum of radii R + // and r = R - h tanθ (a cone and its two caps): V = π h (R² + R r + r²) / 3. + "draft_a_curved_face" => { + let (big, h) = (5.0, 10.0); + let small = big - h * 0.1f64.tan(); + c( + Op::Draft(Shape::Cylinder([0.0; 3], big, h), vec![[5.0, 0.0, 5.0]], [0.0; 3], [0.0, 0.0, 1.0], [0.0, 0.0, 1.0], 0.1), + Expect::Volume(PI * h * (big * big + big * small + small * small) / 3.0), + ) + } // The top is square to the pull, not along it. "draft_a_face_across_the_pull" => { c(Op::Draft(BLOCK, vec![TOP], [0.0; 3], [0.0, 0.0, 1.0], [0.0, 0.0, 1.0], 0.1), Expect::Fails(Error::Unsupported)) @@ -277,6 +288,10 @@ fn judge(name: &str, who: &str, expect: &Expect, got: Got) -> Got { let (a, b) = (m.bounds.0[2], m.bounds.1[2]); assert!((a - lo).abs() < 1e-6 && (b - hi).abs() < 1e-6, "{name}: {who} z from {a} to {b}, expected {lo} to {hi}"); } + (Expect::Solid(v, lo, hi), Ok(m)) => { + assert!(rel(m.size, *v) < 1e-9, "{name}: {who} volume {} vs analytic {v}", m.size); + assert!(near(m.bounds.0, *lo) && near(m.bounds.1, *hi), "{name}: {who} bounds {:?}, expected {lo:?} {hi:?}", m.bounds); + } (Expect::Sheet(s, lo, hi), Ok(m)) => { assert!(rel(m.size, *s) < 1e-9, "{name}: {who} area {} vs analytic {s}", m.size); assert!(near(m.bounds.0, *lo) && near(m.bounds.1, *hi), "{name}: {who} bounds {:?}, expected {lo:?} {hi:?}", m.bounds); @@ -410,14 +425,14 @@ cases!( thicken_a_solid, offset_sheet_plate, offset_sheet_quarter_cylinder: ignore = "solidcore#1441: an offset surface does not export, no SmSurface::ApproximateSurface (solidcore#1441)", - offset_sheet_a_solid, + offset_sheet_a_solid: ignore = "the port lags tangency-labs/smlib#17: core/offset.rs still refuses a closed solid (solidcore offsets it exactly once it does not)", offset_faces_top_out: ignore = "no SmOffsetFacesExecutive, fork a96ce9f (solidcore#1060)", offset_faces_through, draft_box_sides, draft_one_side, draft_one_side_out, draft_one_side_hinged_at_the_top, - draft_a_curved_face, + draft_a_curved_face: ignore = "the port lags tangency-labs/smlib#27: core/offset.rs drafts planes only (solidcore has Cone::lean_cylinder, solidcore#1545)", draft_a_face_across_the_pull, ); From accf0aac99f8670db888342c445f139f1f218cdf Mon Sep 17 00:00:00 2001 From: Brett Lawson Date: Fri, 30 Oct 2026 02:31:44 +0100 Subject: [PATCH 106/108] smlib: solidcore offsets a closed sheet, as the capi since tangency-labs/smlib#17 Ports smlib PR #17 (merge b0180137) into core/offset.rs::offset_sheet: the refusal of a closed manifold solid is dropped, so faces that close into a solid (a sphere's one face, a block's six) give the offset solid. The port also gains the capi's `take` check it was missing: a result without faces is SMLIB_ERR_EMPTY (Error::Empty), not an empty body. Tests (closed forms): - offset_sheet_a_solid un-ignored: 32 * 22 * 12 = 8448, bounds -1 .. (31, 21, 11). - offset_sheet_a_sphere (PR #17's capi case): r 10 moved out 2, (4/3) pi 12^3. - offset_sheet_a_sphere_to_its_centre: r 10 moved in 10 leaves no face: Empty, as C++. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01MNXLXkZLQ6T7TSi4wswcmk --- crates/smlib/src/core/offset.rs | 13 ++++++++----- crates/smlib/src/core/offset_tests.rs | 15 +++++++++++++-- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/crates/smlib/src/core/offset.rs b/crates/smlib/src/core/offset.rs index cc3e516c0..5163bce1a 100644 --- a/crates/smlib/src/core/offset.rs +++ b/crates/smlib/src/core/offset.rs @@ -6,7 +6,8 @@ //! //! As there, every operation works on a copy of its body (`SmApiBrepCopy`) and picks faces by //! point; the shell and the offsets are `SmApiShellBrepFull` and `SmApiOffsetBrepFull`, with -//! convex edges extended and the results merged. +//! convex edges extended and the results merged. A sheet offset takes faces that close into a +//! solid as the capi does since tangency-labs/smlib#17. //! //! What the capi asks of SMLib code that solidcore does not have is [`Error::Unsupported`], //! refused where the capi would first reach it, so every error before it is the C++ path's: a @@ -509,16 +510,18 @@ pub(crate) fn thicken(body: &Body, thickness: f64, symmetric: bool) -> Result Result { if !distance_ok(distance) { return Err(Error::Argument); } on_copy("smlib_offset_sheet", body, |k, mut w| { - if brep_p2::is_manifold_solid(&w)? { - return Ok(Err(Error::Argument)); + // `take`: a result without faces (a sphere moved in to its centre) is SMLIB_ERR_EMPTY. + match called(offset_brep_full(k, &mut w, distance))? { + Ok(r) => finish(r, false), + Err(e) => Ok(Err(e)), } - called(offset_brep_full(k, &mut w, distance)) }) } diff --git a/crates/smlib/src/core/offset_tests.rs b/crates/smlib/src/core/offset_tests.rs index e07568671..e1888bf07 100644 --- a/crates/smlib/src/core/offset_tests.rs +++ b/crates/smlib/src/core/offset_tests.rs @@ -19,7 +19,7 @@ use solidcore::primitive::api_curves::create_line_segment; use solidcore::sweep::api_brep::create_linear_sweep; use super::offset::{draft, offset_faces, offset_sheet, shell, thicken}; -use super::{Body, area, bounds, counts, make_box, make_cylinder, run, to_arrays, volume}; +use super::{Body, area, bounds, counts, make_box, make_cylinder, make_sphere, run, to_arrays, volume}; use crate::export::native; use crate::{BooleanOp, Error}; @@ -33,6 +33,7 @@ const TOL: f64 = 0.01; enum Shape { Box([f64; 3], [f64; 3]), Cylinder([f64; 3], f64, f64), + Sphere([f64; 3], f64), /// A sheet: the line from the first point to the second swept along `dir` by `dist`. LineSheet([f64; 3], [f64; 3], [f64; 3], f64), /// A sheet: the arc about +Z through `center` of `radius` from 0 to `degrees`, swept along @@ -52,6 +53,7 @@ impl Shape { match self { Shape::Box(o, s) => make_box(o, s).unwrap(), Shape::Cylinder(o, r, h) => make_cylinder(o, r, h).unwrap(), + Shape::Sphere(o, r) => make_sphere(o, r).unwrap(), Shape::LineSheet(a, b, dir, dist) => run("sheet", |k| { let c = Curve::from(create_line_segment(v3(a), v3(b))?); create_linear_sweep(k, &[Some(&c)], v3(dir), dist, false) @@ -121,6 +123,8 @@ const FRONT: [f64; 3] = [15.0, 0.0, 5.0]; const Z: [f64; 3] = [0.0, 0.0, 1.0]; /// A 30 x 20 sheet in z = 0: the x axis from 0 to 30 swept 20 along y. const PLATE: Shape = Shape::LineSheet([0.0; 3], [30.0, 0.0, 0.0], [0.0, 1.0, 0.0], 20.0); +/// A sphere of radius 10 about the origin. +const BALL: Shape = Shape::Sphere([0.0; 3], 10.0); /// A quarter of a cylinder of radius 5 about the z axis, 10 high. const QUARTER: Shape = Shape::ArcSheet([0.0; 3], 5.0, 90.0, 10.0); @@ -153,6 +157,10 @@ fn case(name: &str) -> Case { "thicken_a_solid" => c(Op::Thicken(BLOCK, 2.0, false), Expect::Fails(Error::Argument)), // The plate moved 3 along its normal (+z: the x axis swept along y): still 600, at z = 3. "offset_sheet_plate" => c(Op::OffsetSheet(PLATE, 3.0), Expect::Sheet(600.0, [0.0, 0.0, 3.0], [30.0, 20.0, 3.0])), + // A sphere's one face closes on itself (tangency-labs/smlib fix #17): r = 10 moved out 2 is + // the ball of radius 12, (4/3) π 12³; moved in 10, to its centre, nothing is left. + "offset_sheet_a_sphere" => c(Op::OffsetSheet(BALL, 2.0), Expect::Volume(4.0 / 3.0 * PI * 12.0f64.powi(3))), + "offset_sheet_a_sphere_to_its_centre" => c(Op::OffsetSheet(BALL, -10.0), Expect::Fails(Error::Empty)), // The quarter cylinder moved 2 along its normal (outward: the arc's tangent swept along // z): radius 7, area (π/2) 7 · 10. "offset_sheet_quarter_cylinder" => c(Op::OffsetSheet(QUARTER, 2.0), Expect::Sheet(PI / 2.0 * 7.0 * 10.0, [0.0, 0.0, 0.0], [7.0, 7.0, 10.0])), @@ -328,6 +336,7 @@ fn cpp_case(name: &str) -> Got { match s { Shape::Box(o, z) => ffi::make_box(&o, &z).map(Brep::made).unwrap(), Shape::Cylinder(o, r, h) => ffi::make_cylinder(&o, r, h).map(Brep::made).unwrap(), + Shape::Sphere(o, r) => ffi::make_sphere(&o, r).map(Brep::made).unwrap(), Shape::LineSheet(a, b, dir, dist) => Brep::extrude(&[line(a, b)], dir, dist, 0.0, DraftCorner::default(), false).unwrap(), Shape::ArcSheet(o, r, degrees, h) => { let arc = crate::sweeps::Curve::Arc { @@ -425,7 +434,9 @@ cases!( thicken_a_solid, offset_sheet_plate, offset_sheet_quarter_cylinder: ignore = "solidcore#1441: an offset surface does not export, no SmSurface::ApproximateSurface (solidcore#1441)", - offset_sheet_a_solid: ignore = "the port lags tangency-labs/smlib#17: core/offset.rs still refuses a closed solid (solidcore offsets it exactly once it does not)", + offset_sheet_a_solid, + offset_sheet_a_sphere, + offset_sheet_a_sphere_to_its_centre, offset_faces_top_out: ignore = "no SmOffsetFacesExecutive, fork a96ce9f (solidcore#1060)", offset_faces_through, draft_box_sides, From 2c8a1fa09888beea416f36cc71b9ef4bfaf83de2 Mon Sep 17 00:00:00 2001 From: Brett Lawson Date: Fri, 30 Oct 2026 02:39:44 +0100 Subject: [PATCH 107/108] smlib: solidcore drafts a cylinder along the pull into a cone, as the capi since tangency-labs/smlib#27 Ports smlib PR #27 (merge f64ff8b6) into core/offset.rs::draft: a picked face on a cylinder (end radii equal, the #27 test) gets the cone `drafted_cone` gives, through the same LocalOperation as a tilted plane. As in the capi, the outward normal at the face's internal point (`outward_normal`: STEP inversion, NURBS uv, the surface normal turned with the outer faceuse) says pin or hole (s = +1 or -1). The hinge circle is the axis on the neutral plane, at the cylinder's height v0. The radius changes by -s tan(angle) per unit along the pull. The pull must run along the axis (to 1e-9), and the axis must cross the neutral plane; otherwise, or when the cone would close within the face, the draft is Error::Unsupported. The capi's control-point edit and CopyAndAddAnalytics are solidcore's Cone::lean_cylinder (solidcore#1545), with slope -s tan(angle) (z . pull) about height v0. A cone that is not a cylinder (smlib#53's turned generators) stays Unsupported: lean_cylinder takes cylinders only. draft_a_curved_face (R 5, h 10, 0.1 rad: V = pi h (R^2 + R r + r^2) / 3 = 638.3350153968712, r = R - h tan 0.1) stays ignored on solidcore. lean_cylinder keeps the clone's cylinder flag. Under the cylinder_rebuild_mean_radius fix SolidCraft runs with, rebuild_step_from_nurb_parameters then refuses the leaned NURB (SM_ERR 1001). With that fix off, the port meets the closed form, but the face is still flagged a cylinder ({cylinder: 1, plane: 2} vs C++'s {cone: 1, plane: 2}). This is a solidcore bug, to be filed. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01MNXLXkZLQ6T7TSi4wswcmk --- crates/smlib/src/core/offset.rs | 101 ++++++++++++++++++++++++-- crates/smlib/src/core/offset_tests.rs | 2 +- 2 files changed, 97 insertions(+), 6 deletions(-) diff --git a/crates/smlib/src/core/offset.rs b/crates/smlib/src/core/offset.rs index 5163bce1a..fb07417ef 100644 --- a/crates/smlib/src/core/offset.rs +++ b/crates/smlib/src/core/offset.rs @@ -13,8 +13,10 @@ //! refused where the capi would first reach it, so every error before it is the C++ path's: a //! face move (`SmOffsetFacesExecutive`, fork a96ce9f, solidcore#1060). //! -//! A draft's tilted faces go in through solidcore's `SmBrep::LocalOperation` -//! ([`local_operation`]); the capi's check that it moved some face (`moved_faces`) needs face +//! A draft tilts planes and, since tangency-labs/smlib#27, turns a cylinder about the pull into +//! a cone (solidcore's `Cone::lean_cylinder`, solidcore#1545); a cone that is not a cylinder +//! (smlib#53) is [`Error::Unsupported`]. A draft's tilted faces go in through solidcore's +//! `SmBrep::LocalOperation` ([`local_operation`]); the capi's check that it moved some face (`moved_faces`) needs face //! history solidcore does not report (solidcore#1462) and is not made. use solidcore::EntityRef; @@ -34,7 +36,8 @@ use solidcore::offset::offset_executive::p2::{ }; use solidcore::query::api_queries::{BrepRef, face_bounding_box, face_classify_uv, face_closest_point_in_shape, face_internal_point}; use solidcore::query::brep::{BrepIdentity, BrepQuery, LiveBrepObjects}; -use solidcore::surface::surface::SurfaceKind; +use solidcore::surface::cone::Cone; +use solidcore::surface::surface::{Surface, SurfaceKind}; use solidcore::sweep::topology_sweep::store::SweepIdentities; use solidcore::topology::brep::local_operation::local_operation; use solidcore::topology::brep::{p1 as brep_p1, p2 as brep_p2, p3 as brep_p3}; @@ -536,10 +539,83 @@ fn unit(v: [f64; 3]) -> Option { (len > 1e-12 && len.is_finite()).then(|| u * (1.0 / len)) } +/// `outward_normal`: the outward normal of face `f` (its outer faceuse `fu`) at `at`, a point on +/// it: its surface's normal there, turned with the outer faceuse. `None` where SMLib cannot place +/// the point on the surface (the capi's `STEPInversionAnswered` also takes a point outside the +/// domain or off the surface by more than its tolerance; solidcore's inversion answers those with +/// a status, so they are `None` here: the face's own internal point is neither). +fn outward_normal(k: &Kernel, b: &Brep, f: FaceId, fu: FaceuseId, at: Point3) -> solidcore::Result> { + let Some(surf) = b.face(f)?.surface.as_ref() else { return Ok(None) }; + let Some((step, _)) = answer(surf.step_inversion(k, &surf.step_uv_domain(), at, 1e6, None))? else { return Ok(None) }; + let Some(nurb) = answer(surf.convert_uv_from_step_to_nurbs(k, step))? else { return Ok(None) }; + let Some(mut n) = answer(surf.evaluate_normal(k, nurb, Side::Left, Side::Left))? else { return Ok(None) }; + if b.faceuse(fu)?.orientation != OrientType::Same { + n = -n; + } + Ok(Some(n)) +} + +/// `drafted_cone` (tangency-labs/smlib#27): the cone a face on the cylinder `cyl` about the pull +/// (its outward normal `n` at `inside`) becomes drafted by `angle` about its circle on the neutral +/// plane (through `origin`, normal `normal`), so that it leans in going along `pull`: its radius +/// R - s h tan(angle) at height h along the pull from that circle, s = 1 where the face looks +/// away from the axis (a pin), -1 where it looks towards it (a hole). The capi moves the +/// cylinder's NURB control points radially and lets `CopyAndAddAnalytics` find the cone; +/// solidcore's `Cone::lean_cylinder` (solidcore#1545) is that edit, keeping the cylinder's +/// parameters so the face's UV trims stay valid. [`Error::Unsupported`] when the pull does not +/// run along the axis, the axis lies in the neutral plane, or the cone would close within the +/// face's span. A cone that is not a cylinder (`drafted_cone`'s turned generators, +/// tangency-labs/smlib#53) is [`Error::Unsupported`] too: `lean_cylinder` takes cylinders only. +#[allow(clippy::too_many_arguments)] // the capi's drafted_cone +fn drafted_cone( + k: &Kernel, + cyl: &Cone, + n: Vec3, + inside: Point3, + origin: Point3, + normal: Vec3, + pull: Vec3, + angle: f64, +) -> solidcore::Result> { + let bot = cyl.bot_radius(); + if (bot - cyl.top_radius()).abs() > 1e-12 * (1.0 + bot) { + return Ok(Err(Error::Unsupported)); + } + let frame = cyl.canonical().origin; + let z = frame.x_axis().cross(frame.y_axis()); + let len = z.length(); + if !(len > 0.0 && len.is_finite()) { + return Ok(Err(Error::Unsupported)); + } + let z = z * (1.0 / len); + let sense = z.dot(pull); + if (sense.abs() - 1.0).abs() > 1e-9 { + return Ok(Err(Error::Unsupported)); + } + let axis = frame.origin(); + let toward = z.dot(normal); + if toward.abs() < 1e-12 { + return Ok(Err(Error::Unsupported)); + } + // The hinge circle's centre: the axis on the neutral plane, at the cylinder's height v0. + let v0 = (origin - axis).dot(normal) / toward; + let centre = axis + z * v0; + let radial = (inside - centre) - pull * (inside - centre).dot(pull); + let s = if radial.dot(n) >= 0.0 { 1.0 } else { -1.0 }; + // The radius changes by -s tan(angle) per unit along the pull, so by -s tan(angle) (z . pull) + // per unit of the cylinder's height, from its radius at v0. + let slope = -s * angle.tan() * sense; + if !slope.is_finite() { + return Ok(Err(Error::Unsupported)); + } + Ok(answer(cyl.lean_cylinder(k, slope, v0))?.ok_or(Error::Unsupported)) +} + /// `smlib_draft`: its checks, the solid check, the pick, then `draft_faces`: each picked face (a /// plane parallel to the pull) gets a copy of its plane turned by `angle` about its line on the -/// neutral plane, and `SmBrep::LocalOperation` extends or trims the faces around them to meet -/// the tilted planes. +/// neutral plane, and a cylinder about the pull the cone `drafted_cone` gives +/// (tangency-labs/smlib#27); `SmBrep::LocalOperation` extends or trims the faces around them to +/// meet the tilted surfaces. pub(crate) fn draft( body: &Body, points: &[[f64; 3]], @@ -575,6 +651,21 @@ pub(crate) fn draft( let (Some(surf), Some(fu)) = (face.surface.as_ref(), fu) else { return Ok(Err(Error::Status(INVALID_INPUT))); }; + // A cylinder about the pull drafted becomes a cone (`drafted_cone`). + if let SurfaceKind::Cone(c) = surf.kind_with_nurb(k)? { + let cyl = (**c).clone(); + let Some(inside) = answer(face_internal_point(k, &mut w, f))? else { + return Ok(Err(Error::Status(INVALID_INPUT))); + }; + let Some(n) = outward_normal(k, &w, f, fu, inside)? else { + return Ok(Err(Error::Status(INVALID_INPUT))); + }; + match drafted_cone(k, &cyl, n, inside, p3(neutral_origin), normal, along, angle)? { + Ok(cone) => surfaces.push(Surface::from(cone)), + Err(e) => return Ok(Err(e)), + } + continue; + } let SurfaceKind::Plane(plane) = surf.kind_with_nurb(k)? else { return Ok(Err(Error::Unsupported)); }; diff --git a/crates/smlib/src/core/offset_tests.rs b/crates/smlib/src/core/offset_tests.rs index e1888bf07..0fe1d5c96 100644 --- a/crates/smlib/src/core/offset_tests.rs +++ b/crates/smlib/src/core/offset_tests.rs @@ -443,7 +443,7 @@ cases!( draft_one_side, draft_one_side_out, draft_one_side_hinged_at_the_top, - draft_a_curved_face: ignore = "the port lags tangency-labs/smlib#27: core/offset.rs drafts planes only (solidcore has Cone::lean_cylinder, solidcore#1545)", + draft_a_curved_face: ignore = "solidcore#TBD: Cone::lean_cylinder keeps its cylinder flag, so under cylinder_rebuild_mean_radius the rebuild refuses the cone", draft_a_face_across_the_pull, ); From 3499802521f2f5b63f19196fbe802af02d000130 Mon Sep 17 00:00:00 2001 From: Brett Lawson Date: Fri, 30 Oct 2026 03:03:20 +0100 Subject: [PATCH 108/108] smlib tests: the cylinder draft's ignore cites solidcore#1606 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01MNXLXkZLQ6T7TSi4wswcmk --- crates/smlib/src/core/offset_tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/smlib/src/core/offset_tests.rs b/crates/smlib/src/core/offset_tests.rs index 0fe1d5c96..1f86ccc8c 100644 --- a/crates/smlib/src/core/offset_tests.rs +++ b/crates/smlib/src/core/offset_tests.rs @@ -443,7 +443,7 @@ cases!( draft_one_side, draft_one_side_out, draft_one_side_hinged_at_the_top, - draft_a_curved_face: ignore = "solidcore#TBD: Cone::lean_cylinder keeps its cylinder flag, so under cylinder_rebuild_mean_radius the rebuild refuses the cone", + draft_a_curved_face: ignore = "solidcore#1606: Cone::lean_cylinder keeps its cylinder flag, so under cylinder_rebuild_mean_radius the rebuild refuses the cone", draft_a_face_across_the_pull, );