feat: XREF management — auto-resolve, XATTACH, XREF, XRELOAD
- src/io/xref.rs: resolve_xrefs() scans block_records for is_xref flags,
resolves paths relative to the opened file's directory, loads the
referenced DWG/DXF and merges model-space entities into the xref block
- src/modules/insert/xattach.rs: XATTACH command with file-picker flow
(XAttachPick/XAttachPickResult messages), prepare_xref_block() creates
BlockRecord + Block entities and immediately resolves content
- XREF command: lists all external references in the drawing
- XRELOAD command: re-resolves all xref paths and rebuilds scene caches
- Auto-resolve on FileOpened: reports Loaded/NotFound per xref block
- CadCommand trait: added optional xattach_path() method
- ROADMAP.md: 1.9 XREF management marked ✅
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
4c1c13cab6
commit
64837e9aed
10 changed files with 487 additions and 3 deletions
|
|
@ -65,6 +65,27 @@ impl H7CAD {
|
|||
self.refresh_properties();
|
||||
}
|
||||
CmdResult::CommitAndExit(entity) => {
|
||||
// For XATTACH: ensure the xref block definition exists before
|
||||
// committing the INSERT entity that references it.
|
||||
// Extract path early to avoid borrow conflicts.
|
||||
let xattach_path: Option<String> = {
|
||||
let tab = &self.tabs[i];
|
||||
if let Some(cmd) = tab.active_cmd.as_ref() {
|
||||
if cmd.name() == "XATTACH" {
|
||||
cmd.xattach_path()
|
||||
} else {
|
||||
None
|
||||
}
|
||||
} else {
|
||||
None
|
||||
}
|
||||
};
|
||||
if let Some(path) = xattach_path {
|
||||
crate::modules::insert::xattach::prepare_xref_block(
|
||||
&mut self.tabs[i].scene,
|
||||
&path,
|
||||
);
|
||||
}
|
||||
let label = self.history_label_from_active_cmd(i, "ENTITY");
|
||||
self.push_undo_snapshot(i, label);
|
||||
self.commit_entity(entity);
|
||||
|
|
|
|||
Loading…
Reference in a new issue