fix(scene): hatch pattern scale and per-entity annotative check

- Hatch pattern_scale multiplied by annotation_scale in model space so
  pattern density stays consistent when CANNOSCALE changes
- Annotative check now uses AcAnnoPO xdata (R2007+ marker) instead of
  relying solely on group-code-293 flag; falls back to is_annotative
  for files with no xdata (old DXF backward compat)
- acadrust patched to local path for is_annotative field

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Sonnet 4.6 committed 2026-05-06 22:19:28 +03:00
1 parent 0e5dec0948
commit b83c982bc2
4 files changed
+22 -3

No files matched your search

+2 -1
View File
@@ -1573,7 +1573,8 @@ impl Scene {
match &mut m.pattern {
hatch_model::HatchPattern::Pattern(_) => {
m.angle_offset = dxf.pattern_angle as f32;
m.scale = dxf.pattern_scale as f32;
let anno = if self.current_layout == "Model" { self.annotation_scale } else { 1.0 };
m.scale = dxf.pattern_scale as f32 * anno;
}
hatch_model::HatchPattern::Gradient { angle_deg, .. } => {
*angle_deg = dxf.pattern_angle.to_degrees() as f32;
+19
View File
@@ -62,6 +62,25 @@ pub fn tessellate(
};
let name = handle.value().to_string();
// Determine effective annotation scale for this entity.
// AutoCAD marks annotative objects with "AcAnnoPO" xdata (R2007+).
// If no xdata at all: old file without annotation system → treat as annotative.
// If xdata present but no "AcAnnoPO": R2007+ file, entity is non-annotative → no scaling.
let anno_scale = {
let xdata = &entity.common().extended_data;
let is_annotative = if xdata.is_empty() {
// Old DXF / no annotation metadata — fall back to group-code-293 flag.
match entity {
EntityType::Text(t) => t.is_annotative,
EntityType::MText(m) => m.is_annotative,
_ => true,
}
} else {
xdata.get_record("AcAnnoPO").is_some()
};
if is_annotative { anno_scale } else { 1.0 }
};
// MultiLeader/Leader need anno_scale for arrow/dogleg/text — handle before generic path.
if let EntityType::MultiLeader(ml) = entity {
return tessellate_multileader_single(