Origin plane names: Top / Front / Right (#6491) (#6496)

* claim: #6491

* feat(ui): origin plane names Top / Front / Right (#6491)
This commit is contained in:
Lars Jansen
2026-10-27 21:06:14 +00:00
committed by GitHub
parent 42ec27cfe4
commit 83ac98ac76
13 changed files with 240 additions and 22 deletions
@@ -0,0 +1,34 @@
{
"en": {
"prefs.origin_plane_names": "Origin plane names",
"prefs.origin_plane_names_note": "Names shown in the browser, dialogs and lists. {top} is XY, {front} is XZ and {right} is YZ, with Z up. Commands, scripts and saved designs keep XY, XZ and YZ."
},
"ja": {
"prefs.origin_plane_names": "原点平面の名前",
"prefs.origin_plane_names_note": "ブラウザー、ダイアログ、一覧に表示される名前です。{top} は XY、{front} は XZ、{right} は YZ です (Z が上)。コマンド、スクリプト、保存されたデザインでは XY、XZ、YZ のままです。"
},
"zh": {
"prefs.origin_plane_names": "原点平面名称",
"prefs.origin_plane_names_note": "浏览器、对话框和列表中显示的名称。{top} 即 XY,{front} 即 XZ,{right} 即 YZ(Z 轴朝上)。命令、脚本和已保存的设计仍使用 XY、XZ 和 YZ。"
},
"ar": {
"prefs.origin_plane_names": "أسماء مستويات الأصل",
"prefs.origin_plane_names_note": "الأسماء المعروضة في المستعرض والحوارات والقوائم. {top} هو XY و{front} هو XZ و{right} هو YZ، والمحور Z للأعلى. تحتفظ الأوامر والسكربتات والتصاميم المحفوظة بـ XY وXZ وYZ."
},
"he": {
"prefs.origin_plane_names": "שמות מישורי הראשית",
"prefs.origin_plane_names_note": "השמות המוצגים בדפדפן, בתיבות הדו־שיח וברשימות. {top} הוא XY, {front} הוא XZ ו־{right} הוא YZ, כש־Z למעלה. פקודות, סקריפטים ותכנונים שמורים שומרים על XY, XZ ו־YZ."
},
"de": {
"prefs.origin_plane_names": "Namen der Ursprungsebenen",
"prefs.origin_plane_names_note": "Namen in Browser, Dialogen und Listen. {top} ist XY, {front} ist XZ und {right} ist YZ, mit Z nach oben. Befehle, Skripte und gespeicherte Konstruktionen behalten XY, XZ und YZ."
},
"ko": {
"prefs.origin_plane_names": "원점 평면 이름",
"prefs.origin_plane_names_note": "브라우저, 대화 상자, 목록에 표시되는 이름입니다. {top}은 XY, {front}는 XZ, {right}는 YZ이며 Z가 위쪽입니다. 명령, 스크립트, 저장된 디자인은 XY, XZ, YZ를 유지합니다."
},
"vi": {
"prefs.origin_plane_names": "Tên các mặt phẳng gốc",
"prefs.origin_plane_names_note": "Tên hiển thị trong trình duyệt, hộp thoại và danh sách. {top} là XY, {front} là XZ và {right} là YZ, với Z hướng lên. Lệnh, script và thiết kế đã lưu vẫn dùng XY, XZ và YZ."
}
}
+15 -3
View File
@@ -1700,7 +1700,8 @@ fn origin_rows(app: &mut SolveApp, ui: &mut egui::Ui, depth: usize, acts: &Actio
return;
}
for (k, icon, thing) in items {
let label = k;
// An origin plane by the name the preferences give it; its key stays the id.
let label = app.preferences.origin_plane_names.label(k);
let visible = !app.session.visibility.hidden_origin.iter().any(|h| h == k);
let sel = match icon {
"plane" => Some(Sel::Plane { name: k.into() }),
@@ -1711,8 +1712,19 @@ fn origin_rows(app: &mut SolveApp, ui: &mut egui::Ui, depth: usize, acts: &Actio
let r = draw_row(
ui,
ui.id().with(("o", k)),
// Faded when hidden itself or with the whole Origin.
&Row { depth: depth + 1, eye: Some(visible), icon, label, selected, dim: !visible || !app.origin_shown(), mark, ..Default::default() },
// Faded when hidden itself or with the whole Origin. A renamed plane's label is already
// in the interface's language (`name`).
&Row {
depth: depth + 1,
eye: Some(visible),
icon,
label,
name: label != k,
selected,
dim: !visible || !app.origin_shown(),
mark,
..Default::default()
},
);
if r.eye {
// Through the command, so the Origin row's eye is an undo step (#2219).
+10 -8
View File
@@ -2307,13 +2307,15 @@ fn placement_row(d: &mut Dialog, ui: &mut egui::Ui, session: &Session) {
}
/// A picked item as its chip shows it. A round edge or face says what it stands for in `inp`:
/// its axis in an axis input, a circle's centre in a point input.
pub(crate) fn selection_label(s: &Session, d: &Dialog, inp: &SelInput, item: &Sel) -> String {
/// its axis in an axis input, a circle's centre in a point input. An origin plane goes by
/// the name the preferences give it.
pub(crate) fn selection_label(s: &Session, names: crate::prefs::OriginPlaneNames, d: &Dialog, inp: &SelInput, item: &Sel) -> String {
let axis = inp.accept == selection::AXIS_PICKS && round_axis(s, item).is_some();
match item {
Sel::SketchCurve { id, .. } => id.clone(),
Sel::SketchPoint { id } => crate::sketch_modify_ui::point_id(s, item).unwrap_or(id).to_string(),
Sel::Plane { name } | Sel::Axis { name } | Sel::ConstructionPoint { name } | Sel::Body { name } => name.clone(),
Sel::Plane { name } => names.label(name).to_string(),
Sel::Axis { name } | Sel::ConstructionPoint { name } | Sel::Body { name } => name.clone(),
Sel::Face { body, index, .. } if axis => format!("{body} · face {index} axis"),
Sel::Face { body, index, .. } => format!("{body} · face {index}"),
Sel::Edge { body, .. } if axis => format!("{body} · circle axis"),
@@ -2336,8 +2338,8 @@ pub(crate) fn selection_label(s: &Session, d: &Dialog, inp: &SelInput, item: &Se
/// Selection input rows: label, "N selected" (or a hint) and a clear button; clicking a row
/// makes it the active input.
fn input_rows(d: &mut Dialog, ui: &mut egui::Ui, s: &Session) {
input_rows_range(d, ui, s, 0..d.inputs.len());
fn input_rows(d: &mut Dialog, ui: &mut egui::Ui, s: &Session, names: crate::prefs::OriginPlaneNames) {
input_rows_range(d, ui, s, names, 0..d.inputs.len());
}
/// Saved vectors/axes are real inputs even when they have no origin-axis selection chip.
@@ -2360,7 +2362,7 @@ fn stored_revolve_axis(kind: &Kind) -> Option<&Value> {
}
}
pub(crate) fn input_rows_range(d: &mut Dialog, ui: &mut egui::Ui, s: &Session, range: std::ops::Range<usize>) {
pub(crate) fn input_rows_range(d: &mut Dialog, ui: &mut egui::Ui, s: &Session, names: crate::prefs::OriginPlaneNames, range: std::ops::Range<usize>) {
// Edit Text shows its Path input among its own rows.
if matches!(d.kind, Kind::Text(_)) {
return;
@@ -2382,7 +2384,7 @@ pub(crate) fn input_rows_range(d: &mut Dialog, ui: &mut egui::Ui, s: &Session, r
RichText::new(if custom_axis || stored_reference.is_some() {
crate::i18n::tr("dialog.custom_axis").into()
} else if !inp.multi {
inp.items.first().map(|item| selection_label(s, d, inp, item)).unwrap_or_default()
inp.items.first().map(|item| selection_label(s, names, d, inp, item)).unwrap_or_default()
} else {
let count = if i == 0 { shell_count.unwrap_or(inp.items.len()) } else { inp.items.len() };
crate::i18n::format("dialog.selected_count", &[("count", &count.to_string())])
@@ -2439,7 +2441,7 @@ pub(crate) fn input_rows_range(d: &mut Dialog, ui: &mut egui::Ui, s: &Session, r
});
if matches!(d.kind, Kind::SketchModify(_)) && inp.multi {
for (index, item) in inp.items.iter().enumerate() {
if crate::ui_kit::list_row(ui, &format!("{}:{index}", inp.label), &selection_label(s, d, inp, item)).clicked() {
if crate::ui_kit::list_row(ui, &format!("{}:{index}", inp.label), &selection_label(s, names, d, inp, item)).clicked() {
remove = Some((i, index));
}
}
+2 -2
View File
@@ -186,9 +186,9 @@ pub(super) fn rows(app: &mut SolveApp, ctx: &egui::Context, d: &mut Dialog, ui:
placement_row(d, ui, &app.session);
if crate::hole_refs::takes(d) {
// Each reference edge with its distance (#37, #6380).
enter |= crate::hole_refs::input_rows(d, ui, &app.session);
enter |= crate::hole_refs::input_rows(d, ui, &app.session, app.preferences.origin_plane_names);
} else {
input_rows(d, ui, &app.session);
input_rows(d, ui, &app.session, app.preferences.origin_plane_names);
}
d.sync_material(&app.session);
match &mut d.kind {
+2 -2
View File
@@ -238,10 +238,10 @@ pub(crate) fn sync(s: &Session, d: &mut Dialog) {
/// The Single hole's (or the Cylinder's) selection rows, each reference edge with its distance on
/// the row below it once it is picked. Whether Enter was pressed in a distance.
pub(crate) fn input_rows(d: &mut Dialog, ui: &mut egui::Ui, s: &Session) -> bool {
pub(crate) fn input_rows(d: &mut Dialog, ui: &mut egui::Ui, s: &Session, names: crate::prefs::OriginPlaneNames) -> bool {
let mut enter = false;
for i in 0..d.inputs.len() {
crate::dialogs::input_rows_range(d, ui, s, i..i + 1);
crate::dialogs::input_rows_range(d, ui, s, names, i..i + 1);
let Some(k) = d.inputs.get(i).filter(|inp| !inp.items.is_empty()).and_then(|inp| REFERENCES.iter().position(|l| *l == inp.label)) else {
continue;
};
+116
View File
@@ -332,6 +332,35 @@ pub enum HistorySketches {
UnderFeature,
}
/// What the interface calls the origin planes (Preferences › Interface). Only the names shown
/// change: the planes' ids (`XY`, `XZ`, `YZ`), commands, scripts and saved designs keep theirs.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum OriginPlaneNames {
/// XY, XZ and YZ. Also what a naming this version doesn't know reads as (`lenient`).
#[default]
Xyz,
/// Top for XY, Front for XZ and Right for YZ (Z up), the engine's aliases for them.
TopFrontRight,
}
impl OriginPlaneNames {
pub const ALL: [Self; 2] = [Self::Xyz, Self::TopFrontRight];
/// The origin planes' ids, in the order the Preferences list them.
pub const PLANES: [&'static str; 3] = ["XY", "XZ", "YZ"];
/// The name shown for the plane `name`: an origin plane in this naming, in the interface's
/// language; any other plane (a construction plane) by its own name.
pub fn label(self, name: &str) -> &str {
match (self, name) {
(Self::TopFrontRight, "XY") => crate::i18n::tr("ui.top"),
(Self::TopFrontRight, "XZ") => crate::i18n::tr("ui.front"),
(Self::TopFrontRight, "YZ") => crate::i18n::tr("ui.right"),
_ => name,
}
}
}
/// What an orbit turns around (Preferences: "Orbit around").
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
@@ -685,6 +714,8 @@ preference_settings! {
/// Where command dialogs open: at the view's edge, or in the left column in place of the
/// browser and the History there (#6707).
dialog_place: crate::dialog_column::DialogPlace = Default::default(), PAGE_INTERFACE;
/// The names the browser, dialogs and lists show for the origin planes (#6491).
origin_plane_names: OriginPlaneNames = OriginPlaneNames::default(), PAGE_INTERFACE;
/// The wheel zooms toward the point under the cursor (else toward the view's centre).
zoom_to_cursor: bool = true, PAGE_NAVIGATION => check("Zoom to the cursor", "The wheel zooms toward the point under the cursor (off: toward the view's centre)");
/// Spread discrete wheel input across frames (off: apply each event immediately).
@@ -4322,6 +4353,91 @@ mod tests {
assert_eq!(h.app.session.doc.to_json(), design);
}
/// The texts one frame paints.
fn painted_texts(h: &mut crate::scenario::Harness) -> Vec<String> {
let output = h.ctx.run_ui(egui::RawInput { screen_rect: Some(h.ctx.content_rect()), focused: true, ..Default::default() }, |ui| {
h.app.logic(ui.ctx());
h.app.ui(ui);
});
output
.shapes
.iter()
.filter_map(|s| match &s.shape {
egui::Shape::Text(t) => Some(t.galley.job.text.clone()),
_ => None,
})
.collect()
}
/// Origin plane names (#6491): Top, Front and Right are names shown in the browser, the
/// dialogs' chips and the plane choices; the planes' ids, the commands and the design keep XY,
/// XZ and YZ. Saved, refused when unknown, and taken back by Cancel and Restore Defaults.
#[test]
fn origin_plane_names_change_only_the_names_shown() {
use OriginPlaneNames::{TopFrontRight, Xyz};
let old: Prefs = serde_json::from_value(json!({"nav":"solidworks"})).unwrap();
assert_eq!(old.origin_plane_names, Xyz, "older preferences keep XY, XZ and YZ");
assert_eq!(lenient(&json!({"origin_plane_names":"hologram","zoom_reverse":true})).origin_plane_names, Xyz);
assert_eq!(OriginPlaneNames::PLANES.map(|p| Xyz.label(p)), ["XY", "XZ", "YZ"]);
assert_eq!(OriginPlaneNames::PLANES.map(|p| TopFrontRight.label(p)), ["Top", "Front", "Right"]);
assert_eq!(TopFrontRight.label("Plane1"), "Plane1", "construction planes keep their own names");
let mut h = crate::scenario::Harness::new();
let sketch = h.app.run("sketch.create", json!({"plane":"XY"})).unwrap()["sketch"].as_u64().unwrap();
h.app.run("sketch.rectangle.two_point", json!({"p0":[0,0],"p1":[20,10]})).unwrap();
h.app.run("sketch.finish", json!({})).unwrap();
h.frames(2);
h.step(&json!({"click":{"chevron":"Origin"}})).unwrap();
let rows = || crate::browser::drawn_rows().into_iter().map(|(label, ..)| label).collect::<Vec<_>>();
assert!(OriginPlaneNames::PLANES.iter().all(|p| rows().iter().any(|r| r == p)), "{:?}", rows());
let design = h.app.session.doc.to_json();
h.call("ui.prefs", json!({"open":"Interface"}));
super::reveal_preference(&mut h, "prefs:origin_plane_names:top_front_right");
h.step(&json!({"click":{"handle":"prefs:origin_plane_names:top_front_right"}})).unwrap();
assert_eq!(h.app.preferences.origin_plane_names, TopFrontRight);
h.call("ui.prefs", json!({"button":"ok"}));
h.frames(2);
for (id, name) in [("XY", "Top"), ("XZ", "Front"), ("YZ", "Right")] {
assert!(rows().iter().any(|r| r == name) && !rows().iter().any(|r| r == id), "{:?}", rows());
}
assert_eq!(h.app.session.doc.to_json(), design, "a name shown changes nothing in the design");
// Picked from its row, the plane is named in the dialog's chip and runs by its id.
h.call("ui.start", json!({"command":"construct.plane.offset"}));
h.step(&json!({"click":{"browser":"Front"}})).unwrap();
let picked = h.app.dialog.as_ref().and_then(|d| d.inputs.first()).map(|i| i.items.clone());
assert_eq!(picked, Some(vec![solidcraft_engine::Sel::Plane { name: "XZ".into() }]));
assert!(painted_texts(&mut h).iter().any(|t| t == "Front"), "the chip shows the plane's name");
h.step(&json!({"widget":"OK"})).unwrap();
h.frames(2);
let made = h.app.session.doc.features.last().map(|f| serde_json::to_value(&f.kind).unwrap_or_default()).unwrap_or_default();
assert!(made.to_string().contains("\"XZ\""), "the command took the id: {made}");
// The sketch plane choices of Redefine Sketch Plane: by name, and they run by id.
crate::browser::redefine_sketch(&mut h.app, sketch);
h.frames(2);
let texts = painted_texts(&mut h);
assert!(["Use Top plane", "Use Front plane", "Use Right plane"].iter().all(|t| texts.iter().any(|x| x == t)), "{texts:?}");
assert!(!texts.iter().any(|t| t == "Use XY plane"));
crate::sketch_attachment_ui::clear(&mut h.app);
let mut restored = SolveApp::new(solidcraft_engine::Session::default(), Default::default());
restored.load_prefs(&h.app.prefs());
assert_eq!(restored.preferences.origin_plane_names, TopFrontRight, "the choice is saved");
let before = h.app.preferences.clone();
assert!(control(&mut h.app, &json!({"origin_plane_names":"top", "nav":"solidworks"})).is_err());
assert_eq!(h.app.preferences, before, "an unknown naming fails atomically");
h.call("ui.prefs", json!({"open":"Interface","origin_plane_names":"xyz"}));
h.call("ui.prefs", json!({"button":"cancel"}));
assert_eq!(h.app.preferences.origin_plane_names, TopFrontRight, "Cancel takes it back");
h.call("ui.prefs", json!({"open":"Interface"}));
h.call("ui.prefs", json!({"button":"defaults"}));
assert_eq!(h.app.preferences.origin_plane_names, Xyz, "Restore Defaults: XY, XZ and YZ");
h.frames(2);
assert!(OriginPlaneNames::PLANES.iter().all(|p| rows().iter().any(|r| r == p)), "{:?}", rows());
h.call("ui.prefs", json!({"button":"cancel"}));
assert_eq!(h.app.preferences.origin_plane_names, TopFrontRight);
}
#[test]
fn history_sketches_defaults_in_order_and_follows_preferences_transactions() {
let old: Prefs = serde_json::from_value(json!({"timeline_left": true})).unwrap();
+28
View File
@@ -1,5 +1,32 @@
//! Interface settings composition, using shared controls and previews.
use super::*;
/// Origin plane names: each choice shows the three names it gives (`XY / XZ / YZ`), with a note
/// that only the names shown change.
fn origin_plane_names(app: &mut SolveApp, ui: &mut egui::Ui) {
ui_kit::settings_section(ui, "origin_plane_names", app.tr("prefs.origin_plane_names"), |ui| {
let choices: Vec<String> =
OriginPlaneNames::ALL.iter().map(|names| OriginPlaneNames::PLANES.map(|plane| names.label(plane)).join(" / ")).collect();
let options: Vec<&str> = choices.iter().map(String::as_str).collect();
let mut selected = OriginPlaneNames::ALL.iter().position(|names| *names == app.preferences.origin_plane_names).unwrap_or(0);
if ui_kit::settings_segments(ui, app.tr("prefs.origin_plane_names"), &mut selected, &options)
&& let Some(names) = OriginPlaneNames::ALL.get(selected)
{
app.preferences.origin_plane_names = *names;
}
// Handles that don't depend on the language, by the choice's saved value.
for (choice, key) in choices.iter().zip(["xyz", "top_front_right"]) {
if let Some(at) = crate::scenario::handle_at(&format!("dialog:{}:{choice}", app.tr("prefs.origin_plane_names"))) {
crate::scenario::publish_handle(&format!("prefs:origin_plane_names:{key}"), at);
}
}
let top = OriginPlaneNames::TopFrontRight;
let note =
crate::i18n::format("prefs.origin_plane_names_note", &[("top", top.label("XY")), ("front", top.label("XZ")), ("right", top.label("YZ"))]);
ui_kit::text(ui, &note, ui_kit::Text::Hint("origin_plane_names"));
});
}
pub(super) fn interface(app: &mut SolveApp, ui: &mut egui::Ui, t: &Tokens) {
ui_kit::settings_heading(ui, app.tr("prefs.interface"), app.tr("prefs.interface_note"));
ui_kit::settings_section(ui, "theme", app.tr("ui.theme"), |ui| {
@@ -145,6 +172,7 @@ pub(super) fn interface(app: &mut SolveApp, ui: &mut egui::Ui, t: &Tokens) {
ui_kit::layout_preview,
);
});
origin_plane_names(app, ui);
ui_kit::settings_section(ui, "scale", app.tr("prefs.scale_text"), |ui| {
ui_kit::settings_pair(
ui,
+3 -1
View File
@@ -182,7 +182,9 @@ fn move_rotates_about_a_cylinder_wall_and_moves_from_a_circle_centre() {
let a: Vec<f64> = serde_json::from_value(p["axis"].clone()).unwrap();
assert!((a[2].abs() - 1.0).abs() < 1e-9, "about the shaft's axis: {a:?}");
// The chips say what the round picks stand for.
let label = |d: &crate::dialogs::Dialog, i: usize, sel: &Sel| crate::dialogs::selection_label(&h.app.session, d, &d.inputs[i], sel);
let label = |d: &crate::dialogs::Dialog, i: usize, sel: &Sel| {
crate::dialogs::selection_label(&h.app.session, crate::prefs::OriginPlaneNames::Xyz, d, &d.inputs[i], sel)
};
let wall_label = label(&d, 1, &wall);
assert!(wall_label.starts_with("Shaft · face ") && wall_label.ends_with(" axis"), "{wall_label}");
assert!(label(&d, 1, &rim).ends_with("· circle axis"), "{}", label(&d, 1, &rim));
+3 -2
View File
@@ -310,7 +310,8 @@ fn point_label(sk: &solidcraft_engine::sketch::Sketch, id: &str) -> String {
}
}
/// A row's name: "Line 3", "Point (arc 2 centre)", "Edge 4 · Body1", "XY Plane"…
/// A row's name: "Line 3", "Point (arc 2 centre)", "Edge 4 · Body1", "XY Plane" (an origin plane
/// by the name the preferences give it)…
pub fn label(app: &SolveApp, sel: &Sel) -> String {
let st = app.session.world_state();
let in_sketch =
@@ -331,7 +332,7 @@ pub fn label(app: &SolveApp, sel: &Sel) -> String {
Sel::Occurrence { path } => format!("Occurrence {path:?}"),
Sel::Feature { id } => app.session.doc.feature(*id).map(|f| f.name.clone()).unwrap_or_else(|| format!("Feature {id}")),
Sel::Profile { sketch, index } => format!("Profile {} · {}", index + 1, sketch_name(app, *sketch)),
Sel::Plane { name } if matches!(name.as_str(), "XY" | "XZ" | "YZ") => format!("{name} Plane"),
Sel::Plane { name } if matches!(name.as_str(), "XY" | "XZ" | "YZ") => format!("{} Plane", app.preferences.origin_plane_names.label(name)),
Sel::Axis { name } if matches!(name.as_str(), "X" | "Y" | "Z") => format!("{name} Axis"),
Sel::Plane { name } | Sel::Axis { name } | Sel::ConstructionPoint { name } => name.clone(),
}
+19
View File
@@ -246,6 +246,25 @@ fn overlapping_bodies_list_both_and_the_hidden_one_can_be_picked() {
assert_eq!(h.app.session.selection, [Sel::Body { name: "Inner".into() }]);
}
/// Origin plane names (#6491): the list names an origin plane as the preferences do, and picking
/// it still selects the plane by its id.
#[test]
fn origin_planes_are_listed_by_the_names_the_preferences_give_them() {
let mut h = Harness::new();
h.call("ui.view", json!({"view":"top"}));
h.settle();
h.step(&json!({"hold": {"plane": "XY"}})).unwrap();
assert!(labels(&h).iter().any(|r| r == "XY Plane"), "{:?}", labels(&h));
h.step(&json!({"key": "Escape"})).unwrap();
h.call("ui.prefs", json!({"origin_plane_names": "top_front_right"}));
h.step(&json!({"hold": {"plane": "XY"}})).unwrap();
let rows = labels(&h);
let row = rows.iter().position(|r| r == "Top Plane").unwrap_or_else(|| panic!("{rows:?}"));
assert!(!rows.iter().any(|r| r == "XY Plane"), "{rows:?}");
h.step(&json!({"click": {"handle": format!("select_other:{row}")}})).unwrap();
assert_eq!(h.app.session.selection, vec![Sel::Plane { name: "XY".into() }]);
}
#[test]
fn long_names_stay_inside_the_popup_and_remain_available_on_hover() {
let mut h = Harness::new();
+5 -3
View File
@@ -269,9 +269,11 @@ pub fn panel(app: &mut SolveApp, ctx: &egui::Context) {
}
});
ui.horizontal_wrapped(|ui| {
for plane in ["XY", "XZ", "YZ"] {
if ui_kit::button(ui, crate::i18n::format("sketch_panel.use_plane", &[("plane", plane)]), ui_kit::Button::Normal).clicked() {
draft.choose(json!(plane), plane.into());
// The command takes the plane's id; the button and the choice show its name.
for plane in crate::prefs::OriginPlaneNames::PLANES {
let label = app.preferences.origin_plane_names.label(plane);
if ui_kit::button(ui, crate::i18n::format("sketch_panel.use_plane", &[("plane", label)]), ui_kit::Button::Normal).clicked() {
draft.choose(json!(plane), label.into());
}
}
});
+2
View File
@@ -10,6 +10,8 @@ an edited one goes back to how it was, as one step that Undo brings back.
Opening a sketch turns the view to face it. When the sketch ends, the view stays where it is by default. Preferences › Sketch › **When a sketch ends** changes that: **Return to the previous view** goes back to the view from before the sketch, and **Return unless rotated** goes back only when you panned or zoomed the sketch view but didn't turn it.
In scripts, `XY`, `XZ`, `YZ` and their `Top`, `Front`, `Right` aliases name origin planes.
Preferences › Interface › **Origin plane names** shows them as Top, Front and Right in the
browser, dialogs and lists; scripts and saved designs keep XY, XZ and YZ.
These names are reserved: a construction plane cannot be created with or renamed to one
(case-insensitive). If an older design already has a construction plane with such a name, a
string argument naming it is ambiguous and is rejected; use the other alias (`XY` for `Top`)
File diff suppressed because one or more lines are too long