NEW: Z hop restriction

Z hop will only come into effect when it is between retract_lift_above and retract_lift_below.
Signed-off-by: wenjie.guo <wenjie.guo@bambulab.com>
Change-Id: If43aea7024018eb8f532c6af5d8000973f2edee3
This commit is contained in:
wenjie.guo 2023-08-21 17:27:56 +08:00 committed by Lane.Wei
parent a15700e5de
commit c97a88069b
5 changed files with 29 additions and 3 deletions

View file

@ -652,7 +652,10 @@ std::string GCodeWriter::lift(LiftType lift_type, bool spiral_vase)
double target_lift = 0; double target_lift = 0;
{ {
//BBS //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 // BBS
if (m_lifted == 0 && m_to_lift == 0 && target_lift > 0) { if (m_lifted == 0 && m_to_lift == 0 && target_lift > 0) {

View file

@ -135,6 +135,8 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
"retract_restart_extra", "retract_restart_extra",
"retract_restart_extra_toolchange", "retract_restart_extra_toolchange",
"retraction_speed", "retraction_speed",
"retract_lift_above",
"retract_lift_below",
"slow_down_layer_time", "slow_down_layer_time",
"standby_temperature_delta", "standby_temperature_delta",
"machine_start_gcode", "machine_start_gcode",

View file

@ -2431,6 +2431,21 @@ void PrintConfigDef::init_fff_params()
def->mode = comSimple; def->mode = comSimple;
def->set_default_value(new ConfigOptionFloats { 0.4 }); 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 = this->add("z_hop_types", coEnums);
def->label = L("Z Hop Type"); def->label = L("Z Hop Type");
def->tooltip = L(""); def->tooltip = L("");
@ -3435,7 +3450,7 @@ void PrintConfigDef::init_fff_params()
// Declare retract values for filament profile, overriding the printer's extruder profile. // Declare retract values for filament profile, overriding the printer's extruder profile.
for (const char *opt_key : { for (const char *opt_key : {
// floats // 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 // BBS: floats
"wipe_distance", "wipe_distance",
// bools // bools
@ -3482,7 +3497,7 @@ void PrintConfigDef::init_extruder_option_keys()
// ConfigOptionFloats, ConfigOptionPercents, ConfigOptionBools, ConfigOptionStrings // ConfigOptionFloats, ConfigOptionPercents, ConfigOptionBools, ConfigOptionStrings
m_extruder_option_keys = { m_extruder_option_keys = {
"extruder_type", "nozzle_diameter", "min_layer_height", "max_layer_height", "extruder_offset", "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_before_wipe", "retract_restart_extra", "retraction_minimum_travel", "wipe", "wipe_distance",
"retract_when_changing_layer", "retract_length_toolchange", "retract_restart_extra_toolchange", "extruder_colour", "retract_when_changing_layer", "retract_length_toolchange", "retract_restart_extra_toolchange", "extruder_colour",
"default_filament_profile" "default_filament_profile"
@ -3491,6 +3506,8 @@ void PrintConfigDef::init_extruder_option_keys()
m_extruder_retract_keys = { m_extruder_retract_keys = {
"deretraction_speed", "deretraction_speed",
"retract_before_wipe", "retract_before_wipe",
"retract_lift_above",
"retract_lift_below",
"retract_restart_extra", "retract_restart_extra",
"retract_when_changing_layer", "retract_when_changing_layer",
"retraction_length", "retraction_length",

View file

@ -860,6 +860,8 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionFloats, retract_restart_extra)) ((ConfigOptionFloats, retract_restart_extra))
((ConfigOptionFloats, retract_restart_extra_toolchange)) ((ConfigOptionFloats, retract_restart_extra_toolchange))
((ConfigOptionFloats, retraction_speed)) ((ConfigOptionFloats, retraction_speed))
((ConfigOptionFloats, retract_lift_above))
((ConfigOptionFloats, retract_lift_below))
((ConfigOptionString, machine_start_gcode)) ((ConfigOptionString, machine_start_gcode))
((ConfigOptionStrings, filament_start_gcode)) ((ConfigOptionStrings, filament_start_gcode))
((ConfigOptionBool, single_extruder_multi_material)) ((ConfigOptionBool, single_extruder_multi_material))

View file

@ -3465,6 +3465,8 @@ void TabPrinter::build_unregular_pages(bool from_initial_build/* = false*/)
optgroup = page->new_optgroup(L("Retraction"), L"param_retraction"); optgroup = page->new_optgroup(L("Retraction"), L"param_retraction");
optgroup->append_single_option_line("retraction_length", "", extruder_idx); optgroup->append_single_option_line("retraction_length", "", extruder_idx);
optgroup->append_single_option_line("z_hop", "", 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("z_hop_types", "", extruder_idx);
optgroup->append_single_option_line("retraction_speed", "", extruder_idx); optgroup->append_single_option_line("retraction_speed", "", extruder_idx);
optgroup->append_single_option_line("deretraction_speed", "", extruder_idx); optgroup->append_single_option_line("deretraction_speed", "", extruder_idx);