forked from 1b-agent/opencadstudio-upstream
first commit
This commit is contained in:
1 parent
d52c6440ff
commit
d2fdac7f1e
274 files changed
+89330
No files matched your search
@@ -0,0 +1,57 @@
|
||||
// Point tool — ribbon definition + interactive command.
|
||||
//
|
||||
// Command: POINT (PO)
|
||||
// Single click → commits EntityType::Point. Stays active for more points.
|
||||
|
||||
use acadrust::types::Vector3;
|
||||
use acadrust::{EntityType, Point as CadPoint};
|
||||
|
||||
use crate::command::{CadCommand, CmdResult};
|
||||
use crate::modules::{IconKind, ModuleEvent, ToolDef};
|
||||
use crate::scene::wire_model::WireModel;
|
||||
use glam::Vec3;
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn tool() -> ToolDef {
|
||||
ToolDef {
|
||||
id: "POINT",
|
||||
label: "Point",
|
||||
icon: IconKind::Svg(include_bytes!("../../../../assets/icons/point.svg")),
|
||||
event: ModuleEvent::Command("POINT".to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
pub struct PointCommand;
|
||||
|
||||
impl PointCommand {
|
||||
pub fn new() -> Self {
|
||||
Self
|
||||
}
|
||||
}
|
||||
|
||||
impl CadCommand for PointCommand {
|
||||
fn name(&self) -> &'static str {
|
||||
"POINT"
|
||||
}
|
||||
fn prompt(&self) -> String {
|
||||
"POINT Specify point [Enter=done]:".into()
|
||||
}
|
||||
|
||||
fn on_point(&mut self, pt: Vec3) -> CmdResult {
|
||||
let p = CadPoint {
|
||||
location: Vector3::new(pt.x as f64, pt.y as f64, pt.z as f64),
|
||||
..Default::default()
|
||||
};
|
||||
CmdResult::CommitEntity(EntityType::Point(p))
|
||||
}
|
||||
|
||||
fn on_enter(&mut self) -> CmdResult {
|
||||
CmdResult::Cancel
|
||||
}
|
||||
fn on_escape(&mut self) -> CmdResult {
|
||||
CmdResult::Cancel
|
||||
}
|
||||
fn on_mouse_move(&mut self, _pt: Vec3) -> Option<WireModel> {
|
||||
None
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user