Files
OneCAD-Draft/src/modules/home/inquiry/id.rs
T
Hakan SevenandClaude Opus 4.8 c04bdcf846 fix(commands): migrate inquiry + fillet/align/lengthen picks to world XY (#54)
These commands still read the cursor / entity coordinate with the old
"Y-up XZ" assumption (world Z = DXF Y), which is wrong now that the
drawing plane is world XY: ID/DIST/AREA reported swapped Y↔Z values and
zero-area, and fillet/align/lengthen picked against a constant-elevation
axis. Read the drawing-plane coordinate from .y (elevation stays on .z),
matching the central transform and the entity builders.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 10:32:38 +03:00

41 lines
956 B
Rust

// 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 {
// Drawing plane is world XY (z = elevation).
let x = pt.x;
let y = pt.y;
let z = pt.z;
let msg = format!("X = {x:.4}, Y = {y:.4}, Z = {z:.4}");
CmdResult::Measurement(msg)
}
fn on_enter(&mut self) -> CmdResult {
CmdResult::Cancel
}
}
// ── Autocomplete registry ─────────────────────────────────
inventory::submit!(crate::command::CommandRegistration { names: &["ID"] }); // IdCommand