forked from 1b-agent/opencadstudio-upstream
Merge pull request #1806 from ramox81/codex/block-attribute-manager-window
Block Attribute Manager window (BATTMAN / ATTMAN)
This commit is contained in:
commit
7de32c91c2
36 files changed
+2089
-8
No files matched your search
@@ -8,3 +8,44 @@ pub fn tool() -> ToolDef {
|
||||
event: ModuleEvent::Command("ATTMAN".to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
/// The Block Attribute Manager's "Select block" button: one block reference
|
||||
/// picked in the drawing, handed back as `_ATTMAN_PICK <hex handle>`.
|
||||
pub struct AttmanPickCommand;
|
||||
|
||||
impl crate::command::CadCommand for AttmanPickCommand {
|
||||
fn name(&self) -> &'static str {
|
||||
"BATTMAN"
|
||||
}
|
||||
|
||||
fn prompt(&self) -> String {
|
||||
"Select a block:".into()
|
||||
}
|
||||
|
||||
fn needs_entity_pick(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn entity_pick_highlights_hover(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn on_entity_pick(&mut self, handle: codec::Handle, _pt: glam::DVec3) -> crate::command::CmdResult {
|
||||
if handle.is_null() {
|
||||
return crate::command::CmdResult::NeedPoint;
|
||||
}
|
||||
crate::command::CmdResult::Dispatch(format!("_ATTMAN_PICK {:X}", handle.value()))
|
||||
}
|
||||
|
||||
fn on_point(&mut self, _pt: glam::DVec3) -> crate::command::CmdResult {
|
||||
crate::command::CmdResult::NeedPoint
|
||||
}
|
||||
|
||||
fn on_enter(&mut self) -> crate::command::CmdResult {
|
||||
crate::command::CmdResult::Dispatch("_ATTMAN_PICK".into())
|
||||
}
|
||||
|
||||
fn on_escape(&mut self) -> crate::command::CmdResult {
|
||||
crate::command::CmdResult::Dispatch("_ATTMAN_PICK".into())
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
mod attdef;
|
||||
pub(crate) mod attedit;
|
||||
mod attman;
|
||||
pub(crate) mod attman;
|
||||
pub mod base_point;
|
||||
pub(crate) mod block_cmdline;
|
||||
mod content_browser;
|
||||
|
||||
Reference in new issue
Block a user