fix: regenerate inline sub-entity handles when copying entities
`document.add_entity` only assigns the top-level handle, leaving inline sub-entities that carry their own — INSERT attributes and 3D-polyline vertices — with the source's handles. Copying such an entity therefore produced duplicate handles in the document, which corrupts the saved DWG so other CAD apps (QCAD, DWG TrueView) refuse to open it. Add `Scene::add_entity_clone` / `reset_clone_subhandles`, which allocate fresh handles for the entity and every inline sub-entity, and route all duplication paths through it: COPY/ARRAY/MIRROR-copy (via copy_entities) and clipboard paste. (#129) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
70e73877b2
commit
446430d2b3
2 changed files with 34 additions and 2 deletions
|
|
@ -557,8 +557,7 @@ impl OpenCADStudio {
|
|||
.into_iter()
|
||||
.map(|mut entity| {
|
||||
crate::scene::view::dispatch::apply_transform(&mut entity, &translate);
|
||||
entity.common_mut().handle = acadrust::Handle::NULL;
|
||||
self.tabs[i].scene.add_entity(entity)
|
||||
self.tabs[i].scene.add_entity_clone(entity)
|
||||
})
|
||||
.filter(|h| !h.is_null())
|
||||
.collect();
|
||||
|
|
|
|||
Loading…
Reference in a new issue