Surface Extrude: sheets from open curves and profile walls (#815)
surface.extrude sweeps open curve chains and profile boundaries along the sketch normal into a surface body (walls only, no caps). Saved under format 17. Refs #757 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8dd583930e
commit
e540832626
17 files changed
+493
-79
No files matched your search
@@ -800,6 +800,35 @@ fn surface_dialogs_make_their_commands() {
|
||||
assert!((v - 30.0 * 20.0 * 2.0).abs() < 1.0, "{v}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn surface_extrude_dialog_takes_profiles_and_curves() {
|
||||
// A rectangle and a free line in one sketch: the dialog sends both (the profile's walls
|
||||
// and the line's wall) as one surface extrude, and Edit Feature brings the picks back.
|
||||
let mut app = app_with(json!([
|
||||
{"command": "sketch.create", "params": {"plane": "XY"}},
|
||||
{"command": "sketch.rectangle.two_point", "params": {"p0": [0, 0], "p1": [30, 20]}},
|
||||
{"command": "sketch.line", "params": {"points": [[40, 0], [50, 0]], "ids": ["free"]}},
|
||||
{"command": "sketch.finish", "params": {}}
|
||||
]));
|
||||
let sk = app.session.doc.features.last().unwrap().id;
|
||||
let mut d = start(&mut app, vec![], "surface.extrude");
|
||||
d.inputs[0].items = vec![Sel::Profile { sketch: sk, index: 0 }, Sel::SketchCurve { id: "free".into() }];
|
||||
let (id, p) = apply_commands(&app, &d).unwrap().remove(0);
|
||||
assert_eq!(id, "surface.extrude");
|
||||
assert_eq!(p["curves"], json!(["free"]), "{p}");
|
||||
assert_eq!(p["profiles"], json!([0]), "{p}");
|
||||
app.session.execute(&id, &p).unwrap();
|
||||
let st = app.session.model.state();
|
||||
let sheet = st.bodies.last().unwrap();
|
||||
assert!(sheet.body.is_surface() && sheet.body.face_count() == 5);
|
||||
let area = sheet.mesh().measure().area;
|
||||
assert!((area - (100.0 + 10.0) * 10.0).abs() < 1e-6, "{area}");
|
||||
let fid = app.session.doc.features.last().unwrap().id;
|
||||
let back = crate::dialogs::for_feature(&app, fid, None).unwrap();
|
||||
assert!(matches!(back.kind, Kind::Surface(_)));
|
||||
assert_eq!(back.inputs[0].items.len(), 2);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn patch_dialog_fills_a_loop_of_edges_that_is_not_planar() {
|
||||
// A box with its top cut away by a sideways cylinder: its rim is a closed loop of four
|
||||
|
||||
Reference in new issue
Block a user