forked from 1b-agent/opencadstudio-upstream
feat: honour LUNITS / LUPREC unit formatting + INSUNITS scaling on insert
Property-panel coordinate display and block-insert scaling were both hard-coded, ignoring the document's stored unit configuration. - LUNITS / LUPREC: edit_prop() now formats values through a thread-local UnitContext seeded by refresh_properties(). Decimal / Scientific / Engineering / Architectural / Fractional all render correctly without threading the document handle through every entity properties builder. - AUNITS / AUPREC: format_angle() helper available (decimal degrees, DMS, grad, rad). Callers that already format angular values via radians can switch over without touching the helper signatures. - INSUNITS + MEASUREMENT: xref's source INSUNITS is carried onto the host BlockRecord.units during merge. commit_entity() then scales new INSERTs so 1 source-unit maps to the host's INSUNITS length. When either side is unitless (0) MEASUREMENT acts as the fallback (0=Imperial / inches, 1=Metric / mm), matching AutoCAD's rule. Co-Authored-By: Claude Opus 4.7 <[email protected]>
This commit is contained in:
1 parent
9c4043ef45
commit
b3e117a969
4 files changed
+198
-2
No files matched your search
@@ -143,6 +143,13 @@ fn merge_xref_into_block(
|
||||
) {
|
||||
let prefix = xref_block_name;
|
||||
|
||||
// Carry the xref's INSUNITS onto the host BlockRecord. Used at INSERT
|
||||
// time so the inserted xref scales to the host's units (INSUNITS).
|
||||
let src_insunits = xref_doc.header.insertion_units;
|
||||
if let Some(br) = doc.block_records.iter_mut().find(|b| b.handle == br_handle) {
|
||||
br.units = src_insunits;
|
||||
}
|
||||
|
||||
// ── Layers ──────────────────────────────────────────────────────────
|
||||
// Prefix every xref layer (including "0"). Entity layer references are
|
||||
// remapped below so the resolver finds the merged copy. Host layers
|
||||
|
||||
Reference in new issue
Block a user