fix(render): annotative scale representations + model-space linetype scale

Two rendering defects surfaced on the budweiser benchmark drawings, both
tied to a drawing's annotation scale.

Annotative scale representations. A drawing may materialise each annotation
scale as its own object (here a block insert per scale, on a "0 @ <scale>"
layer, each carrying a per-object AcDbContextData bound to one scale).
Nothing filtered them, so every scale drew at once — a 1× copy stacked
under a 10× one. Add annotative::annotative_offscale and apply it in the
three paths that expand block content: the wire block-defn cache, the
resident/top-level visibility gate (model space only — paper viewports use
their per-viewport frozen scale layers), and the exploded-insert hatch/fill
walk (filtered before normalize strips the handle). An object is shown when
a representation matches the current scale; the off-scale ones are hidden.
When the current scale is unsupported by any representation, fall back to
the base "1:1" copy instead of hiding everything (the object must not
vanish) or showing everything (the copies must not stack).

Model-space linetype scale. PSLTSCALE (a paper-space flag) was applied to
model-space linetypes via the annotation scale, so a drawing saved at e.g.
CANNOSCALE 10:1 drew its linetypes 10× off. Thread a `paper_space` flag
through tessellate_entity and gate the PSLTSCALE factor on it, so it only
scales linetypes for content shown inside a paper-space viewport; model
space keeps LTSCALE × CELTSCALE.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-07-23 21:24:56 +03:00
1 parent 5e2b67c642
commit d54fb9e2aa
5 files changed
+113 -2

No files matched your search

+17
View File
@@ -3212,6 +3212,7 @@ impl Scene {
Some(&blk),
None,
None,
anno_scale_override.is_some(),
);
memo_updates.push((*h, Arc::new(raw.clone())));
let mut faded = raw;
@@ -4541,6 +4542,16 @@ impl Scene {
}
}
}
// Annotative scale representation: draw only the current scale's copy.
// Model-space only (`frozen_layers` is None): a paper-space viewport
// renders at its own annotation scale and already hides the off-scale
// representations through its per-viewport frozen "0 @ <scale>" layers,
// so applying the model-space scale here would fight that.
if frozen_layers.is_none()
&& crate::scene::annotative::annotative_offscale(&self.document, c)
{
return false;
}
self.belongs_to_visible_block(c.handle, c.owner_handle, block_handle)
}
@@ -4674,6 +4685,9 @@ impl Scene {
} else {
1.0
};
// Content shown inside a paper-space viewport carries a scale override;
// only there does PSLTSCALE resize linetypes by the viewport scale.
let paper = anno_scale_override.is_some();
let blk_cache = self.block_cache_arc();
let blk_ref: &cache::block_cache::BlockCache = &blk_cache;
// Zoom-adaptive curve sampling for top-level Edge tessellation. Target
@@ -4776,6 +4790,7 @@ impl Scene {
let e: &EntityType = e;
let w = tessellate_entity(
doc, sel, avp, bg, anno, e, Some(blk_ref), view_aabb, wpp,
paper,
);
(e.common().handle, Arc::new(w))
})
@@ -4795,6 +4810,7 @@ impl Scene {
.flat_map(|e| {
tessellate_entity(
doc, sel, avp, bg, anno, e, Some(blk_ref), view_aabb, wpp,
paper,
)
})
.collect()
@@ -5055,6 +5071,7 @@ impl Scene {
Some(&blk_cache),
None,
None,
self.current_layout != "Model",
)
}