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
|
@ -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;
|
||||
|
|
|
@ -455,22 +455,23 @@ void PrintConfigDef::init_fff_params()
|
|||
const int max_temp = 1500;
|
||||
|
||||
def = this->add("reduce_crossing_wall", coBool);
|
||||
def->label = L("Avoid crossing wall when travel");
|
||||
def->label = L("Avoid crossing wall");
|
||||
def->category = L("Quality");
|
||||
def->tooltip = L("Detour and avoid to travel across wall which may cause blob on surface");
|
||||
def->mode = comDevelop;
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionBool(false));
|
||||
|
||||
def = this->add("max_travel_detour_distance", coFloat);
|
||||
def->label = L("Max travel detour distance");
|
||||
def = this->add("max_travel_detour_distance", coFloatOrPercent);
|
||||
def->label = L("Avoid crossing wall - Max detour length");
|
||||
def->category = L("Quality");
|
||||
def->tooltip = L("Maximum detour distance for avoiding crossing wall. "
|
||||
"Don't detour if the detour distance is large than this value");
|
||||
def->sidetext = L("mm");
|
||||
"Don't detour if the detour distance is large than this value. "
|
||||
"Detour length could be specified either as an absolute value or as percentage (for example 50%) of a direct travel path. Zero to disable");
|
||||
def->sidetext = L("mm or %");
|
||||
def->min = 0;
|
||||
def->max_literal = 1000;
|
||||
def->mode = comDevelop;
|
||||
def->set_default_value(new ConfigOptionFloat(0.));
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionFloatOrPercent(0., false));
|
||||
|
||||
// BBS
|
||||
def = this->add("cool_plate_temp", coInts);
|
||||
|
|
|
@ -799,7 +799,7 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
|
|||
//BBS
|
||||
((ConfigOptionInts, additional_cooling_fan_speed))
|
||||
((ConfigOptionBool, reduce_crossing_wall))
|
||||
((ConfigOptionFloat, max_travel_detour_distance))
|
||||
((ConfigOptionFloatOrPercent, max_travel_detour_distance))
|
||||
((ConfigOptionPoints, printable_area))
|
||||
//BBS: add bed_exclude_area
|
||||
((ConfigOptionPoints, bed_exclude_area))
|
||||
|
|
Loading…
Reference in New Issue