forked from 1b-agent/opencadstudio-upstream
Xref attach: placement preview, relative paths on the first save, no-match messages
The reference follows the cursor while its insertion point, scale or rotation is asked (preview-only PScale/PX/PY/PZ/PRotate included); a relative path chosen before the drawing had a file becomes relative on the first save, and relative paths start from "./" at or below the drawing's folder; -XREF name options report "No matching xref names found.". Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
6bd55bc32e
commit
498a97df0f
8 files changed
+204
-7
No files matched your search
@@ -2304,6 +2304,15 @@ impl OpenCADStudio {
|
||||
});
|
||||
let clone_started = iced::time::Instant::now();
|
||||
let mut snapshot = self.tabs[i].scene.document_for_save();
|
||||
// First save: references attached with a relative path type while
|
||||
// the drawing had no file become relative to it.
|
||||
if self.tabs[i].current_path.is_none() && purpose != crate::app::SavePurpose::Autosave {
|
||||
crate::io::xref::make_relative(
|
||||
&mut snapshot,
|
||||
&self.tabs[i].xref_relative_on_save,
|
||||
&path,
|
||||
);
|
||||
}
|
||||
// Save-As across folders: rebase relative reference paths onto the
|
||||
// new base dir inside the snapshot only (live strings are untouched).
|
||||
if purpose == crate::app::SavePurpose::SaveAs {
|
||||
@@ -2606,6 +2615,14 @@ impl OpenCADStudio {
|
||||
}
|
||||
if outcome.set_current_path {
|
||||
let old_path = self.tabs[i].current_path.clone();
|
||||
if old_path.is_none() {
|
||||
let pending = std::mem::take(&mut self.tabs[i].xref_relative_on_save);
|
||||
crate::io::xref::make_relative(
|
||||
&mut self.tabs[i].scene.document,
|
||||
&pending,
|
||||
&outcome.path,
|
||||
);
|
||||
}
|
||||
self.tabs[i].current_path = Some(outcome.path.clone());
|
||||
self.tabs[i].scene.document.version = outcome.version;
|
||||
if outcome.purpose == crate::app::SavePurpose::SaveAs {
|
||||
|
||||
Reference in new issue
Block a user