From 57357aaa1207dff16b38aa3859beadafab9bfdf0 Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Thu, 23 Jul 2026 07:23:10 +0300 Subject: [PATCH] fix(linetype): draw embedded shapes without the .shx; fix rotation unit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Document linetypes referencing ltypeshp.shx glyphs (ZIGZAG, BATTING, TRACKS) skipped their shape elements whenever the shape file wasn't on disk — the usual case for traded drawings. The standard ltypeshp numbers now bridge to the bundled LFF substitute shapes (130 TRACK1, 131 ZIG, 132 BOX, 133 CIRC1, 134 BAT); a resolvable file still wins with the real SHX glyph. The element rotation also converted twice: DWG stores radians, the segment field carries degrees (the .lin unit), and the walker calls to_radians() — a 180°-flipped second copy rendered at ~3°, folding the below-baseline half of ZIGZAG/BATTING up onto the line. Convert at the document boundary. Co-Authored-By: Claude Fable 5 --- src/io/linetypes.rs | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/src/io/linetypes.rs b/src/io/linetypes.rs index 40d9ddba2..8ec9df326 100644 --- a/src/io/linetypes.rs +++ b/src/io/linetypes.rs @@ -131,7 +131,9 @@ pub fn document_lt_segments(document: &CadDocument, name: &str) -> Option { @@ -144,7 +146,7 @@ pub fn document_lt_segments(document: &CadDocument, name: &str) -> Option Option "TRACK1", + 131 => "ZIG", + 132 => "BOX", + 133 => "CIRC1", + 134 => "BAT", + _ => "", }; + if resolved.is_none() && sub_name.is_empty() { + continue; + } let scale = c.scale as f32; segments.push(LtSegment::Shape { - name: String::new(), - shx_file: resolved, + name: sub_name.to_string(), + shx_file: resolved.unwrap_or_default(), number: *shape_number as u16, x: c.offset[0] as f32, y: c.offset[1] as f32, scale: if scale.abs() < 1e-6 { 1.0 } else { scale }, - rot_deg: c.rotation as f32, + rot_deg: (c.rotation as f32).to_degrees(), }); } }