From a9c1d1b92b09eb930b652b6be51cd6eb2b25b910 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Tue, 11 Jun 2024 15:25:37 +0200 Subject: [PATCH] Refactor a little for clarity and to save some lines. done as part of CURA-8076 --- src/FffGcodeWriter.cpp | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/FffGcodeWriter.cpp b/src/FffGcodeWriter.cpp index db67d01f72..46c1a8ec70 100644 --- a/src/FffGcodeWriter.cpp +++ b/src/FffGcodeWriter.cpp @@ -2675,34 +2675,27 @@ bool FffGcodeWriter::processInsets( } const AngleDegrees overhang_angle = mesh.settings.get("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("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 {