Skip to content

Commit

Permalink
Apply the raft infill overlap
Browse files Browse the repository at this point in the history
  • Loading branch information
wawanbreton committed Jun 19, 2024
1 parent e6bb061 commit cfdf0b4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
5 changes: 4 additions & 1 deletion include/infill.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }
Expand All @@ -188,6 +190,7 @@ class Infill
, zag_skip_count_{ zag_skip_count }
, pocket_size_{ pocket_size }
, mirror_offset_{ zig_zaggify }
, pattern_overlap_{ pattern_overlap }
{
}

Expand Down
22 changes: 15 additions & 7 deletions src/FffGcodeWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,6 @@ void FffGcodeWriter::processRaft(const SliceDataStorage& storage)
const size_t num_surface_layers = surface_settings.get<size_t>("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;
Expand Down Expand Up @@ -624,6 +623,8 @@ void FffGcodeWriter::processRaft(const SliceDataStorage& storage)
const size_t wall_line_count = base_settings.get<size_t>("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<coord_t>("raft_base_line_spacing");
constexpr coord_t infill_overlap = 0;
const coord_t pattern_overlap = base_settings.get<coord_t>("raft_base_infill_overlap_mm");
const coord_t line_spacing_prime_tower = base_settings.get<coord_t>("prime_tower_raft_base_line_spacing");
const Point2LL& infill_origin = Point2LL();
constexpr bool skip_stitching = false;
Expand Down Expand Up @@ -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,
Expand All @@ -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<VariableWidthLines> raft_paths;
infill_comp.generate(raft_paths, raft_polygons, raft_lines, base_settings, layer_nr, SectionType::ADHESION);
if (! raft_paths.empty())
Expand Down Expand Up @@ -753,6 +755,8 @@ void FffGcodeWriter::processRaft(const SliceDataStorage& storage)
const coord_t interface_line_spacing = interface_settings.get<coord_t>("raft_interface_line_spacing");
const Ratio interface_fan_speed = interface_settings.get<Ratio>("raft_interface_fan_speed");
const coord_t interface_line_width = interface_settings.get<coord_t>("raft_interface_line_width");
constexpr coord_t interface_infill_overlap = 0;
const coord_t interface_pattern_overlap = interface_settings.get<coord_t>("raft_interface_infill_overlap_mm");
const coord_t interface_avoid_distance = interface_settings.get<coord_t>("travel_avoid_distance");
const coord_t interface_max_resolution = interface_settings.get<coord_t>("meshfix_maximum_resolution");
const coord_t interface_max_deviation = interface_settings.get<coord_t>("meshfix_maximum_deviation");
Expand Down Expand Up @@ -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,
Expand All @@ -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<VariableWidthLines> raft_paths;
infill_comp.generate(raft_paths, raft_polygons, raft_lines, interface_settings, layer_nr, SectionType::ADHESION);
if (! raft_paths.empty())
Expand Down Expand Up @@ -912,6 +917,8 @@ void FffGcodeWriter::processRaft(const SliceDataStorage& storage)
const coord_t surface_max_resolution = surface_settings.get<coord_t>("meshfix_maximum_resolution");
const coord_t surface_max_deviation = surface_settings.get<coord_t>("meshfix_maximum_deviation");
const coord_t surface_line_width = surface_settings.get<coord_t>("raft_surface_line_width");
constexpr coord_t surface_infill_overlap = 0;
const coord_t surface_pattern_overlap = surface_settings.get<coord_t>("raft_surface_infill_overlap_mm");
const coord_t surface_avoid_distance = surface_settings.get<coord_t>("travel_avoid_distance");
const Ratio surface_fan_speed = surface_settings.get<Ratio>("raft_surface_fan_speed");
const bool surface_monotonic = surface_settings.get<bool>("raft_surface_monotonic");
Expand Down Expand Up @@ -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,
Expand All @@ -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<VariableWidthLines> raft_paths;
infill_comp.generate(raft_paths, raft_polygons, raft_lines, surface_settings, layer_nr, SectionType::ADHESION);
Expand Down
2 changes: 2 additions & 0 deletions src/infill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cfdf0b4

Please sign in to comment.