ucs: dynamic UCS on planar solid faces

With dynamic UCS on (UCSDETECT 1, toggled with F6), a command's first
point picked on a planar face of a solid sets the UCS to that face for
the rest of the command, so 2D commands draw on the face (#1711). An
unsnapped first point lands on the face itself; a snapped point off the
face's plane belongs to other geometry and leaves the UCS alone. The
previous UCS comes back when the command ends. UCS commands themselves
are left out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 5.5 committed 2026-10-15 11:40:39 +03:00
1 parent 19ecf78bd9
commit cccea4008b
33 files changed
+193

No files matched your search

+19
View File
@@ -11363,6 +11363,25 @@ impl Scene {
)
}
/// The UCS of the planar solid face under `local` (relative to `bounds`),
/// Z along the face normal, and the picked point on the face.
pub fn planar_face_ucs_at(
&mut self,
bounds: iced::Rectangle,
local: iced::Point,
) -> Option<(codec::tables::Ucs, glam::DVec3)> {
let camera = self.camera.borrow();
let view_rot = camera.view_proj_rte(bounds);
let eye = camera.eye();
drop(camera);
let (handle, pick) = self.solid_click_hit_point(local, view_rot, eye, bounds)?;
self.restore_solid_models(&[handle]);
let body = self.solid_models.get(&handle)?;
let face = crate::scene::model::solid_model::nearest_planar_face(body, pick.to_array())?;
crate::scene::model::solid_model::planar_face_ucs(body, face, pick.to_array())
.map(|ucs| (ucs, pick))
}
/// The nearest solid or mesh surface under `local` (relative to `bounds`).
pub fn surface_pivot_at(
&self,