Fixed of unintentional disabling of wipe even in cases when avoid crossing perimeters weren't applied due to exceeding the maximum detour length.
This commit is contained in:
parent
3eb63c93e1
commit
80251e0cf9
1 changed files with 7 additions and 2 deletions
|
@ -944,19 +944,24 @@ Polyline AvoidCrossingPerimeters::travel_to(const GCode &gcodegen, const Point &
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
if (opt_max_detour.value > 0) {
|
||||||
double direct_length = travel.length();
|
double direct_length = travel.length();
|
||||||
double detour = result_pl.length() - direct_length;
|
double detour = result_pl.length() - direct_length;
|
||||||
double max_detour_length = opt_max_detour.percent ?
|
double max_detour_length = opt_max_detour.percent ?
|
||||||
direct_length * 0.01 * opt_max_detour.value :
|
direct_length * 0.01 * opt_max_detour.value :
|
||||||
scale_(opt_max_detour.value);
|
scale_(opt_max_detour.value);
|
||||||
if (detour > max_detour_length)
|
if (detour > max_detour_length) {
|
||||||
result_pl = {start, end};
|
result_pl = {start, end};
|
||||||
|
max_detour_length_exceeded = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (use_external) {
|
if (use_external) {
|
||||||
result_pl.translate(-scaled_origin);
|
result_pl.translate(-scaled_origin);
|
||||||
*could_be_wipe_disabled = false;
|
*could_be_wipe_disabled = false;
|
||||||
|
} else if (max_detour_length_exceeded) {
|
||||||
|
*could_be_wipe_disabled = false;
|
||||||
} else
|
} else
|
||||||
*could_be_wipe_disabled = !need_wipe(gcodegen, m_grid_lslice, travel, result_pl, travel_intersection_count);
|
*could_be_wipe_disabled = !need_wipe(gcodegen, m_grid_lslice, travel, result_pl, travel_intersection_count);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue