Feat: DIST / ID / AREA inquiry commands
Add three classic CAD measurement commands: - DIST (DI): two-point pick → distance, angle, delta XYZ - ID: one-point pick → coordinates - AREA: multi-point polygon pick (Enter to close) → area + perimeter New CmdResult::Measurement(String) variant ends active command and prints result to command line without modifying the document. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
db66982098
commit
a3bb2714c1
8 changed files with 225 additions and 0 deletions
36
src/modules/home/inquiry/id.rs
Normal file
36
src/modules/home/inquiry/id.rs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
// ID command — report coordinates of a picked point.
|
||||
|
||||
use glam::Vec3;
|
||||
|
||||
use crate::command::{CadCommand, CmdResult};
|
||||
|
||||
pub struct IdCommand;
|
||||
|
||||
impl IdCommand {
|
||||
pub fn new() -> Self {
|
||||
Self
|
||||
}
|
||||
}
|
||||
|
||||
impl CadCommand for IdCommand {
|
||||
fn name(&self) -> &'static str {
|
||||
"ID"
|
||||
}
|
||||
|
||||
fn prompt(&self) -> String {
|
||||
"ID Specify point:".into()
|
||||
}
|
||||
|
||||
fn on_point(&mut self, pt: Vec3) -> CmdResult {
|
||||
// Y-up world: X stays X, Z→drawing Y, Y→elevation Z
|
||||
let x = pt.x;
|
||||
let y = pt.z;
|
||||
let z = pt.y;
|
||||
let msg = format!("X = {x:.4}, Y = {y:.4}, Z = {z:.4}");
|
||||
CmdResult::Measurement(msg)
|
||||
}
|
||||
|
||||
fn on_enter(&mut self) -> CmdResult {
|
||||
CmdResult::Cancel
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue