From 950fa39b0f344cf5a1399c676e8579ec7010fe6f Mon Sep 17 00:00:00 2001 From: bherbruck Date: Thu, 8 Oct 2026 01:59:53 +0000 Subject: [PATCH] Coil dialog; value box for curve-based dialogs (pipe, rib, path pattern) at the picked curve Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AS5Tn3xieewUSg3uxrMVdL --- crates/ui-egui/src/canvas.rs | 5 +++++ crates/ui-egui/src/dialogs.rs | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index fe7461e8..1e73636a 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -29,6 +29,11 @@ pub fn anchor(app: &SolveApp, d: &Dialog) -> Option<(Vec3, Option)> { Sel::Face { body, index, point } => (*point, crate::dialogs::planar_face(&app.session, body, *index).map(|(_, n)| n)), Sel::Edge { body, index, point } => (*point, st.body(body).and_then(|b| edge_bisector(&b.mesh(), *index, *point))), Sel::Vertex { point, .. } => (*point, None), + Sel::SketchCurve { id } => { + let ss = st.sketches.iter().rev().find(|ss| ss.sketch.curve_index(id).is_some())?; + let pts = ss.sketch.polyline(ss.sketch.curve_index(id)?); + (ss.plane.to_world(*pts.get(pts.len() / 2)?), None) + } Sel::Body { name } => (st.body(name)?.mesh().bounds().center(), None), Sel::Plane { name } => { let pl = solvecraft_engine::geom::Plane::named(name).or_else(|| { diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index f39f8074..b94bc072 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -350,6 +350,14 @@ impl Dialog { Kind::Primitive { cmd: "PrimitiveTorus", fields: vec![("major", "20".into()), ("minor", "5".into())], operation: 0 }, vec![], ), + "PrimitiveCoil" => Dialog::new( + Kind::Primitive { + cmd: "PrimitiveCoil", + fields: vec![("diameter", "40".into()), ("revolutions", "4".into()), ("pitch", "8".into()), ("section_size", "3".into())], + operation: 0, + }, + vec![], + ), "FusionCombineCommand" => Dialog::new( Kind::Combine { operation: 1, keep_tools: false }, vec![SelInput::new("Target body", BODIES, false), SelInput::new("Tool bodies", BODIES, true)], @@ -647,6 +655,7 @@ fn title(k: &Kind) -> &'static str { "PrimitiveBox" => "BOX", "PrimitiveCylinder" => "CYLINDER", "PrimitiveSphere" => "SPHERE", + "PrimitiveCoil" => "COIL", _ => "TORUS", }, Kind::Combine { .. } => "COMBINE",