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:
Hakan Seven 2026-06-21 06:45:49 +03:00
commit d5f1348f1b
4 changed files with 167 additions and 0 deletions

View file

@ -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 {