From 80251e0cf98c117be915c3bc7adfc4ce85b127b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hejl?= Date: Wed, 16 Dec 2020 13:17:09 +0100 Subject: [PATCH] Fixed of unintentional disabling of wipe even in cases when avoid crossing perimeters weren't applied due to exceeding the maximum detour length. --- src/libslic3r/GCode/AvoidCrossingPerimeters.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/GCode/AvoidCrossingPerimeters.cpp b/src/libslic3r/GCode/AvoidCrossingPerimeters.cpp index 59652b565..f1d895372 100644 --- a/src/libslic3r/GCode/AvoidCrossingPerimeters.cpp +++ b/src/libslic3r/GCode/AvoidCrossingPerimeters.cpp @@ -943,20 +943,25 @@ Polyline AvoidCrossingPerimeters::travel_to(const GCode &gcodegen, const Point & travel_intersection_count = 0; } - const ConfigOptionFloatOrPercent &opt_max_detour = gcodegen.config().avoid_crossing_perimeters_max_detour; + const ConfigOptionFloatOrPercent &opt_max_detour = gcodegen.config().avoid_crossing_perimeters_max_detour; + bool max_detour_length_exceeded = false; if (opt_max_detour.value > 0) { double direct_length = travel.length(); double detour = result_pl.length() - direct_length; double max_detour_length = opt_max_detour.percent ? direct_length * 0.01 * opt_max_detour.value : scale_(opt_max_detour.value); - if (detour > max_detour_length) + if (detour > max_detour_length) { result_pl = {start, end}; + max_detour_length_exceeded = true; + } } if (use_external) { result_pl.translate(-scaled_origin); *could_be_wipe_disabled = false; + } else if (max_detour_length_exceeded) { + *could_be_wipe_disabled = false; } else *could_be_wipe_disabled = !need_wipe(gcodegen, m_grid_lslice, travel, result_pl, travel_intersection_count);