fix(3d): box/lasso-select 3D solids and refresh them after a transform
Box, window, crossing and lasso selection only tested wires and hatches, so 3D solids (which render as meshes) could never be selected that way. Add mesh_box_hit / mesh_poly_hit that project the solid mesh and test it against the box / lasso (window = all vertices inside, crossing = any vertex inside or the region sitting inside the solid), and wire them into the selection paths. Also re-tessellate solids after a move/rotate/scale/mirror/copy: the entity moved but its cached mesh didn't, so the solid stayed drawn at its old position. Rebuild the mesh caches when a transformed/copied handle is an ACIS volume. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
c5969b4776
commit
d5f1348f1b
4 changed files with 167 additions and 0 deletions
|
|
@ -77,6 +77,13 @@ impl OpenCADStudio {
|
|||
let label = self.history_label_from_active_cmd(i, "MOVE");
|
||||
self.push_undo_snapshot(i, label);
|
||||
self.tabs[i].scene.transform_entities(&handles, &transform);
|
||||
// ACIS solids render from a cached mesh, so a move/rotate/
|
||||
// scale/mirror needs the mesh re-tessellated from the now-moved
|
||||
// body — wire re-tessellation alone leaves the solid drawn at
|
||||
// its old spot. (#135)
|
||||
if self.tabs[i].scene.any_solid(&handles) {
|
||||
self.tabs[i].scene.populate_meshes_from_document();
|
||||
}
|
||||
self.tabs[i].dirty = true;
|
||||
self.tabs[i].scene.clear_preview_wire();
|
||||
self.tabs[i].active_cmd = None;
|
||||
|
|
@ -88,6 +95,9 @@ impl OpenCADStudio {
|
|||
let label = self.history_label_from_active_cmd(i, "COPY");
|
||||
self.push_undo_snapshot(i, label);
|
||||
let new_handles = self.tabs[i].scene.copy_entities(&handles, &transform);
|
||||
if self.tabs[i].scene.any_solid(&new_handles) {
|
||||
self.tabs[i].scene.populate_meshes_from_document();
|
||||
}
|
||||
self.tabs[i].dirty = true;
|
||||
self.tabs[i].scene.deselect_all();
|
||||
for h in new_handles {
|
||||
|
|
|
|||
|
|
@ -3739,6 +3739,9 @@ impl OpenCADStudio {
|
|||
vp_mat,
|
||||
bounds,
|
||||
));
|
||||
handles.extend(
|
||||
self.tabs[i].scene.mesh_box_hit(a, p, crossing, vp_mat, bounds),
|
||||
);
|
||||
// Box/lasso accumulates like individual picks
|
||||
// (issue #83): a plain box adds to the current
|
||||
// selection, Shift+box removes the boxed
|
||||
|
|
@ -3790,6 +3793,9 @@ impl OpenCADStudio {
|
|||
vp_mat,
|
||||
bounds,
|
||||
));
|
||||
handles.extend(
|
||||
self.tabs[i].scene.mesh_poly_hit(&poly_pts, crossing, vp_mat, bounds),
|
||||
);
|
||||
// Selection filter: keep only allowed types.
|
||||
handles.retain(|&h| self.tabs[i].scene.passes_selection_filter(h));
|
||||
// Accumulate like the box path (issue #83): plain
|
||||
|
|
@ -3926,6 +3932,9 @@ impl OpenCADStudio {
|
|||
vp_mat,
|
||||
bounds,
|
||||
));
|
||||
handles.extend(
|
||||
self.tabs[i].scene.mesh_box_hit(a, p, crossing, vp_mat, bounds),
|
||||
);
|
||||
// Selection filter: keep only allowed types.
|
||||
handles.retain(|&h| self.tabs[i].scene.passes_selection_filter(h));
|
||||
// Accumulate (issue #83): a plain box adds to the
|
||||
|
|
|
|||
Loading…
Reference in a new issue