mirror of
https://github.com/FULU-Foundation/OrcaSlicer-bambulab.git
synced 2026-05-16 20:32:43 -07:00
Avoid crossing perimeters max detour could newly be specified
in percentage of the direct path.
This commit is contained in:
@@ -903,9 +903,16 @@ Polyline AvoidCrossingPerimeters::travel_to(const GCode &gcodegen, const Point &
|
||||
travel_intersection_count = 0;
|
||||
}
|
||||
|
||||
double max_detour_length scale_(gcodegen.config().avoid_crossing_perimeters_max_detour);
|
||||
if (max_detour_length > 0 && (result_pl.length() - travel.length()) > max_detour_length)
|
||||
result_pl = {start, end};
|
||||
const ConfigOptionFloatOrPercent &opt_max_detour = gcodegen.config().avoid_crossing_perimeters_max_detour;
|
||||
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)
|
||||
result_pl = {start, end};
|
||||
}
|
||||
|
||||
if (use_external) {
|
||||
result_pl.translate(-scaled_origin);
|
||||
|
||||
Reference in New Issue
Block a user