|
@@ -81,6 +81,28 @@ 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 {
|
|
|
+ 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 {
|
|
|
+ HatchPattern::Directional
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
#[cfg_attr(feature = "default-debug", derive(Debug))]
|
|
|
#[derive(BinRead, BinWrite, Clone, Diff, PartialEq)]
|
|
|
#[diff(attr(
|
|
@@ -382,6 +404,33 @@ impl Display for Hatch {
|
|
|
*self.legacy_setting.mark_contour != 0,
|
|
|
*self.legacy_setting.contour_priority != 0
|
|
|
)?;
|
|
|
+ for (index, setting) in self.hatch_settings.iter().enumerate() {
|
|
|
+ if setting.enabled.into() {
|
|
|
+ write!(
|
|
|
+ f,
|
|
|
+ "\nHatch #{}: Count: {}, Pen: {}, Pattern: {}, All Calc: {}, Follow Edge Once: {}, Edge Offset: {:.2}, Line Spacing: {:.2}",
|
|
|
+ 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,
|
|
|
+ )?;
|
|
|
+ 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,
|
|
|
+ )?;
|
|
|
+ }
|
|
|
+ }
|
|
|
Ok(())
|
|
|
}
|
|
|
}
|