Skip to content

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

Revolve follows the highlighted sketch edge (#7452) (#7479)

SamD989f2e11793408
diff --git a/attribution/pending/revolve-selected-axis-screenshots.md b/attribution/pending/revolve-selected-axis-screenshots.md
new file mode 100644
index 0000000000..c8679b95f7
--- /dev/null
+++ b/attribution/pending/revolve-selected-axis-screenshots.md
@@ -0,0 +1,10 @@
+| docs/screenshots/7452/demo-01-extrude5-edge-frame.png | SamD98 | screenshot of the actual SolidCraft desktop UI showing the revolve axis pick on the Cat Post Topper repro design (docs/screenshots/7452/revolve-edge-frame.solidcraft), for #7452 | MIT OR Apache-2.0 |
+| docs/screenshots/7452/demo-04-preview-outer-l11.png | SamD98 | screenshot of the actual SolidCraft desktop UI showing the revolve axis pick on the Cat Post Topper repro design (docs/screenshots/7452/revolve-edge-frame.solidcraft), for #7452 | MIT OR Apache-2.0 |
+| docs/screenshots/7452/demo-05-preview-inner-l8.png | SamD98 | screenshot of the actual SolidCraft desktop UI showing the revolve axis pick on the Cat Post Topper repro design (docs/screenshots/7452/revolve-edge-frame.solidcraft), for #7452 | MIT OR Apache-2.0 |
+| docs/screenshots/7452/demo-06-result-outer-120.png | SamD98 | screenshot of the actual SolidCraft desktop UI showing the revolve axis pick on the Cat Post Topper repro design (docs/screenshots/7452/revolve-edge-frame.solidcraft), for #7452 | MIT OR Apache-2.0 |
+| docs/screenshots/7452/demo-07-preview-360.png | SamD98 | screenshot of the actual SolidCraft desktop UI showing the revolve axis pick on the Cat Post Topper repro design (docs/screenshots/7452/revolve-edge-frame.solidcraft), for #7452 | MIT OR Apache-2.0 |
+| docs/screenshots/7452/demo-08-cancelled.png | SamD98 | screenshot of the actual SolidCraft desktop UI showing the revolve axis pick on the Cat Post Topper repro design (docs/screenshots/7452/revolve-edge-frame.solidcraft), for #7452 | MIT OR Apache-2.0 |
+| docs/screenshots/7452/demo-13-colliding-id.png | SamD98 | screenshot of the actual SolidCraft desktop UI showing the revolve axis pick on the Cat Post Topper repro design (docs/screenshots/7452/revolve-edge-frame.solidcraft), for #7452 | MIT OR Apache-2.0 |
+| docs/screenshots/7452/demo-14-surface-l1.png | SamD98 | screenshot of the actual SolidCraft desktop UI showing the revolve axis pick on the Cat Post Topper repro design (docs/screenshots/7452/revolve-edge-frame.solidcraft), for #7452 | MIT OR Apache-2.0 |
+| docs/screenshots/7452/demo-15-surface-result.png | SamD98 | screenshot of the actual SolidCraft desktop UI showing the revolve axis pick on the Cat Post Topper repro design (docs/screenshots/7452/revolve-edge-frame.solidcraft), for #7452 | MIT OR Apache-2.0 |
+| docs/screenshots/7452/revolve-selected-edge.mp4 | SamD98 | screen recording of the actual SolidCraft desktop UI showing the revolve axis pick on the Cat Post Topper repro design (docs/screenshots/7452/revolve-edge-frame.solidcraft), for #7452 | MIT OR Apache-2.0 |
diff --git a/crates/engine/src/cmd/revolve_convention_tests.rs b/crates/engine/src/cmd/revolve_convention_tests.rs
index f3cc54c7e5..30a9374e8b 100644
--- a/crates/engine/src/cmd/revolve_convention_tests.rs
+++ b/crates/engine/src/cmd/revolve_convention_tests.rs
@@ -401,6 +401,48 @@ fn construction_axis_moved_behind_its_revolve_and_back() {
assert!((solidcraft_kernel::measure(&s.model.state().bodies[0].body).unwrap().volume - 60.0 * PI).abs() < 0.05);
}
+/// The two vertical sides of one rectangle are different axes. A two-point rectangle numbers
+/// the max-x side and the min-x side separately; a 120° revolve about each must contain a point
+/// swept about that side and not the point swept about the other (#7452).
+#[test]
+fn rectangle_revolve_about_its_right_edge_differs_from_its_left() {
+ for (axis_x, sample_x) in [(30.0, 10.5), (10.0, 29.5)] {
+ let mut s = Session::default();
+ run(&mut s, "sketch.create", json!({"name": "Profile", "plane": "XY"}));
+ run(&mut s, "sketch.rectangle.two_point", json!({"p0": [10, 0], "p1": [30, 10]}));
+ let id = vertical_line(&s, axis_x);
+ run(&mut s, "sketch.finish", json!({}));
+ run(&mut s, "solid.revolve", json!({"sketch": "Profile", "axis": id, "angle": "120 deg", "operation": "new"}));
+ let body = &s.model.state().bodies[0].body;
+ let on_edge = lift_xy(axis_x, sample_x);
+ let on_other = lift_xy(if axis_x > 20.0 { 10.0 } else { 30.0 }, if sample_x < 20.0 { 29.5 } else { 10.5 });
+ assert!(body.classify_point(on_edge).unwrap() == solidcraft_kernel::PointClass::Inside, "axis x={axis_x} ({id}) should contain {on_edge:?}");
+ assert!(
+ body.classify_point(on_other).unwrap() != solidcraft_kernel::PointClass::Inside,
+ "axis x={axis_x} ({id}) should not contain the other edge's probe {on_other:?}"
+ );
+ }
+}
+
+fn vertical_line(s: &Session, x: f64) -> String {
+ let sk = s.doc.sketch(s.active_sketch.expect("sketch")).expect("sketch");
+ sk.curves
+ .iter()
+ .find_map(|c| {
+ let solidcraft_sketch::CurveKind::Line { a, b } = c.kind else { return None };
+ let (pa, pb) = (sk.point(a)?, sk.point(b)?);
+ ((pa.x - x).abs() < 1e-9 && (pb.x - x).abs() < 1e-9).then(|| c.id.clone())
+ })
+ .unwrap_or_else(|| panic!("no vertical line at x={x}"))
+}
+
+/// `(point_x, 5, 0)` rotated 80° about `x = axis_x` toward +Z, the sketch-normal sense on XY.
+fn lift_xy(axis_x: f64, point_x: f64) -> Vec3 {
+ let dx = point_x - axis_x;
+ let t = 80.0_f64.to_radians();
+ Vec3::new(axis_x + dx * t.cos(), 5.0, dx.abs() * t.sin())
+}
+
#[test]
fn construction_axis_revolve_rejects_invalid_axes_atomically() {
for (a, b, message) in [
diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs
index 23362f4a71..e453ff6e8d 100644
--- a/crates/ui-egui/src/dialogs.rs
+++ b/crates/ui-egui/src/dialogs.rs
@@ -5201,13 +5201,17 @@ fn dialog_commands(app: &SolveApp, d: &Dialog) -> Result<Vec<(String, Value)>, S
}
Kind::Revolve { angle, operation, axis: stored_axis } => {
need(0, "profiles")?;
+ let (sketch, idx) = profiles();
+ // A sketch line is kept by id only when that id on the profile sketch is the
+ // highlighted line. Ids repeat across sketches (#3726); the highlight and the angle
+ // handle follow the pick's sketch, and a bare id would revolve about whatever line
+ // the profile sketch happens to number the same.
let axis = match sels(d, 1).first() {
Some(Sel::Axis { name }) => json!(name),
- Some(Sel::SketchCurve { id, .. }) => json!(id),
+ Some(curve @ Sel::SketchCurve { .. }) => sketch_curve_axis(app, curve, sketch.as_u64())?,
Some(x) => axis_param(app, x)?,
None => stored_axis.clone().ok_or("select an axis")?,
};
- let (sketch, idx) = profiles();
let mut p = json!({"axis": axis, "angle": angle, "operation": OPS.get(*operation).copied().unwrap_or("new")});
// A planar body face revolves like a profile (#2747); profiles win when both are picked.
let face = sels(d, 0).iter().find_map(|x| match x {
@@ -6192,6 +6196,48 @@ pub(crate) fn takes_as_axis(s: &Session, sel: &Sel) -> bool {
}
}
+/// A sketch curve picked as a revolve axis.
+///
+/// The highlight and the angle handle follow [`axis_of`] (the sketch the pick names, or the
+/// active sketch when it does not). Eval resolves a bare curve id on the profile sketch, and
+/// curve ids repeat from sketch to sketch (#3726), so that line can be a different edge — often
+/// the opposite side of a rectangle. Keep the id when the profile sketch's line is the
+/// highlighted one, so a same-sketch axis stays a sketch line. Otherwise pass the highlighted
+/// line as `{origin, dir}` in world coordinates (the command stores it in the component frame).
+/// A face profile has no sketch yet — its generated sketch numbers edges from `l1` again — so
+/// that pick is always the geometric line.
+pub(crate) fn sketch_curve_axis(app: &SolveApp, sel: &Sel, profile_sketch: Option<u64>) -> Result<Value, String> {
+ let Sel::SketchCurve { id, .. } = sel else { return axis_param(app, sel) };
+ let (origin, dir) = axis_of(app, sel).ok_or(AXIS_PICK)?;
+ if !origin.is_finite() || !dir.is_finite() {
+ return Err(AXIS_PICK.into());
+ }
+ let same = profile_sketch.and_then(|sketch| profile_axis_line(app, sketch, id)).is_some_and(|line| same_axis(line, (origin, dir)));
+ if same { Ok(json!(id)) } else { Ok(json!({"origin": pt(origin), "dir": pt(dir)})) }
+}
+
+/// The world line of curve `id` on `sketch`, when that curve is a line.
+fn profile_axis_line(app: &SolveApp, sketch: u64, id: &str) -> Option<(Vec3, Vec3)> {
+ let st = app.session.world_state().ok()?;
+ let ss = st.sketch(sketch)?;
+ let c = ss.sketch.curves.get(ss.sketch.curve_index(id)?)?;
+ let solidcraft_engine::sketch::CurveKind::Line { a, b } = c.kind else { return None };
+ let pa = ss.plane.to_world(ss.sketch.point(a)?);
+ let pb = ss.plane.to_world(ss.sketch.point(b)?);
+ let dir = (pb - pa).normalized()?;
+ (pa.is_finite() && dir.is_finite()).then_some((pa, dir))
+}
+
+/// Whether two world lines are the same axis: parallel, and no gap between them.
+fn same_axis((o1, d1): (Vec3, Vec3), (o2, d2): (Vec3, Vec3)) -> bool {
+ let (Some(d1), Some(d2)) = (d1.normalized(), d2.normalized()) else { return false };
+ if d1.dot(d2).abs() <= 1.0 - 1e-9 {
+ return false;
+ }
+ let sep = (o2 - o1).cross(d1).len();
+ sep <= 1e-6 * (1.0 + o1.len() + o2.len())
+}
+
/// An axis input's pick as a command's `axis`: a world axis or construction axis by name, a
/// circular edge or round face by reference, anything else (a sketch line, a straight edge) as
/// its line.
diff --git a/crates/ui-egui/src/dialogs_surface.rs b/crates/ui-egui/src/dialogs_surface.rs
index cdc393941b..af49ad8348 100644
--- a/crates/ui-egui/src/dialogs_surface.rs
+++ b/crates/ui-egui/src/dialogs_surface.rs
@@ -528,9 +528,12 @@ pub fn commands(app: &SolveApp, k: &Surf, inputs: &[SelInput], extra: &Map<Strin
Surf::Revolve { angle, symmetric, axis } => {
need(0, "profiles or curves to revolve")?;
let mut p = sheet_picks(app, items(inputs, 0))?;
+ // Same as a solid revolve: a bare curve id is resolved on this profile sketch, where
+ // it can name a different line than the one the pick highlights (#7452, #3726).
+ let profile_sketch = p.get("sketch").and_then(Value::as_u64);
p["axis"] = match items(inputs, 1).first() {
Some(Sel::Axis { name }) => json!(name),
- Some(Sel::SketchCurve { id, .. }) => json!(id),
+ Some(curve @ Sel::SketchCurve { .. }) => crate::dialogs::sketch_curve_axis(app, curve, profile_sketch)?,
Some(x) => crate::dialogs::axis_param(app, x)?,
None => axis.clone().ok_or("select an axis")?,
};
diff --git a/crates/ui-egui/src/revolve_edit_tests.rs b/crates/ui-egui/src/revolve_edit_tests.rs
index 81c0f3d9c3..64b78f05ef 100644
--- a/crates/ui-egui/src/revolve_edit_tests.rs
+++ b/crates/ui-egui/src/revolve_edit_tests.rs
@@ -1,5 +1,8 @@
+use crate::dialogs::{Dialog, Kind, apply_commands};
use crate::scenario::Harness;
use serde_json::{Value, json};
+use solidcore_record::Vec3;
+use solidcraft_engine::Sel;
use solidcraft_engine::doc::{AxisRef, FeatureKind};
use solidcraft_engine::geom::prelude::*;
@@ -347,3 +350,245 @@ fn an_axis_origin_that_cannot_be_evaluated_is_kept_by_an_untouched_edit() {
assert_eq!(saved_axis(&h), original, "surface: {surface}, moved: {moved}");
}
}
+
+fn xy_rectangle(h: &mut Harness, name: &str, p0: [f64; 2], p1: [f64; 2]) -> u64 {
+ h.app.run("sketch.create", json!({"plane": "XY", "name": name})).unwrap();
+ h.app.run("sketch.rectangle.two_point", json!({"p0": p0, "p1": p1})).unwrap();
+ h.app.run("sketch.finish", json!({})).unwrap();
+ h.app.session.doc.find_feature(name).unwrap().id
+}
+
+fn revolve_dialog(app: &crate::SolveApp, profiles: Vec<Sel>, axis: Sel) -> Dialog {
+ let mut d = Dialog::for_command(app, "solid.revolve").unwrap();
+ d.inputs[0].items = profiles;
+ d.inputs[1].items = vec![axis];
+ if let Kind::Revolve { angle, operation, .. } = &mut d.kind {
+ *angle = "120 deg".into();
+ *operation = 0;
+ }
+ d
+}
+
+fn vertical_id(app: &crate::SolveApp, sketch: u64, x: f64) -> String {
+ let st = app.session.world_state().unwrap();
+ let ss = st.sketch(sketch).unwrap();
+ ss.sketch
+ .curves
+ .iter()
+ .find_map(|c| {
+ let solidcraft_engine::sketch::CurveKind::Line { a, b } = c.kind else { return None };
+ let (pa, pb) = (ss.sketch.point(a)?, ss.sketch.point(b)?);
+ ((pa.x - x).abs() < 1e-6 && (pb.x - x).abs() < 1e-6).then(|| c.id.clone())
+ })
+ .unwrap_or_else(|| panic!("no vertical line at x={x}"))
+}
+
+fn segment(app: &crate::SolveApp, sketch: u64, id: &str) -> (Vec3, Vec3) {
+ let st = app.session.world_state().unwrap();
+ let ss = st.sketch(sketch).unwrap();
+ let i = ss.sketch.curve_index(id).unwrap_or_else(|| panic!("no curve {id}"));
+ let c = &ss.sketch.curves[i];
+ let solidcraft_engine::sketch::CurveKind::Line { a, b } = c.kind else { panic!("{id} is not a line") };
+ (ss.plane.to_world(ss.sketch.point(a).unwrap()), ss.plane.to_world(ss.sketch.point(b).unwrap()))
+}
+
+/// `(point_x, 5, 0)` rotated 80° about `x = axis_x` toward +Z.
+fn lift_xy(axis_x: f64, point_x: f64) -> Vec3 {
+ let dx = point_x - axis_x;
+ let t = 80.0_f64.to_radians();
+ Vec3::new(axis_x + dx * t.cos(), 5.0, dx.abs() * t.sin())
+}
+
+fn assert_pivots_on(preview: &solidcraft_engine::Preview, on_axis: Vec3, on_other: Vec3, what: &str) {
+ let before: std::collections::BTreeSet<_> = preview.before.bodies.iter().map(|b| b.name.as_str()).collect();
+ let body = preview
+ .after
+ .bodies
+ .iter()
+ .filter(|b| !before.contains(b.name.as_str()))
+ .find(|b| b.body.classify_point(on_axis).is_ok_and(|c| c == solidcraft_engine::kernel::PointClass::Inside))
+ .unwrap_or_else(|| panic!("{what}: no new body contains {on_axis:?}"));
+ assert!(
+ body.body.classify_point(on_other).is_ok_and(|c| c != solidcraft_engine::kernel::PointClass::Inside),
+ "{what}: also contains the other edge's probe {on_other:?}"
+ );
+}
+
+/// A dialog pick of the profile's own edge keeps that curve id, and the preview pivots on it
+/// rather than on the opposite side. Naming the sketch and leaving it unnamed while that sketch
+/// is active are the two ways a click stores the pick.
+#[test]
+fn dialog_axis_keeps_the_profile_line_when_it_is_the_highlighted_edge() {
+ let mut h = Harness::new();
+ let sketch = xy_rectangle(&mut h, "Profile", [10.0, 0.0], [30.0, 10.0]);
+ let right = vertical_id(&h.app, sketch, 30.0);
+ let left = vertical_id(&h.app, sketch, 10.0);
+ assert_ne!(right, left);
+ for named in [Some(sketch), None] {
+ if named.is_none() {
+ h.app.run("sketch.edit", json!({"sketch": "Profile"})).unwrap();
+ }
+ let d = revolve_dialog(&h.app, vec![Sel::Profile { sketch, index: 0 }], Sel::SketchCurve { id: right.clone(), sketch: named });
+ let cmds = apply_commands(&h.app, &d).unwrap();
+ assert_eq!(cmds[0].0, "solid.revolve");
+ assert_eq!(cmds[0].1["axis"], json!(right), "named={named:?}");
+ let preview = h.app.session.preview(&cmds).unwrap();
+ assert_pivots_on(&preview, lift_xy(30.0, 10.5), lift_xy(10.0, 29.5), &format!("named={named:?}"));
+ if named.is_none() {
+ h.app.run("sketch.finish", json!({})).unwrap();
+ }
+ }
+}
+
+/// Curve ids repeat across sketches (#3726). The highlighted line is this sketch's `l2` (x = 10);
+/// the profile sketch's line of the same id is the opposite edge (x = 30). The preview must pivot
+/// on the highlighted line, and the command must not pass the bare id.
+#[test]
+fn dialog_revolve_follows_the_highlighted_edge_when_the_curve_id_collides() {
+ let mut h = Harness::new();
+ let profile = xy_rectangle(&mut h, "Profile", [10.0, 0.0], [30.0, 10.0]);
+ let right = vertical_id(&h.app, profile, 30.0);
+ h.app.run("sketch.create", json!({"plane": "XY", "name": "Axis"})).unwrap();
+ h.app.run("sketch.line", json!({"points": [[10, 0], [10, 10]], "ids": [right]})).unwrap();
+ let axis_sketch = h.app.session.active_sketch.unwrap();
+ let (highlighted, _) = segment(&h.app, axis_sketch, &right);
+ let (profile_line, _) = segment(&h.app, profile, &right);
+ assert!((highlighted.x - 10.0).abs() < 1e-6, "{highlighted:?}");
+ assert!((profile_line.x - 30.0).abs() < 1e-6, "{profile_line:?}");
+ for named in [Some(axis_sketch), None] {
+ let d = revolve_dialog(&h.app, vec![Sel::Profile { sketch: profile, index: 0 }], Sel::SketchCurve { id: right.clone(), sketch: named });
+ let cmds = apply_commands(&h.app, &d).unwrap();
+ let axis = &cmds[0].1["axis"];
+ let origin_x = axis["origin"][0].as_f64().unwrap_or_else(|| panic!("named={named:?} stored {axis}, the colliding id"));
+ assert!((origin_x - 10.0).abs() < 1e-6, "named={named:?}: {axis}");
+ let preview = h.app.session.preview(&cmds).unwrap();
+ // About the highlighted edge x = 10, from a point near the far edge. The other probe is
+ // the same construction about the profile sketch's line of this id.
+ assert_pivots_on(&preview, lift_xy(10.0, 29.5), lift_xy(30.0, 10.5), &format!("named={named:?}"));
+ }
+ let (kind, mut inputs) = crate::dialogs_surface::start(&h.app, "surface.revolve").unwrap();
+ let Kind::Surface(mut surf) = kind else { panic!("surface revolve") };
+ if let crate::dialogs_surface::Surf::Revolve { angle, .. } = &mut surf {
+ *angle = "120 deg".into();
+ }
+ inputs[0].items = vec![Sel::Profile { sketch: profile, index: 0 }];
+ inputs[1].items = vec![Sel::SketchCurve { id: right, sketch: Some(axis_sketch) }];
+ let cmds = crate::dialogs_surface::commands(&h.app, &surf, &inputs, &serde_json::Map::new()).unwrap();
+ assert_eq!(cmds[0].0, "surface.revolve");
+ assert!((cmds[0].1["axis"]["origin"][0].as_f64().unwrap() - 10.0).abs() < 1e-6, "{}", cmds[0].1["axis"]);
+}
+
+fn linked_span(app: &crate::SolveApp, sketch: u64) -> (f64, f64, f64, f64) {
+ let st = app.session.world_state().unwrap();
+ let ss = st.sketch(sketch).unwrap();
+ let mut xs = Vec::new();
+ let mut ys = Vec::new();
+ for c in &ss.sketch.curves {
+ if c.link.is_none() {
+ continue;
+ }
+ let solidcraft_engine::sketch::CurveKind::Line { a, b } = c.kind else { continue };
+ for p in [ss.sketch.point(a), ss.sketch.point(b)].into_iter().flatten() {
+ xs.push(p.x);
+ ys.push(p.y);
+ }
+ }
+ assert!(!xs.is_empty(), "the face sketch should project the face outline");
+ (
+ xs.iter().copied().fold(f64::MAX, f64::min),
+ xs.iter().copied().fold(f64::MIN, f64::max),
+ ys.iter().copied().fold(f64::MAX, f64::min),
+ ys.iter().copied().fold(f64::MIN, f64::max),
+ )
+}
+
+/// A rectangle drawn across a face edge splits the sketch into two profiles. The picked drawn
+/// edge — and a second sketch's line that reuses that edge's id but lies on the other side —
+/// must be the axis the preview revolves about (#7452).
+#[test]
+fn face_sketch_two_profiles_revolve_about_the_highlighted_edge() {
+ let mut h = Harness::new();
+ h.app.run("solid.box", json!({"length": 40, "width": 30, "height": 20, "corner": [0, 0, 0]})).unwrap();
+ h.app.run("sketch.create", json!({"plane": {"face": [20, 0, 10]}, "name": "OnFace"})).unwrap();
+ let sketch = h.app.session.active_sketch.unwrap();
+ let (x0, _, y0, y1) = linked_span(&h.app, sketch);
+ let mid_y = (y0 + y1) * 0.5;
+ // Twelve millimetres outside the face, eight inside, so a point near either vertical side
+ // stays inside a revolve about that side and outside a revolve about the other.
+ let left_x = x0 - 12.0;
+ let right_x = x0 + 8.0;
+ h.app.run("sketch.rectangle.two_point", json!({"p0": [left_x, mid_y - 4.0], "p1": [right_x, mid_y + 4.0]})).unwrap();
+ h.app.run("sketch.finish", json!({})).unwrap();
+ let st = h.app.session.world_state().unwrap();
+ let ss = st.sketch(sketch).unwrap();
+ assert!(ss.profiles.len() >= 2, "straddling the face edge should make two profiles, got {}", ss.profiles.len());
+ let outside = ss
+ .profiles
+ .iter()
+ .position(|p| p.centroid.x < x0 - 0.5)
+ .unwrap_or_else(|| panic!("no profile outside the face: {:?}", ss.profiles.iter().map(|p| p.centroid).collect::<Vec<_>>()));
+ let normal = ss.plane.normal();
+ let drawn_at = |x: f64| {
+ ss.sketch.curves.iter().find_map(|c| {
+ if c.link.is_some() {
+ return None;
+ }
+ let solidcraft_engine::sketch::CurveKind::Line { a, b } = c.kind else { return None };
+ let (pa, pb) = (ss.sketch.point(a)?, ss.sketch.point(b)?);
+ ((pa.x - x).abs() < 1e-6 && (pb.x - x).abs() < 1e-6).then(|| c.id.clone())
+ })
+ };
+ let right_id = drawn_at(right_x).unwrap_or_else(|| panic!("no drawn edge at {right_x}"));
+ let left_id = drawn_at(left_x).unwrap_or_else(|| panic!("no drawn edge at {left_x}"));
+ let (right_a, right_b) = segment(&h.app, sketch, &right_id);
+ let (left_a, left_b) = segment(&h.app, sketch, &left_id);
+ let right_mid = (right_a + right_b) * 0.5;
+ let left_mid = (left_a + left_b) * 0.5;
+ let span = right_mid.dist(left_mid);
+ assert!((span - (right_x - left_x)).abs() < 1e-4, "sketch millimetres should match the face plane, span {span}");
+ let across = (right_mid - left_mid).normalized().unwrap();
+ // 0.5 mm in from the left edge, and 0.5 mm short of the face edge (the far side of the
+ // outside region when the axis is the left edge).
+ let near_left = left_mid + across * 0.5;
+ let near_face = left_mid + across * 11.5;
+ let right_dir = (right_b - right_a).normalized().unwrap();
+ let left_dir = (left_b - left_a).normalized().unwrap();
+ let about_right = spin(normal, right_mid, right_dir, near_left, 80.0);
+ let about_left = spin(normal, left_mid, left_dir, near_face, 80.0);
+
+ let d = revolve_dialog(&h.app, vec![Sel::Profile { sketch, index: outside }], Sel::SketchCurve { id: right_id.clone(), sketch: Some(sketch) });
+ let cmds = apply_commands(&h.app, &d).unwrap();
+ assert_eq!(cmds[0].1["axis"], json!(right_id), "the drawn edge is this profile sketch's own line");
+ let preview = h.app.session.preview(&cmds).unwrap();
+ assert_pivots_on(&preview, about_right, about_left, "same-sketch face edge");
+
+ // Another sketch on the same face reuses the drawn edge's id for the opposite side.
+ h.app.run("sketch.create", json!({"plane": {"face": [20, 0, 10]}, "name": "Other", "project_edges": false})).unwrap();
+ h.app.run("sketch.line", json!({"points": [[left_x, mid_y - 4.0], [left_x, mid_y + 4.0]], "ids": [right_id]})).unwrap();
+ let other = h.app.session.active_sketch.unwrap();
+ let (other_a, other_b) = segment(&h.app, other, cmds[0].1["axis"].as_str().unwrap());
+ let other_mid = (other_a + other_b) * 0.5;
+ assert!(other_mid.dist(left_mid) < 1e-4, "the colliding line should lie on the left edge, got {other_mid:?} vs {left_mid:?}");
+ assert!(other_mid.dist(right_mid) > 1.0, "it must not be the profile line");
+ let colliding = cmds[0].1["axis"].as_str().unwrap().to_string();
+ let d = revolve_dialog(&h.app, vec![Sel::Profile { sketch, index: outside }], Sel::SketchCurve { id: colliding, sketch: Some(other) });
+ let cmds = apply_commands(&h.app, &d).unwrap();
+ let origin = cmds[0].1["axis"]["origin"].as_array().unwrap_or_else(|| panic!("colliding pick stored {}", cmds[0].1["axis"]));
+ let got = Vec3::new(origin[0].as_f64().unwrap(), origin[1].as_f64().unwrap(), origin[2].as_f64().unwrap());
+ assert!(
+ got.dist(other_mid) < 1.0 || (got - other_a).cross((other_b - other_a).normalized().unwrap()).len() < 1e-4,
+ "axis {got:?} is not the highlighted line {other_a:?}–{other_b:?}"
+ );
+ let preview = h.app.session.preview(&cmds).unwrap();
+ assert_pivots_on(&preview, about_left, about_right, "face sketch, colliding id");
+}
+
+fn spin(normal: Vec3, origin: Vec3, dir: Vec3, point: Vec3, deg: f64) -> Vec3 {
+ let mut axis = dir.normalized().unwrap();
+ if axis.cross(point - origin).dot(normal) < 0.0 {
+ axis = -axis;
+ }
+ let t = deg.to_radians();
+ let v = point - origin;
+ origin + v * t.cos() + axis.cross(v) * t.sin() + axis * (axis.dot(v) * (1.0 - t.cos()))
+}
diff --git a/docs/screenshots/7452/demo-01-extrude5-edge-frame.png b/docs/screenshots/7452/demo-01-extrude5-edge-frame.png
new file mode 100644
index 0000000000..8e139540ea
Binary files /dev/null and b/docs/screenshots/7452/demo-01-extrude5-edge-frame.png differ
diff --git a/docs/screenshots/7452/demo-04-preview-outer-l11.png b/docs/screenshots/7452/demo-04-preview-outer-l11.png
new file mode 100644
index 0000000000..8e6dea9d8c
Binary files /dev/null and b/docs/screenshots/7452/demo-04-preview-outer-l11.png differ
diff --git a/docs/screenshots/7452/demo-05-preview-inner-l8.png b/docs/screenshots/7452/demo-05-preview-inner-l8.png
new file mode 100644
index 0000000000..952028bfc7
Binary files /dev/null and b/docs/screenshots/7452/demo-05-preview-inner-l8.png differ
diff --git a/docs/screenshots/7452/demo-06-result-outer-120.png b/docs/screenshots/7452/demo-06-result-outer-120.png
new file mode 100644
index 0000000000..73b90089f4
Binary files /dev/null and b/docs/screenshots/7452/demo-06-result-outer-120.png differ
diff --git a/docs/screenshots/7452/demo-07-preview-360.png b/docs/screenshots/7452/demo-07-preview-360.png
new file mode 100644
index 0000000000..d657e8af79
Binary files /dev/null and b/docs/screenshots/7452/demo-07-preview-360.png differ
diff --git a/docs/screenshots/7452/demo-08-cancelled.png b/docs/screenshots/7452/demo-08-cancelled.png
new file mode 100644
index 0000000000..fcc0e9bd8e
Binary files /dev/null and b/docs/screenshots/7452/demo-08-cancelled.png differ
diff --git a/docs/screenshots/7452/demo-13-colliding-id.png b/docs/screenshots/7452/demo-13-colliding-id.png
new file mode 100644
index 0000000000..b2278f6d70
Binary files /dev/null and b/docs/screenshots/7452/demo-13-colliding-id.png differ
diff --git a/docs/screenshots/7452/demo-14-surface-l1.png b/docs/screenshots/7452/demo-14-surface-l1.png
new file mode 100644
index 0000000000..6ea7aac220
Binary files /dev/null and b/docs/screenshots/7452/demo-14-surface-l1.png differ
diff --git a/docs/screenshots/7452/demo-15-surface-result.png b/docs/screenshots/7452/demo-15-surface-result.png
new file mode 100644
index 0000000000..1875915392
Binary files /dev/null and b/docs/screenshots/7452/demo-15-surface-result.png differ
diff --git a/docs/screenshots/7452/revolve-edge-frame.solidcraft b/docs/screenshots/7452/revolve-edge-frame.solidcraft
new file mode 100644
index 0000000000..da1f2feb2f
Binary files /dev/null and b/docs/screenshots/7452/revolve-edge-frame.solidcraft differ
diff --git a/docs/screenshots/7452/revolve-selected-edge.mp4 b/docs/screenshots/7452/revolve-selected-edge.mp4
new file mode 100644
index 0000000000..bcc3400c84
Binary files /dev/null and b/docs/screenshots/7452/revolve-selected-edge.mp4 differ