feat(snap): independent 3D object-snap system with six modes

Grid snap locks to SNAPUNIT instead of magnetizing; snapped 3D points keep elevation instead of flattening to z=0. New SnapTypes Vertex/EdgeMidpoint/FaceCenter/Knot/FacePerpendicular/NearestFace with their own F4 master toggle and mode set, tiers, and markers, fully independent of the 2D master. Solid B-rep corners/edge-midpoints/face-centers from mesh edges and kernel faces, spline knot points, and live perpendicular/nearest-to-face on mesh triangles merged priority-aware in move/click paths. Drafting Settings 3D Object Snap tab is fully live (was dead placeholders); Nearest-to-face off by default. TDD: behavioral LINE-to-solid tests plus engine/scene unit tests.
This commit is contained in:
Karim Jerbi committed 2026-09-16 16:43:37 +01:00
1 parent d894b8eb05
commit ca0ee37d26
16 files changed
+1728 -67

No files matched your search

+14
View File
@@ -26,6 +26,7 @@ fn is_modal_blocked_key_msg(msg: &Message) -> bool {
| Message::MTextCaretMove(_)
| Message::DeleteSelected
| Message::ToggleSnapEnabled
| Message::ToggleSnap3dEnabled
| Message::ToggleGrid
| Message::ToggleOrtho
| Message::ToggleGridSnap
@@ -3702,6 +3703,11 @@ impl OpenCADStudio {
self.persist_settings_if_changed();
Task::none()
}
Message::ToggleSnap3dEnabled => {
self.snapper.toggle_snap3d();
self.sync_vport_display(self.active_tab);
Task::none()
}
Message::ToggleGridSnap => {
self.snapper.toggle_grid_snap();
self.sync_vport_display(self.active_tab);
@@ -4562,6 +4568,14 @@ impl OpenCADStudio {
}
Task::none()
}
Message::DraftingSettingsToggleSnapMode3d(snap_type) => {
if let Some(state) = &mut self.drafting_settings_state {
if !state.snap3d_modes.remove(&snap_type) {
state.snap3d_modes.insert(snap_type);
}
}
Task::none()
}
Message::DraftingSettingsSnapSelectAll => {
if let Some(state) = &mut self.drafting_settings_state {
for &(snap_type, _, _) in crate::snap::ALL_SNAP_MODES {