forked from 1b-agent/opencadstudio-upstream
feat(ucs): integrate coordinate systems
Route coordinate input, geometry creation, transforms, properties,\nviews, and viewport persistence through a shared working plane.\n\nRefs #484
This commit is contained in:
1 parent
b1d55c6a7e
commit
657d023fb7
61 files changed
+2218
-747
No files matched your search
@@ -12,7 +12,7 @@ use acadrust::EntityType;
|
||||
use glam::DVec3;
|
||||
use crate::t;
|
||||
|
||||
use crate::command::{CadCommand, CmdResult};
|
||||
use crate::command::{CadCommand, CmdResult, WorkingPlane};
|
||||
use crate::modules::{IconKind, ModuleEvent, ToolDef};
|
||||
|
||||
#[allow(dead_code)]
|
||||
@@ -67,6 +67,7 @@ pub struct MinsertCommand {
|
||||
columns: u16,
|
||||
row_spacing: f64,
|
||||
column_spacing: f64,
|
||||
plane: WorkingPlane,
|
||||
}
|
||||
|
||||
impl MinsertCommand {
|
||||
@@ -78,6 +79,7 @@ impl MinsertCommand {
|
||||
columns: 1,
|
||||
row_spacing: 0.0,
|
||||
column_spacing: 0.0,
|
||||
plane: WorkingPlane::default(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +90,7 @@ impl MinsertCommand {
|
||||
ins.column_count = self.columns.max(1);
|
||||
ins.row_spacing = self.row_spacing;
|
||||
ins.column_spacing = self.column_spacing;
|
||||
CmdResult::CommitAndExit(EntityType::Insert(ins))
|
||||
CmdResult::CommitAndExit(self.plane.place_entity(EntityType::Insert(ins)))
|
||||
}
|
||||
|
||||
/// Advance from the parameter currently at `idx` to the next, or build the
|
||||
@@ -109,6 +111,10 @@ impl MinsertCommand {
|
||||
}
|
||||
|
||||
impl CadCommand for MinsertCommand {
|
||||
fn set_working_plane(&mut self, plane: WorkingPlane) {
|
||||
self.plane = plane;
|
||||
}
|
||||
|
||||
fn name(&self) -> &'static str {
|
||||
"MINSERT"
|
||||
}
|
||||
@@ -160,7 +166,8 @@ impl CadCommand for MinsertCommand {
|
||||
Step::Name => CmdResult::NeedPoint,
|
||||
Step::Point { name } => {
|
||||
let name = name.clone();
|
||||
let point = Vector3::new(pt.x, pt.y, pt.z);
|
||||
let point = self.plane.to_local(pt);
|
||||
let point = Vector3::new(point.x, point.y, point.z);
|
||||
self.step = Step::Params {
|
||||
name,
|
||||
point,
|
||||
|
||||
Reference in new issue
Block a user