Skip to content

Commit

Permalink
Refactor a little for clarity and to save some lines.
Browse files Browse the repository at this point in the history
done as part of CURA-8076
  • Loading branch information
rburema committed Jun 11, 2024
1 parent d6ead24 commit a9c1d1b
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions src/FffGcodeWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2675,34 +2675,27 @@ bool FffGcodeWriter::processInsets(
}

const AngleDegrees overhang_angle = mesh.settings.get<AngleDegrees>("wall_overhang_angle");
if (overhang_angle >= 90)
{
// clear to disable overhang detection
gcode_layer.setOverhangMask(Shape());
}
else
Shape overhang_region; // keep empty to disable overhang detection
if (overhang_angle < 90)
{
// the overhang mask is set to the area of the current part's outline minus the region that is considered to be supported
// the supported region is made up of those areas that really are supported by either model or support on the layer below
// expanded to take into account the overhang angle, the greater the overhang angle, the larger the supported area is
// considered to be
const coord_t overhang_width = layer_height * std::tan(overhang_angle / (180 / std::numbers::pi));
Shape overhang_region = part.outline.offset(-half_outer_wall_width).difference(outlines_below.offset(10 + overhang_width - half_outer_wall_width)).offset(10);
gcode_layer.setOverhangMask(overhang_region);
overhang_region = part.outline.offset(-half_outer_wall_width).difference(outlines_below.offset(10 + overhang_width - half_outer_wall_width)).offset(10);
}
gcode_layer.setOverhangMask(overhang_region);

// As above, but for the seam overhang mask instead of the wall one.
const AngleDegrees seam_overhang_angle = mesh.settings.get<AngleDegrees>("seam_overhang_angle");
if (seam_overhang_angle >= 90)
{
gcode_layer.setSeamOverhangMask(Shape());
}
else
Shape seam_overhang_region; // keep empty to disable overhang detection w.r.t. seams
if (seam_overhang_angle < 90)
{
const coord_t overhang_width = layer_height * std::tan(seam_overhang_angle / (180 / std::numbers::pi));
Shape overhang_region = part.outline.offset(-half_outer_wall_width).difference(outlines_below.offset(10 + overhang_width - half_outer_wall_width)).offset(10);
gcode_layer.setSeamOverhangMask(overhang_region);
seam_overhang_region = part.outline.offset(-half_outer_wall_width).difference(outlines_below.offset(10 + overhang_width - half_outer_wall_width)).offset(10);
}
gcode_layer.setSeamOverhangMask(seam_overhang_region);

const auto roofing_mask_fn = [&]() -> Shape
{
Expand Down

0 comments on commit a9c1d1b

Please sign in to comment.