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

Sketches drive surface extrudes, revolves, sweeps and lofts, so the Surface
tab gets the same Sketch panel as Model and Sheet Metal. A sketch started
there keeps the tab until it opens.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bherbruck
2026-10-20 21:57:10 -04:00
committed by GitHub
parent bdd2fb1a5c
commit bd65a561c8
2 changed files with 20 additions and 0 deletions
+19
View File
@@ -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");
}
}
+1
View File
@@ -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`** |