mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-16 10:02:12 +00:00
ENH: avoid crossing wall when travel
Provide related two options to avoid crossing wall when travel. This is handling for github issue #106 Signed-off-by: salt.wei <salt.wei@bambulab.com> Change-Id: I127adbb70f33c3954a08f3087e64c4e75212c7f0
This commit is contained in:
@@ -1167,12 +1167,14 @@ Polyline AvoidCrossingPerimeters::travel_to(const GCode &gcodegen, const Point &
|
||||
travel_intersection_count = 0;
|
||||
}
|
||||
|
||||
const ConfigOptionFloat &opt_max_detour = gcodegen.config().max_travel_detour_distance;
|
||||
const ConfigOptionFloatOrPercent &opt_max_detour = gcodegen.config().max_travel_detour_distance;
|
||||
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 = scale_(opt_max_detour.value);
|
||||
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};
|
||||
max_detour_length_exceeded = true;
|
||||
|
||||
Reference in New Issue
Block a user