From 2019964591e5b70b5f93366130aa0d5c4619b953 Mon Sep 17 00:00:00 2001 From: ramox81 <184937705+ramox81@users.noreply.github.com> Date: Fri, 16 Oct 2026 16:13:29 +0300 Subject: [PATCH] Block definitions tessellate their solids A block defined from objects (imported STEP products, pasted blocks, recreated or redefined definitions) left its solids, surfaces and meshes without the instanced block meshes they draw through, so their inserts showed nothing until the drawing was reopened. Co-Authored-By: Claude Opus 5.5 --- src/scene/entity.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/scene/entity.rs b/src/scene/entity.rs index ac89c65c6..5b9af9763 100644 --- a/src/scene/entity.rs +++ b/src/scene/entity.rs @@ -1349,6 +1349,9 @@ impl Scene { .map_err(|e| e.to_string())?; entity_handles.push(handle); } + // Solids, surfaces and meshes of a definition draw through their + // instanced block meshes, which only a tessellation pass creates. + self.refresh_meshes_for_handles(&entity_handles); // Block defns don't render on their own, but the geometry cache must // pick up the new definition so the interactive insert can preview it. self.bump_geometry(); @@ -1391,12 +1394,14 @@ impl Scene { block_end.common.owner_handle = br_handle; let _ = self.document.add_entity(EntityType::BlockEnd(block_end)); + let mut added = Vec::new(); for mut entity in entities { Self::reset_clone_subhandles(&mut self.document, &mut entity); entity.common_mut().handle = Handle::NULL; entity.common_mut().owner_handle = br_handle; - let _ = self.document.add_entity(entity); + added.extend(self.document.add_entity(entity).ok()); } + self.refresh_meshes_for_handles(&added); self.bump_geometry(); } @@ -1446,18 +1451,21 @@ impl Scene { }) .map(|e| e.common().handle) .collect(); - for h in owned { - self.document.remove_entity(h); + for h in &owned { + self.document.remove_entity(*h); } if let Some(EntityType::Block(block)) = self.document.get_entity_mut(block_handle) { block.base_point = base_point; } + // The old contents' meshes go with them; the new ones are built. + let mut changed = owned; for mut entity in entities { Self::reset_clone_subhandles(&mut self.document, &mut entity); entity.common_mut().handle = Handle::NULL; entity.common_mut().owner_handle = br_handle; - let _ = self.document.add_entity(entity); + changed.extend(self.document.add_entity(entity).ok()); } + self.refresh_meshes_for_handles(&changed); self.bump_geometry(); Ok(()) }