forked from 1b-agent/opencadstudio-upstream
fix(dimension): bake↔live consistency, edits, baseline/continue, grips
Batch 1-3 of the dimension audit (19 issues). The dominant class was the baked *D block diverging from the live render: a reloaded dimension renders from that block, so on save+reopen it silently changed. Bake now matches the live render: - text value/format via the shared style-resolved path (DIMDEC/DIMLFAC/ DIMPOST/units/<>), correct height + rotation ladder, suppression - angular dims bake their swept arc (no longer collapse to a V) - diameter draws edge-to-edge through the centre (live + bake), centre mark - radius/linear/aligned bake arrowheads - group-10 (base.definition_point) synced from the edited geometry so an edited dim no longer shifts on reload Editing / properties: - aligned no longer corrupts ext_line_rotation when a coordinate is edited - DIMTEDIT pins the moved text (text_user_positioned) - angle properties shown/edited in degrees - non-linear text respects the user-positioned gate Commands / geometry: - DIMBASELINE stacks outward (not toward the points) and its preview no longer tilts over non-level points - DIMCONTINUE/DIMBASELINE inherit the base dim's text rotation (UCS chains) - angular extension lines reach the arc (no gap) - text grip sits on the text for auto-placed dims instead of the origin Refs #181. (acadrust DXF round-trip + QDIM/DIMBREAK/DIMJOGLINE/DIMSPACE/ DIMEDIT to follow.) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
b691854e7a
commit
3c5aa4453a
7 files changed
+591
-131
No files matched your search
@@ -151,28 +151,28 @@ fn preview_wire(points: Vec<Vec3>) -> WireModel {
|
||||
}
|
||||
}
|
||||
|
||||
fn linear_dimension_preview(first: Vec3, second: Vec3, def: Vec3, axis: Vec3) -> Vec<Vec3> {
|
||||
/// Project the two extension origins onto the dimension line, which passes
|
||||
/// through `def` along `axis`. Each origin is projected *independently*: a
|
||||
/// single shared offset only lands both on the line when they are level, and
|
||||
/// tilts the dimension line when they are not (e.g. measuring across sloped
|
||||
/// points). See #181.
|
||||
fn dim_line_endpoints(first: Vec3, second: Vec3, def: Vec3, axis: Vec3) -> (Vec3, Vec3) {
|
||||
let perp = Vec3::new(-axis.y, axis.x, 0.0);
|
||||
let offset = (def - first).dot(perp);
|
||||
let d1 = first + perp * offset;
|
||||
let d2 = second + perp * offset;
|
||||
vec![
|
||||
first,
|
||||
d1,
|
||||
Vec3::new(f32::NAN, f32::NAN, f32::NAN),
|
||||
second,
|
||||
d2,
|
||||
Vec3::new(f32::NAN, f32::NAN, f32::NAN),
|
||||
d1,
|
||||
d2,
|
||||
]
|
||||
let dperp = def.dot(perp);
|
||||
let d1 = first + perp * (dperp - first.dot(perp));
|
||||
let d2 = second + perp * (dperp - second.dot(perp));
|
||||
(d1, d2)
|
||||
}
|
||||
|
||||
fn linear_dimension_preview(first: Vec3, second: Vec3, def: Vec3, axis: Vec3) -> Vec<Vec3> {
|
||||
let (d1, d2) = dim_line_endpoints(first, second, def, axis);
|
||||
let nan = Vec3::new(f32::NAN, f32::NAN, f32::NAN);
|
||||
vec![first, d1, nan, second, d2, nan, d1, d2]
|
||||
}
|
||||
|
||||
fn linear_text_pos(first: Vec3, second: Vec3, def: Vec3, axis: Vec3) -> Vec3 {
|
||||
let (d1, d2) = dim_line_endpoints(first, second, def, axis);
|
||||
let perp = Vec3::new(-axis.y, axis.x, 0.0);
|
||||
let offset = (def - first).dot(perp);
|
||||
let d1 = first + perp * offset;
|
||||
let d2 = second + perp * offset;
|
||||
(d1 + d2) * 0.5 + perp * 0.15
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user