forked from 1b-agent/opencadstudio-upstream
feat(scale): drive scales from the drawing's scale list
Read the model-space annotation scale from the standard CANNOSCALE / CANNOSCALEVALUE header variables instead of a user-variable hack, and populate both the status-bar scale picker and the viewport Scale property purely from the drawing's ACAD_SCALELIST — no built-in fallback set. Xref-derived scales (`_XREF` suffix, `name|` prefix) are filtered out so only the host drawing's own scales appear. Bumps the patched acadrust to the commit that adds CANNOSCALE/ CANNOSCALEVALUE read/write. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
b5ce376d5c
commit
edc8cbc969
8 files changed
+128
-30
No files matched your search
@@ -144,6 +144,34 @@ impl OpenCADStudio {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Drive the viewport scale picker from the drawing's
|
||||
// own scale list instead of a built-in set.
|
||||
let file_scales = self.tabs[i].scene.scale_list();
|
||||
if !file_scales.is_empty() {
|
||||
let eff = crate::scene::vp_effective_scale(
|
||||
vp.custom_scale,
|
||||
vp.view_height,
|
||||
vp.height,
|
||||
);
|
||||
let selected = file_scales
|
||||
.iter()
|
||||
.find(|(_, _, f)| (f - eff).abs() < 0.001 * f.max(0.001))
|
||||
.map(|(n, _, _)| n.clone())
|
||||
.unwrap_or_default();
|
||||
let options: Vec<String> =
|
||||
file_scales.iter().map(|(n, _, _)| n.clone()).collect();
|
||||
if let Some(geom) = sections.last_mut() {
|
||||
if let Some(prop) =
|
||||
geom.props.iter_mut().find(|p| p.field == "vscale_std")
|
||||
{
|
||||
prop.value = crate::scene::object::PropValue::Choice {
|
||||
selected,
|
||||
options,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Inject DimStyle picker for Dimension entities.
|
||||
|
||||
Reference in new issue
Block a user