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 <noreply@anthropic.com>
This commit is contained in:
parent
0e5dec0948
commit
b83c982bc2
4 changed files with 22 additions and 3 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -41,7 +41,6 @@ checksum = "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618"
|
|||
[[package]]
|
||||
name = "acadrust"
|
||||
version = "0.3.4"
|
||||
source = "git+https://github.com/HakanSeven12/acadrust.git?branch=feat%2Flayout-paper-dimensions#2eaa7aacce3c5de4d6f15a0474fd365db0da9fba"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"anyhow",
|
||||
|
|
|
|||
|
|
@ -23,4 +23,4 @@ rayon = "1"
|
|||
windows-sys = { version = "0.59", features = ["Win32_UI_Shell", "Win32_UI_WindowsAndMessaging"] }
|
||||
|
||||
[patch.crates-io]
|
||||
acadrust = { git = "https://github.com/HakanSeven12/acadrust.git", branch = "feat/layout-paper-dimensions" }
|
||||
acadrust = { path = "../acadrust" }
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Reference in a new issue