forked from 1b-agent/opencadstudio-upstream
feat(commands): add CLOSE, HIDE, VISUALSTYLES, QUICKCALC, HYPERLINK, XOPEN
Six more standard commands by reusing existing infrastructure: - CLOSE: close the active tab (Message::TabClose) - HIDE / VISUALSTYLES: per-viewport render mode (Message::SetRenderMode) - QUICKCALC / QC: alias the CAL arithmetic evaluator - HYPERLINK <url>: attach a hyperlink via the PE_URL XData record - XOPEN: open a selected xref's source file (Message::OpenRecent) COMMANDS.md updated to 214 done / 15 partial / 33 missing of 262. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
c19c18c2f2
commit
e2a83a6487
7 files changed
+201
-77
No files matched your search
@@ -565,6 +565,36 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
// XOPEN — open the source file of the selected external reference in
|
||||
// a new tab (reuses the existence-checked OpenRecent path).
|
||||
"XOPEN" => {
|
||||
let names: Vec<String> = self.tabs[i]
|
||||
.scene
|
||||
.selected_entities()
|
||||
.iter()
|
||||
.filter_map(|(_, e)| match e {
|
||||
acadrust::EntityType::Insert(ins) => Some(ins.block_name.clone()),
|
||||
_ => None,
|
||||
})
|
||||
.collect();
|
||||
let path = names.iter().find_map(|bn| {
|
||||
let br = self.tabs[i].scene.document.block_records.get(bn)?;
|
||||
if br.xref_path.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(br.xref_path.clone())
|
||||
}
|
||||
});
|
||||
match path {
|
||||
Some(p) => {
|
||||
return Some(Task::done(Message::OpenRecent(std::path::PathBuf::from(p))))
|
||||
}
|
||||
None => self
|
||||
.command_line
|
||||
.push_error("XOPEN: select an external reference (xref) to open."),
|
||||
}
|
||||
}
|
||||
|
||||
// NCOPY — copy the nested objects of the selected block reference(s)
|
||||
// into model space, keeping the block (a non-destructive extraction;
|
||||
// every nested object is copied — the block is not exploded).
|
||||
|
||||
Reference in new issue
Block a user