fix(clipboard): copied XDATA keeps its application in another drawing

EED names its application by APPID handle. Copying between drawings
(paste, COPYTO, block palette insert, REFEDIT) kept the source
drawing's handles, so the saved DWG named APPIDs it did not have and
the reference program refused to open it (xdata.cpp eInvalidInput).
The copy now carries the APPID records its XDATA names, registers the
missing ones, and re-points the EED at them.

COPYTO also skipped every layer the target lacked (the check tested
the source) and filled the target with the whole linetype catalog; it
now copies the missing layers and loads only the linetypes used.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 5.5 committed 2026-10-16 06:37:19 +03:00
1 parent d909bd0787
commit 218150c76a
5 files changed
+120 -9

No files matched your search

+9 -2
View File
@@ -424,17 +424,24 @@ impl OpenCADStudio {
let i = self.active_tab;
self.push_undo_snapshot(i, "INSERT");
self.merge_dependencies(i, &deps);
let apps = crate::app::command_driver::clipboard::eed_app_map(
&self.tabs[i].scene.document,
&deps,
);
let mut created = Vec::new();
for def in &deps.blocks {
let scene = &mut self.tabs[i].scene;
let mut entities = def.entities.clone();
for entity in &mut entities {
crate::app::command_driver::clipboard::remap_eed_apps(entity, &apps);
}
if redefine && def.name.eq_ignore_ascii_case(name) {
let entities = def.entities.clone();
if let Err(err) = scene.redefine_block_raw(&def.name, def.base_point, entities) {
self.command_line.push_error(&err);
return Err(err);
}
} else if scene.document.block_records.get(&def.name).is_none() {
scene.define_block_raw(&def.name, def.base_point, def.entities.clone());
scene.define_block_raw(&def.name, def.base_point, entities);
created.push(def);
}
}