Skip to content

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

Press Pull on a chamfer or fillet face edits it where you clicked (#4986) (#9771)

Daniel958ab867cd5d
diff --git a/crates/engine/src/cmd/features.rs b/crates/engine/src/cmd/features.rs
index 9a38d94a29..18be03cd04 100644
--- a/crates/engine/src/cmd/features.rs
+++ b/crates/engine/src/cmd/features.rs
@@ -1591,8 +1591,8 @@ pub(crate) fn edge_ref_form(e: &Value) -> std::result::Result<EdgeRefForm<'_>, &
Ok(EdgeRefForm::Index { body, index })
}
-/// Press Pull: a face moves along its normal (an extrude that joins outward or cuts inward); an
-/// edge is rounded (a fillet).
+/// Press Pull: a face moves along its normal (an extrude that joins outward or cuts inward); a
+/// fillet's or chamfer's face changes that feature's size; an edge is rounded (a fillet).
fn press_pull(s: &mut Session, p: &Value) -> Result<Value> {
let cmd = "solid.press_pull";
let distance = req_expr(cmd, p, "distance")?;
@@ -1604,10 +1604,9 @@ fn press_pull(s: &mut Session, p: &Value) -> Result<Value> {
if d.abs() < 1e-9 {
return Err(bad(cmd, "the distance must not be zero"));
}
- // A fillet's or chamfer's face: its size changes by the distance (the feature is edited).
- if let Some(fp) = vec3(face)
- && super::face::face_is_planar(s, fp) == Some(false)
- {
+ // A fillet's or chamfer's face: its size changes by the distance (the feature is edited). A
+ // chamfer's face is flat, so this is asked before whether the face is planar (#4986).
+ if let Some(fp) = vec3(face) {
let name = solidcraft_doc::naming::face_names_at(&s.model.state(), &[fp]).into_iter().next().unwrap_or_default();
let fid = solidcraft_doc::persistent_name::made_by(&name);
if solidcraft_doc::persistent_name::is_blend(&name) {
@@ -1625,8 +1624,10 @@ fn press_pull(s: &mut Session, p: &Value) -> Result<Value> {
return Ok(json!({"feature": f.id, "edited": f.name, key: new, "recomputed": out.get("recomputed"), "restored": out.get("restored")}));
}
// Another curved face moves along its normal.
- let r = super::find_command("solid.offset_face").ok_or_else(|| bad(cmd, "solid.offset_face"))?;
- return (r.run)(s, &json!({"faces": [face], "distance": distance}));
+ if super::face::face_is_planar(s, fp) == Some(false) {
+ let r = super::find_command("solid.offset_face").ok_or_else(|| bad(cmd, "solid.offset_face"))?;
+ return (r.run)(s, &json!({"faces": [face], "distance": distance}));
+ }
}
// Pushed in: the extrude cuts the other way by as much (a bare number stays one, so it keeps
// being read as a bare number typed into the extrude).
diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs
index e2dfd5e392..a4cbe1bd90 100644
--- a/crates/engine/src/tests.rs
+++ b/crates/engine/src/tests.rs
@@ -2878,6 +2878,60 @@ fn press_pull_on_curved_faces() {
assert!(err.contains("offset"), "{err}");
}
+/// #4986: Press Pull on a chamfer's flat face changes the chamfer's distance, as on a fillet's
+/// face it changes the radius, rather than extruding the face.
+#[test]
+fn press_pull_on_a_chamfer_face_edits_the_chamfer() {
+ let mut s = Session::default();
+ run(&mut s, "solid.box", json!({"length": 40, "width": 30, "height": 20}));
+ run(&mut s, "solid.chamfer", json!({"edges": [[40, 0, 10]], "distance": 3, "name": "Bevel"}));
+ let cut = |d: f64| d * d / 2.0 * 20.0;
+ assert!(rel(volume(&mut s), 24000.0 - cut(3.0)) < 1e-6);
+ // The chamfer's face runs from (37, 0) to (40, 3); its middle.
+ let out = run(&mut s, "solid.press_pull", json!({"face": [38.5, 1.5, 10], "distance": 2}));
+ assert_eq!(out["edited"], "Bevel", "{out}");
+ assert_eq!(s.doc.features.len(), 2, "no extrude added");
+ assert!(rel(volume(&mut s), 24000.0 - cut(5.0)) < 1e-6, "{}", volume(&mut s));
+ // A point on the flat front face 0.02 mm from its edge with the chamfer (which now runs from
+ // (35, 0) to (40, 5)) is the front face's: it is extruded, the chamfer is left alone.
+ let mut t = Session::default();
+ run(&mut t, "solid.box", json!({"length": 40, "width": 30, "height": 20}));
+ run(&mut t, "solid.chamfer", json!({"edges": [[40, 0, 10]], "distance": 3, "name": "Bevel"}));
+ let out = run(&mut t, "solid.press_pull", json!({"face": [36.98, 0, 10], "distance": 1}));
+ assert!(out.get("edited").is_none(), "{out}");
+ assert!(matches!(t.doc.features.last().map(|f| &f.kind), Some(solidcraft_doc::FeatureKind::Extrude { .. })), "an extrude added: {out}");
+ assert!(
+ matches!(&t.doc.features[1].kind, solidcraft_doc::FeatureKind::Chamfer { distance, .. } if distance == "3"),
+ "{:?}",
+ t.doc.features[1].kind
+ );
+ // Too far in (past zero) or too far out: an error, the chamfer as it was.
+ let on = [39.0, 1.0, 10.0];
+ for d in [-10.0, 1e9] {
+ assert!(s.execute("solid.press_pull", &json!({"face": on, "distance": d})).is_err(), "{d}");
+ assert!(rel(volume(&mut s), 24000.0 - cut(5.0)) < 1e-6, "{d}: {}", volume(&mut s));
+ }
+ // An unequal chamfer's first distance changes and its second stays; an angle chamfer keeps
+ // its angle.
+ // Each chamfer's face crosses the corner's bisector at legs a, b: (40 - u, u), u = ab / (a + b).
+ let tan30 = (PI / 6.0).tan();
+ for (extra, u) in [(json!({"distance2": 4}), 8.0 / 6.0), (json!({"angle": "30 deg"}), 2.0 * tan30 / (1.0 + tan30))] {
+ let mut s = Session::default();
+ run(&mut s, "solid.box", json!({"length": 40, "width": 30, "height": 20}));
+ let mut p = json!({"edges": [[40, 0, 10]], "distance": 2, "name": "Bevel"});
+ p.as_object_mut().unwrap().extend(extra.as_object().unwrap().clone());
+ run(&mut s, "solid.chamfer", p);
+ let v0 = volume(&mut s);
+ let out = run(&mut s, "solid.press_pull", json!({"face": [40.0 - u, u, 10.0], "distance": 1}));
+ assert_eq!(out["edited"], "Bevel", "{extra}: {out}");
+ assert_eq!(s.doc.features.len(), 2, "{extra}");
+ let Some(solidcraft_doc::FeatureKind::Chamfer { distance2, angle, .. }) = s.doc.features.last().map(|f| &f.kind) else { panic!("{extra}") };
+ assert_eq!(distance2.as_ref().map(|e| e.to_string()), extra.get("distance2").map(|v| v.to_string()), "{extra}");
+ assert_eq!(angle.as_ref().map(|e| e.to_string()), extra.get("angle").and_then(|v| v.as_str()).map(str::to_string), "{extra}");
+ assert!(volume(&mut s) < v0 - 1.0, "{extra}: a bigger chamfer cuts more");
+ }
+}
+
/// A cut in one component leaves other components' bodies alone unless they are named as
/// participants; auto join/cut looks at the active component only.
#[test]
diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs
index 760a23dce2..8e284097e0 100644
--- a/crates/ui-egui/src/canvas.rs
+++ b/crates/ui-egui/src/canvas.rs
@@ -20,7 +20,7 @@ use crate::viewport::{Proj, projected_polygon};
/// direction a growing value points.
pub fn anchor(app: &SolveApp, d: &Dialog) -> Option<(Vec3, Option<Vec3>)> {
let st = app.session.world_state();
- let first = d.inputs.first()?.items.first()?;
+ let first = &anchor_item(app, d)?;
let (at, normal) = match first {
Sel::Profile { sketch, index } => {
let ss = st.sketch(*sketch)?;
@@ -250,12 +250,44 @@ pub(crate) fn blend_grow_dir(m: &Mesh, index: usize, p: Vec3) -> Option<Vec3> {
Some(if edge_concave(m, index, p).unwrap_or(false) { n } else { -n })
}
+/// The pick the dialog's arrow sits on: the first, or for a fillet or chamfer reopened from a
+/// click on one of its faces (Press Pull), its edge nearest the click, at the point on it nearest
+/// the click (#4986).
+fn anchor_item(app: &SolveApp, d: &Dialog) -> Option<Sel> {
+ let items = &d.inputs.first()?.items;
+ let first = items.first()?.clone();
+ let (Some(hint), Kind::Fillet { .. }) = (d.anchor_hint, &d.kind) else { return Some(first) };
+ let st = app.session.world_state();
+ let nearest = items
+ .iter()
+ .filter_map(|s| {
+ let Sel::Edge { body, index, .. } = s else { return None };
+ let at = nearest_on_polyline(st.body(body)?.mesh().edges.get(*index)?, hint)?;
+ Some((at.dist(hint), Sel::Edge { body: body.clone(), index: *index, point: at }))
+ })
+ .min_by(|a, b| a.0.total_cmp(&b.0));
+ Some(nearest.map_or(first, |(_, s)| s))
+}
+
+/// The point of the polyline `pts` nearest `p`.
+fn nearest_on_polyline(pts: &[Vec3], p: Vec3) -> Option<Vec3> {
+ let on = |a: Vec3, b: Vec3| {
+ let ab = b - a;
+ let len2 = ab.dot(ab);
+ a + ab * if len2 > 0.0 { ((p - a).dot(ab) / len2).clamp(0.0, 1.0) } else { 0.0 }
+ };
+ pts.windows(2)
+ .filter_map(|w| if let [a, b] = w { Some(on(*a, *b)) } else { None })
+ .min_by(|x, y| x.dist(p).total_cmp(&y.dist(p)))
+ .or_else(|| pts.first().copied())
+}
+
/// The directions Distance 1 and Distance 2 of a chamfer of two distances run from its edge at
/// `at`: along the face that faces up most, or the other one with Flip, and along the remaining
/// face (the kernel's `chamfer_tool_sides` picks them the same way). None for any other dialog.
pub(crate) fn chamfer_face_dirs(app: &SolveApp, d: &Dialog, at: Vec3) -> Option<(Vec3, Vec3)> {
let Kind::Fillet { chamfer: true, ctype: 1, flip, .. } = &d.kind else { return None };
- let Some(Sel::Edge { body, index, .. }) = d.inputs.first()?.items.first() else { return None };
+ let Some(Sel::Edge { body, index, .. }) = &anchor_item(app, d) else { return None };
let st = app.session.world_state();
let mesh = st.body(body)?.mesh();
let sides = edge_sides(&mesh, *index, at)?;
@@ -1963,6 +1995,19 @@ fn arrow(painter: &egui::Painter, a: Pos2, b: Pos2, col: Color32) {
mod tests {
use super::*;
+ /// The arrow's point on a picked edge: one point, a zero-length piece, a click past the end.
+ #[test]
+ fn nearest_on_polyline_handles_short_edges_and_clicks_past_the_end() {
+ let p = |x: f64, y: f64| Vec3::new(x, y, 0.0);
+ assert_eq!(nearest_on_polyline(&[], p(1.0, 1.0)), None);
+ assert_eq!(nearest_on_polyline(&[p(2.0, 3.0)], p(9.0, 9.0)), Some(p(2.0, 3.0)));
+ assert_eq!(nearest_on_polyline(&[p(2.0, 3.0), p(2.0, 3.0)], p(9.0, 9.0)), Some(p(2.0, 3.0)));
+ let edge = [p(0.0, 0.0), p(0.0, 0.0), p(10.0, 0.0)];
+ assert_eq!(nearest_on_polyline(&edge, p(4.0, 2.0)), Some(p(4.0, 0.0)));
+ assert_eq!(nearest_on_polyline(&edge, p(15.0, 1.0)), Some(p(10.0, 0.0)));
+ assert_eq!(nearest_on_polyline(&edge, p(-3.0, -1.0)), Some(p(0.0, 0.0)));
+ }
+
#[test]
fn offset_plane_preview_stays_within_its_square() {
let rect = egui::Rect::from_min_size(Pos2::ZERO, vec2(800.0, 600.0));
diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs
index 0e323356df..98ef7c920b 100644
--- a/crates/ui-egui/src/dialogs.rs
+++ b/crates/ui-egui/src/dialogs.rs
@@ -508,6 +508,9 @@ pub struct Dialog {
pub press_pull: bool,
/// The operation the window chooses by itself (#6901).
pub op_auto: crate::op_auto::OpAuto,
+ /// Where the face that reopened this fillet or chamfer was clicked (Press Pull): its arrow
+ /// sits on the edge nearest it. UI state only, never saved.
+ pub(crate) anchor_hint: Option<Vec3>,
}
#[derive(Clone, Debug)]
@@ -764,6 +767,7 @@ impl Dialog {
shell_chain: Default::default(),
press_pull: false,
op_auto: Default::default(),
+ anchor_hint: None,
}
}
diff --git a/crates/ui-egui/src/documents.rs b/crates/ui-egui/src/documents.rs
index a17a7efda4..af6cc8be74 100644
--- a/crates/ui-egui/src/documents.rs
+++ b/crates/ui-egui/src/documents.rs
@@ -234,6 +234,8 @@ fn swap_in(app: &mut SolveApp, mut slot: DocSlot) -> DocSlot {
crate::agent_chat::leave_document(app);
app.agent_chat.swap_document(&mut slot.agent_chat);
let out_rev = app.session.revision;
+ // A click's point means nothing in the other design.
+ app.edit_anchor_hint = None;
let mut out = DocSlot {
session: std::mem::replace(&mut app.session, slot.session),
autosave: app.autosave.as_mut().and_then(|a| std::mem::replace(&mut a.active, slot.autosave)),
diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs
index 58674104cb..95f8f95ef3 100644
--- a/crates/ui-egui/src/lib.rs
+++ b/crates/ui-egui/src/lib.rs
@@ -594,6 +594,8 @@ pub struct SolveApp {
/// A linked component's design edited in place, with its assembly around it.
pub edit_in_place: edit_in_place::EditInPlace,
pub(crate) pending_feature_edit: Option<feature_edit::PendingFeatureEdit>,
+ /// The feature being reopened from a click and where, until its dialog opens (UI state only).
+ edit_anchor_hint: Option<(u64, solidcraft_engine::geom::Vec3)>,
/// The open feature window's check of what its material does (#6901).
pub op_check: op_auto::OpCheck,
/// A command recomputing the history (the marker moved, undo) computing off the window
@@ -828,6 +830,7 @@ impl SolveApp {
editing_state: None,
edit_in_place: Default::default(),
pending_feature_edit: None,
+ edit_anchor_hint: None,
op_check: op_auto::OpCheck::default(),
deferred: None,
deferred_queue: Vec::new(),
@@ -1851,9 +1854,9 @@ impl SolveApp {
self.cancel_sketch();
return;
}
- // Press Pull: edges get a fillet, a fillet's round face reopens its fillet (its size
- // changes, as `solid.press_pull` does: #1932), other curved faces an offset, planar faces
- // and profiles an extrude.
+ // Press Pull: edges get a fillet, a fillet's round face or a chamfer's flat one reopens
+ // its feature (its size changes, as `solid.press_pull` does: #1932, #4986), other curved
+ // faces an offset, planar faces and profiles an extrude.
if id == "solid.press_pull" {
if let Some(pending) = &mut self.pending_feature_edit {
pending.then_start(id);
@@ -1863,16 +1866,18 @@ impl SolveApp {
return self.start("solid.fillet");
}
let sel = &self.session.selection;
- let curved = sel.iter().find_map(|s| match s {
- solidcraft_engine::Sel::Face { body, index, .. } if dialogs::planar_face(&self.session, body, *index).is_none() => {
- Some((body, *index))
- }
+ let blend = sel.iter().find_map(|s| match s {
+ solidcraft_engine::Sel::Face { body, index, point } => dialogs::blend_feature(&self.session, body, *index).map(|id| (id, *point)),
_ => None,
});
- if let Some((body, index)) = curved {
- if let Some(blend) = dialogs::blend_feature(&self.session, body, index) {
- return self.edit_feature(blend);
- }
+ // Its arrow sits on the edge of the face clicked.
+ if let Some((blend, point)) = blend {
+ return self.edit_feature_at(blend, Some(point));
+ }
+ let curved = sel.iter().any(
+ |s| matches!(s, solidcraft_engine::Sel::Face { body, index, .. } if dialogs::planar_face(&self.session, body, *index).is_none()),
+ );
+ if curved {
return self.start("solid.offset_face");
}
let empty = sel.is_empty();
@@ -2052,7 +2057,15 @@ impl SolveApp {
/// Edit a feature: sketches open in sketch mode; other features roll the
/// timeline back to just before themselves and reopen their dialog, filled in.
pub fn edit_feature(&mut self, id: u64) {
+ self.edit_feature_at(id, None);
+ }
+
+ /// [`Self::edit_feature`] opened from a click at `at` on what the feature made: the dialog's
+ /// arrow sits by that point (a fillet's or chamfer's edge nearest it).
+ pub(crate) fn edit_feature_at(&mut self, id: u64, at: Option<solidcraft_engine::geom::Vec3>) {
use solidcraft_engine::doc::FeatureKind;
+ // A non-finite point (over the control channel) keeps the first edge.
+ self.edit_anchor_hint = at.filter(|p| p.is_finite()).map(|p| (id, p));
dialogs::cancel(self);
let Some(f) = self.session.doc.feature(id) else { return };
if matches!(f.kind, FeatureKind::Sketch { .. }) {
@@ -2075,8 +2088,12 @@ impl SolveApp {
fn open_feature_edit(&mut self, id: u64, marker: Option<usize>, original: Session) {
self.editing_state = Some(dialogs::EditingState { source: self.session.scratch(), original });
+ // The id check matters while another feature's reopening is still pending: a later call
+ // for a feature id that is gone returns before it drops that pending edit.
+ let hint = self.edit_anchor_hint.take().filter(|(f, _)| *f == id).map(|(_, p)| p);
match dialogs::for_feature(self, id, marker) {
- Some(d) => {
+ Some(mut d) => {
+ d.anchor_hint = hint;
if !d.previews() {
self.editing_state = None;
}
diff --git a/crates/ui-egui/src/preselect_tests.rs b/crates/ui-egui/src/preselect_tests.rs
index 846838ed5d..713e311f99 100644
--- a/crates/ui-egui/src/preselect_tests.rs
+++ b/crates/ui-egui/src/preselect_tests.rs
@@ -942,6 +942,105 @@ fn fillet_face_then_press_pull_edits_its_fillet() {
assert_eq!(d.editing.map(|e| e.0), Some(fillet));
}
+/// Press Pull on a chamfer's flat face reopens the chamfer to change its distance, as on a
+/// fillet's face, rather than extruding it (#4986): picked first, or picked with Press Pull
+/// already open.
+#[test]
+fn chamfer_face_then_press_pull_edits_its_chamfer() {
+ let script = json!([
+ {"command": "solid.box", "params": {"length": 40, "width": 30, "height": 20}},
+ {"command": "solid.chamfer", "params": {"edges": [[40, 0, 10]], "distance": 3}}
+ ]);
+ // The middle of the chamfer's face, from (37, 0) to (40, 3).
+ let p = Vec3::new(38.5, 1.5, 10.0);
+ let bevel = |app: &SolveApp| {
+ let names = solidcraft_engine::doc::naming::face_names_at(&app.session.model.state(), &[p]);
+ assert!(names[0].contains("blend"), "{names:?}");
+ let st = app.session.model.state();
+ let b = st.body("Body1").unwrap();
+ let index = solidcraft_engine::doc::naming::face_names(b).iter().position(|n| *n == names[0]).unwrap();
+ Sel::Face { body: "Body1".into(), index, point: p }
+ };
+ let mut app = app_with(script.clone());
+ let chamfer = app.session.doc.features.last().unwrap().id;
+ let sel = bevel(&app);
+ let d = start(&mut app, vec![sel], "solid.press_pull");
+ assert!(matches!(&d.kind, Kind::Fillet { radius, chamfer: true, .. } if radius.starts_with('3')), "{:?}", d.kind);
+ assert_eq!(d.editing.map(|e| e.0), Some(chamfer));
+
+ let mut app = app_with(script);
+ app.start("solid.press_pull");
+ let sel = bevel(&app);
+ let index = if let Sel::Face { index, .. } = &sel { *index } else { 0 };
+ crate::viewport::dialog_pick(&mut app, &crate::viewport::Hit::Face { body: "Body1".into(), index, point: p }, sel);
+ let d = app.dialog.clone().unwrap();
+ assert!(matches!(d.kind, Kind::Fillet { chamfer: true, .. }), "{:?}", d.kind);
+ assert_eq!(d.editing.map(|e| e.0), Some(chamfer));
+}
+
+/// Press Pull reopens a fillet or chamfer of several edges with its arrow on the edge of the face
+/// clicked, not on the feature's first edge (the Sample Plate's far corner): picked first, or
+/// picked with Press Pull open. Opened from the history, the arrow stays on the first edge.
+#[test]
+fn press_pull_on_a_blend_face_puts_the_arrow_on_the_clicked_edge() {
+ let r = 6.0 * std::f64::consts::FRAC_1_SQRT_2;
+ let chamfered = json!([
+ {"command": "solid.box", "params": {"length": 40, "width": 30, "height": 20}},
+ {"command": "solid.chamfer", "params": {"edges": [[20, 0, 20], [40, 15, 20], [20, 30, 20], [0, 15, 20]], "distance": 2}}
+ ]);
+ // The script, the body, a point on the clicked blend face, its edge, the feature's first edge.
+ let cases = [
+ (solidcraft_engine::sample::script(), "Plate", Vec3::new(74.0 + r, 44.0 + r, 4.0), Vec3::new(80.0, 50.0, 4.0), Vec3::new(0.0, 0.0, 4.0)),
+ (chamfered, "Body1", Vec3::new(20.0, 29.0, 19.0), Vec3::new(20.0, 30.0, 20.0), Vec3::new(20.0, 0.0, 20.0)),
+ ];
+ for (script, body, p, clicked, first) in cases {
+ let setup = |h: &mut crate::scenario::Harness| -> Sel {
+ h.app.session.run_script(&script).unwrap();
+ h.frames(2);
+ h.step(&json!({"call": "ui.view", "params": {"view": "fit"}})).unwrap();
+ let names = solidcraft_engine::doc::naming::face_names_at(&h.app.session.model.state(), &[p]);
+ assert!(names[0].contains("blend"), "{names:?}");
+ let st = h.app.session.model.state();
+ let index = solidcraft_engine::doc::naming::face_names(st.body(body).unwrap()).iter().position(|n| *n == names[0]).unwrap();
+ Sel::Face { body: body.into(), index, point: p }
+ };
+ // The arrow is nearer `want` than `other` on screen.
+ let arrow_near = |h: &mut crate::scenario::Harness, want: Vec3, other: Vec3, how: &str| {
+ h.frames(5);
+ assert!(
+ matches!(h.app.dialog.as_ref().map(|d| &d.kind), Some(Kind::Fillet { .. })),
+ "{body} {how}: {:?}",
+ h.app.dialog.as_ref().map(|d| &d.kind)
+ );
+ let tip = crate::scenario::handle_at("arrow").unwrap_or_else(|| panic!("{body} {how}: no arrow"));
+ let mut dist = |w: Vec3| {
+ let [x, y] = h.at(&json!({"world": [w.x, w.y, w.z]})).unwrap();
+ tip.distance(egui::pos2(x as f32, y as f32))
+ };
+ let (a, b) = (dist(want), dist(other));
+ assert!(a < b, "{body} {how}: the arrow is {a} px from the edge it should be on, {b} px from the other");
+ };
+ let mut h = crate::scenario::Harness::new();
+ let face = setup(&mut h);
+ h.app.session.selection = vec![face];
+ h.step(&json!({"start": "solid.press_pull"})).unwrap();
+ arrow_near(&mut h, clicked, first, "picked first");
+ // No click to go by: the feature's first edge, as before.
+ let id = h.app.dialog.as_ref().and_then(|d| d.editing).map(|e| e.0).unwrap();
+ crate::dialogs::cancel(&mut h.app);
+ h.step(&json!({"call": "ui.editFeature", "params": {"feature": id}})).unwrap();
+ arrow_near(&mut h, first, clicked, "from the history");
+
+ let mut h = crate::scenario::Harness::new();
+ let face = setup(&mut h);
+ h.step(&json!({"start": "solid.press_pull"})).unwrap();
+ let index = if let Sel::Face { index, .. } = &face { *index } else { 0 };
+ let hit = crate::viewport::Hit::Face { body: body.into(), index, point: p };
+ crate::viewport::dialog_pick(&mut h.app, &hit, face);
+ arrow_near(&mut h, clicked, first, "picked with Press Pull open");
+ }
+}
+
#[test]
fn faces_then_shell_and_face_then_hole() {
let mut app = boxed();
diff --git a/crates/ui-egui/src/viewport.rs b/crates/ui-egui/src/viewport.rs
index b33f196da0..074e2c05b7 100644
--- a/crates/ui-egui/src/viewport.rs
+++ b/crates/ui-egui/src/viewport.rs
@@ -3201,13 +3201,17 @@ pub(crate) fn dialog_pick(app: &mut SolveApp, hit: &Hit, sel: Sel) {
if app.applying.is_some() {
return;
}
- // Press Pull's first pick of a curved face or an edge reopens it as an offset or a fillet.
+ // Press Pull's first pick of a curved face, a chamfer's face or an edge reopens it as an
+ // offset, the chamfer or a fillet.
if let Some(d) = &app.dialog
&& d.press_pull
&& d.inputs.first().is_some_and(|i| i.items.is_empty())
&& match &sel {
Sel::Edge { .. } => true,
- Sel::Face { body, index, .. } => crate::dialogs::planar_face(&app.session, body, *index).is_none(),
+ Sel::Face { body, index, .. } => {
+ crate::dialogs::planar_face(&app.session, body, *index).is_none()
+ || crate::dialogs::blend_feature(&app.session, body, *index).is_some()
+ }
_ => false,
}
{