Skip to content

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

Coil dialog; value box for curve-based dialogs (pipe, rib, path pattern) at the picked curve

bherbruck950fa39b0f34
diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs
index fe7461e868..1e73636a85 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<Vec3>)> {
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 f39f80749a..b94bc07273 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",