diff --git a/src/modules/annotate/table_cmd.rs b/src/modules/annotate/table_cmd.rs index 799ccb937..e9ad1fe5c 100644 --- a/src/modules/annotate/table_cmd.rs +++ b/src/modules/annotate/table_cmd.rs @@ -118,7 +118,7 @@ impl CadCommand for TableCommand { fn on_point(&mut self, pt: Vec3) -> CmdResult { if let Step::Insertion { cols, rows } = self.step { - let ins = Vector3::new(pt.x as f64, pt.z as f64, pt.y as f64); + let ins = Vector3::new(pt.x as f64, pt.y as f64, pt.z as f64); let table = TableBuilder::new(rows, cols) .at(ins) .row_height(ROW_HEIGHT) diff --git a/src/modules/annotate/tolerance_cmd.rs b/src/modules/annotate/tolerance_cmd.rs index 1328a6510..87aae917d 100644 --- a/src/modules/annotate/tolerance_cmd.rs +++ b/src/modules/annotate/tolerance_cmd.rs @@ -66,7 +66,7 @@ impl CadCommand for ToleranceCommand { fn on_point(&mut self, pt: Vec3) -> CmdResult { if let Step::Insertion { text } = &self.step { - let ins = Vector3::new(pt.x as f64, pt.z as f64, pt.y as f64); + let ins = Vector3::new(pt.x as f64, pt.y as f64, pt.z as f64); let tol = Tolerance::with_text(ins, text.clone()); CmdResult::CommitAndExit(EntityType::Tolerance(tol)) } else { diff --git a/src/modules/home/draw/attdef.rs b/src/modules/home/draw/attdef.rs index a5074d8b3..499b814a2 100644 --- a/src/modules/home/draw/attdef.rs +++ b/src/modules/home/draw/attdef.rs @@ -117,7 +117,7 @@ impl CadCommand for AttdefCommand { tag: tag.clone(), prompt: prompt.clone(), default_value: default.clone(), - insertion_point: Vector3::new(pt.x as f64, pt.z as f64, pt.y as f64), + insertion_point: Vector3::new(pt.x as f64, pt.y as f64, pt.z as f64), height: self.height, ..Default::default() }; diff --git a/src/modules/home/draw/donut.rs b/src/modules/home/draw/donut.rs index 35b0c7741..715d14048 100644 --- a/src/modules/home/draw/donut.rs +++ b/src/modules/home/draw/donut.rs @@ -86,7 +86,7 @@ impl CadCommand for DonutCommand { fn on_point(&mut self, pt: Vec3) -> CmdResult { match &self.state { DonutState::PlaceCenter => { - let entity = make_donut(pt.x as f64, pt.z as f64, self.inner_r, self.outer_r); + let entity = make_donut(pt.x as f64, pt.y as f64, self.inner_r, self.outer_r); // Keep command active so user can place more donuts. CmdResult::CommitEntity(entity) } diff --git a/src/modules/home/draw/mline.rs b/src/modules/home/draw/mline.rs index 2e95fbe87..545a03726 100644 --- a/src/modules/home/draw/mline.rs +++ b/src/modules/home/draw/mline.rs @@ -146,7 +146,7 @@ impl CadCommand for MlineCommand { fn build_mline(pts: &[Vec3], scale: f64, closed: bool, style_name: &str) -> EntityType { let verts: Vec = pts .iter() - .map(|p| Vector3::new(p.x as f64, p.z as f64, p.y as f64)) + .map(|p| Vector3::new(p.x as f64, p.y as f64, p.z as f64)) .collect(); let mut mline = if closed { MLine::closed_from_points(&verts) diff --git a/src/modules/home/draw/raster_image.rs b/src/modules/home/draw/raster_image.rs index 233660571..5b93e9cd5 100644 --- a/src/modules/home/draw/raster_image.rs +++ b/src/modules/home/draw/raster_image.rs @@ -43,7 +43,7 @@ impl ImageCommand { let world_width = ((width_pt.x - origin.x) as f64).abs().max(0.001); let world_height = world_width / self.aspect(); - let ins = Vector3::new(origin.x as f64, origin.z as f64, origin.y as f64); + let ins = Vector3::new(origin.x as f64, origin.y as f64, origin.z as f64); let mut img = RasterImage::with_size( &self.file_path, diff --git a/src/modules/home/draw/revcloud.rs b/src/modules/home/draw/revcloud.rs index 5862c6af3..aa77be11a 100644 --- a/src/modules/home/draw/revcloud.rs +++ b/src/modules/home/draw/revcloud.rs @@ -109,7 +109,7 @@ fn make_revcloud(pts: &[Vec3], arc_len: f64) -> EntityType { for i in 0..n { let p0 = pts[i]; let p1 = pts[(i + 1) % n]; - let seg_len = ((p1.x - p0.x).powi(2) + (p1.z - p0.z).powi(2)).sqrt() as f64; + let seg_len = ((p1.x - p0.x).powi(2) + (p1.y - p0.y).powi(2)).sqrt() as f64; if seg_len < 1e-6 { continue; } @@ -117,11 +117,11 @@ fn make_revcloud(pts: &[Vec3], arc_len: f64) -> EntityType { // How many full arcs fit? let num_arcs = ((seg_len / arc_len).round() as usize).max(1); let step_x = (p1.x - p0.x) as f64 / num_arcs as f64; - let step_z = (p1.z - p0.z) as f64 / num_arcs as f64; + let step_y = (p1.y - p0.y) as f64 / num_arcs as f64; for j in 0..num_arcs { let x = p0.x as f64 + step_x * j as f64; - let y = p0.z as f64 + step_z * j as f64; // DXF Y + let y = p0.y as f64 + step_y * j as f64; // DXF Y let mut v = LwVertex::new(Vector2::new(x, y)); v.bulge = bump_bulge; vertices.push(v); diff --git a/src/modules/home/draw/wipeout.rs b/src/modules/home/draw/wipeout.rs index 28d64efe1..c10e6ef46 100644 --- a/src/modules/home/draw/wipeout.rs +++ b/src/modules/home/draw/wipeout.rs @@ -168,18 +168,18 @@ impl CadCommand for WipeoutCommand { } fn make_rect_wipeout(p1: Vec3, p2: Vec3) -> EntityType { - // Y-up world: X→DXF X, Z→DXF Y, Y→DXF Z - let c1 = Vector3::new(p1.x.min(p2.x) as f64, p1.z.min(p2.z) as f64, p1.y as f64); - let c2 = Vector3::new(p1.x.max(p2.x) as f64, p1.z.max(p2.z) as f64, p1.y as f64); + // Drawing plane is world XY (z = elevation). + let c1 = Vector3::new(p1.x.min(p2.x) as f64, p1.y.min(p2.y) as f64, p1.z as f64); + let c2 = Vector3::new(p1.x.max(p2.x) as f64, p1.y.max(p2.y) as f64, p1.z as f64); EntityType::Wipeout(Wipeout::from_corners(c1, c2)) } fn make_poly_wipeout(pts: &[Vec3]) -> EntityType { use acadrust::types::Vector2; - let z = pts[0].y as f64; + let z = pts[0].z as f64; let verts: Vec = pts .iter() - .map(|p| Vector2::new(p.x as f64, p.z as f64)) + .map(|p| Vector2::new(p.x as f64, p.y as f64)) .collect(); EntityType::Wipeout(Wipeout::polygonal(&verts, z)) }