Added the possibility to set the maximum length of the detour

This commit is contained in:
Lukáš Hejl 2020-10-16 02:25:45 +02:00
parent c16aad7e0b
commit c828a5d6e9
6 changed files with 22 additions and 2 deletions

View File

@ -597,6 +597,12 @@ namespace Slic3r {
result.points.front() = start;
result.points.back() = end;
Line travel(start, end);
double max_detour_length scale_(gcodegen.config().avoid_crossing_perimeters_max_detour);
if ((max_detour_length > 0) && ((result.length() - travel.length()) > max_detour_length)) {
result = Polyline({start, end});
}
if (use_external)
result.translate(-scaled_origin);
return result;

View File

@ -410,7 +410,7 @@ const std::vector<std::string>& Preset::print_options()
"infill_every_layers", "infill_only_where_needed", "solid_infill_every_layers", "fill_angle", "bridge_angle",
"solid_infill_below_area", "only_retract_when_crossing_perimeters", "infill_first",
"ironing", "ironing_type", "ironing_flowrate", "ironing_speed", "ironing_spacing",
"max_print_speed", "max_volumetric_speed",
"max_print_speed", "max_volumetric_speed", "avoid_crossing_perimeters_max_detour",
#ifdef HAS_PRESSURE_EQUALIZER
"max_volumetric_extrusion_rate_slope_positive", "max_volumetric_extrusion_rate_slope_negative",
#endif /* HAS_PRESSURE_EQUALIZER */

View File

@ -71,6 +71,7 @@ bool Print::invalidate_state_by_config_options(const std::vector<t_config_option
// or they are only notes not influencing the generated G-code.
static std::unordered_set<std::string> steps_gcode = {
"avoid_crossing_perimeters",
"avoid_crossing_perimeters_max_detour",
"bed_shape",
"bed_temperature",
"before_layer_gcode",

View File

@ -180,6 +180,16 @@ void PrintConfigDef::init_fff_params()
def->mode = comExpert;
def->set_default_value(new ConfigOptionBool(false));
def = this->add("avoid_crossing_perimeters_max_detour", coFloat);
def->label = L("Avoid crossing perimeters - The max detour lenght");
def->category = L("Layers and Perimeters");
def->tooltip = L("The maximum detour length for avoid crossing perimeters. "
"If the detour is longer than this value, avoid crossing perimeters is not applied for this path.");
def->sidetext = L("mm (zero to disable)");
def->min = 0;
def->mode = comExpert;
def->set_default_value(new ConfigOptionFloat(0.));
def = this->add("bed_temperature", coInts);
def->label = L("Other layers");
def->tooltip = L("Bed temperature for layers after the first one. "

View File

@ -821,6 +821,7 @@ class PrintConfig : public MachineEnvelopeConfig, public GCodeConfig
public:
ConfigOptionBool avoid_crossing_perimeters;
ConfigOptionFloat avoid_crossing_perimeters_max_detour;
ConfigOptionPoints bed_shape;
ConfigOptionInts bed_temperature;
ConfigOptionFloat bridge_acceleration;
@ -894,6 +895,7 @@ protected:
this->MachineEnvelopeConfig::initialize(cache, base_ptr);
this->GCodeConfig::initialize(cache, base_ptr);
OPT_PTR(avoid_crossing_perimeters);
OPT_PTR(avoid_crossing_perimeters_max_detour);
OPT_PTR(bed_shape);
OPT_PTR(bed_temperature);
OPT_PTR(bridge_acceleration);

View File

@ -530,7 +530,7 @@ void Tab::decorate()
wxColour* colored_label_clr = nullptr;
if (opt.first == "bed_shape" || opt.first == "filament_ramming_parameters" ||
opt.first == "compatible_prints" || opt.first == "compatible_printers")
opt.first == "compatible_prints" || opt.first == "compatible_printers")
colored_label_clr = (m_colored_Label_colors.find(opt.first) == m_colored_Label_colors.end()) ? nullptr : m_colored_Label_colors.at(opt.first);
if (!colored_label_clr) {
@ -1410,6 +1410,7 @@ void TabPrint::build()
optgroup->append_single_option_line("extra_perimeters", category_path + "extra-perimeters-if-needed");
optgroup->append_single_option_line("ensure_vertical_shell_thickness", category_path + "ensure-vertical-shell-thickness");
optgroup->append_single_option_line("avoid_crossing_perimeters", category_path + "avoid-crossing-perimeters");
optgroup->append_single_option_line("avoid_crossing_perimeters_max_detour", category_path + "avoid_crossing_perimeters_max_detour");
optgroup->append_single_option_line("thin_walls", category_path + "detect-thin-walls");
optgroup->append_single_option_line("overhangs", category_path + "detect-bridging-perimeters");