From 7f951c2df8e0b654c08c118502c8378c05fde435 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hejl?= Date: Wed, 1 Dec 2021 08:18:27 +0100 Subject: [PATCH] Fixed an issue that travels could lead through a hole when the avoid crossing perimeters was enabled at the same with "External perimeter first" or "Detect thin walls". --- src/libslic3r/GCode/AvoidCrossingPerimeters.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/libslic3r/GCode/AvoidCrossingPerimeters.cpp b/src/libslic3r/GCode/AvoidCrossingPerimeters.cpp index 1f538862b..d29f7216a 100644 --- a/src/libslic3r/GCode/AvoidCrossingPerimeters.cpp +++ b/src/libslic3r/GCode/AvoidCrossingPerimeters.cpp @@ -254,7 +254,7 @@ static std::vector extend_for_closest_lines(const std::vector new_intersections = intersections; - if (!intersections.empty() && !start_lines.empty()) { + if (!new_intersections.empty() && !start_lines.empty()) { size_t cl_start_idx = get_closer(start_lines, new_intersections.front(), start); if (cl_start_idx != std::numeric_limits::max()) { // If there is any ClosestLine around the start point closer to the Intersection, then replace this Intersection with ClosestLine. @@ -265,11 +265,13 @@ static std::vector extend_for_closest_lines(const std::vector::max()) ? start_lines[start_closest_lines_idx] : start_lines.front(); new_intersections.insert(new_intersections.begin(),{cl_start.border_idx, cl_start.line_idx, cl_start.point, compute_distance(cl_start)}); } - } else if (!intersections.empty() && !end_lines.empty()) { + } + + if (!new_intersections.empty() && !end_lines.empty()) { size_t cl_end_idx = get_closer(end_lines, new_intersections.back(), end); if (cl_end_idx != std::numeric_limits::max()) { // If there is any ClosestLine around the end point closer to the Intersection, then replace this Intersection with ClosestLine. @@ -280,7 +282,7 @@ static std::vector extend_for_closest_lines(const std::vector::max()) ? end_lines[end_closest_lines_idx] : end_lines.front(); new_intersections.push_back({cl_end.border_idx, cl_end.line_idx, cl_end.point, compute_distance(cl_end)}); }