Skip to content

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

Add the Fair Surface and Match Surface dialogs (#4644) (#4653)

raykholo06749ac464e1
diff --git a/assets/locales/pending/fair-match-surface.json b/assets/locales/pending/fair-match-surface.json
new file mode 100644
index 0000000000..d270385ce5
--- /dev/null
+++ b/assets/locales/pending/fair-match-surface.json
@@ -0,0 +1,90 @@
+{
+ "en": {
+ "Surface or face": "Surface or face",
+ "Surface or faces": "Surface or faces",
+ "Target edges": "Target edges",
+ "ui.fair_iterations": "Iterations",
+ "ui.fair_keep_edges": "Keep edges",
+ "ui.fair_strength": "Strength",
+ "ui.fair_surface_title": "FAIR SURFACE",
+ "ui.fair_tolerance_default": "0.001 of body size",
+ "ui.match_surface_title": "MATCH SURFACE"
+ },
+ "ja": {
+ "Surface or face": "サーフェスまたは面",
+ "Surface or faces": "サーフェスまたは面",
+ "Target edges": "ターゲットのエッジ",
+ "ui.fair_iterations": "反復回数",
+ "ui.fair_keep_edges": "エッジを保持",
+ "ui.fair_strength": "強度",
+ "ui.fair_surface_title": "サーフェスフェアリング",
+ "ui.fair_tolerance_default": "ボディサイズの 0.001 倍",
+ "ui.match_surface_title": "サーフェス一致"
+ },
+ "zh": {
+ "Surface or face": "曲面或面",
+ "Surface or faces": "曲面或面",
+ "Target edges": "目标边",
+ "ui.fair_iterations": "迭代次数",
+ "ui.fair_keep_edges": "保持边",
+ "ui.fair_strength": "强度",
+ "ui.fair_surface_title": "曲面光顺",
+ "ui.fair_tolerance_default": "实体尺寸的 0.001 倍",
+ "ui.match_surface_title": "曲面匹配"
+ },
+ "de": {
+ "Surface or face": "Flächenkörper oder Fläche",
+ "Surface or faces": "Flächenkörper oder Flächen",
+ "Target edges": "Zielkanten",
+ "ui.fair_iterations": "Iterationen",
+ "ui.fair_keep_edges": "Kanten behalten",
+ "ui.fair_strength": "Stärke",
+ "ui.fair_surface_title": "FLÄCHENBEGRADIGUNG",
+ "ui.fair_tolerance_default": "0,001 der Körpergröße",
+ "ui.match_surface_title": "FLÄCHENANPASSUNG"
+ },
+ "ko": {
+ "Surface or face": "곡면 또는 면",
+ "Surface or faces": "곡면 또는 면",
+ "Target edges": "대상 모서리",
+ "ui.fair_iterations": "반복 횟수",
+ "ui.fair_keep_edges": "모서리 유지",
+ "ui.fair_strength": "강도",
+ "ui.fair_surface_title": "서피스 페어링",
+ "ui.fair_tolerance_default": "바디 크기의 0.001배",
+ "ui.match_surface_title": "서피스 일치"
+ },
+ "ar": {
+ "Surface or face": "سطح أو وجه",
+ "Surface or faces": "سطح أو أوجه",
+ "Target edges": "الحواف المستهدفة",
+ "ui.fair_iterations": "عدد التكرارات",
+ "ui.fair_keep_edges": "الحفاظ على الحواف",
+ "ui.fair_strength": "شدة التنعيم",
+ "ui.fair_surface_title": "تنعيم السطح",
+ "ui.fair_tolerance_default": "0.001 من حجم الجسم",
+ "ui.match_surface_title": "مطابقة السطح"
+ },
+ "he": {
+ "Surface or face": "משטח או פאה",
+ "Surface or faces": "משטח או פאות",
+ "Target edges": "מקצועות יעד",
+ "ui.fair_iterations": "מספר איטרציות",
+ "ui.fair_keep_edges": "שמירה על המקצועות",
+ "ui.fair_strength": "עוצמה",
+ "ui.fair_surface_title": "החלקת משטח",
+ "ui.fair_tolerance_default": "0.001 מגודל הגוף",
+ "ui.match_surface_title": "התאמת משטח"
+ },
+ "vi": {
+ "Surface or face": "Bề mặt hoặc mặt",
+ "Surface or faces": "Bề mặt hoặc các mặt",
+ "Target edges": "Các cạnh đích",
+ "ui.fair_iterations": "Số lần lặp",
+ "ui.fair_keep_edges": "Giữ các cạnh",
+ "ui.fair_strength": "Cường độ",
+ "ui.fair_surface_title": "LÀM MƯỢT BỀ MẶT",
+ "ui.fair_tolerance_default": "0,001 lần kích thước thân khối",
+ "ui.match_surface_title": "KHỚP BỀ MẶT"
+ }
+}
diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs
index bf9cda0e85..168a5c0beb 100644
--- a/crates/ui-egui/src/dialogs.rs
+++ b/crates/ui-egui/src/dialogs.rs
@@ -6046,10 +6046,15 @@ fn stored_frames(s: &Session) -> Option<Vec<(String, solidcraft_engine::doc::Mat
/// The edge of a visible body through (or nearest) a point.
pub(crate) fn edge_sel(s: &Session, p0: Vec3) -> Option<Sel> {
+ edge_sel_on(s, None, p0)
+}
+
+/// [`edge_sel`], searching only the body called `only` when given (a pick saved on that body).
+pub(crate) fn edge_sel_on(s: &Session, only: Option<&str>, p0: Vec3) -> Option<Sel> {
let st = crate::open_meshing::session_world(s);
let frames = stored_frames(s);
let mut best: Option<(f64, Sel)> = None;
- for b in &st.bodies {
+ for b in st.bodies.iter().filter(|b| only.is_none_or(|n| b.name == n)) {
let p = stored_on(&frames, &b.name, p0);
let m = b.mesh();
for (i, e) in m.edges.iter().enumerate() {
@@ -6064,6 +6069,11 @@ pub(crate) fn edge_sel(s: &Session, p0: Vec3) -> Option<Sel> {
/// The body face containing a point (nearest triangle).
pub(crate) fn face_sel(s: &Session, p0: Vec3) -> Option<Sel> {
+ face_sel_on(s, None, p0)
+}
+
+/// [`face_sel`], searching only the body called `only` when given (a pick saved on that body).
+pub(crate) fn face_sel_on(s: &Session, only: Option<&str>, p0: Vec3) -> Option<Sel> {
use solidcraft_engine::kernel::{self, FaceSurface};
if !p0.is_finite() {
@@ -6072,7 +6082,7 @@ pub(crate) fn face_sel(s: &Session, p0: Vec3) -> Option<Sel> {
let st = crate::open_meshing::session_world(s);
let frames = stored_frames(s);
let mut best: Option<(f64, &solidcraft_engine::doc::ModelBody, usize, Vec3)> = None;
- for b in &st.bodies {
+ for b in st.bodies.iter().filter(|b| only.is_none_or(|n| b.name == n)) {
let p = stored_on(&frames, &b.name, p0);
let m = b.mesh();
for (t, f) in m.triangles.iter().zip(&m.tri_face) {
diff --git a/crates/ui-egui/src/dialogs_all_tests.rs b/crates/ui-egui/src/dialogs_all_tests.rs
index e2ca53e736..71610fc17c 100644
--- a/crates/ui-egui/src/dialogs_all_tests.rs
+++ b/crates/ui-egui/src/dialogs_all_tests.rs
@@ -153,6 +153,8 @@ fn representative(h: &Harness, command: &str) -> Dialog {
vec![Sel::Axis { name: axis.into() }]
} else if input.accept & (FACES | PLANAR_FACES) != 0 {
vec![face_sel(s, point).unwrap()]
+ } else if command == "surface.match" && index == 2 {
+ vec![edge_sel(s, Vec3::new(40.0, 0.0, 5.0)).unwrap()]
} else if input.accept & EDGES != 0 {
vec![edge_sel(s, Vec3::new(10.0, 0.0, 5.0)).unwrap()]
} else {
@@ -233,6 +235,7 @@ fn check_form(command: &str, labels: &[&str]) {
"solid.thread" => &["Modeled", "Automatic size"],
"solid.boundary_fill" => &["Remove Tools"],
"surface.offset" => &["Tangent chain"],
+ "surface.fair" => &["Keep edges"],
"surface.trim" => &["Extend to meet", "Stitch the kept pieces"],
"surface.ruled" => &["Flip"],
"surface.untrim" => &["Restore outer boundary", "In place (surfaces)"],
@@ -281,6 +284,7 @@ fn control_role(command: &str, label: &str) -> Option<egui::accesskit::Role> {
Some(match label {
"Type" if matches!(command, "sheet.flange" | "sheet.hem" | "solid.revolve" | "solid.emboss") => return None,
"Direction" => return None, // segmented buttons, labelled by each choice
+ "ui.fair_strength" | "ui.fair_iterations" => return None,
"Continuity" | "Corners" | "Cells" | "Profile" => return None,
"Operation" if command == "solid.mirror" => return None,
"Operation" | "Type" | "Orientation" | "Move Type" | "Object Type" | "Rule" | "Rim Edge" | "Catch Direction" | "Shape" | "Holes" | "Size"
@@ -515,6 +519,8 @@ form_case!(surface_reverse, "surface.reverse_normal", []);
form_case!(surface_offset, "surface.offset", ["Distance"]);
form_case!(surface_ruled, "surface.ruled", ["Distance", "Type", "Corners"]);
form_case!(surface_stitch, "surface.stitch", ["Tolerance"]);
+form_case!(surface_fair, "surface.fair", ["ui.fair_strength", "ui.fair_iterations", "Tolerance"]);
+form_case!(surface_match, "surface.match", ["Continuity"]);
form_case!(thicken, "surface.thicken", ["Thickness", "Direction", "Operation"]);
form_case!(surface_extend, "surface.extend", ["Distance"]);
form_case!(surface_trim, "surface.trim", []);
diff --git a/crates/ui-egui/src/dialogs_surface.rs b/crates/ui-egui/src/dialogs_surface.rs
index 939025d8f5..cdc393941b 100644
--- a/crates/ui-egui/src/dialogs_surface.rs
+++ b/crates/ui-egui/src/dialogs_surface.rs
@@ -1,6 +1,6 @@
//! Dialogs for the surface tools and face splitting (#19): Surface Extrude, Revolve, Sweep and
-//! Loft, Offset and Ruled Surface, Blend and Boundary Surface, Patch, Stitch, Thicken, Extend, Trim, Untrim
-//! and Split Face. Each has a live preview and Edit Feature.
+//! Loft, Offset and Ruled Surface, Blend and Boundary Surface, Patch, Stitch, Thicken, Extend, Trim, Untrim,
+//! Fair Surface, Match Surface and Split Face. Each has a live preview and Edit Feature.
use crate::dialogs::put;
use crate::ui_kit::{choice_row, expr_row, hint_row};
@@ -42,6 +42,17 @@ crate::dialog_descriptor::dialog_descriptors! {
FeatureKind::SurfaceExtend { distance, .. }) {
distance: String = "10 mm".into() => distance.to_string(),
} => json!({"distance": distance});
+ Fair("surface.fair", "ui.fair_surface_title", [("Surface or faces", BODIES | FACES, true)],
+ FeatureKind::SurfaceFair { strength, iterations, keep_edges, tolerance, .. }) {
+ strength: f64 = 1.0 => *strength,
+ iterations: u32 = 1 => *iterations,
+ keep_edges: bool = true => *keep_edges,
+ tolerance: String = String::new() => tolerance.to_string(),
+ } => json!({"strength": strength, "iterations": iterations, "keep_edges": keep_edges});
+ Match("surface.match", "ui.match_surface_title", [("Surface or face", BODIES | FACES, true), ("Target", BODIES | FACES, false), ("Target edges", EDGES, true)],
+ FeatureKind::SurfaceMatch { order, .. }) {
+ order: usize = 1 => MATCH_CONTINUITY.iter().position(|(_, word)| *word == order.as_str()).unwrap_or(1),
+ } => json!({"order": MATCH_CONTINUITY.get(*order).map_or("g2", |(_, word)| *word)});
; custom {
/// `direction`: an index into [`EXTRUDE_SIDES`].
Extrude {
@@ -162,6 +173,9 @@ fn boundary_orders() -> Vec<Continuity> {
Construction::Network.offered()
}
+/// The continuity of a surface matched to its target's edge chain.
+const MATCH_CONTINUITY: [(&str, &str); 3] = [("Tangent (G1)", "g1"), ("Curvature (G2)", "g2"), ("Curvature change (G3)", "g3")];
+
/// What a boundary surface becomes: a body of its own, or part of the body of its edges.
const BOUNDARY_OPS: [&str; 2] = ["New Body", "Join"];
@@ -241,6 +255,19 @@ pub fn start(app: &SolveApp, id: &str) -> Option<(Kind, Vec<SelInput>)> {
pub fn rows(ui: &mut egui::Ui, k: &mut Surf) -> bool {
let mut enter = false;
match k {
+ Surf::Fair { strength, iterations, keep_edges, tolerance } => {
+ form_row(ui, "ui.fair_strength", |ui| {
+ ui_kit::scalar_field(ui, strength, f64::MIN_POSITIVE..=1.0);
+ });
+ form_row(ui, "ui.fair_iterations", |ui| {
+ ui_kit::number_field(ui, iterations, 1..=1000, 1.0, "");
+ });
+ enter |= hint_row(ui, "Tolerance", tolerance, crate::i18n::tr_label("ui.fair_tolerance_default"));
+ ui_kit::options(ui, "fair_options", &mut [("ui.fair_keep_edges", keep_edges)]);
+ }
+ Surf::Match { order } => {
+ choice_row(ui, "Continuity", "match_order", order, &MATCH_CONTINUITY.map(|(label, _)| label));
+ }
Surf::Stitch { tolerance } => {
enter |= hint_row(ui, "Tolerance", tolerance, crate::i18n::tr("ui.stitch_tolerance_hint"));
}
@@ -691,6 +718,24 @@ pub fn commands(app: &SolveApp, k: &Surf, inputs: &[SelInput], extra: &Map<Strin
}
("surface.ruled", p)
}
+ Surf::Fair { tolerance, .. } => {
+ let (body, faces) = body_and_faces(items(inputs, 0))?;
+ let mut p = json!({"body": body, "faces": faces});
+ put(&mut p, &[("tolerance", tolerance)]);
+ ("surface.fair", p)
+ }
+ Surf::Match { .. } => {
+ let (body, faces) = body_and_faces(items(inputs, 0))?;
+ if items(inputs, 1).len() != 1 {
+ return Err("select the target body first".into());
+ }
+ let (target, _) = body_and_faces(items(inputs, 1))?;
+ let (edge_body, edges) = body_and_edges(items(inputs, 2))?;
+ if edge_body != target {
+ return Err("pick edges of the target body".into());
+ }
+ ("surface.match", json!({"body": body, "faces": faces, "target": target, "edges": edges}))
+ }
Surf::Unstitch | Surf::ReverseNormal => {
need(0, "a body or some of its faces")?;
let (body, faces) = body_and_faces(items(inputs, 0))?;
@@ -1002,6 +1047,20 @@ pub fn for_feature(app: &SolveApp, kind: &FeatureKind, frame: &Mat) -> Option<(K
}
return Some((Kind::Surface(k), ins, extra));
}
+ FeatureKind::SurfaceFair { body, faces, .. } | FeatureKind::SurfaceMatch { body, faces, .. } => {
+ let source = if faces.is_empty() {
+ vec![Sel::Body { name: body.to_string() }]
+ } else {
+ // Every saved face must come back on its body: a partial set would redefine the feature.
+ faces.iter().map(|p| crate::dialogs::face_sel_on(s, Some(body.as_ref()), p.0)).collect::<Option<Vec<_>>>()?
+ };
+ let mut fill = vec![source];
+ if let FeatureKind::SurfaceMatch { target, edges, .. } = kind {
+ fill.push(vec![Sel::Body { name: target.to_string() }]);
+ fill.push(edges.iter().map(|p| crate::dialogs::edge_sel_on(s, Some(target.as_ref()), p.0)).collect::<Option<Vec<_>>>()?);
+ }
+ (Surf::simple_restore(kind)?, fill)
+ }
FeatureKind::Unstitch { body, faces } | FeatureKind::ReverseNormal { body, faces } => {
let sels: Vec<Sel> = if faces.is_empty() {
vec![Sel::Body { name: body.to_string() }]
diff --git a/crates/ui-egui/src/length_input.rs b/crates/ui-egui/src/length_input.rs
index 7eb6e380ba..82faba95a6 100644
--- a/crates/ui-egui/src/length_input.rs
+++ b/crates/ui-egui/src/length_input.rs
@@ -127,7 +127,7 @@ pub(crate) fn fields<'a>(doc: &Document, kind: &'a mut crate::dialogs::Kind) ->
vec![distance]
}
Surf::Thicken { thickness, .. } => vec![thickness],
- Surf::Stitch { tolerance } => vec![tolerance],
+ Surf::Stitch { tolerance } | Surf::Fair { tolerance, .. } => vec![tolerance],
_ => vec![],
},
D::Sheet(k) => match k {
diff --git a/crates/ui-egui/src/preselect_tests.rs b/crates/ui-egui/src/preselect_tests.rs
index 2c8c11808d..7553eff104 100644
--- a/crates/ui-egui/src/preselect_tests.rs
+++ b/crates/ui-egui/src/preselect_tests.rs
@@ -2101,6 +2101,141 @@ fn surface_dialogs_make_their_commands() {
assert!((v - 30.0 * 20.0 * 2.0).abs() < 1.0, "{v}");
}
+#[test]
+fn fair_surface_dialog_defaults_picks_and_edit_values() {
+ use solidcraft_engine::doc::{BodyName, FeatureKind, IDENTITY};
+ let mut app = app_with(json!([]));
+ let mut d = start(&mut app, vec![Sel::Body { name: "Sheet".into() }], "surface.fair");
+ assert_eq!(d.inputs.len(), 1);
+ assert_eq!(d.inputs[0].accept, crate::selection::BODIES | crate::selection::FACES);
+ let (id, p) = apply_commands(&app, &d).unwrap().remove(0);
+ assert_eq!(id, "surface.fair");
+ assert_eq!(p, json!({"body":"Sheet", "faces":[], "strength":1.0, "iterations":1, "keep_edges":true}));
+ d.inputs[0].items = vec![Sel::Face { body: "Sheet".into(), index: 0, point: Vec3::new(1.0, 2.0, 3.0) }];
+ assert_eq!(apply_commands(&app, &d).unwrap()[0].1["faces"], json!([[1.0, 2.0, 3.0]]));
+ d.inputs[0].items.push(Sel::Body { name: "Other".into() });
+ assert!(apply_commands(&app, &d).is_err());
+ d.inputs[0].items.clear();
+ assert!(apply_commands(&app, &d).is_err());
+
+ let feature = FeatureKind::SurfaceFair {
+ body: BodyName::from("Sheet"),
+ faces: vec![],
+ strength: 0.4,
+ iterations: 7,
+ keep_edges: false,
+ tolerance: "0.2 mm".into(),
+ };
+ let (kind, inputs, extra) = crate::dialogs_surface::for_feature(&app, &feature, &IDENTITY).unwrap();
+ let cmds = if let Kind::Surface(k) = kind {
+ crate::dialogs_surface::commands(&app, &k, &inputs, &extra).unwrap()
+ } else {
+ panic!("expected a surface dialog")
+ };
+ assert_eq!(cmds[0].1, json!({"body":"Sheet", "faces":[], "strength":0.4, "iterations":7, "keep_edges":false, "tolerance":"0.2 mm"}));
+}
+
+#[test]
+fn match_surface_dialog_defaults_picks_and_edit_values() {
+ use solidcraft_engine::doc::kernel::Continuity;
+ use solidcraft_engine::doc::{BodyName, FeatureKind, IDENTITY, Position};
+ let mut app = app_with(json!([{"command":"solid.box", "params":{"length":10,"width":10,"height":10,"body_name":"Target"}}]));
+ let mut d = start(&mut app, vec![Sel::Body { name: "Sheet".into() }], "surface.match");
+ assert_eq!(d.inputs.len(), 3);
+ assert_eq!(d.inputs[0].accept, crate::selection::BODIES | crate::selection::FACES);
+ assert_eq!(d.inputs[1].accept, crate::selection::BODIES | crate::selection::FACES);
+ assert_eq!(d.inputs[2].accept, crate::selection::EDGES);
+ assert!(apply_commands(&app, &d).is_err());
+ d.inputs[1].items = vec![Sel::Body { name: "Target".into() }];
+ assert!(apply_commands(&app, &d).is_err());
+ let point = Vec3::new(5.0, 0.0, 0.0);
+ d.inputs[2].items = vec![crate::dialogs::edge_sel(&app.session, point).unwrap()];
+ let (id, p) = apply_commands(&app, &d).unwrap().remove(0);
+ assert_eq!(id, "surface.match");
+ assert_eq!(p, json!({"body":"Sheet", "faces":[], "target":"Target", "edges":[[5.0,0.0,0.0]], "order":"g2"}));
+ d.inputs[0].items = vec![Sel::Face { body: "Sheet".into(), index: 0, point: Vec3::new(1.0, 2.0, 3.0) }];
+ assert_eq!(apply_commands(&app, &d).unwrap()[0].1["faces"], json!([[1.0, 2.0, 3.0]]));
+ d.inputs[1].items = vec![Sel::Face { body: "Target".into(), index: 0, point: Vec3::new(5.0, 5.0, 10.0) }];
+ assert_eq!(apply_commands(&app, &d).unwrap()[0].1["target"], json!("Target"));
+ d.inputs[1].items = vec![Sel::Body { name: "Other".into() }];
+ assert!(apply_commands(&app, &d).is_err());
+
+ let face = Sel::Face { body: "Sheet".into(), index: 0, point: Vec3::new(1.0, 2.0, 3.0) };
+ let preselected = start(&mut app, vec![face.clone()], "surface.match");
+ assert_eq!(preselected.inputs[0].items, vec![face]);
+ assert!(preselected.inputs[1].items.is_empty());
+
+ let feature = FeatureKind::SurfaceMatch {
+ body: BodyName::from("Sheet"),
+ faces: vec![],
+ target: BodyName::from("Target"),
+ edges: vec![Position(point)],
+ order: Continuity::G3,
+ };
+ let (kind, inputs, extra) = crate::dialogs_surface::for_feature(&app, &feature, &IDENTITY).unwrap();
+ let cmds = if let Kind::Surface(k) = kind {
+ crate::dialogs_surface::commands(&app, &k, &inputs, &extra).unwrap()
+ } else {
+ panic!("expected a surface dialog")
+ };
+ assert_eq!(cmds[0].1, json!({"body":"Sheet", "faces":[], "target":"Target", "edges":[[5.0,0.0,0.0]], "order":"g3"}));
+}
+
+/// A Fair tolerance is a length: a bare value follows the design unit on OK, like Stitch's.
+#[test]
+fn fair_surface_tolerance_is_a_length_in_the_design_unit() {
+ let mut app = app_with(json!([]));
+ app.session.execute("document.units", &json!({"units":"in"})).unwrap();
+ let mut d = start(&mut app, vec![Sel::Body { name: "Sheet".into() }], "surface.fair");
+ if let Kind::Surface(crate::dialogs_surface::Surf::Fair { tolerance, .. }) = &mut d.kind {
+ *tolerance = "0.1".into();
+ } else {
+ panic!("expected the Fair dialog");
+ }
+ let (_, p) = apply_commands(&app, &d).unwrap().remove(0);
+ let sent = p["tolerance"].as_str().unwrap_or_default();
+ let mm = app.session.doc.eval(sent, ValueKind::Length).unwrap();
+ assert!((mm - 2.54).abs() < 1e-9, "{sent} -> {mm}");
+ // Refilling an edit goes through the same length fields.
+ let mut k = d.kind.clone();
+ assert_eq!(crate::length_input::fields(&app.session.doc, &mut k).len(), 1);
+}
+
+/// Edit Feature restores a Fair or Match pick on the body it was saved on, even when another
+/// body has geometry at the same point (here the seam the two boxes share).
+#[test]
+fn fair_and_match_picks_reopen_on_their_saved_bodies() {
+ use solidcraft_engine::doc::kernel::Continuity;
+ use solidcraft_engine::doc::{BodyName, FacePick, FeatureKind, IDENTITY, Position};
+ let app = app_with(json!([
+ {"command":"solid.box", "params":{"corner":[0,0,0],"length":10,"width":10,"height":10,"body_name":"Src"}},
+ {"command":"solid.box", "params":{"corner":[10,0,0],"length":10,"width":10,"height":10,"body_name":"Target","operation":"new"}}
+ ]));
+ // The shared wall is x = 10 and the shared edge runs along it at y = 0.
+ let wall = FacePick(Vec3::new(10.0, 5.0, 5.0));
+ let edge = Position(Vec3::new(10.0, 0.0, 5.0));
+ let fair = FeatureKind::SurfaceFair {
+ body: BodyName::from("Target"),
+ faces: vec![wall],
+ strength: 1.0,
+ iterations: 1,
+ keep_edges: true,
+ tolerance: String::new().into(),
+ };
+ let (_, inputs, _) = crate::dialogs_surface::for_feature(&app, &fair, &IDENTITY).unwrap();
+ assert!(matches!(inputs[0].items.as_slice(), [Sel::Face { body, .. }] if body == "Target"), "{:?}", inputs[0].items);
+ let matched = FeatureKind::SurfaceMatch {
+ body: BodyName::from("Target"),
+ faces: vec![wall],
+ target: BodyName::from("Target"),
+ edges: vec![edge],
+ order: Continuity::G2,
+ };
+ let (_, inputs, _) = crate::dialogs_surface::for_feature(&app, &matched, &IDENTITY).unwrap();
+ assert!(matches!(inputs[0].items.as_slice(), [Sel::Face { body, .. }] if body == "Target"), "{:?}", inputs[0].items);
+ assert!(matches!(inputs[2].items.as_slice(), [Sel::Edge { body, .. }] if body == "Target"), "{:?}", inputs[2].items);
+}
+
#[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
diff --git a/crates/ui-egui/src/toolbar.rs b/crates/ui-egui/src/toolbar.rs
index b627e76eef..71a5a8cc28 100644
--- a/crates/ui-egui/src/toolbar.rs
+++ b/crates/ui-egui/src/toolbar.rs
@@ -5932,8 +5932,7 @@ mod command_start_tab_tests {
"edit.restore_checkpoint",
"parameters.move",
"library.inspect",
- "surface.fair",
- "surface.match",
+ // surface.fair and surface.match open their dialogs (#4644), so they start something.
"sheet.export_bend_table",
] {
let mut h = on_model_with_a_box();