Skip to content

Commit

Permalink
Only split up densities _completely_ when we zig-zaggify infill.
Browse files Browse the repository at this point in the history
Only do the new split-up in the rare cases where stuff goes wrong for now (= gradual fills + connected fill lines). We're not adjusting the percentages for not doubling/tripling/etc over an area anymore, since that would change too much at this juncture, make it less predicatble which lines in the layer below match up, and we have more walls anyway because of the zig-zagging.

part of CURA-11597
  • Loading branch information
rburema committed Apr 11, 2024
1 parent f05f538 commit 449c209
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/skin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ void SkinInfillAreaComputation::generateGradualInfill(SliceMeshStorage& mesh)
const auto infill_wall_count = mesh.settings.get<size_t>("infill_wall_line_count");
const auto infill_wall_width = mesh.settings.get<coord_t>("infill_line_width");
const auto infill_overlap = mesh.settings.get<coord_t>("infill_overlap_mm");
const auto is_connected = mesh.settings.get<bool>("zig_zaggify_infill") || mesh.settings.get<EFillMethod>("infill_pattern") == EFillMethod::ZIG_ZAG;
for (LayerIndex layer_idx = 0; layer_idx < static_cast<LayerIndex>(mesh.layers.size()); layer_idx++)
{ // loop also over layers which don't contain infill cause of bottom_ and top_layer to initialize their infill_area_per_combine_per_density
SliceLayer& layer = mesh.layers[layer_idx];
Expand All @@ -497,7 +498,7 @@ void SkinInfillAreaComputation::generateGradualInfill(SliceMeshStorage& mesh)
continue;
}
Polygons less_dense_infill = infill_area; // one step less dense with each infill_step
Polygons sum_more_dense;
Polygons sum_more_dense; // NOTE: Only used for zig-zag or connected fills.
for (size_t infill_step = 0; infill_step < max_infill_steps; infill_step++)
{
LayerIndex min_layer = layer_idx + infill_step * gradual_infill_step_layer_count + static_cast<size_t>(layer_skip_count);
Expand Down Expand Up @@ -532,7 +533,10 @@ void SkinInfillAreaComputation::generateGradualInfill(SliceMeshStorage& mesh)
const Polygons more_dense_infill = infill_area.difference(less_dense_infill);
infill_area_per_combine_current_density.push_back(
simplifier.polygon(more_dense_infill.difference(sum_more_dense).offset(-infill_wall_width).offset(infill_wall_width)));
sum_more_dense = sum_more_dense.unionPolygons(more_dense_infill);
if (is_connected)
{
sum_more_dense = sum_more_dense.unionPolygons(more_dense_infill);
}
}
part.infill_area_per_combine_per_density.emplace_back();
std::vector<Polygons>& infill_area_per_combine_current_density = part.infill_area_per_combine_per_density.back();
Expand Down
8 changes: 6 additions & 2 deletions src/support.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ void AreaSupport::generateGradualSupport(SliceDataStorage& storage)
const size_t max_density_steps = infill_extruder.settings_.get<size_t>("gradual_support_infill_steps");

const coord_t wall_width = infill_extruder.settings_.get<coord_t>("support_line_width");
const bool is_connected = infill_extruder.settings_.get<bool>("zig_zaggify_infill") || infill_extruder.settings_.get<EFillMethod>("infill_pattern") == EFillMethod::ZIG_ZAG;
const Simplify simplifier(infill_extruder.settings_);

// no early-out for this function; it needs to initialize the [infill_area_per_combine_per_density]
Expand Down Expand Up @@ -235,7 +236,7 @@ void AreaSupport::generateGradualSupport(SliceDataStorage& storage)

// calculate density areas for this island
Polygons less_dense_support = infill_area; // one step less dense with each density_step
Polygons sum_more_dense;
Polygons sum_more_dense; // NOTE: Only used for zig-zag or connected fills.
for (unsigned int density_step = 0; density_step < max_density_steps; ++density_step)
{
LayerIndex actual_min_layer{ layer_nr + density_step * gradual_support_step_layer_count + static_cast<LayerIndex::value_type>(layer_skip_count) };
Expand Down Expand Up @@ -295,7 +296,10 @@ void AreaSupport::generateGradualSupport(SliceDataStorage& storage)
std::vector<Polygons>& support_area_current_density = support_infill_part.infill_area_per_combine_per_density_.back();
const Polygons more_dense_support = infill_area.difference(less_dense_support);
support_area_current_density.push_back(simplifier.polygon(more_dense_support.difference(sum_more_dense).offset(-wall_width).offset(wall_width)));
sum_more_dense = sum_more_dense.unionPolygons(more_dense_support);
if (is_connected)
{
sum_more_dense = sum_more_dense.unionPolygons(more_dense_support);
}
}

support_infill_part.infill_area_per_combine_per_density_.emplace_back();
Expand Down

0 comments on commit 449c209

Please sign in to comment.