From 5b5c1bf48ad00fc3bf5fbe5357d68ae909f02bd5 Mon Sep 17 00:00:00 2001 From: Erwan MATHIEU Date: Mon, 24 Jun 2024 12:58:53 +0200 Subject: [PATCH] Add possibility to do the nozzle switch retract earlier We now try to insert the nozzle switch retract at the same time as the travel move to the nozzle switch position, to avoid oozing during this (long) move. If there is no such move, it will fallback to the old behavior, but this should quite never happen. CURA-11796 --- include/pathPlanning/GCodePath.h | 1 + src/LayerPlan.cpp | 9 ++++++++- src/plugins/converters.cpp | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/include/pathPlanning/GCodePath.h b/include/pathPlanning/GCodePath.h index 09160202d9..577cd8efcc 100644 --- a/include/pathPlanning/GCodePath.h +++ b/include/pathPlanning/GCodePath.h @@ -40,6 +40,7 @@ struct GCodePath Ratio speed_factor{ 1.0 }; //!< A speed factor that is multiplied with the travel speed. This factor can be used to change the travel speed. Ratio speed_back_pressure_factor{ 1.0 }; // retraction_wipe_config : retraction_config; gcode.writeRetraction(retraction_config->retraction_config); + if (path.retract_for_nozzle_switch) + { + constexpr bool force = true; + constexpr bool extruder_switch = true; + gcode.writeRetraction(retraction_config->extruder_switch_retraction_config, force, extruder_switch); + } insertTempOnTime(extruder_plan.getRetractTime(path), path_idx); if (path.perform_z_hop) { diff --git a/src/plugins/converters.cpp b/src/plugins/converters.cpp index f53d2cbc7c..964a50007d 100644 --- a/src/plugins/converters.cpp +++ b/src/plugins/converters.cpp @@ -347,6 +347,7 @@ gcode_paths_modify_request::value_type gcode_path->set_speed_factor(path.speed_factor); gcode_path->set_speed_back_pressure_factor(path.speed_back_pressure_factor); gcode_path->set_retract(path.retract); + gcode_path->set_retract_for_nozzle_switch(path.retract_for_nozzle_switch); gcode_path->set_unretract_before_last_travel_move(path.unretract_before_last_travel_move); gcode_path->set_perform_z_hop(path.perform_z_hop); gcode_path->set_perform_prime(path.perform_prime); @@ -464,6 +465,7 @@ gcode_paths_modify_response::native_value_type .speed_factor = gcode_path_msg.speed_factor(), .speed_back_pressure_factor = gcode_path_msg.speed_back_pressure_factor(), .retract = gcode_path_msg.retract(), + .retract_for_nozzle_switch = gcode_path_msg.retract_for_nozzle_switch(), .unretract_before_last_travel_move = gcode_path_msg.unretract_before_last_travel_move(), .perform_z_hop = gcode_path_msg.perform_z_hop(), .perform_prime = gcode_path_msg.perform_prime(),