SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.
Frames: a Weldments ribbon tab (#4003) (#5262)
Karl Von Richter44b0056d48ab
diff --git a/assets/locales/cs.json b/assets/locales/cs.jsonindex aa0884302f..297d55ef79 100644--- a/assets/locales/cs.json+++ b/assets/locales/cs.json@@ -1852,6 +1852,7 @@"ui.heading_torus": "ANULOID","ui.heading_utilities": "NÁSTROJE","ui.heading_utility": "NÁSTROJE",+ "ui.heading_weldments": "SVAŘENCE","ui.help": "Nápověda","ui.hide": "Skrýt","ui.hideAxes": "Skrýt osy",diff --git a/assets/locales/da.json b/assets/locales/da.jsonindex 332b952d24..b223792dad 100644--- a/assets/locales/da.json+++ b/assets/locales/da.json@@ -2041,6 +2041,7 @@"ui.heading_torus": "TORUS","ui.heading_utilities": "VÆRKTØJER","ui.heading_utility": "VÆRKTØJ",+ "ui.heading_weldments": "SVEJSNING","ui.help": "Hjælp","ui.hide": "Skjul","ui.hideAxes": "Skjul akser",diff --git a/assets/locales/de.json b/assets/locales/de.jsonindex c6aff9c048..7468da6af2 100644--- a/assets/locales/de.json+++ b/assets/locales/de.json@@ -1940,6 +1940,7 @@"ui.heading_torus": "TORUS","ui.heading_utilities": "WERKZEUGE","ui.heading_utility": "HILFSMITTEL",+ "ui.heading_weldments": "SCHWEISSTEILE","ui.help": "Hilfe","ui.hide": "Ausblenden","ui.hideAxes": "Achsen ausblenden",diff --git a/assets/locales/en.json b/assets/locales/en.jsonindex dfa2663f89..ea3cab9a56 100644--- a/assets/locales/en.json+++ b/assets/locales/en.json@@ -2806,6 +2806,7 @@"ui.heading_torus": "TORUS","ui.heading_utilities": "UTILITIES","ui.heading_utility": "UTILITY",+ "ui.heading_weldments": "WELDMENTS","ui.help": "Help","ui.hide": "Hide","ui.hideAxes": "Hide Axes",diff --git a/assets/locales/es.json b/assets/locales/es.jsonindex 2b413af789..0422ee6531 100644--- a/assets/locales/es.json+++ b/assets/locales/es.json@@ -2335,6 +2335,7 @@"ui.heading_torus": "TORO","ui.heading_utilities": "UTILIDADES","ui.heading_utility": "UTILIDAD",+ "ui.heading_weldments": "SOLDADURA","ui.help": "Ayuda","ui.hide": "Ocultar","ui.hideAxes": "Ocultar ejes",diff --git a/assets/locales/fr.json b/assets/locales/fr.jsonindex 26aa075cf5..c8950986b7 100644--- a/assets/locales/fr.json+++ b/assets/locales/fr.json@@ -1698,6 +1698,7 @@"ui.heading_torus": "TORE","ui.heading_utilities": "UTILITAIRES","ui.heading_utility": "UTILITAIRE",+ "ui.heading_weldments": "MÉCANO-SOUDURE","ui.help": "Aide","ui.hide": "Masquer","ui.hideAxes": "Masquer les axes",diff --git a/assets/locales/gl.json b/assets/locales/gl.jsonindex 1983aa9b48..6ed41e7afa 100644--- a/assets/locales/gl.json+++ b/assets/locales/gl.json@@ -1684,6 +1684,7 @@"ui.heading_torus": "TORO","ui.heading_utilities": "UTILIDADES","ui.heading_utility": "UTILIDADE",+ "ui.heading_weldments": "SOLDADURA","ui.help": "Axuda","ui.hide": "Ocultar","ui.hideAxes": "Ocultar os eixes",diff --git a/assets/locales/hu.json b/assets/locales/hu.jsonindex 6aac08f01d..185c7764b5 100644--- a/assets/locales/hu.json+++ b/assets/locales/hu.json@@ -1626,6 +1626,7 @@"ui.heading_torus": "TÓRUSZ","ui.heading_utilities": "SEGÉDESZKÖZÖK","ui.heading_utility": "SEGÉDESZKÖZ",+ "ui.heading_weldments": "HEGESZTÉS","ui.help": "Súgó","ui.hide": "Elrejtés","ui.hideAxes": "Tengelyek elrejtése",diff --git a/assets/locales/id.json b/assets/locales/id.jsonindex 11eae48e27..bdc4af34d0 100644--- a/assets/locales/id.json+++ b/assets/locales/id.json@@ -1626,6 +1626,7 @@"ui.heading_torus": "TORUS","ui.heading_utilities": "UTILITAS","ui.heading_utility": "UTILITAS",+ "ui.heading_weldments": "KONSTRUKSI LAS","ui.help": "Bantuan","ui.hide": "Sembunyikan","ui.hideAxes": "Sembunyikan Sumbu",diff --git a/assets/locales/it.json b/assets/locales/it.jsonindex 1c61ab57a9..c8393c23ab 100644--- a/assets/locales/it.json+++ b/assets/locales/it.json@@ -1701,6 +1701,7 @@"ui.heading_torus": "TORO","ui.heading_utilities": "UTILITÀ","ui.heading_utility": "UTILITÀ",+ "ui.heading_weldments": "SALDATURE","ui.help": "Aiuto","ui.hide": "Nascondi","ui.hideAxes": "Nascondi assi",diff --git a/assets/locales/ja.json b/assets/locales/ja.jsonindex b5cc402607..856130f0bd 100644--- a/assets/locales/ja.json+++ b/assets/locales/ja.json@@ -2806,6 +2806,7 @@"ui.heading_torus": "トーラス","ui.heading_utilities": "ユーティリティ","ui.heading_utility": "ユーティリティ",+ "ui.heading_weldments": "溶接構造","ui.help": "ヘルプ","ui.hide": "非表示","ui.hideAxes": "軸を非表示",diff --git a/assets/locales/ko.json b/assets/locales/ko.jsonindex 7f587c0fa1..19cd9d851f 100644--- a/assets/locales/ko.json+++ b/assets/locales/ko.json@@ -2107,6 +2107,7 @@"ui.heading_torus": "토러스","ui.heading_utilities": "유틸리티","ui.heading_utility": "유틸리티",+ "ui.heading_weldments": "용접 구조물","ui.help": "도움말","ui.hide": "숨기기","ui.hideAxes": "축 숨기기",diff --git a/assets/locales/ms.json b/assets/locales/ms.jsonindex e25eb7d9db..2986165d8d 100644--- a/assets/locales/ms.json+++ b/assets/locales/ms.json@@ -1684,6 +1684,7 @@"ui.heading_torus": "TORUS","ui.heading_utilities": "UTILITI","ui.heading_utility": "UTILITI",+ "ui.heading_weldments": "KIMPALAN","ui.help": "Bantuan","ui.hide": "Sembunyi","ui.hideAxes": "Sembunyi Paksi",diff --git a/assets/locales/nl.json b/assets/locales/nl.jsonindex 6791dc2919..6249afd9a0 100644--- a/assets/locales/nl.json+++ b/assets/locales/nl.json@@ -1626,6 +1626,7 @@"ui.heading_torus": "TORUS","ui.heading_utilities": "HULPPROGRAMMA'S","ui.heading_utility": "HULPPROGRAMMA",+ "ui.heading_weldments": "LASWERK","ui.help": "Help","ui.hide": "Verbergen","ui.hideAxes": "Assen verbergen",diff --git a/assets/locales/pl.json b/assets/locales/pl.jsonindex 7d9591d45f..888bfc0003 100644--- a/assets/locales/pl.json+++ b/assets/locales/pl.json@@ -1871,6 +1871,7 @@"ui.heading_torus": "TORUS","ui.heading_utilities": "NARZĘDZIA","ui.heading_utility": "NARZĘDZIE",+ "ui.heading_weldments": "SPAWANIE","ui.help": "Pomoc","ui.hide": "Ukryj","ui.hideAxes": "Ukryj osie",diff --git a/assets/locales/pt-BR.json b/assets/locales/pt-BR.jsonindex 42604bb9ef..ac7331be57 100644--- a/assets/locales/pt-BR.json+++ b/assets/locales/pt-BR.json@@ -2006,6 +2006,7 @@"ui.heading_torus": "TORO","ui.heading_utilities": "UTILITÁRIOS","ui.heading_utility": "UTILITÁRIO",+ "ui.heading_weldments": "SOLDAGEM","ui.help": "Ajuda","ui.hide": "Ocultar","ui.hideAxes": "Ocultar eixos",diff --git a/assets/locales/ro.json b/assets/locales/ro.jsonindex 01cec7dbd9..124d1361bc 100644--- a/assets/locales/ro.json+++ b/assets/locales/ro.json@@ -1626,6 +1626,7 @@"ui.heading_torus": "TOR","ui.heading_utilities": "UTILITARE","ui.heading_utility": "UTILITAR",+ "ui.heading_weldments": "SUDURĂ","ui.help": "Ajutor","ui.hide": "Ascunde","ui.hideAxes": "Ascunde axele",diff --git a/assets/locales/ru.json b/assets/locales/ru.jsonindex e13f608b63..cf4586fec8 100644--- a/assets/locales/ru.json+++ b/assets/locales/ru.json@@ -1683,6 +1683,7 @@"ui.heading_torus": "ТОР","ui.heading_utilities": "УТИЛИТЫ","ui.heading_utility": "УТИЛИТА",+ "ui.heading_weldments": "СВАРКА","ui.help": "Справка","ui.hide": "Скрыть","ui.hideAxes": "Скрыть оси",diff --git a/assets/locales/sv.json b/assets/locales/sv.jsonindex b4c31c7263..8c527e5e90 100644--- a/assets/locales/sv.json+++ b/assets/locales/sv.json@@ -1626,6 +1626,7 @@"ui.heading_torus": "TORUS","ui.heading_utilities": "VERKTYG","ui.heading_utility": "VERKTYG",+ "ui.heading_weldments": "SVETSNING","ui.help": "Hjälp","ui.hide": "Dölj","ui.hideAxes": "Dölj axlar",diff --git a/assets/locales/tr.json b/assets/locales/tr.jsonindex 413a877132..a36053cab1 100644--- a/assets/locales/tr.json+++ b/assets/locales/tr.json@@ -1683,6 +1683,7 @@"ui.heading_torus": "TORUS","ui.heading_utilities": "ARAÇLAR","ui.heading_utility": "YARDIMCI ARAÇLAR",+ "ui.heading_weldments": "KAYNAK","ui.help": "Yardım","ui.hide": "Gizle","ui.hideAxes": "Eksenleri gizle",diff --git a/assets/locales/uk.json b/assets/locales/uk.jsonindex 53fdcd7053..a4d89b48b1 100644--- a/assets/locales/uk.json+++ b/assets/locales/uk.json@@ -1979,6 +1979,7 @@"ui.heading_torus": "ТОР","ui.heading_utilities": "УТИЛІТИ","ui.heading_utility": "УТИЛІТА",+ "ui.heading_weldments": "ЗВАРЮВАННЯ","ui.help": "Довідка","ui.hide": "Приховати","ui.hideAxes": "Приховати осі",diff --git a/assets/locales/vi.json b/assets/locales/vi.jsonindex 220b93c08c..df12ada4c4 100644--- a/assets/locales/vi.json+++ b/assets/locales/vi.json@@ -1684,6 +1684,7 @@"ui.heading_torus": "HÌNH XUYẾN","ui.heading_utilities": "TIỆN ÍCH","ui.heading_utility": "TIỆN ÍCH",+ "ui.heading_weldments": "KẾT CẤU HÀN","ui.help": "Trợ giúp","ui.hide": "Ẩn","ui.hideAxes": "Ẩn Các trục",diff --git a/assets/locales/zh-TW.json b/assets/locales/zh-TW.jsonindex b98c39ebc0..c8a977edda 100644--- a/assets/locales/zh-TW.json+++ b/assets/locales/zh-TW.json@@ -1626,6 +1626,7 @@"ui.heading_torus": "圓環體","ui.heading_utilities": "工具","ui.heading_utility": "實用工具",+ "ui.heading_weldments": "焊件","ui.help": "說明","ui.hide": "隱藏","ui.hideAxes": "隱藏軸",diff --git a/assets/locales/zh.json b/assets/locales/zh.jsonindex af09650a30..e91c4b3783 100644--- a/assets/locales/zh.json+++ b/assets/locales/zh.json@@ -2806,6 +2806,7 @@"ui.heading_torus": "圆环体","ui.heading_utilities": "工具","ui.heading_utility": "实用工具",+ "ui.heading_weldments": "焊件","ui.help": "帮助","ui.hide": "隐藏","ui.hideAxes": "隐藏轴",diff --git a/crates/engine/src/cmd/frame.rs b/crates/engine/src/cmd/frame.rsindex aabd51c72c..57a0f432f3 100644--- a/crates/engine/src/cmd/frame.rs+++ b/crates/engine/src/cmd/frame.rs@@ -30,7 +30,7 @@ macro_rules! profile_doc {}pub static COMMANDS: &[CommandSpec] = &[- CommandSpec::new("frame.member", "Frame Member", member).at("SOLID", "CREATE").icon("frame_member").enabled(not_in_sketch).params(concat!(+ CommandSpec::new("frame.member", "Frame Member", member).at("WELDMENTS", "CREATE").icon("frame_member").enabled(not_in_sketch).params(concat!("sketch: the frame sketch (id or name; 2D or 3D); lines?: [curve ids] (one member each; default: every straight line drawn in the sketch: not construction, not projected or otherwise linked, not of no length); ",profile_doc!()," | profile_sketch: a sketch whose profile is the section, in its own x and y around its origin, with profiles?: picks as solid.extrude takes them (default: its material, nested loops alternating, so two circles make a tube); anchor?: origin|center|centroid|top_left|top|top_right|left|right|bottom_left|bottom|bottom_right (the profile point that sits on each line, default origin); angle?: angle expr (the profile turned about the line; default 0: its y as near world up as the line allows, a vertical member's x along world X); mirror?: bool (the profile mirrored across its y axis); name?; body_name? (what the members are named after, then numbered: `Rail`, `Rail (2)`…; default the profile's description, `Rect Tube 40x40x3`, or the profile sketch's name); names?: {line id: name} (names to keep, as Edit Feature keeps them). One body per line, from its start to its end; each member keeps its name when other lines are added or deleted. Returns the feature and the bodies it made"diff --git a/crates/ui-egui/src/toolbar.rs b/crates/ui-egui/src/toolbar.rsindex 723dd4059a..e544059356 100644--- a/crates/ui-egui/src/toolbar.rs+++ b/crates/ui-egui/src/toolbar.rs@@ -898,8 +898,9 @@ fn ribbon_text(ui: &egui::Ui, at: egui::Pos2, text: &str, size: f32, color: Colo}/// SKETCH while editing a sketch and SHEET METAL while a sheet body is active take the contextual-/// tab style; SHEET METAL is an ordinary tab otherwise.-fn contextual_tab(app: &SolveApp, tab: &str) -> bool {+/// tab style; SHEET METAL is an ordinary tab otherwise. WELDMENTS selects itself on a frame member+/// but keeps the ordinary tab look, as MODEL has when selected.+pub(crate) fn contextual_tab(app: &SolveApp, tab: &str) -> bool {tab == "SKETCH" || (tab == "SHEET METAL" && crate::workspace::sheet_body(app).is_some())}diff --git a/crates/ui-egui/src/workspace.rs b/crates/ui-egui/src/workspace.rsindex d3c0ce96f4..dccb1689e3 100644--- a/crates/ui-egui/src/workspace.rs+++ b/crates/ui-egui/src/workspace.rs@@ -61,8 +61,8 @@ pub struct Section {}/// Parameters and Configurations stay on every design tab they were on before the ribbon-/// redesign (MODEL and SHEET METAL), on SKETCH while editing a sketch, and in MANAGE, their-/// canonical home.+/// redesign (MODEL and SHEET METAL), on SKETCH while editing a sketch, on WELDMENTS, and in+/// MANAGE, their canonical home.const CONFIGURE: &[&str] = &["parameters.change", "config.table", "config.configure"];/// Commands that stay for agents, MCP and scripts but are not offered to people: the sketch solves@@ -259,6 +259,10 @@ pub const SECTIONS: &[Section] = &[Section { tab: "SHEET METAL", panel: "OUTPUT", promoted: 2, ids: &["sheet.export_dxf", "sheet.export_bend_table"] },Section { tab: "SHEET METAL", panel: "RULES", promoted: 1, ids: &["sheet.manage_rules"] },Section { tab: "SHEET METAL", panel: "CONFIGURE", promoted: 2, ids: CONFIGURE },+ // A frame starts from a sketch of its lines; its profile sizes are often parameters.+ Section { tab: "WELDMENTS", panel: "SKETCH", promoted: 1, ids: &["sketch.create"] },+ Section { tab: "WELDMENTS", panel: "CREATE", promoted: 1, ids: &["frame.member"] },+ Section { tab: "WELDMENTS", panel: "CONFIGURE", promoted: 2, ids: CONFIGURE },// One Render tab with task-ordered groups; only implemented registry commands.// The shared ribbon owns pins, search, section menus and responsive overflow.Section {@@ -421,6 +425,7 @@ pub const PLACEMENTS: &[(&str, &str, &str, &str)] = &[("SKETCH", "FINISH SKETCH", "SKETCH", "FINISH SKETCH"),("SHEET METAL", "CREATE", "SHEET METAL", "CREATE"),("SHEET METAL", "MODIFY", "SHEET METAL", "FLAT"),+ ("WELDMENTS", "CREATE", "WELDMENTS", "CREATE"),("PLASTIC", "CREATE", "MODEL", "CREATE"),("PLASTIC", "SETUP", "MANAGE", "RULES"),("MESH", "MODIFY", "INSERT", "FILES"),@@ -504,21 +509,35 @@ pub fn feature_icon(k: &FeatureKind) -> Option<&'static str> {}/// Selected geometry identifies the active body; without a body selection use the last body-/// of the active component, matching feature dialogs. Rules on unrelated bodies do not count.-pub fn sheet_body(app: &crate::SolveApp) -> Option<String> {+/// of the active component, matching feature dialogs.+fn active_body<'a>(app: &'a crate::SolveApp, state: &'a solidcraft_engine::doc::ModelState) -> Option<&'a str> {use solidcraft_engine::Sel;- let state = app.session.model.state();let selected = app.session.selection.iter().find_map(|s| match s {Sel::Body { name } => Some(name.as_str()),Sel::Face { body, .. } | Sel::Edge { body, .. } => Some(body.as_str()),_ => None,});- let body = selected.or_else(|| {+ selected.or_else(|| {state.bodies.iter().rev().find(|b| app.session.doc.model_body_component(b) == app.session.active_component).map(|b| b.name.as_str())- })?;+ })+}++/// The active body when it is sheet metal. Rules on unrelated bodies do not count.+pub fn sheet_body(app: &crate::SolveApp) -> Option<String> {+ let state = app.session.model.state();+ let body = active_body(app, &state)?;state.sheets.iter().find(|s| s.body == body).map(|s| s.body.clone())}+/// The active body when a Frame Member feature made it.+pub fn frame_body(app: &crate::SolveApp) -> Option<String> {+ let state = app.session.model.state();+ let name = active_body(app, &state)?;+ let body = state.bodies.iter().find(|b| b.name == name)?;+ let made_by = app.session.doc.feature(body.feature)?;+ matches!(made_by.kind, FeatureKind::FrameMember { .. }).then(|| body.name.clone())+}+pub fn visible_tabs(app: &crate::SolveApp) -> Vec<&'static str> {if crate::render_workspace::active(app) {return vec!["RENDER"];@@ -528,18 +547,26 @@ pub fn visible_tabs(app: &crate::SolveApp) -> Vec<&'static str> {tabs.push("SKETCH");}// Always reachable, as before the ribbon redesign: a sheet-metal part starts from an- // ordinary sketch or solid, so the tab cannot wait for a sheet body.+ // ordinary sketch or solid, so the tab cannot wait for a sheet body. A frame starts+ // from a sketch of its lines, so Weldments is always there too.tabs.push("SHEET METAL");+ tabs.push("WELDMENTS");tabs}-/// Select contextual tabs on entry (or a different sheet body), allowing the other tabs to-/// remain usable for the rest of that context. Sketch takes precedence over sheet metal.+/// Select contextual tabs on entry (or a different sheet body or frame member), allowing the+/// other tabs to remain usable for the rest of that context. Sketch takes precedence over sheet+/// metal, and sheet metal over weldments.pub fn sync_context(app: &mut crate::SolveApp) {if crate::render_workspace::active(app) {return;}- let context = app.session.active_sketch.map(|id| format!("sketch:{id}")).or_else(|| sheet_body(app).map(|body| format!("sheet:{body}")));+ let context = app+ .session+ .active_sketch+ .map(|id| format!("sketch:{id}"))+ .or_else(|| sheet_body(app).map(|body| format!("sheet:{body}")))+ .or_else(|| frame_body(app).map(|body| format!("frame:{body}")));if app.ui.ribbon_context != context {let was_sketch = app.ui.ribbon_context.as_deref().is_some_and(|c| c.starts_with("sketch:"));let back = if app.session.active_sketch.is_some() {@@ -558,6 +585,8 @@ pub fn sync_context(app: &mut crate::SolveApp) {} else if let Some(back) = back.as_deref().filter(|t| *t != "SKETCH" && visible_tabs(app).contains(t)) {// Finishing a sketch goes back to the tab it came from (#3250).visible_tabs(app).into_iter().find(|t| t == &back).unwrap_or("MODEL")+ } else if context.as_deref().is_some_and(|c| c.starts_with("frame:")) {+ "WELDMENTS"} else if context.is_some() {"SHEET METAL"} else {@@ -752,8 +781,8 @@ mod tests {fn contextual_tabs_follow_the_active_body_and_allow_other_tabs() {let mut h = crate::scenario::Harness::new();let mut fresh = TABS.to_vec();- fresh.push("SHEET METAL");- assert_eq!(visible_tabs(&h.app), fresh, "SHEET METAL is reachable before any sheet body exists");+ fresh.extend(["SHEET METAL", "WELDMENTS"]);+ assert_eq!(visible_tabs(&h.app), fresh, "SHEET METAL and WELDMENTS are reachable before any sheet body or member exists");h.app.run("sketch.create", json!({"plane":"XY"})).unwrap();assert_eq!(h.app.ui.tab, "SKETCH");h.app.run("sketch.rectangle.two_point", json!({"p0":[0,0],"p1":[40,30]})).unwrap();@@ -780,6 +809,50 @@ mod tests {assert_eq!(h.app.ui.tab, "SHEET METAL");}+ /// Weldments is there in a fresh document (a frame starts from a sketch of its lines), holds+ /// Frame Member, and selects itself while a member is the active body, as Sheet Metal does for+ /// a sheet body, but keeps the ordinary tab look.+ #[test]+ fn weldments_tab_holds_frame_member_and_follows_a_member_body() {+ let specs = solidcraft_engine::command_specs();+ assert_eq!(panels("WELDMENTS"), ["SKETCH", "CREATE", "CONFIGURE"]);+ let (create, n) = layout("WELDMENTS", "CREATE", &specs).unwrap();+ assert_eq!(create.iter().take(n).map(|c| c.id).collect::<Vec<_>>(), ["frame.member"]);+ assert!(!panel_ids("MODEL", &specs).contains(&"frame.member"), "Frame Member's home is Weldments");++ let mut h = crate::scenario::Harness::new();+ h.step(&json!({"click":{"handle":"tab:WELDMENTS"}})).unwrap();+ h.frames(2);+ assert_eq!(h.app.ui.tab, "WELDMENTS");+ for id in ["sketch.create", "frame.member", "parameters.change"] {+ assert!(crate::scenario::handle_at(&format!("button:{id}")).is_some(), "{id} is a button on the Weldments tab");+ }+ h.step(&json!({"click":{"handle":"button:frame.member"}})).unwrap();+ assert!(matches!(h.app.dialog.as_ref().map(|d| &d.kind), Some(crate::dialogs::Kind::Frame(_))));+ assert_eq!(h.app.ui.tab, "WELDMENTS", "Frame Member opens from the tab without leaving it");+ h.step(&json!({"key":"Escape"})).unwrap();++ h.app.run("sketch.create", json!({"plane":"XZ", "name":"Frame"})).unwrap();+ h.app.run("sketch.rectangle.two_point", json!({"p0":[0,0],"p1":[600,400]})).unwrap();+ h.app.run("sketch.finish", json!({})).unwrap();+ h.app.run("solid.box", json!({"body_name":"Plate", "operation":"new", "length":100, "width":100, "height":10})).unwrap();+ assert!(frame_body(&h.app).is_none(), "a plain solid is not a member");+ h.app.ui.tab = "INSPECT".into();+ let tube = json!({"kind":"rect_tube", "width":40, "height":40, "wall":3});+ h.app.run("frame.member", json!({"sketch":"Frame", "profile":tube, "body_name":"Rail"})).unwrap();+ assert_eq!(frame_body(&h.app).as_deref(), Some("Rail (4)"));+ assert_eq!(h.app.ui.tab, "WELDMENTS", "a new member selects the tab");+ assert!(!crate::toolbar::contextual_tab(&h.app, "WELDMENTS"), "selected on a member, it keeps the ordinary tab look");++ h.app.run("select.set", json!({"items":[{"type":"body","name":"Plate"}]})).unwrap();+ sync_context(&mut h.app);+ assert!(frame_body(&h.app).is_none());+ assert!(visible_tabs(&h.app).contains(&"WELDMENTS"), "the tab stays reachable off a member");+ h.app.run("select.set", json!({"items":[{"type":"body","name":"Rail (2)"}]})).unwrap();+ sync_context(&mut h.app);+ assert_eq!(h.app.ui.tab, "WELDMENTS");+ }+/// Parameters and Configurations are on the design tabs they were on before the redesign, and a/// fresh document reaches Sheet Metal (to flange a sketch or convert a solid) by its tab.#[test]diff --git a/docs/control-protocol.md b/docs/control-protocol.mdindex ba47e87cea..d57758ea10 100644--- a/docs/control-protocol.md+++ b/docs/control-protocol.md@@ -289,7 +289,7 @@ labels; `prefs:measure_axis_distances` identifies the checkbox.| `ui.dialogInput` | `index` | what clicking an input's Select chip does: picks go to that input || `ui.at` | `world: [x,y,z]` \| `sketch: [x,y]` \| `plane: "XY"` \| `axis: "Z"` \| `dimension: "d1"` (its value text) \| `handle: "arrow"` (a manipulator handle, see `scenario::publish_handle`) | the screen point (a scenario step's target; see `crates/ui-egui/src/scenario.rs`) || `ui.pick` | `pixels?: [[x,y]…]`, `rays?: [{origin, dir}…]`, `frame?: "window"\|"model"`, `width?`, `height?`, `edges?` (default true), `edge_px?` (default 6), `all?`, `include_ghosted?` | read-only geometry under each pixel or ray (#6304): one entry per input, `null` where nothing is hit — body, face index, exact world `point` and outward `normal`, `depth`, `occurrence`/`component` for placed parts, `edge`/`vertex` within `edge_px` of a pixel, `section_cap: true` on a cut face. `window` pixels are physical pixels of a window screenshot; `model` pixels are pixels of a `ui.render` of `width`×`height` (default 960×600), so it works headless. As `view.pick` through `engine.execute`/`engine.batch`. See `crates/ui-egui/src/view_pick.rs` |-| `ui.handles` | `prefix?` | the handles drawn last frame, `[{name, x, y}]`: toolbar buttons and drop-down items `toolbar:<command id>` (the button alone: `button:<command id>`; a drop-down row: `dropdown:<command id>`, highlighted `dropdown_hot:<command id>`, its pin `dropdown_pin:<command id>`; Customize Toolbar's check boxes `customize:<command id>`), ribbon tabs `tab:<name>` (MODEL, SURFACE, ASSEMBLE, INSERT, INSPECT, MANAGE, VIEW; contextual SKETCH and SHEET METAL; workspace RENDER), panel labels `panel:<tab>:<panel>` (also `ribbon:section:<TAB>:<SECTION>`), document overflow list `tab:overflow`, workspace column `ribbon:workspace`, command-search launcher `ribbon:search`, browser rows `row:<label>` and fold arrows `fold:<label>`, manipulator handles; signed-axis tips `axis_view:z`, `axis_view:-y`; optional cube facets `navigation_cube:top`, `navigation_cube:top_front_right`, controls `navigation_cube:control:home` (and other actions), plus signed-axis aliases for visible cube faces; Preferences navigator picker `prefs:navigator`, options `prefs:navigator:Signed axes` and `prefs:navigator:Cube`; in the Motion Study dialog, where the chart puts its first and last step `motion:chart_start` and `motion:chart_end`, the Check collisions button `motion:check` and each collision found `motion:collision:<n>` |+| `ui.handles` | `prefix?` | the handles drawn last frame, `[{name, x, y}]`: toolbar buttons and drop-down items `toolbar:<command id>` (the button alone: `button:<command id>`; a drop-down row: `dropdown:<command id>`, highlighted `dropdown_hot:<command id>`, its pin `dropdown_pin:<command id>`; Customize Toolbar's check boxes `customize:<command id>`), ribbon tabs `tab:<name>` (MODEL, SURFACE, ASSEMBLE, INSERT, INSPECT, MANAGE, VIEW, SHEET METAL, WELDMENTS; contextual SKETCH; workspace RENDER), panel labels `panel:<tab>:<panel>` (also `ribbon:section:<TAB>:<SECTION>`), document overflow list `tab:overflow`, workspace column `ribbon:workspace`, command-search launcher `ribbon:search`, browser rows `row:<label>` and fold arrows `fold:<label>`, manipulator handles; signed-axis tips `axis_view:z`, `axis_view:-y`; optional cube facets `navigation_cube:top`, `navigation_cube:top_front_right`, controls `navigation_cube:control:home` (and other actions), plus signed-axis aliases for visible cube faces; Preferences navigator picker `prefs:navigator`, options `prefs:navigator:Signed axes` and `prefs:navigator:Cube`; in the Motion Study dialog, where the chart puts its first and last step `motion:chart_start` and `motion:chart_end`, the Check collisions button `motion:check` and each collision found `motion:collision:<n>` || `ui.editFeature` | `feature` (id or name) | what double-clicking a timeline item does: rolls back to it and opens its dialog filled in (sketches open in sketch mode) || `ui.scroll` | `x`, `y`, `delta?` | wheel zoom at the cursor || `ui.key` | `key` (egui key name, `Enter`, `Escape`…), `cmd?`, `ctrl?`, `shift?`, `alt?`, `pressed?` | By default, press and release, then release modifiers. With `pressed: true` or `false`, send only that edge; modifiers remain as given. `cmd` retains the legacy primary-modifier alias unless `ctrl` is explicit: `cmd:true, ctrl:false` sends physical Command, and both true sends Control+Command. `ui.move` can change modifiers between edges. |diff --git a/docs/frames.md b/docs/frames.mdindex 9efa485ab8..f0655e6d99 100644--- a/docs/frames.md+++ b/docs/frames.md@@ -12,7 +12,7 @@ members and their profiles. Corners, trims, end caps, gussets, welds and the cut2. **Choose a profile**: a built-in one from its dimensions (below), or your own drawn in a sketch(a vendor's extrusion: insert their DXF with `sketch.insert_dxf`). A profile sketch's origin isthe point that sits on each line, and its x and y are the profile's.-3. **Add members**: **Frame Member** (MODEL › CREATE, `frame.member`) makes one body per line,+3. **Add members**: **Frame Member** (WELDMENTS › CREATE, `frame.member`) makes one body per line,square to it, from its start to its end. Repeat with another profile for the next group oflines.@@ -24,6 +24,10 @@ members and their profiles. Corners, trims, end caps, gussets, welds and the cutMembers are ordinary bodies: mirror, pattern, move, drill and combine them with the usualcommands. Where members meet they overlap until corner treatments land.+The **Weldments** ribbon tab gathers the frame commands: New Sketch, Frame Member and+Parameters. Like Sheet Metal it is always there, and it selects itself when a frame member is+the selected body (or the last body of the active component).+## The Frame Member dialog- **Lines**: pick the frame sketch's lines in the view (2D or 3D sketch lines). **All Lines**diff --git a/docs/ribbon-layout.md b/docs/ribbon-layout.mdindex ec4a31f9a1..c60860e29c 100644--- a/docs/ribbon-layout.md+++ b/docs/ribbon-layout.md@@ -2,14 +2,14 @@The UI layout in `crates/ui-egui/src/workspace.rs` maps the original engine registry placements into ribbon sections. `docs/features.md` continues to document registry placements; command registrations and ids are unchanged.-Always shown, in order: MODEL, SURFACE, ASSEMBLE, INSERT, INSPECT, MANAGE, VIEW, SHEET METAL. SKETCH appears during sketch editing. SHEET METAL is reachable in every document, so a sheet-metal part can start from a sketch or a solid; it takes the contextual style and selects itself when the selected body (or the last body of the active component) has evaluated sheet-metal data. Entering a context selects its tab; the other tabs remain available. RENDER belongs to the Render workspace.+Always shown, in order: MODEL, SURFACE, ASSEMBLE, INSERT, INSPECT, MANAGE, VIEW, SHEET METAL, WELDMENTS. SKETCH appears during sketch editing. SHEET METAL is reachable in every document, so a sheet-metal part can start from a sketch or a solid; it takes the contextual style and selects itself when the selected body (or the last body of the active component) has evaluated sheet-metal data. WELDMENTS is reachable in every document too, since a frame starts from a sketch of its lines; it selects itself when that body is a frame member, keeping the ordinary tab look (sheet metal comes first). Entering a context selects its tab; the other tabs remain available. RENDER belongs to the Render workspace.**Bold command ids are default promoted buttons.** Every listed command remains in the section menu. Saved user pins can add buttons, as before.| Tab | Section | Command ids, in menu order ||---|---|---|| MODEL | SKETCH | **`sketch.create`**, `sketch.edit`, `sketch.line3d`, `sketch.spline3d`, `sketch.point3d`, `sketch.move3d` |-| MODEL | CREATE | **`solid.extrude`**, **`solid.revolve`**, **`solid.hole`**, `solid.sweep`, `solid.loft`, `solid.box`, `solid.cylinder`, `solid.sphere`, `solid.torus`, `solid.pipe`, `solid.bounding_solid`, `solid.thread`, `solid.boundary_fill`, `solid.coil`, `solid.rib`, `solid.web`, `solid.emboss`, `plastic.boss`, `plastic.lip`, `plastic.snap_fit`, `plastic.rest`, `frame.member` |+| MODEL | CREATE | **`solid.extrude`**, **`solid.revolve`**, **`solid.hole`**, `solid.sweep`, `solid.loft`, `solid.box`, `solid.cylinder`, `solid.sphere`, `solid.torus`, `solid.pipe`, `solid.bounding_solid`, `solid.thread`, `solid.boundary_fill`, `solid.coil`, `solid.rib`, `solid.web`, `solid.emboss`, `plastic.boss`, `plastic.lip`, `plastic.snap_fit`, `plastic.rest` || MODEL | MODIFY | **`solid.fillet`**, **`solid.chamfer`**, **`solid.shell`**, **`solid.press_pull`**, `sheet.convert`, `solid.combine`, `solid.scale`, `solid.offset_face`, `solid.draft`, `solid.split_face`, `solid.split_body`, `solid.replace_face`, `solid.remove`, `timeline.delete`, `face.delete` || 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` |@@ -52,6 +52,9 @@ Always shown, in order: MODEL, SURFACE, ASSEMBLE, INSERT, INSPECT, MANAGE, VIEW,| SHEET METAL | OUTPUT | **`sheet.export_dxf`**, **`sheet.export_bend_table`** || SHEET METAL | RULES | **`sheet.manage_rules`** || SHEET METAL | CONFIGURE | **`parameters.change`**, **`config.table`**, `config.configure` |+| WELDMENTS | SKETCH | **`sketch.create`** |+| WELDMENTS | CREATE | **`frame.member`** |+| WELDMENTS | CONFIGURE | **`parameters.change`**, **`config.table`**, `config.configure` || SKETCH | CONFIGURE | **`parameters.change`**, **`config.table`**, `config.configure` || RENDER | SCENE | **`render.scene`** || RENDER | IMAGE | **`render.start`** |@@ -93,7 +96,7 @@ Explicit command-id lists override the default placement mapping. Shared command| SOLID / CONSTRUCT | 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` || SOLID / CREATE | ASSEMBLE / JOINTS | `joint.origin` || SOLID / CREATE | MODEL / ARRANGE | `solid.pattern.rectangular`, `solid.pattern.circular`, `solid.pattern.path`, `solid.mirror` |-| SOLID / CREATE | MODEL / CREATE | `solid.extrude`, `solid.revolve`, `solid.sweep`, `solid.loft`, `solid.box`, `solid.cylinder`, `solid.sphere`, `solid.torus`, `solid.hole`, `solid.pipe`, `solid.bounding_solid`, `solid.thread`, `solid.boundary_fill`, `solid.coil`, `solid.rib`, `solid.web`, `solid.emboss`, `frame.member` |+| SOLID / CREATE | MODEL / CREATE | `solid.extrude`, `solid.revolve`, `solid.sweep`, `solid.loft`, `solid.box`, `solid.cylinder`, `solid.sphere`, `solid.torus`, `solid.hole`, `solid.pipe`, `solid.bounding_solid`, `solid.thread`, `solid.boundary_fill`, `solid.coil`, `solid.rib`, `solid.web`, `solid.emboss` || SOLID / CREATE | MODEL / SKETCH | `sketch.create` || SOLID / INSERT | INSERT / FILES | `file.insert_step`, `file.insert_mesh` || SOLID / INSERT | INSERT / LIBRARY | `parts.fastener` |@@ -110,6 +113,7 @@ Explicit command-id lists override the default placement mapping. Shared command| SURFACE / CREATE | SURFACE / CREATE | `surface.boundary`, `surface.patch`, `surface.extrude`, `surface.revolve`, `surface.sweep`, `surface.loft`, `surface.offset`, `surface.ruled`, `surface.blend` || SURFACE / INSPECT | INSPECT / SURFACE QUALITY | `inspect.continuity` || SURFACE / MODIFY | SURFACE / EDIT | `surface.stitch`, `surface.extend`, `surface.trim`, `surface.untrim`, `surface.unstitch`, `surface.reverse_normal`, `surface.fair`, `surface.fillet`, `surface.match` |+| WELDMENTS / CREATE | WELDMENTS / CREATE | `frame.member` |## Placement decisions and missing commandsdiff --git a/xtask/src/book.rs b/xtask/src/book.rsindex d598a31cb2..b5c03e847c 100644--- a/xtask/src/book.rs+++ b/xtask/src/book.rs@@ -15,7 +15,7 @@ use serde_json::Value;use crate::cargo;/// Toolbar tabs in toolbar order; commands not on the toolbar come last, grouped by id prefix.-const TABS: &[&str] = &["SOLID", "SKETCH", "SURFACE", "SHEET METAL", "PLASTIC"];+const TABS: &[&str] = &["SOLID", "SKETCH", "SURFACE", "SHEET METAL", "WELDMENTS", "PLASTIC"];const SNAPSHOT_SIZE: (&str, &str) = ("960", "600");pub fn run(root: &Path, build: bool) -> Result<(), String> {