mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 07:27:41 -06: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:
parent
f155f5a498
commit
6c8015ca28
3 changed files with 14 additions and 11 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue