Sheet metal: tear as a fourth corner relief shape (#809)
A sheet metal rule's corner relief shape can now be tear; saved under format 17 with a note. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
bfbf5f9432
commit
dd084ec9e1
11 files changed
+751
-56
No files matched your search
@@ -33,8 +33,8 @@ const RULE_FIELDS: [(&str, &str); 8] = [
|
||||
("gap", "Flange Gap"),
|
||||
];
|
||||
/// The corner relief shapes the manager offers (the rule's `corner_relief_shape`) and their labels.
|
||||
const RELIEF_SHAPES: [&str; 3] = ["notch", "round", "rectangular"];
|
||||
const RELIEF_SHAPE_LABELS: [&str; 3] = ["Notch", "Round", "Rectangular"];
|
||||
const RELIEF_SHAPES: [&str; 4] = ["notch", "round", "rectangular", "tear"];
|
||||
const RELIEF_SHAPE_LABELS: [&str; 4] = ["Notch", "Round", "Rectangular", "Tear"];
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub enum Sm {
|
||||
|
||||
@@ -350,6 +350,15 @@ fn rules_dialog_picks_the_corner_relief_shape() {
|
||||
h.step(&json!({"start": "sheet.manage_rules"})).unwrap();
|
||||
h.frames(3);
|
||||
assert_eq!(shown(&h.app), Some(1), "the dialog shows the rule's shape");
|
||||
// The tear: no relief in the base, both ends of all four bends torn.
|
||||
h.step(&json!({"click": {"handle": "dialog:Corner Relief Shape"}})).unwrap();
|
||||
h.step(&json!({"click": {"handle": "dialog:Corner Relief Shape:Tear"}})).unwrap();
|
||||
assert_eq!(shown(&h.app), Some(3));
|
||||
h.step(&json!({"widget": "OK"})).unwrap();
|
||||
assert!(h.app.dialog.is_none(), "{:?}", h.app.dialog);
|
||||
assert_eq!(h.app.session.doc.sheet_rule(None).corner_relief_shape, "tear");
|
||||
let torn = h.app.session.model.state().sheets.last().map(|s| s.flanges.iter().filter(|f| f.tear == (true, true)).count());
|
||||
assert_eq!((rounds(&h.app), torn), (Some(0), Some(4)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[
|
||||
{
|
||||
"note": "Sheet Metal Rules: the Corner Relief Shape row sets the rule's corner_relief_shape, and the tray made with the rule follows. The bend on the 120 mm edge is 120 - 2*s0 long (s0 = 3*tan 36 deg) and 8 mm shorter with a relief 8 mm across at both its ends."
|
||||
"note": "Sheet Metal Rules: the Corner Relief Shape row sets the rule's corner_relief_shape, and the tray made with the rule follows. The bend on the 120 mm edge is 120 - 2*s0 long (s0 = 3*tan 36 deg) and 8 mm shorter with a relief 8 mm across at both its ends. Torn, its centre line is sin 72 deg - 0.5/sqrt 2 longer: each end runs half that past the corner, toward its flange's closed end."
|
||||
},
|
||||
{
|
||||
"call": "ui.set",
|
||||
@@ -213,5 +213,53 @@
|
||||
},
|
||||
{
|
||||
"shot": "s51_rectangular_reliefs"
|
||||
},
|
||||
{
|
||||
"start": "sheet.manage_rules"
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"handle": "dialog:Corner Relief Shape"
|
||||
}
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"handle": "dialog:Corner Relief Shape:Tear"
|
||||
}
|
||||
},
|
||||
{
|
||||
"widget": "OK"
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"dialog": null,
|
||||
"errors": 0,
|
||||
"query": {
|
||||
"command": "sheet.rules",
|
||||
"path": [
|
||||
"rules",
|
||||
0,
|
||||
"rule",
|
||||
"corner_relief_shape"
|
||||
],
|
||||
"value": "tear"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"query": {
|
||||
"command": "sheet.flat_pattern",
|
||||
"path": [
|
||||
"bends",
|
||||
0,
|
||||
"length"
|
||||
],
|
||||
"value": 116.238247958
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"shot": "s51_torn_corners"
|
||||
}
|
||||
]
|
||||
Reference in new issue
Block a user