Skip to content

Commit

Permalink
Split overhang angle w.r.t. seams off from overhang angle.
Browse files Browse the repository at this point in the history
part of CURA-8076
  • Loading branch information
rburema committed Jun 11, 2024
1 parent f4ddf76 commit d6ead24
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
12 changes: 10 additions & 2 deletions include/LayerPlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class LayerPlan : public NoCopy
coord_t comb_move_inside_distance_; //!< Whenever using the minimum boundary for combing it tries to move the coordinates inside by this distance after calculating the combing.
Shape bridge_wall_mask_; //!< The regions of a layer part that are not supported, used for bridging
Shape overhang_mask_; //!< The regions of a layer part where the walls overhang
Shape seam_overhang_mask_; //!< The regions of a layer part where the walls overhang, specifically as defined for the seam
Shape roofing_mask_; //!< The regions of a layer part where the walls are exposed to the air

bool min_layer_time_used = false; //!< Wether or not the minimum layer time (cool_min_layer_time) was actually used in this layerplan.
Expand Down Expand Up @@ -283,6 +284,13 @@ class LayerPlan : public NoCopy
*/
void setOverhangMask(const Shape& polys);

/*!
* Set seam_overhang_mask.
*
* \param polys The overhung areas of the part currently being processed that will require modified print settings w.r.t. seams
*/
void setSeamOverhangMask(const Shape& polys);

/*!
* Set roofing_mask.
*
Expand Down Expand Up @@ -671,12 +679,12 @@ class LayerPlan : public NoCopy
template<typename T>
unsigned locateFirstSupportedVertex(const T& wall, const unsigned start_idx) const
{
if (bridge_wall_mask_.empty() && overhang_mask_.empty())
if (bridge_wall_mask_.empty() && seam_overhang_mask_.empty())
{
return start_idx;
}

const auto air_below = bridge_wall_mask_.unionPolygons(overhang_mask_);
const auto air_below = bridge_wall_mask_.unionPolygons(seam_overhang_mask_);

unsigned curr_idx = start_idx;

Expand Down
15 changes: 15 additions & 0 deletions src/FffGcodeWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2691,6 +2691,19 @@ bool FffGcodeWriter::processInsets(
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
{
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);
}

const auto roofing_mask_fn = [&]() -> Shape
{
const size_t roofing_layer_count = std::min(mesh.settings.get<size_t>("roofing_layer_count"), mesh.settings.get<size_t>("top_layers"));
Expand Down Expand Up @@ -2721,6 +2734,8 @@ bool FffGcodeWriter::processInsets(
gcode_layer.setBridgeWallMask(Shape());
// clear to disable overhang detection
gcode_layer.setOverhangMask(Shape());
// clear to disable overhang detection
gcode_layer.setSeamOverhangMask(Shape());
// clear to disable use of roofing settings
gcode_layer.setRoofingMask(Shape());
}
Expand Down
5 changes: 5 additions & 0 deletions src/LayerPlan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2689,6 +2689,11 @@ void LayerPlan::setOverhangMask(const Shape& polys)
overhang_mask_ = polys;
}

void LayerPlan::setSeamOverhangMask(const Shape& polys)
{
seam_overhang_mask_ = polys;
}

void LayerPlan::setRoofingMask(const Shape& polys)
{
roofing_mask_ = polys;
Expand Down

0 comments on commit d6ead24

Please sign in to comment.