Explorar el Código

Fix hatch object info

Kevin Lee hace 6 meses
padre
commit
d8bbda90a5
Se han modificado 1 ficheros con 26 adiciones y 21 borrados
  1. 26 21
      src/ezcad/objects/hatch.rs

+ 26 - 21
src/ezcad/objects/hatch.rs

@@ -83,20 +83,22 @@ impl From<HatchPattern> for HatchFlag {
 
 impl From<HatchFlag> for HatchPattern {
     fn from(value: HatchFlag) -> Self {
-        if value.bidirectional_pattern() != 0 {
-            HatchPattern::Bidirectional
-        } else if value.ring_pattern() != 0 {
+        if value.ring_pattern() != 0 {
             HatchPattern::Ring
-        } else if value.continuous_pattern() != 0 {
-            HatchPattern::Continuous
-        } else if value.gong_pattern() != 0 {
-            HatchPattern::Gong
         } else if value.background_pattern() != 0 {
             HatchPattern::Background
         } else if value.fill_pattern() != 0 {
             HatchPattern::Fill
         } else if value.zigzag_pattern() != 0 {
             HatchPattern::Zigzag
+        } else if value.gong_pattern() != 0 {
+            HatchPattern::Gong
+        } else if value.bidirectional_pattern() != 0 {
+            if value.continuous_pattern() != 0 {
+                HatchPattern::Continuous
+            } else {
+                HatchPattern::Bidirectional
+            }
         } else {
             HatchPattern::Directional
         }
@@ -408,26 +410,29 @@ impl Display for Hatch {
             if setting.enabled.into() {
                 write!(
                     f,
-                    "\nHatch #{}: Count: {}, Pen: {}, Pattern: {}, All Calc: {}, Follow Edge Once: {}, Edge Offset: {:.2}, Line Spacing: {:.2}",
+                    "\nHatch #{}: All Calc: {}, Follow Edge Once: {}, Cross Hatch: {}, Pattern: {}, Angle: {:.2}, Pen: {}, Count: {}, Line Space: {:.2}, Avg Distribte Line: {}",
                     index,
-                    setting.count,
-                    setting.pen,
-                    HatchPattern::from(*setting.flags),
                     setting.flags.all_calc() != 0,
                     setting.flags.follow_edge_once() != 0,
-                    setting.edge_offset,
-                    setting.line_spacing,
+                    setting.flags.cross_hatch() != 0,
+                    HatchPattern::from(*setting.flags),
+                    *setting.angle,
+                    *setting.pen,
+                    *setting.count,
+                    *setting.line_spacing,
+                    setting.flags.average_distribute_line() != 0,
                 )?;
                 write!(
                     f,
-                    "\n          Start Offset: {:.2}, End Offset: {:.2}, Angle: {:.2}, Rotate Angle: {:.2}, Line Reduction: {:.2}, Loop Count: {}, Loop Distance: {:.2}",
-                    setting.start_offset,
-                    setting.end_offset,
-                    setting.angle,
-                    setting.rotate_angle,
-                    setting.line_reduction,
-                    setting.loop_count,
-                    setting.loop_distance,
+                    "\n          Edge Offset: {:.2}, Start Offset: {:.2}, End Offset: {:.2}, Line Reduction: {:.2}, Loop Count: {}, Loop Distance: {:.2}, Auto Rotate: {}, Auto Rotate Angle: {:.2}",
+                    *setting.edge_offset,
+                    *setting.start_offset,
+                    *setting.end_offset,
+                    *setting.line_reduction,
+                    *setting.loop_count,
+                    *setting.loop_distance,
+                    setting.flags.auto_rotate_hatch_angle() != 0,
+                    *setting.rotate_angle,
                 )?;
             }
         }