Skip to content

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

fix(ui): put Point on the default sketch toolbar (#445)

selune5c7149e57d38
diff --git a/ROADMAP.md b/ROADMAP.md
index 23aa4e1867..ac796bc5cb 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -61,6 +61,8 @@ PCB / Package, Render, Animation, Simulation, Manufacture/CAM, Drawings.
## Dimensioning and error reporting
+- Point has a default Sketch CREATE toolbar button alongside the existing drawing tools.
+ Saved custom layouts are preserved; Reset Toolbar restores the default Point button.
- Construction planes cannot take an origin-plane name (XY, XZ, YZ, Top, Front, Right). Plane
arguments reject such a name when an older design's construction plane already has it. Use
the other alias, the construction feature's numeric ID or an explicit plane; existing
diff --git a/crates/ui-egui/src/toolbar.rs b/crates/ui-egui/src/toolbar.rs
index 57bb8f301e..266da26459 100644
--- a/crates/ui-egui/src/toolbar.rs
+++ b/crates/ui-egui/src/toolbar.rs
@@ -30,7 +30,6 @@ pub fn promoted(tab: &str, panel: &str) -> usize {
match (tab, panel) {
("SOLID", "CREATE") => 4,
("SOLID", "MODIFY") => 4,
- ("SKETCH", "CREATE") => 6,
("SKETCH", "CONSTRAINTS") => 6,
(_, "FINISH SKETCH") => 1,
_ => 2,
diff --git a/crates/ui-egui/src/workspace.rs b/crates/ui-egui/src/workspace.rs
index 5fcdea5696..5ab66a4e65 100644
--- a/crates/ui-egui/src/workspace.rs
+++ b/crates/ui-egui/src/workspace.rs
@@ -1,5 +1,5 @@
-//! Toolbar layout of the tabs that share commands with others (Fusion's layout): the SOLID
-//! tab's ASSEMBLE panel, SHEET METAL and PLASTIC. A command is registered on one tab and panel;
+//! Explicit toolbar layouts: Sketch CREATE, the SOLID tab's ASSEMBLE panel, SHEET METAL and
+//! PLASTIC. A command is registered on one tab and panel;
//! these panels list the commands they show in order (the first few get big buttons), so Extrude
//! or Joint appear on several tabs. Commands registered on such a panel but not listed follow at
//! the end.
@@ -100,6 +100,19 @@ pub fn panels(tab: &str) -> Option<&'static [&'static str]> {
/// to the registry.
pub fn layout<'a>(tab: &str, panel: &str, specs: &[&'a CommandSpec]) -> Option<(Vec<&'a CommandSpec>, usize)> {
let (ids, promoted, own_tab): (&[&str], usize, &str) = match (tab, panel) {
+ ("SKETCH", "CREATE") => (
+ &[
+ "sketch.line",
+ "sketch.rectangle.two_point",
+ "sketch.rectangle.three_point",
+ "sketch.rectangle.center",
+ "sketch.circle.center",
+ "sketch.circle.two_point",
+ "sketch.point",
+ ],
+ 7,
+ tab,
+ ),
("SOLID", "CONFIGURE") => (&["parameters.change", "config.table"], 2, tab),
("SOLID" | "SHEET METAL" | "PLASTIC", "ASSEMBLE") => (ASSEMBLE, 3, tab),
("SHEET METAL", "CREATE") => (SHEET_CREATE, 3, tab),
diff --git a/crates/ui-egui/tests/scenarios/s49_sketch_point_toolbar.json b/crates/ui-egui/tests/scenarios/s49_sketch_point_toolbar.json
new file mode 100644
index 0000000000..4016041af0
--- /dev/null
+++ b/crates/ui-egui/tests/scenarios/s49_sketch_point_toolbar.json
@@ -0,0 +1,27 @@
+[
+ {"note":"#191: Point is a default Sketch CREATE button; the existing six drawing buttons remain available."},
+ {"call":"engine.execute","params":{"command":"sketch.create","params":{"plane":"XY"}}},
+ {"expect":{"shown_handles":["button:sketch.line","button:sketch.rectangle.two_point","button:sketch.rectangle.three_point","button:sketch.rectangle.center","button:sketch.circle.center","button:sketch.circle.two_point","button:sketch.point"]}},
+ {"click":{"handle":"button:sketch.point"}},
+ {"expect":{"tool":"sketch.point","dialog":null}},
+ {"click":{"sketch":[20,15]}},
+ {"key":"Escape"},
+ {"expect":{"errors":0,"sketch_world":{"point":"p1","at":[20,15,0]}}},
+ {"call":"ui.menu","params":{"x":400,"y":80,"target":{"type":"toolbar_command","id":"sketch.point"}}},
+ {"call":"ui.menuPick","params":{"item":"Remove from Toolbar"}},
+ {"expect":{"hidden_handles":["button:sketch.point"]}},
+ {"restart":"close"},
+ {"call":"engine.execute","params":{"command":"sketch.create","params":{"plane":"XY"}}},
+ {"expect":{"hidden_handles":["button:sketch.point"]}},
+ {"click":{"handle":"panel:SKETCH:CREATE"}},
+ {"expect":{"shown_handles":["dropdown:sketch.point"]}},
+ {"click":{"handle":"dropdown:sketch.point"}},
+ {"key":"Escape"},
+ {"call":"ui.menu","params":{"x":400,"y":80,"target":{"type":"toolbar"}}},
+ {"call":"ui.menuPick","params":{"item":"Reset Toolbar"}},
+ {"expect":{"shown_handles":["button:sketch.point","button:sketch.line"],"errors":0}},
+ {"call":"ui.resize","params":{"width":640,"height":720}},
+ {"click":{"handle":"panel:SKETCH:CREATE"}},
+ {"click":{"handle":"dropdown:sketch.point"}},
+ {"expect":{"tool":"sketch.point","errors":0}}
+]
diff --git a/docs/book/src/guide/sketching.md b/docs/book/src/guide/sketching.md
index 19b6854f24..1041951905 100644
--- a/docs/book/src/guide/sketching.md
+++ b/docs/book/src/guide/sketching.md
@@ -21,6 +21,10 @@ constraint status and **Finish Sketch** button remain visible.
## Geometry
+**Point** is available directly on the default Sketch **CREATE** toolbar. Click it, then
+click in the sketch to place a point. Existing toolbar customizations are kept; use
+**Reset Toolbar** from the toolbar's context menu to restore the default buttons.
+
Lines and polylines (L), rectangles (two-point R, three-point, centre), circles (centre C,
two-point, three-point, tangent), arcs (three-point, centre, tangent), polygons, slots, ellipses,
fit-point and control-point splines, conics, points and text. **Construction** (X) turns curves