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] 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 + } + } + ] +}