diff --git a/src/libslic3r/GCode/Wipe.hpp b/src/libslic3r/GCode/Wipe.hpp index f02a77f..5cbb48a 100644 --- a/src/libslic3r/GCode/Wipe.hpp +++ b/src/libslic3r/GCode/Wipe.hpp @@ -49,7 +49,7 @@ public: // Reduce feedrate a bit; travel speed is often too high to move on existing material. // Too fast = ripping of existing material; too slow = short wipe path, thus more blob. - static double calc_wipe_speed(const GCodeConfig &config) { return config.travel_speed.value * 0.8; } + static double calc_wipe_speed(const GCodeConfig &config) { return config.wipe_distance.get_at(0)/(config.retract_length.get_at(0)/config.retract_speed.get_at(0)); } // Reduce retraction length a bit to avoid effective retraction speed to be greater than the configured one // due to rounding (TODO: test and/or better math for this). static double calc_xy_to_e_ratio(const GCodeConfig &config, unsigned int extruder_id) diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 587489f..de6c963 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -504,7 +504,9 @@ static std::vector s_Preset_filament_options { //B26 "smooth_time", //B39 - "disable_rapid_cooling_fan_first_layers" + "disable_rapid_cooling_fan_first_layers", + //w15 + "filament_wipe_distance" }; static std::vector s_Preset_machine_limits_options { diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index ff586f6..7d4412c 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -157,7 +157,9 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n "use_relative_e_distances", "use_volumetric_e", "variable_layer_height", - "wipe" + "wipe", + //w15 + "wipe_distance" }; static std::unordered_set steps_ignore; diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 005156c..6f4297d 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -2394,6 +2394,14 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionPercents { 0. }); + def = this->add("wipe_distance", coFloats); + def->label = L("Wipe Distance"); + def->tooltip = L("Discribe how long the nozzle will move along the last path when retracting."); + def->sidetext = L("mm"); + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionFloats{2.}); + + def = this->add("retract_layer_change", coBools); def->label = L("Retract on layer change"); def->tooltip = L("This flag enforces a retraction whenever a Z move is done."); @@ -3592,6 +3600,8 @@ void PrintConfigDef::init_fff_params() "retract_length", "retract_lift", "retract_lift_above", "retract_lift_below", "retract_speed", "travel_max_lift", "deretract_speed", "retract_restart_extra", "retract_before_travel", "retract_length_toolchange", "retract_restart_extra_toolchange", + //w15 + "wipe_distance", //B34 "filament_diameter", "extrusion_multiplier", @@ -3638,7 +3648,9 @@ void PrintConfigDef::init_extruder_option_keys() //B34 "filament_diameter", "extrusion_multiplier", - "default_filament_profile" + "default_filament_profile", + //w15 + "wipe_distance" }; m_extruder_retract_keys = { @@ -3661,7 +3673,8 @@ void PrintConfigDef::init_extruder_option_keys() "travel_max_lift", "travel_ramping_lift", "travel_slope", - "wipe" + "wipe", + "wipe_distance" }; assert(std::is_sorted(m_extruder_retract_keys.begin(), m_extruder_retract_keys.end())); } diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index f254776..2499721 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -772,6 +772,8 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionString, color_change_gcode)) ((ConfigOptionString, pause_print_gcode)) ((ConfigOptionString, template_custom_gcode)) + //w15 + ((ConfigOptionFloats, wipe_distance)) ) static inline std::string get_extrusion_axis(const GCodeConfig &cfg) diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 43749ec..005e036 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -1967,6 +1967,8 @@ std::vector>> option_keys { "filament_retract_layer_change", "filament_wipe", "filament_retract_before_wipe", + //w15 + "filament_wipe_distance", }}, {"Retraction when tool is disabled", { "filament_retract_length_toolchange", @@ -3152,6 +3154,8 @@ const std::vector extruder_options = { "retract_layer_change", "wipe", "retract_before_wipe", "travel_ramping_lift", "travel_slope", "travel_max_lift", "travel_lift_before_obstacle", "retract_length_toolchange", "retract_restart_extra_toolchange", + //w15 + "wipe_distance", }; void TabPrinter::build_extruder_pages(size_t n_before_extruders) @@ -3325,6 +3329,8 @@ void TabPrinter::build_extruder_pages(size_t n_before_extruders) optgroup->append_single_option_line("retract_layer_change", "", extruder_idx); optgroup->append_single_option_line("wipe", "", extruder_idx); optgroup->append_single_option_line("retract_before_wipe", "", extruder_idx); + //w15 + optgroup->append_single_option_line("wipe_distance", "", extruder_idx); optgroup = page->new_optgroup(L("Retraction when tool is disabled (advanced settings for multi-extruder setups)")); optgroup->append_single_option_line("retract_length_toolchange", "", extruder_idx); @@ -3554,12 +3560,14 @@ void TabPrinter::toggle_options() // some options only apply when not using firmware retraction vec.resize(0); - vec = { "retract_speed", "deretract_speed", "retract_before_wipe", "retract_restart_extra", "wipe" }; + //w15 + vec = {"retract_speed", "deretract_speed", "retract_before_wipe", "retract_restart_extra", "wipe", "wipe_distance"}; for (auto el : vec) toggle_option(el, retraction && !use_firmware_retraction, i); bool wipe = m_config->opt_bool("wipe", i); toggle_option("retract_before_wipe", wipe, i); + toggle_option("wipd_distance", wipe, i); if (use_firmware_retraction && wipe) { //wxMessageDialog dialog(parent(),