Skip to content

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

Wave 41/509: kernel-cases: sheet-metal fold cases from #262, #264, #638, #639, #685

Brennen Herbruck06bdfc1c131e
diff --git a/tests/kernel-cases/sheet-metal/262-fold-a-tab-just-inside-its-root/expected.json b/tests/kernel-cases/sheet-metal/262-fold-a-tab-just-inside-its-root/expected.json
new file mode 100644
index 0000000000..caf9359535
--- /dev/null
+++ b/tests/kernel-cases/sheet-metal/262-fold-a-tab-just-inside-its-root/expected.json
@@ -0,0 +1,11 @@
+{
+ "sources": [
+ "tangency-labs/solidcraft#262",
+ "tangency-labs/solidcraft#277"
+ ],
+ "what": "a 20 x 20 tab folded 90 degrees on a line 1 mm inside its root, where the bend zone stays clear of the blank's outline",
+ "source": "analytic",
+ "method": "blank area 100*50 + 20*20 = 5400 mm2 at t = 0.8; the fold has width 20: a fold keeps the flat length of the blank, so a fold of angle th, inner radius R, thickness t and K-factor K over a width w takes a flat strip of BA = th(R+Kt) and puts a bend of volume th((R+t)^2-R^2)w/2 in its place: V = V_flat + th w t^2 (1/2 - K) (the bend's mid-surface lies at R+t/2, the neutral axis at R+Kt). V = 5400*0.8 + (pi/2)*20*0.64*0.06",
+ "body_count": 1,
+ "volume_mm3": 4321.206371578978
+}
\ No newline at end of file
diff --git a/tests/kernel-cases/sheet-metal/262-fold-a-tab-just-inside-its-root/recipe.json b/tests/kernel-cases/sheet-metal/262-fold-a-tab-just-inside-its-root/recipe.json
new file mode 100644
index 0000000000..8b6edff183
--- /dev/null
+++ b/tests/kernel-cases/sheet-metal/262-fold-a-tab-just-inside-its-root/recipe.json
@@ -0,0 +1,98 @@
+{
+ "commands": [
+ {
+ "command": "sheet.manage_rules",
+ "params": {
+ "name": "Steel 0.8",
+ "thickness": "0.8 mm",
+ "active": true,
+ "bend_radius": "0.8 mm",
+ "k_factor": 0.44
+ }
+ },
+ {
+ "command": "sketch.create",
+ "params": {
+ "plane": "XY",
+ "name": "Blank"
+ }
+ },
+ {
+ "command": "sketch.line",
+ "params": {
+ "points": [
+ [
+ 0,
+ 0
+ ],
+ [
+ 100,
+ 0
+ ],
+ [
+ 100,
+ 50
+ ],
+ [
+ 60,
+ 50
+ ],
+ [
+ 60,
+ 70
+ ],
+ [
+ 40,
+ 70
+ ],
+ [
+ 40,
+ 50
+ ],
+ [
+ 0,
+ 50
+ ]
+ ],
+ "closed": true
+ }
+ },
+ {
+ "command": "sketch.finish",
+ "params": {}
+ },
+ {
+ "command": "sheet.flange",
+ "params": {
+ "type": "base",
+ "sketch": "Blank"
+ }
+ },
+ {
+ "command": "sheet.fold",
+ "params": {
+ "points": [
+ [
+ 40,
+ 51,
+ 0.8
+ ],
+ [
+ 60,
+ 51,
+ 0.8
+ ]
+ ],
+ "fixed": [
+ 50,
+ 25,
+ 0.8
+ ]
+ }
+ },
+ {
+ "command": "inspect.measure",
+ "params": {}
+ }
+ ]
+}
\ No newline at end of file
diff --git a/tests/kernel-cases/sheet-metal/262-fold-at-a-tab-root-refused/expected.json b/tests/kernel-cases/sheet-metal/262-fold-at-a-tab-root-refused/expected.json
new file mode 100644
index 0000000000..34d0c187ea
--- /dev/null
+++ b/tests/kernel-cases/sheet-metal/262-fold-at-a-tab-root-refused/expected.json
@@ -0,0 +1,10 @@
+{
+ "sources": [
+ "tangency-labs/solidcraft#262",
+ "tangency-labs/solidcraft#277"
+ ],
+ "what": "a fold exactly at a tab's root, where the bend zone (+-BA/2) would reach the blank's outline beside the tab, needs a bend relief",
+ "source": "invariants",
+ "method": "the fold line y = 50 is the tab's root: its bend zone reaches the corners (40,50) and (60,50) of the outline, so a clean bend is impossible without a relief that fold does not cut; the right behaviour is a refusal that names the cause, not a panic, a hang or a malformed body (BA/2 = (pi/2)(0.8+0.352)/2 = 0.905 mm)",
+ "outcome": "refused"
+}
\ No newline at end of file
diff --git a/tests/kernel-cases/sheet-metal/262-fold-at-a-tab-root-refused/recipe.json b/tests/kernel-cases/sheet-metal/262-fold-at-a-tab-root-refused/recipe.json
new file mode 100644
index 0000000000..16c1cf7e51
--- /dev/null
+++ b/tests/kernel-cases/sheet-metal/262-fold-at-a-tab-root-refused/recipe.json
@@ -0,0 +1,94 @@
+{
+ "commands": [
+ {
+ "command": "sheet.manage_rules",
+ "params": {
+ "name": "Steel 0.8",
+ "thickness": "0.8 mm",
+ "active": true,
+ "bend_radius": "0.8 mm",
+ "k_factor": 0.44
+ }
+ },
+ {
+ "command": "sketch.create",
+ "params": {
+ "plane": "XY",
+ "name": "Blank"
+ }
+ },
+ {
+ "command": "sketch.line",
+ "params": {
+ "points": [
+ [
+ 0,
+ 0
+ ],
+ [
+ 100,
+ 0
+ ],
+ [
+ 100,
+ 50
+ ],
+ [
+ 60,
+ 50
+ ],
+ [
+ 60,
+ 70
+ ],
+ [
+ 40,
+ 70
+ ],
+ [
+ 40,
+ 50
+ ],
+ [
+ 0,
+ 50
+ ]
+ ],
+ "closed": true
+ }
+ },
+ {
+ "command": "sketch.finish",
+ "params": {}
+ },
+ {
+ "command": "sheet.flange",
+ "params": {
+ "type": "base",
+ "sketch": "Blank"
+ }
+ },
+ {
+ "command": "sheet.fold",
+ "params": {
+ "points": [
+ [
+ 40,
+ 50,
+ 0.8
+ ],
+ [
+ 60,
+ 50,
+ 0.8
+ ]
+ ],
+ "fixed": [
+ 50,
+ 25,
+ 0.8
+ ]
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/tests/kernel-cases/sheet-metal/264-fold-one-of-two-collinear-tabs/expected.json b/tests/kernel-cases/sheet-metal/264-fold-one-of-two-collinear-tabs/expected.json
new file mode 100644
index 0000000000..000508aa4e
--- /dev/null
+++ b/tests/kernel-cases/sheet-metal/264-fold-one-of-two-collinear-tabs/expected.json
@@ -0,0 +1,11 @@
+{
+ "sources": [
+ "tangency-labs/solidcraft#264",
+ "tangency-labs/solidcraft#279"
+ ],
+ "what": "a 100 x 40 blank with two 15 x 7 tabs on one line, one tab folded 90 degrees on a line that the other tab also lies on",
+ "source": "analytic",
+ "method": "blank area 100*40 + 2*15*7 = 4210 mm2 at t = 0.8; the one fold (width 7, R = t = 0.8, K = 0.44): a fold keeps the flat length of the blank, so a fold of angle th, inner radius R, thickness t and K-factor K over a width w takes a flat strip of BA = th(R+Kt) and puts a bend of volume th((R+t)^2-R^2)w/2 in its place: V = V_flat + th w t^2 (1/2 - K) (the bend's mid-surface lies at R+t/2, the neutral axis at R+Kt). V = 4210*0.8 + (pi/2)*7*0.64*0.06",
+ "body_count": 1,
+ "volume_mm3": 3368.4222300526426
+}
\ No newline at end of file
diff --git a/tests/kernel-cases/sheet-metal/264-fold-one-of-two-collinear-tabs/recipe.json b/tests/kernel-cases/sheet-metal/264-fold-one-of-two-collinear-tabs/recipe.json
new file mode 100644
index 0000000000..95758fcd16
--- /dev/null
+++ b/tests/kernel-cases/sheet-metal/264-fold-one-of-two-collinear-tabs/recipe.json
@@ -0,0 +1,114 @@
+{
+ "commands": [
+ {
+ "command": "sheet.manage_rules",
+ "params": {
+ "name": "Steel 0.8",
+ "thickness": "0.8 mm",
+ "active": true,
+ "bend_radius": "0.8 mm",
+ "k_factor": 0.44
+ }
+ },
+ {
+ "command": "sketch.create",
+ "params": {
+ "plane": "XY",
+ "name": "Blank"
+ }
+ },
+ {
+ "command": "sketch.line",
+ "params": {
+ "points": [
+ [
+ 0,
+ 0
+ ],
+ [
+ 100,
+ 0
+ ],
+ [
+ 100,
+ 5
+ ],
+ [
+ 115,
+ 5
+ ],
+ [
+ 115,
+ 12
+ ],
+ [
+ 100,
+ 12
+ ],
+ [
+ 100,
+ 28
+ ],
+ [
+ 115,
+ 28
+ ],
+ [
+ 115,
+ 35
+ ],
+ [
+ 100,
+ 35
+ ],
+ [
+ 100,
+ 40
+ ],
+ [
+ 0,
+ 40
+ ]
+ ],
+ "closed": true
+ }
+ },
+ {
+ "command": "sketch.finish",
+ "params": {}
+ },
+ {
+ "command": "sheet.flange",
+ "params": {
+ "type": "base",
+ "sketch": "Blank"
+ }
+ },
+ {
+ "command": "sheet.fold",
+ "params": {
+ "points": [
+ [
+ 107,
+ 5,
+ 0.8
+ ],
+ [
+ 107,
+ 12,
+ 0.8
+ ]
+ ],
+ "fixed": [
+ 50,
+ 20,
+ 0.8
+ ]
+ }
+ },
+ {
+ "command": "inspect.measure",
+ "params": {}
+ }
+ ]
+}
\ No newline at end of file
diff --git a/tests/kernel-cases/sheet-metal/264-one-fold-across-two-collinear-tabs/expected.json b/tests/kernel-cases/sheet-metal/264-one-fold-across-two-collinear-tabs/expected.json
new file mode 100644
index 0000000000..2eef8e0bb3
--- /dev/null
+++ b/tests/kernel-cases/sheet-metal/264-one-fold-across-two-collinear-tabs/expected.json
@@ -0,0 +1,10 @@
+{
+ "sources": [
+ "tangency-labs/solidcraft#264"
+ ],
+ "what": "one fold line spanning both of two collinear tabs folds both",
+ "source": "analytic",
+ "method": "blank area 4210 mm2 at t = 0.8; one fold line over both tabs bends both (width 7 each): a fold keeps the flat length of the blank, so a fold of angle th, inner radius R, thickness t and K-factor K over a width w takes a flat strip of BA = th(R+Kt) and puts a bend of volume th((R+t)^2-R^2)w/2 in its place: V = V_flat + th w t^2 (1/2 - K) (the bend's mid-surface lies at R+t/2, the neutral axis at R+Kt). V = 4210*0.8 + 2*(pi/2)*7*0.64*0.06",
+ "body_count": 1,
+ "volume_mm3": 3368.8444601052847
+}
\ No newline at end of file
diff --git a/tests/kernel-cases/sheet-metal/264-one-fold-across-two-collinear-tabs/recipe.json b/tests/kernel-cases/sheet-metal/264-one-fold-across-two-collinear-tabs/recipe.json
new file mode 100644
index 0000000000..e9f89e9d22
--- /dev/null
+++ b/tests/kernel-cases/sheet-metal/264-one-fold-across-two-collinear-tabs/recipe.json
@@ -0,0 +1,114 @@
+{
+ "commands": [
+ {
+ "command": "sheet.manage_rules",
+ "params": {
+ "name": "Steel 0.8",
+ "thickness": "0.8 mm",
+ "active": true,
+ "bend_radius": "0.8 mm",
+ "k_factor": 0.44
+ }
+ },
+ {
+ "command": "sketch.create",
+ "params": {
+ "plane": "XY",
+ "name": "Blank"
+ }
+ },
+ {
+ "command": "sketch.line",
+ "params": {
+ "points": [
+ [
+ 0,
+ 0
+ ],
+ [
+ 100,
+ 0
+ ],
+ [
+ 100,
+ 5
+ ],
+ [
+ 115,
+ 5
+ ],
+ [
+ 115,
+ 12
+ ],
+ [
+ 100,
+ 12
+ ],
+ [
+ 100,
+ 28
+ ],
+ [
+ 115,
+ 28
+ ],
+ [
+ 115,
+ 35
+ ],
+ [
+ 100,
+ 35
+ ],
+ [
+ 100,
+ 40
+ ],
+ [
+ 0,
+ 40
+ ]
+ ],
+ "closed": true
+ }
+ },
+ {
+ "command": "sketch.finish",
+ "params": {}
+ },
+ {
+ "command": "sheet.flange",
+ "params": {
+ "type": "base",
+ "sketch": "Blank"
+ }
+ },
+ {
+ "command": "sheet.fold",
+ "params": {
+ "points": [
+ [
+ 107,
+ 5,
+ 0.8
+ ],
+ [
+ 107,
+ 35,
+ 0.8
+ ]
+ ],
+ "fixed": [
+ 50,
+ 20,
+ 0.8
+ ]
+ }
+ },
+ {
+ "command": "inspect.measure",
+ "params": {}
+ }
+ ]
+}
\ No newline at end of file
diff --git a/tests/kernel-cases/sheet-metal/638-fold-both-collinear-tabs-one-after-the-other/expected.json b/tests/kernel-cases/sheet-metal/638-fold-both-collinear-tabs-one-after-the-other/expected.json
new file mode 100644
index 0000000000..fbc5f69bd9
--- /dev/null
+++ b/tests/kernel-cases/sheet-metal/638-fold-both-collinear-tabs-one-after-the-other/expected.json
@@ -0,0 +1,12 @@
+{
+ "sources": [
+ "tangency-labs/solidcraft#638",
+ "tangency-labs/solidcraft#652",
+ "tangency-labs/solidcraft#963"
+ ],
+ "what": "two collinear tabs folded in two features on the same line; the second fold used to be refused as crossing a slanted edge",
+ "source": "analytic",
+ "method": "blank area 4210 mm2 at t = 0.8, two folds of width 7: a fold keeps the flat length of the blank, so a fold of angle th, inner radius R, thickness t and K-factor K over a width w takes a flat strip of BA = th(R+Kt) and puts a bend of volume th((R+t)^2-R^2)w/2 in its place: V = V_flat + th w t^2 (1/2 - K) (the bend's mid-surface lies at R+t/2, the neutral axis at R+Kt). V = 4210*0.8 + 2*(pi/2)*7*0.64*0.06",
+ "body_count": 1,
+ "volume_mm3": 3368.8444601052847
+}
\ No newline at end of file
diff --git a/tests/kernel-cases/sheet-metal/638-fold-both-collinear-tabs-one-after-the-other/recipe.json b/tests/kernel-cases/sheet-metal/638-fold-both-collinear-tabs-one-after-the-other/recipe.json
new file mode 100644
index 0000000000..b04b45dc48
--- /dev/null
+++ b/tests/kernel-cases/sheet-metal/638-fold-both-collinear-tabs-one-after-the-other/recipe.json
@@ -0,0 +1,136 @@
+{
+ "commands": [
+ {
+ "command": "sheet.manage_rules",
+ "params": {
+ "name": "Steel 0.8",
+ "thickness": "0.8 mm",
+ "active": true,
+ "bend_radius": "0.8 mm",
+ "k_factor": 0.44
+ }
+ },
+ {
+ "command": "sketch.create",
+ "params": {
+ "plane": "XY",
+ "name": "Blank"
+ }
+ },
+ {
+ "command": "sketch.line",
+ "params": {
+ "points": [
+ [
+ 0,
+ 0
+ ],
+ [
+ 100,
+ 0
+ ],
+ [
+ 100,
+ 5
+ ],
+ [
+ 115,
+ 5
+ ],
+ [
+ 115,
+ 12
+ ],
+ [
+ 100,
+ 12
+ ],
+ [
+ 100,
+ 28
+ ],
+ [
+ 115,
+ 28
+ ],
+ [
+ 115,
+ 35
+ ],
+ [
+ 100,
+ 35
+ ],
+ [
+ 100,
+ 40
+ ],
+ [
+ 0,
+ 40
+ ]
+ ],
+ "closed": true
+ }
+ },
+ {
+ "command": "sketch.finish",
+ "params": {}
+ },
+ {
+ "command": "sheet.flange",
+ "params": {
+ "type": "base",
+ "sketch": "Blank"
+ }
+ },
+ {
+ "command": "sheet.fold",
+ "params": {
+ "points": [
+ [
+ 107,
+ 5,
+ 0.8
+ ],
+ [
+ 107,
+ 12,
+ 0.8
+ ]
+ ],
+ "fixed": [
+ 50,
+ 20,
+ 0.8
+ ]
+ }
+ },
+ {
+ "command": "sheet.fold",
+ "params": {
+ "points": [
+ [
+ 107,
+ 28,
+ 0.8
+ ],
+ [
+ 107,
+ 35,
+ 0.8
+ ]
+ ],
+ "fixed": [
+ 50,
+ 20,
+ 0.8
+ ]
+ }
+ },
+ {
+ "command": "inspect.measure",
+ "params": {}
+ }
+ ]
+}
\ No newline at end of file
diff --git a/tests/kernel-cases/sheet-metal/639-fold-tab-on-inside-edge-of-an-L-blank/expected.json b/tests/kernel-cases/sheet-metal/639-fold-tab-on-inside-edge-of-an-L-blank/expected.json
new file mode 100644
index 0000000000..5101712590
--- /dev/null
+++ b/tests/kernel-cases/sheet-metal/639-fold-tab-on-inside-edge-of-an-L-blank/expected.json
@@ -0,0 +1,12 @@
+{
+ "sources": [
+ "tangency-labs/solidcraft#639",
+ "tangency-labs/solidcraft#653",
+ "tangency-labs/solidcraft#963"
+ ],
+ "what": "a tab (x 45..60, y 60..90) on an inside edge of an L-shaped blank folded 90 degrees at x = 59 with the fixed point on the other leg; refused as folding tabs that join again",
+ "source": "analytic",
+ "method": "blank area by the shoelace formula 7450.0 mm2 at t = 0.8; the fold has width 30 (the tab's height along the line): a fold keeps the flat length of the blank, so a fold of angle th, inner radius R, thickness t and K-factor K over a width w takes a flat strip of BA = th(R+Kt) and puts a bend of volume th((R+t)^2-R^2)w/2 in its place: V = V_flat + th w t^2 (1/2 - K) (the bend's mid-surface lies at R+t/2, the neutral axis at R+Kt). V = 7450.0*0.8 + (pi/2)*30*0.64*0.06",
+ "body_count": 1,
+ "volume_mm3": 5961.809557368468
+}
\ No newline at end of file
diff --git a/tests/kernel-cases/sheet-metal/639-fold-tab-on-inside-edge-of-an-L-blank/recipe.json b/tests/kernel-cases/sheet-metal/639-fold-tab-on-inside-edge-of-an-L-blank/recipe.json
new file mode 100644
index 0000000000..9357e79c07
--- /dev/null
+++ b/tests/kernel-cases/sheet-metal/639-fold-tab-on-inside-edge-of-an-L-blank/recipe.json
@@ -0,0 +1,106 @@
+{
+ "commands": [
+ {
+ "command": "sheet.manage_rules",
+ "params": {
+ "name": "Steel 0.8",
+ "thickness": "0.8 mm",
+ "active": true,
+ "bend_radius": "0.8 mm",
+ "k_factor": 0.44
+ }
+ },
+ {
+ "command": "sketch.create",
+ "params": {
+ "plane": "XY",
+ "name": "Blank"
+ }
+ },
+ {
+ "command": "sketch.line",
+ "params": {
+ "points": [
+ [
+ 0,
+ 0
+ ],
+ [
+ 100,
+ 0
+ ],
+ [
+ 100,
+ 100
+ ],
+ [
+ 60,
+ 100
+ ],
+ [
+ 60,
+ 90
+ ],
+ [
+ 45,
+ 90
+ ],
+ [
+ 45,
+ 60
+ ],
+ [
+ 60,
+ 60
+ ],
+ [
+ 60,
+ 50
+ ],
+ [
+ 0,
+ 50
+ ]
+ ],
+ "closed": true
+ }
+ },
+ {
+ "command": "sketch.finish",
+ "params": {}
+ },
+ {
+ "command": "sheet.flange",
+ "params": {
+ "type": "base",
+ "sketch": "Blank"
+ }
+ },
+ {
+ "command": "sheet.fold",
+ "params": {
+ "points": [
+ [
+ 59,
+ 60,
+ 0.8
+ ],
+ [
+ 59,
+ 90,
+ 0.8
+ ]
+ ],
+ "fixed": [
+ 40,
+ 30,
+ 0.8
+ ]
+ }
+ },
+ {
+ "command": "inspect.measure",
+ "params": {}
+ }
+ ]
+}
\ No newline at end of file
diff --git a/tests/kernel-cases/sheet-metal/685-fold-with-the-fixed-point-on-the-top-face/expected.json b/tests/kernel-cases/sheet-metal/685-fold-with-the-fixed-point-on-the-top-face/expected.json
new file mode 100644
index 0000000000..b40b1d137f
--- /dev/null
+++ b/tests/kernel-cases/sheet-metal/685-fold-with-the-fixed-point-on-the-top-face/expected.json
@@ -0,0 +1,10 @@
+{
+ "sources": [
+ "tangency-labs/solidcraft#958"
+ ],
+ "what": "a large thin blank folded across its whole width with the fixed point exactly on the sheet's top face",
+ "source": "analytic",
+ "method": "465 x 200 x 0.8 plate: V_flat = 74400 mm3; one fold of width 200 across it: a fold keeps the flat length of the blank, so a fold of angle th, inner radius R, thickness t and K-factor K over a width w takes a flat strip of BA = th(R+Kt) and puts a bend of volume th((R+t)^2-R^2)w/2 in its place: V = V_flat + th w t^2 (1/2 - K) (the bend's mid-surface lies at R+t/2, the neutral axis at R+Kt). V = 74400 + (pi/2)*200*0.64*0.06",
+ "body_count": 1,
+ "volume_mm3": 74412.06371578979
+}
\ No newline at end of file
diff --git a/tests/kernel-cases/sheet-metal/685-fold-with-the-fixed-point-on-the-top-face/recipe.json b/tests/kernel-cases/sheet-metal/685-fold-with-the-fixed-point-on-the-top-face/recipe.json
new file mode 100644
index 0000000000..c4ecc91f2f
--- /dev/null
+++ b/tests/kernel-cases/sheet-metal/685-fold-with-the-fixed-point-on-the-top-face/recipe.json
@@ -0,0 +1,71 @@
+{
+ "commands": [
+ {
+ "command": "sheet.manage_rules",
+ "params": {
+ "name": "Steel 0.8",
+ "thickness": "0.8 mm",
+ "active": true,
+ "bend_radius": "0.8 mm",
+ "k_factor": 0.44
+ }
+ },
+ {
+ "command": "sketch.create",
+ "params": {
+ "plane": "XY",
+ "name": "Base"
+ }
+ },
+ {
+ "command": "sketch.rectangle.two_point",
+ "params": {
+ "p0": [
+ 0,
+ 0
+ ],
+ "p1": [
+ 465,
+ 200
+ ]
+ }
+ },
+ {
+ "command": "sketch.finish",
+ "params": {}
+ },
+ {
+ "command": "sheet.flange",
+ "params": {
+ "type": "base",
+ "sketch": "Base"
+ }
+ },
+ {
+ "command": "sheet.fold",
+ "params": {
+ "points": [
+ [
+ 300,
+ 0,
+ 0.8
+ ],
+ [
+ 300,
+ 200,
+ 0.8
+ ]
+ ],
+ "fixed": [
+ 100,
+ 100,
+ 0.8
+ ]
+ }
+ },
+ {
+ "command": "inspect.measure",
+ "params": {}
+ }
+ ]
+}
\ No newline at end of file