feat: add missing Annotate tab commands and icons

New dimension commands: QDIM, DIMEDIT, DIMTEDIT, DIMBREAK, DIMSPACE,
DIMJOGLINE with full command workflows and SVG icons.

New multileader commands: MLEADERADD, MLEADERREMOVE, MLEADERALIGN,
MLEADERCOLLECT with entity injection pattern for in-place editing.

Updated annotate ribbon: all tools exposed across Text, Dimensions,
Leaders, Tables, Markup, and Annotation Scaling groups. Added STYLE,
FIND, DIMSTYLE shortcut buttons.

Added `inject_picked_entity` to the CadCommand trait for commands that
need a cloned copy of the picked entity to modify (DIMTEDIT, MLEADERADD,
MLEADERREMOVE). Sentinel-based dispatch in cmd_result.rs handles
DIMBREAK, DIMSPACE, DIMJOGLINE, MLEADERALIGN, and MLEADERCOLLECT.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Sonnet 4.6 committed 2026-04-09 03:26:47 +03:00
1 parent 510bcf11e5
commit 08b9a21d31
25 files changed
+1408 -1

No files matched your search

+75
View File
@@ -0,0 +1,75 @@
// DIMEDIT command — edit dimension text or reset it to the measured value.
//
// Workflow:
// 1. Pick a dimension entity
// 2. Enter new text (blank = reset to auto-measured value, "<>" = measured value placeholder)
use acadrust::Handle;
use glam::Vec3;
use crate::command::{CadCommand, CmdResult};
use crate::modules::{IconKind, ModuleEvent, ToolDef};
pub const ICON: IconKind = IconKind::Svg(include_bytes!("../../../assets/icons/dim_edit.svg"));
pub fn tool() -> ToolDef {
ToolDef {
id: "DIMEDIT",
label: "Dim Edit",
icon: ICON,
event: ModuleEvent::Command("DIMEDIT".to_string()),
}
}
enum Step {
PickDim,
EnterText { handle: Handle },
}
pub struct DimEditCommand {
step: Step,
}
impl DimEditCommand {
pub fn new() -> Self {
Self { step: Step::PickDim }
}
}
impl CadCommand for DimEditCommand {
fn name(&self) -> &'static str { "DIMEDIT" }
fn prompt(&self) -> String {
match &self.step {
Step::PickDim => "DIMEDIT Select dimension:".into(),
Step::EnterText { .. } => "DIMEDIT Enter text override (blank = reset to measured):".into(),
}
}
fn needs_entity_pick(&self) -> bool {
matches!(self.step, Step::PickDim)
}
fn on_entity_pick(&mut self, handle: Handle, _pt: Vec3) -> CmdResult {
if handle.is_null() { return CmdResult::NeedPoint; }
self.step = Step::EnterText { handle };
CmdResult::NeedPoint
}
fn wants_text_input(&self) -> bool {
matches!(self.step, Step::EnterText { .. })
}
fn on_text_input(&mut self, text: &str) -> Option<CmdResult> {
let handle = match &self.step {
Step::EnterText { handle } => *handle,
_ => return None,
};
// Empty = reset to auto-measured, "<>" = keep measured, else override
let new_text = text.trim().to_string();
Some(CmdResult::DdeditEntity { handle, new_text })
}
fn on_point(&mut self, _pt: Vec3) -> CmdResult { CmdResult::NeedPoint }
fn on_enter(&mut self) -> CmdResult { CmdResult::Cancel }
}