From cfdf0b40eefbbaa5158f0feffd8d5afa5864561b Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU Date: Wed, 19 Jun 2024 13:52:45 +0200 Subject: [PATCH] Apply the raft infill overlap --- include/infill.h | 5 ++++- src/FffGcodeWriter.cpp | 22 +++++++++++++++------- src/infill.cpp | 2 ++ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/include/infill.h b/include/infill.h index 081652d68f..53994fb122 100644 --- a/include/infill.h +++ b/include/infill.h @@ -42,6 +42,7 @@ class Infill coord_t infill_line_width_{}; //!< The line width of the infill lines to generate coord_t line_distance_{}; //!< The distance between two infill lines / polygons coord_t infill_overlap_{}; //!< the distance by which to overlap with the actual area within which to generate infill + coord_t pattern_overlap_{ 0 }; //!< The distance by which to overlap the inner infill pattern with the walls size_t infill_multiplier_{}; //!< the number of infill lines next to each other AngleDegrees fill_angle_{}; //!< for linear infill types: the angle of the infill lines (or the angle of the grid) coord_t z_{}; //!< height of the layer for which we generate infill @@ -163,7 +164,8 @@ class Infill bool use_endpieces, bool skip_some_zags, size_t zag_skip_count, - coord_t pocket_size) noexcept + coord_t pocket_size, + coord_t pattern_overlap = 0) noexcept : pattern_{ pattern } , zig_zaggify_{ zig_zaggify } , connect_polygons_{ connect_polygons } @@ -188,6 +190,7 @@ class Infill , zag_skip_count_{ zag_skip_count } , pocket_size_{ pocket_size } , mirror_offset_{ zig_zaggify } + , pattern_overlap_{ pattern_overlap } { } diff --git a/src/FffGcodeWriter.cpp b/src/FffGcodeWriter.cpp index c9651d0624..2411f3d02a 100644 --- a/src/FffGcodeWriter.cpp +++ b/src/FffGcodeWriter.cpp @@ -580,7 +580,6 @@ void FffGcodeWriter::processRaft(const SliceDataStorage& storage) const size_t num_surface_layers = surface_settings.get("raft_surface_layers"); // some infill config for all lines infill generation below - constexpr double fill_overlap = 0; // raft line shouldn't be expanded - there is no boundary polygon printed constexpr int infill_multiplier = 1; // rafts use single lines constexpr int extra_infill_shift = 0; constexpr bool fill_gaps = true; @@ -624,6 +623,8 @@ void FffGcodeWriter::processRaft(const SliceDataStorage& storage) const size_t wall_line_count = base_settings.get("raft_base_wall_count"); const coord_t small_area_width = 0; // A raft never has a small region due to the large horizontal expansion. const coord_t line_spacing = base_settings.get("raft_base_line_spacing"); + constexpr coord_t infill_overlap = 0; + const coord_t pattern_overlap = base_settings.get("raft_base_infill_overlap_mm"); const coord_t line_spacing_prime_tower = base_settings.get("prime_tower_raft_base_line_spacing"); const Point2LL& infill_origin = Point2LL(); constexpr bool skip_stitching = false; @@ -668,7 +669,7 @@ void FffGcodeWriter::processRaft(const SliceDataStorage& storage) raft_outline_path.outline, gcode_layer.configs_storage_.raft_base_config.getLineWidth(), raft_outline_path.line_spacing, - fill_overlap, + infill_overlap, infill_multiplier, fill_angle, z, @@ -684,7 +685,8 @@ void FffGcodeWriter::processRaft(const SliceDataStorage& storage) use_endpieces, skip_some_zags, zag_skip_count, - pocket_size); + pocket_size, + pattern_overlap); std::vector raft_paths; infill_comp.generate(raft_paths, raft_polygons, raft_lines, base_settings, layer_nr, SectionType::ADHESION); if (! raft_paths.empty()) @@ -753,6 +755,8 @@ void FffGcodeWriter::processRaft(const SliceDataStorage& storage) const coord_t interface_line_spacing = interface_settings.get("raft_interface_line_spacing"); const Ratio interface_fan_speed = interface_settings.get("raft_interface_fan_speed"); const coord_t interface_line_width = interface_settings.get("raft_interface_line_width"); + constexpr coord_t interface_infill_overlap = 0; + const coord_t interface_pattern_overlap = interface_settings.get("raft_interface_infill_overlap_mm"); const coord_t interface_avoid_distance = interface_settings.get("travel_avoid_distance"); const coord_t interface_max_resolution = interface_settings.get("meshfix_maximum_resolution"); const coord_t interface_max_deviation = interface_settings.get("meshfix_maximum_deviation"); @@ -826,7 +830,7 @@ void FffGcodeWriter::processRaft(const SliceDataStorage& storage) raft_outline_path, infill_outline_width, interface_line_spacing, - fill_overlap, + interface_infill_overlap, infill_multiplier, fill_angle, z, @@ -842,7 +846,8 @@ void FffGcodeWriter::processRaft(const SliceDataStorage& storage) use_endpieces, skip_some_zags, zag_skip_count, - pocket_size); + pocket_size, + interface_pattern_overlap); std::vector raft_paths; infill_comp.generate(raft_paths, raft_polygons, raft_lines, interface_settings, layer_nr, SectionType::ADHESION); if (! raft_paths.empty()) @@ -912,6 +917,8 @@ void FffGcodeWriter::processRaft(const SliceDataStorage& storage) const coord_t surface_max_resolution = surface_settings.get("meshfix_maximum_resolution"); const coord_t surface_max_deviation = surface_settings.get("meshfix_maximum_deviation"); const coord_t surface_line_width = surface_settings.get("raft_surface_line_width"); + constexpr coord_t surface_infill_overlap = 0; + const coord_t surface_pattern_overlap = surface_settings.get("raft_surface_infill_overlap_mm"); const coord_t surface_avoid_distance = surface_settings.get("travel_avoid_distance"); const Ratio surface_fan_speed = surface_settings.get("raft_surface_fan_speed"); const bool surface_monotonic = surface_settings.get("raft_surface_monotonic"); @@ -991,7 +998,7 @@ void FffGcodeWriter::processRaft(const SliceDataStorage& storage) raft_island, infill_outline_width, surface_line_spacing, - fill_overlap, + surface_infill_overlap, infill_multiplier, fill_angle, z, @@ -1007,7 +1014,8 @@ void FffGcodeWriter::processRaft(const SliceDataStorage& storage) use_endpieces, skip_some_zags, zag_skip_count, - pocket_size); + pocket_size, + surface_pattern_overlap); std::vector raft_paths; infill_comp.generate(raft_paths, raft_polygons, raft_lines, surface_settings, layer_nr, SectionType::ADHESION); diff --git a/src/infill.cpp b/src/infill.cpp index a2d931d262..86f72c646c 100644 --- a/src/infill.cpp +++ b/src/infill.cpp @@ -103,6 +103,8 @@ void Infill::generate( inner_contour_ = generateWallToolPaths(toolpaths, outer_contour_, wall_line_count_, infill_line_width_, infill_overlap_, settings, layer_idx, section_type); scripta::log("infill_inner_contour_0", inner_contour_, section_type, layer_idx); + inner_contour_ = inner_contour_.offset(pattern_overlap_); + // It does not make sense to print a pattern in a small region. So the infill region // is split into a small region that will be filled with walls and the normal region // that will be filled with the pattern. This split of regions is not needed if the