Skip to content

Commit

Permalink
Correct for support-gap equal to exact layer-height multiple.
Browse files Browse the repository at this point in the history
part of CURA-10407
  • Loading branch information
rburema committed Oct 25, 2023
1 parent 98fc849 commit 78fcc88
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/FffGcodeWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2289,7 +2289,7 @@ bool FffGcodeWriter::processInsets(
if (mesh_group_settings.get<bool>("support_enable"))
{
const coord_t z_distance_top = mesh.settings.get<coord_t>("support_top_distance");
const size_t z_distance_top_layers = round_up_divide(z_distance_top, layer_height); // Previously '... +1', but now there is an extra fractional layer on top.
const size_t z_distance_top_layers = round_up_divide(z_distance_top, layer_height) + (z_distance_top % layer_height == 0) ? 1 : 0;
const int support_layer_nr = gcode_layer.getLayerNr() - z_distance_top_layers;

if (support_layer_nr > 0)
Expand Down Expand Up @@ -2693,7 +2693,7 @@ void FffGcodeWriter::processTopBottom(
{
const coord_t layer_height = mesh_config.inset0_config.getLayerThickness();
const coord_t z_distance_top = mesh.settings.get<coord_t>("support_top_distance");
const size_t z_distance_top_layers = round_up_divide(z_distance_top, layer_height); // Previously '... +1', but now there is an extra fractional layer on top.
const size_t z_distance_top_layers = round_up_divide(z_distance_top, layer_height) + (z_distance_top % layer_height == 0) ? 1 : 0;
support_layer_nr = layer_nr - z_distance_top_layers;
}

Expand Down
4 changes: 2 additions & 2 deletions src/support.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ void AreaSupport::generateOverhangAreasForMesh(SliceDataStorage& storage, SliceM
// Don't generate overhang areas if the Z distance is higher than the objects we're generating support for.
const coord_t layer_height = Application::getInstance().current_slice->scene.current_mesh_group->settings.get<coord_t>("layer_height");
const coord_t z_distance_top = mesh.settings.get<coord_t>("support_top_distance");
const size_t z_distance_top_layers = round_up_divide(z_distance_top, layer_height); // Previously '... +1', but now there is an extra fractional layer on top.
const size_t z_distance_top_layers = round_up_divide(z_distance_top, layer_height) + (z_distance_top % layer_height == 0) ? 1 : 0;
if (z_distance_top_layers + 1 > storage.print_layer_count)
{
return;
Expand Down Expand Up @@ -1050,7 +1050,7 @@ void AreaSupport::generateSupportAreasForMesh(
// early out
const coord_t layer_thickness = mesh_group_settings.get<coord_t>("layer_height");
const coord_t z_distance_top = ((mesh.settings.get<bool>("support_roof_enable")) ? roof_settings : infill_settings).get<coord_t>("support_top_distance");
const size_t layer_z_distance_top = round_up_divide(z_distance_top, layer_thickness); // Previously '... +1', but now there is an extra fractional layer on top.
const size_t layer_z_distance_top = round_up_divide(z_distance_top, layer_thickness) + (z_distance_top % layer_thickness == 0) ? 1 : 0;
if (layer_z_distance_top + 1 > layer_count)
{
return;
Expand Down

0 comments on commit 78fcc88

Please sign in to comment.