diff --git a/crates/engine/src/cmd/annotate.rs b/crates/engine/src/cmd/annotate.rs index b60a7c2e4..6fdd0869d 100644 --- a/crates/engine/src/cmd/annotate.rs +++ b/crates/engine/src/cmd/annotate.rs @@ -120,7 +120,7 @@ fn style(s: &Session) -> String { s.doc().map(|d| d.header.str("DIMSTYLE", "Standard")).unwrap_or_else(|_| "Standard".into()) } -fn dim(s: &Session, kind: DimKind, defpt: Vec2, p13: Vec2, p14: Vec2, p15: Vec2, p16: Vec2, text: &str) -> EntityKind { +fn dim(s: &Session, kind: DimKind, defpt: Vec2, p13: Vec2, p14: Vec2, p15: Vec2, text: &str) -> EntityKind { EntityKind::Dimension(Dimension { kind, defpt: v3(defpt), @@ -128,7 +128,7 @@ fn dim(s: &Session, kind: DimKind, defpt: Vec2, p13: Vec2, p14: Vec2, p15: Vec2, p13: v3(p13), p14: v3(p14), p15: v3(p15), - p16: v3(p16), + p16: v3(Vec2::ZERO), text: text.into(), style: style(s), measurement: 0.0, diff --git a/crates/engine/src/cmd/annotate_dimedit.rs b/crates/engine/src/cmd/annotate_dimedit.rs index 87d1c2dca..563b67de1 100644 --- a/crates/engine/src/cmd/annotate_dimedit.rs +++ b/crates/engine/src/cmd/annotate_dimedit.rs @@ -283,7 +283,7 @@ fn jogged_kind(s: &Session, c: Vec2, r: f64, center: Vec2, at: Vec2, jog: Option } let tip = c + dir * r; let jog = jog.unwrap_or_else(|| center.mid(tip)); - let mut k = dim(s, DimKind::Radius, c, Vec2::ZERO, Vec2::ZERO, tip, Vec2::ZERO, text); + let mut k = dim(s, DimKind::Radius, c, Vec2::ZERO, Vec2::ZERO, tip, text); if let EntityKind::Dimension(dm) = &mut k { dm.marks.jogged = Some(JoggedRadius { center: v3(center), jog: v3(jog) }); if at.dist(c) > r + 1e-9 { diff --git a/crates/engine/src/cmd/annotate_qdim.rs b/crates/engine/src/cmd/annotate_qdim.rs index 06a7b4956..34b327e4e 100644 --- a/crates/engine/src/cmd/annotate_qdim.rs +++ b/crates/engine/src/cmd/annotate_qdim.rs @@ -96,9 +96,9 @@ fn plan( let dir = if dir == Vec2::ZERO || !dir.is_finite() { Vec2::from_angle(std::f64::consts::FRAC_PI_4) } else { dir }; let p = *c + dir * *r; out.push(if mode == Mode::Diameter { - dim(s, DimKind::Diameter, *c - dir * *r, Vec2::ZERO, Vec2::ZERO, p, Vec2::ZERO, "") + dim(s, DimKind::Diameter, *c - dir * *r, Vec2::ZERO, Vec2::ZERO, p, "") } else { - dim(s, DimKind::Radius, *c, Vec2::ZERO, Vec2::ZERO, p, Vec2::ZERO, "") + dim(s, DimKind::Radius, *c, Vec2::ZERO, Vec2::ZERO, p, "") }); } if out.is_empty() { @@ -131,7 +131,7 @@ fn plan( .iter() .map(|p| { let end = if vertical { Vec2::new(at.x, p.y) } else { Vec2::new(p.x, at.y) }; - dim(s, DimKind::Ordinate { x_type: !vertical }, origin, *p, end, Vec2::ZERO, Vec2::ZERO, "") + dim(s, DimKind::Ordinate { x_type: !vertical }, origin, *p, end, Vec2::ZERO, "") }) .collect()); } @@ -147,8 +147,7 @@ fn plan( let mid = bounds.center(); let out_dir = if vertical { Vec2::new(if at.x >= mid.x { 1.0 } else { -1.0 }, 0.0) } else { Vec2::new(0.0, if at.y >= mid.y { 1.0 } else { -1.0 }) }; - let lin = - |a: Vec2, b: Vec2, k: usize| dim(s, DimKind::Linear { rotation: rot }, at + out_dir * (step * k as f64), a, b, Vec2::ZERO, Vec2::ZERO, ""); + let lin = |a: Vec2, b: Vec2, k: usize| dim(s, DimKind::Linear { rotation: rot }, at + out_dir * (step * k as f64), a, b, Vec2::ZERO, ""); Ok(match mode { Mode::Baseline => { // From the datum (the point nearest it, by default the first) to every other point. diff --git a/crates/engine/src/cmd/draw2.rs b/crates/engine/src/cmd/draw2.rs index 0d3e011b6..04067ae08 100644 --- a/crates/engine/src/cmd/draw2.rs +++ b/crates/engine/src/cmd/draw2.rs @@ -1684,10 +1684,9 @@ impl RectM2 { } let first = self.origin(w, h).unwrap_or(a); let hd = s.add_entity(rect_kind(first, (w, h), self.rotation, self.fillet, self.chamfer, self.width, self.elevation))?; - if self.thickness != 0.0 { - let t = self.thickness; - s.doc_mut()?.modify_entity(hd, |e| e.common.thickness = t)?; - } + // A rectangle has its own thickness option and does not take THICKNESS. + let t = self.thickness; + s.doc_mut()?.modify_entity(hd, |e| e.common.thickness = t)?; Ok(Step::Done) } /// The rectangle's local origin (the corner `rect_kind` draws from) for a size: the first