forked from 1b-agent/opencadstudio-upstream
Merge pull request #1798 from Pictus08/feat/autocad-pgp-ucs-follow
Import AutoCAD PGP aliases and support UCSFOLLOW workflows. The UCS conflict keeps main's click-origin flow (axis preview, Enter accepts the placed axes) and takes the PR's prompt and option keywords.
This commit is contained in:
commit
87c44cee78
39 files changed
+809
-29
No files matched your search
@@ -8566,6 +8566,7 @@ impl OpenCADStudio {
|
||||
.collect();
|
||||
rows.sort_by(|a, b| a.0.cmp(&b.0));
|
||||
self.alias_editor_rows = rows;
|
||||
self.alias_import_report.clear();
|
||||
self.alias_pending_add = false;
|
||||
self.alias_reset_confirm = false;
|
||||
self.alias_close_confirm = false;
|
||||
@@ -8587,6 +8588,29 @@ impl OpenCADStudio {
|
||||
// check button does, so no half-visible "ghost" row appears.
|
||||
Task::none()
|
||||
}
|
||||
Message::AliasEditorImport => Task::perform(
|
||||
async {
|
||||
let handle = rfd::AsyncFileDialog::new()
|
||||
.add_filter(crate::t!("Command aliases (*.pgp)").as_ref(), &["pgp"])
|
||||
.pick_file().await?;
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
{ Some(std::fs::read(handle.path()).map_err(|e| e.to_string())) }
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
{ Some(Ok(handle.read().await)) }
|
||||
},
|
||||
Message::AliasEditorImported,
|
||||
),
|
||||
Message::AliasEditorImported(result) => {
|
||||
// A picker can finish after the modal was dismissed.
|
||||
if self.active_modal == Some(super::ModalKind::Aliases) {
|
||||
match result {
|
||||
Some(Ok(bytes)) => self.import_alias_pgp(&bytes),
|
||||
Some(Err(error)) => self.command_line.push_error(&format!("PGP: {error}")),
|
||||
None => {}
|
||||
}
|
||||
}
|
||||
Task::none()
|
||||
}
|
||||
Message::AliasEditorAdd => {
|
||||
if self.alias_pending_add {
|
||||
// One draft at a time: keep the existing top draft.
|
||||
|
||||
@@ -3506,12 +3506,17 @@ impl OpenCADStudio {
|
||||
}
|
||||
_ => false,
|
||||
};
|
||||
if !same_basis(self.tabs[i].active_ucs.as_ref(), persisted.as_ref()) {
|
||||
let changed = !same_basis(self.tabs[i].active_ucs.as_ref(), persisted.as_ref());
|
||||
if changed {
|
||||
self.push_undo_snapshot(i, label);
|
||||
self.tabs[i].persist_active_ucs();
|
||||
self.tabs[i].dirty = true;
|
||||
}
|
||||
self.tabs[i].sync_ucs_to_scene();
|
||||
if changed && self.tabs[i].scene.ucs_follow() {
|
||||
let rotation = self.tabs[i].scene.viewcube_ucs_mat();
|
||||
self.plan_snap(i, rotation);
|
||||
}
|
||||
}
|
||||
|
||||
// ── Per-pane Model viewport (pane_grid) ───────────────────────────────
|
||||
|
||||
Reference in new issue
Block a user