diff --git a/src/libslic3r/GCodeWriter.cpp b/src/libslic3r/GCodeWriter.cpp index 8a9f3488b8..57f9f1775a 100644 --- a/src/libslic3r/GCodeWriter.cpp +++ b/src/libslic3r/GCodeWriter.cpp @@ -652,7 +652,10 @@ std::string GCodeWriter::lift(LiftType lift_type, bool spiral_vase) double target_lift = 0; { //BBS - target_lift = this->config.z_hop.get_at(m_extruder->id()); + double above = this->config.retract_lift_above.get_at(m_extruder->id()); + double below = this->config.retract_lift_below.get_at(m_extruder->id()); + if (m_pos.z() >= above && (below == 0 || m_pos.z() <= below)) + target_lift = this->config.z_hop.get_at(m_extruder->id()); } // BBS if (m_lifted == 0 && m_to_lift == 0 && target_lift > 0) { diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index de2f02a32f..6761f5d9f2 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -135,6 +135,8 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n "retract_restart_extra", "retract_restart_extra_toolchange", "retraction_speed", + "retract_lift_above", + "retract_lift_below", "slow_down_layer_time", "standby_temperature_delta", "machine_start_gcode", diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 650d7c61e0..3f09cd54fa 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -2431,6 +2431,21 @@ void PrintConfigDef::init_fff_params() def->mode = comSimple; def->set_default_value(new ConfigOptionFloats { 0.4 }); + def = this->add("retract_lift_above", coFloats); + def->label = L("Z hop lower boundary"); + def->tooltip = L("Z hop will only come into effect when Z is above this value and is below the parameter: \"Z hop upper boundary\""); + def->sidetext = L("mm"); + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionFloats{0.}); + + def = this->add("retract_lift_below", coFloats); + def->label = L("Z hop upper boundary"); + def->tooltip = L("If this value is positive, Z hop will only come into effect when Z is above the parameter: \"Z hop lower boundary\" and is below this value"); + def->sidetext = L("mm"); + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionFloats{0.}); + + def = this->add("z_hop_types", coEnums); def->label = L("Z Hop Type"); def->tooltip = L(""); @@ -3435,7 +3450,7 @@ void PrintConfigDef::init_fff_params() // Declare retract values for filament profile, overriding the printer's extruder profile. for (const char *opt_key : { // floats - "retraction_length", "z_hop", "z_hop_types", "retraction_speed", "deretraction_speed", "retract_restart_extra", "retraction_minimum_travel", + "retraction_length", "z_hop", "z_hop_types", "retract_lift_above", "retract_lift_below","retraction_speed", "deretraction_speed", "retract_restart_extra", "retraction_minimum_travel", // BBS: floats "wipe_distance", // bools @@ -3482,7 +3497,7 @@ void PrintConfigDef::init_extruder_option_keys() // ConfigOptionFloats, ConfigOptionPercents, ConfigOptionBools, ConfigOptionStrings m_extruder_option_keys = { "extruder_type", "nozzle_diameter", "min_layer_height", "max_layer_height", "extruder_offset", - "retraction_length", "z_hop", "z_hop_types", "retraction_speed", "deretraction_speed", + "retraction_length", "z_hop", "z_hop_types", "retraction_speed", "retract_lift_above", "retract_lift_below","deretraction_speed", "retract_before_wipe", "retract_restart_extra", "retraction_minimum_travel", "wipe", "wipe_distance", "retract_when_changing_layer", "retract_length_toolchange", "retract_restart_extra_toolchange", "extruder_colour", "default_filament_profile" @@ -3491,6 +3506,8 @@ void PrintConfigDef::init_extruder_option_keys() m_extruder_retract_keys = { "deretraction_speed", "retract_before_wipe", + "retract_lift_above", + "retract_lift_below", "retract_restart_extra", "retract_when_changing_layer", "retraction_length", diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 3f1fa4a2a4..dee5c2bf12 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -860,6 +860,8 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionFloats, retract_restart_extra)) ((ConfigOptionFloats, retract_restart_extra_toolchange)) ((ConfigOptionFloats, retraction_speed)) + ((ConfigOptionFloats, retract_lift_above)) + ((ConfigOptionFloats, retract_lift_below)) ((ConfigOptionString, machine_start_gcode)) ((ConfigOptionStrings, filament_start_gcode)) ((ConfigOptionBool, single_extruder_multi_material)) diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 9b52351cd5..eba32f616a 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -3465,6 +3465,8 @@ void TabPrinter::build_unregular_pages(bool from_initial_build/* = false*/) optgroup = page->new_optgroup(L("Retraction"), L"param_retraction"); optgroup->append_single_option_line("retraction_length", "", extruder_idx); optgroup->append_single_option_line("z_hop", "", extruder_idx); + optgroup->append_single_option_line("retract_lift_above", "", extruder_idx); + optgroup->append_single_option_line("retract_lift_below", "", extruder_idx); optgroup->append_single_option_line("z_hop_types", "", extruder_idx); optgroup->append_single_option_line("retraction_speed", "", extruder_idx); optgroup->append_single_option_line("deretraction_speed", "", extruder_idx);