Preview angled construction planes (#5697)

* Preview planes at an angle

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Plane at Angle: test the preview when an existing plane is edited

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* ui: include ghost setting in plane preview test

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* test: close angle plane regression test block

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Frank
2026-10-25 10:04:57 +00:00
committed by GitHub
parent bbc3aa4301
commit e4f11c8df6
2 changed files with 45 additions and 0 deletions
+24
View File
@@ -1035,6 +1035,7 @@ impl Dialog {
| Kind::PatternCirc { .. }
| Kind::Loft { .. }
| Kind::Sweep { .. }
| Kind::AnglePlane { .. }
| Kind::PathPlane { .. }
| Kind::Midplane
| Kind::Construct { .. }
@@ -5413,6 +5414,29 @@ mod refused_ok_tests {
}
}
#[test]
fn selected_plane_axis_and_angle_build_a_preview() {
let app = SolveApp::new(Session::default(), Default::default());
let mut dialog = Dialog::for_command(&app, "construct.plane.at_angle").expect("the command has a dialog");
dialog.inputs[0].items = vec![Sel::Plane { name: "XY".into() }];
dialog.inputs[1].items = vec![Sel::Axis { name: "X".into() }];
if let Kind::AnglePlane { angle } = &mut dialog.kind {
*angle = "30 deg".into();
}
assert!(dialog.previews());
let commands = preview_commands(&app, &dialog).expect("the selected inputs form a command");
assert_eq!(commands.first().map(|(_, params)| params["angle"].as_str()), Some(Some("30 deg")));
let preview = crate::preview::compute(
&app.session,
&commands,
crate::preview::Colors { body: [1; 4], added: [2; 4], new_body: [3; 4], removed: [4; 4], edge: [5; 4], ghost: false },
)
.expect("the angled plane previews");
assert!(!preview.scene.xray.is_empty(), "the preview contains the translucent construction plane");
}
/// A box, and a hole dialog with a position picked on its top.
fn hole_dialog() -> Harness {
let mut h = Harness::new();
+21
View File
@@ -2155,6 +2155,27 @@ fn offset_plane_through_a_picked_vertex() {
assert!(matches!(reopened.inputs[1].items.as_slice(), [Sel::Vertex { body, .. }] if body == "Box"), "{:?}", reopened.inputs[1].items);
}
/// Plane at Angle draws the tilted plane while its dialog is open, when created and when edited,
/// and redraws it when the angle changes (it used to show only the picked plane and the label).
#[test]
fn plane_at_angle_previews_the_tilted_plane_when_edited() {
let mut h = crate::scenario::Harness::new();
h.app.home.open = false;
let id = h.app.run("construct.plane.at_angle", json!({"base":"XY","axis":"Y","angle":"45 deg"})).unwrap()["feature"].as_u64().unwrap();
h.app.edit_feature(id);
h.frames(2);
let d = h.app.dialog.as_ref().unwrap();
assert!(matches!(d.kind, Kind::AnglePlane { .. }) && d.editing.is_some(), "{d:?}");
assert!(d.previews(), "the edited plane is previewed");
wait_feature_preview(&mut h);
let first = h.app.preview.key;
if let Kind::AnglePlane { angle } = &mut h.app.dialog.as_mut().unwrap().kind {
*angle = "30 deg".into();
}
wait_feature_preview(&mut h);
assert_ne!(h.app.preview.key, first, "a new angle redraws the preview");
}
/// #2474, #2494: every construct tool asks for what it needs. Started from the toolbar with
/// nothing selected, none of them runs its command and reports that `a` (or `face`, `edge`…)
/// is required; a construct command added later without a dialog fails here too.