fix: UCS FACE/OBJECT pick from the interactive prompt; reuse ocs_axes

Follow-up to #1341:
- interactive UCS offers Face / OBject; bare UCS OBJECT starts an entity pick
- one UcsPickCommand serves both FACE and OBJECT
- ucs_from_normal calls the existing arbitrary-axis helper instead of a copy
- prompt catalogue key and en-US text follow the new option list

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Fable 5.1 committed 2026-09-18 18:42:44 +03:00
1 parent 3ba4ab9e7f
commit 9978713acc
7 files changed
+50 -43

No files matched your search

+21 -11
View File
@@ -347,23 +347,30 @@ impl CadCommand for ValuePromptCommand {
}
}
/// Interactive front-end for `UCS FACE` — Fusion's "create sketch on a face".
/// Interactive pick for `UCS FACE` and `UCS OBJECT`.
///
/// Picks one face of a solid and hands the resulting plane to the inline
/// `UCS FACE <handle> <x,y,z>` handler via [`CmdResult::Dispatch`], so the
/// plane construction lives in exactly one place whether the user clicked a
/// face or typed the arguments. `entity_pick_uses_surface_point` is what
/// makes the click land *on the solid's surface* rather than on the current
/// drawing plane, which is the whole point: the pick coordinate is the face.
pub struct UcsFaceCommand;
/// Hands the picked entity to the inline `UCS FACE <handle> <x,y,z>` /
/// `UCS OBJECT <handle>` handler via [`CmdResult::Dispatch`], so the plane
/// construction lives in one place whether the user clicked or typed the
/// arguments. For a face the click lands *on the solid's surface*
/// (`entity_pick_uses_surface_point`) and that point becomes the plane
/// origin; for an object only the handle matters.
pub struct UcsPickCommand {
/// `true` picks a solid face; `false` picks a planar entity.
pub face: bool,
}
impl CadCommand for UcsFaceCommand {
impl CadCommand for UcsPickCommand {
fn name(&self) -> &'static str {
"UCS"
}
fn prompt(&self) -> String {
crate::t!("UCS FACE Select a face to draw on:").into_owned()
if self.face {
crate::t!("UCS FACE Select a face to draw on:").into_owned()
} else {
crate::t!("UCS OBJECT Select object to align UCS:").into_owned()
}
}
fn needs_entity_pick(&self) -> bool {
@@ -371,7 +378,7 @@ impl CadCommand for UcsFaceCommand {
}
fn entity_pick_uses_surface_point(&self) -> bool {
true
self.face
}
fn entity_pick_highlights_hover(&self) -> bool {
@@ -382,6 +389,9 @@ impl CadCommand for UcsFaceCommand {
if handle.is_null() {
return CmdResult::NeedPoint;
}
if !self.face {
return CmdResult::Dispatch(format!("UCS OBJECT {:X}", handle.value()));
}
// Hex handle and comma-separated coordinates are what the inline
// parser reads back. Full `{}` precision, not a rounded format: the
// point has to stay on the face for the planar-face lookup.