annotation: annotative dimstyles ignore DIMSCALE; unit-converted scales

An annotative dimension style still stores a DIMSCALE (100 in ACA
templates), but its features are sized by the annotation scale. Using
the stored value drew 3 mm dimension text 300 units tall, burying the
plan under giant digits.

Some templates also store their ratio scales already converted to the
drawing unit (a metre drawing's "1:50" as 1 paper = 0.05 drawing, with
CANNOSCALEVALUE 20). Applying the INSUNITS conversion on top shrank
the annotation multiplier a thousandfold.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 5.5 committed 2026-10-15 03:16:33 +03:00
1 parent 2414721c14
commit 1ae118b1bb
2 files changed
+27 -2

No files matched your search

+6
View File
@@ -1756,6 +1756,12 @@ pub(crate) fn resolved_dimension_style(
}
}
// An annotative style sizes its features by the annotation scale; the
// DIMSCALE it still stores is inert.
if style.annotative {
style.dimscale = 0.0;
}
// Negative DIMLFAC applies only in paper space, and there only to a
// dimension that measures model space through a viewport. The associative
// record stores the applied factor; zero marks paper-space geometry whose
+21 -2
View File
@@ -5654,11 +5654,30 @@ impl Scene {
4 // Millimeters
};
crate::modules::draw::units::conversion_factor(
let factor = crate::modules::draw::units::conversion_factor(
self.document.header.insertion_units,
paper_unit,
)
.unwrap_or(1.0)
.unwrap_or(1.0);
// Some templates store their ratio scales already converted to the
// drawing unit (a metre drawing's "1:50" as 1 paper = 0.05 drawing).
// Those must not be converted a second time.
let converted = self.document.objects.values().find_map(|object| {
let ObjectType::Scale(scale) = object else {
return None;
};
let (paper, drawing) = scale.name.split_once(':')?;
let paper = paper.trim().parse::<f64>().ok()?;
let nominal = drawing.trim().parse::<f64>().ok()? / paper;
let stored = scale.drawing_units / scale.paper_units;
(nominal.is_finite() && nominal > 0.0)
.then(|| (stored * factor - nominal).abs() <= 1.0e-6 * nominal)
});
if factor != 1.0 && converted == Some(true) {
1.0
} else {
factor
}
}
fn is_architectural_scale_name(name: &str) -> bool {