Skip to content

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

Ribbon: New Sketch on the Surface tab (#3964)

bherbruckbd65a561c89c
diff --git a/crates/ui-egui/src/workspace.rs b/crates/ui-egui/src/workspace.rs
index ebeb8428e8..eab60311b9 100644
--- a/crates/ui-egui/src/workspace.rs
+++ b/crates/ui-egui/src/workspace.rs
@@ -91,6 +91,8 @@ pub const SECTIONS: &[Section] = &[
},
Section { tab: "MODEL", panel: "CONFIGURE", promoted: 2, ids: CONFIGURE },
Section { tab: "MODEL", panel: "CONSTRUCT", promoted: 1, ids: &["construct.plane.offset"] },
+ // Sketches drive surfaces too: New Sketch leads the tab, as on MODEL and SHEET METAL.
+ Section { tab: "SURFACE", panel: "SKETCH", promoted: 1, ids: &["sketch.create"] },
Section { tab: "SURFACE", panel: "CREATE", promoted: 4, ids: &["surface.extrude", "surface.revolve", "surface.sweep", "surface.loft"] },
Section { tab: "SURFACE", panel: "EDIT", promoted: 4, ids: &["surface.trim", "surface.untrim", "surface.extend", "surface.stitch"] },
Section { tab: "SURFACE", panel: "CONVERT", promoted: 2, ids: &["surface.thicken", "mesh.convert"] },
@@ -634,6 +636,7 @@ mod tests {
("ASSEMBLE", "COMPONENTS", "component.insert_design"),
("SHEET METAL", "CREATE", "sheet.convert"),
("SHEET METAL", "SKETCH", "sketch.create"),
+ ("SURFACE", "SKETCH", "sketch.create"),
("SKETCH", "REFERENCE", "canvas.insert"),
] {
assert!(layout(tab, panel, &specs).unwrap().0.iter().any(|c| c.id == id));
@@ -948,4 +951,20 @@ mod tests {
assert!(h.app.session.active_sketch.is_some());
assert_eq!(h.app.ui.tab, "SKETCH");
}
+
+ /// New Sketch is on the SURFACE tab too, and a sketch started there stays on that tab until
+ /// it opens.
+ #[test]
+ fn new_sketch_starts_from_the_surface_tab() {
+ let mut h = crate::scenario::Harness::new();
+ h.step(&json!({"click": {"handle": "tab:SURFACE"}})).unwrap();
+ h.frames(2);
+ h.step(&json!({"click": {"handle": "button:sketch.create"}})).unwrap();
+ h.frames(2);
+ assert_eq!(h.app.ui.tab, "SURFACE", "New Sketch is on this tab, so it stays");
+ h.step(&json!({"click": {"plane": "XY"}})).unwrap();
+ h.frames(2);
+ assert!(h.app.session.active_sketch.is_some());
+ assert_eq!(h.app.ui.tab, "SKETCH");
+ }
}
diff --git a/docs/ribbon-layout.md b/docs/ribbon-layout.md
index 2a42cb7fd5..8ce6677906 100644
--- a/docs/ribbon-layout.md
+++ b/docs/ribbon-layout.md
@@ -14,6 +14,7 @@ Always shown, in order: MODEL, SURFACE, ASSEMBLE, INSERT, INSPECT, MANAGE, VIEW,
| MODEL | ARRANGE | **`solid.move`**, **`solid.mirror`**, **`solid.pattern.rectangular`**, `solid.align`, `solid.pattern.circular`, `solid.pattern.path` |
| MODEL | CONFIGURE | **`parameters.change`**, **`config.table`**, `config.configure` |
| MODEL | CONSTRUCT | **`construct.plane.offset`**, `construct.plane.at_angle`, `construct.axis.through_cylinder`, `construct.axis.normal_to_face`, `construct.axis.two_planes`, `construct.axis.two_points`, `construct.axis.edge`, `construct.point.vertex`, `construct.point.two_edges`, `construct.point.three_planes`, `construct.point.center`, `construct.point.edge_plane`, `construct.point.along_path`, `construct.plane.midplane`, `construct.plane.two_edges`, `construct.plane.three_points`, `construct.plane.tangent`, `construct.plane.along_path`, `construct.plane.perpendicular` |
+| SURFACE | SKETCH | **`sketch.create`** |
| SURFACE | CREATE | **`surface.extrude`**, **`surface.revolve`**, **`surface.sweep`**, **`surface.loft`**, `surface.boundary`, `surface.patch`, `surface.offset`, `surface.ruled`, `surface.blend` |
| SURFACE | EDIT | **`surface.trim`**, **`surface.untrim`**, **`surface.extend`**, **`surface.stitch`**, `surface.unstitch`, `surface.reverse_normal`, `surface.fair`, `surface.fillet`, `surface.match` |
| SURFACE | CONVERT | **`surface.thicken`**, **`mesh.convert`** |