wipe speed

supermerill/SuperSlicer#1471
This commit is contained in:
supermerill 2021-09-05 14:13:37 +02:00
parent d8f5882872
commit d0459d60ce
7 changed files with 156 additions and 134 deletions

View File

@ -29,7 +29,9 @@ group:Retraction
setting:idx:retract_restart_extra
setting:idx:retract_before_travel
setting:idx:retract_layer_change
group:Retraction wipe
setting:idx:wipe
setting:idx:wipe_speed
setting:idx:retract_before_wipe
setting:idx:wipe_extra_perimeter
group:Retraction when tool is disabled (advanced settings for multi-extruder setups)

View File

@ -158,6 +158,8 @@ std::string Wipe::wipe(GCode& gcodegen, bool toolchange)
/* 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. */
double wipe_speed = gcodegen.writer().config.travel_speed.value * 0.8;
if(gcodegen.writer().tool_is_extruder() && gcodegen.writer().config.wipe_speed.get_at(gcodegen.writer().tool()->id()) > 0)
wipe_speed = gcodegen.writer().config.wipe_speed.get_at(gcodegen.writer().tool()->id());
// get the retraction length
double length = gcodegen.writer().tool()->retract_length();
@ -367,10 +369,10 @@ static inline void set_extra_lift(const Layer& layer, const Print& print, GCodeW
return gcode;
}
// This function postprocesses gcode_original, rotates and moves all G1 extrusions and returns resulting gcode
// Starting position has to be supplied explicitely (otherwise it would fail in case first G1 command only contained one coordinate)
std::string WipeTowerIntegration::post_process_wipe_tower_moves(const WipeTower::ToolChangeResult& tcr, const Vec2f& translation, float angle) const
{
// This function postprocesses gcode_original, rotates and moves all G1 extrusions and returns resulting gcode
// Starting position has to be supplied explicitely (otherwise it would fail in case first G1 command only contained one coordinate)
std::string WipeTowerIntegration::post_process_wipe_tower_moves(const WipeTower::ToolChangeResult& tcr, const Vec2f& translation, float angle) const
{
Vec2f extruder_offset = m_extruder_offsets[tcr.initial_tool].cast<float>();
std::istringstream gcode_str(tcr.gcode);
@ -439,7 +441,7 @@ static inline void set_extra_lift(const Layer& layer, const Print& print, GCodeW
}
}
return gcode_out;
}
}
std::string WipeTowerIntegration::prime(GCode& gcodegen)
@ -461,7 +463,6 @@ static inline void set_extra_lift(const Layer& layer, const Print& print, GCodeW
if (!(size_t(m_tool_change_idx) < m_tool_changes[m_layer_idx].size()))
throw Slic3r::RuntimeError("Wipe tower generation failed, possibly due to empty first layer.");
// Calculate where the wipe tower layer will be printed. -1 means that print z will not change,
// resulting in a wipe tower with sparse layers.
double wipe_tower_z = -1;

View File

@ -686,7 +686,7 @@ const std::vector<std::string>& Preset::filament_options()
"external_perimeter_fan_speed",
// Retract overrides
"filament_retract_length", "filament_retract_lift", "filament_retract_lift_above", "filament_retract_lift_below", "filament_retract_speed", "filament_deretract_speed", "filament_retract_restart_extra", "filament_retract_before_travel",
"filament_retract_layer_change", "filament_wipe", "filament_wipe_extra_perimeter", "filament_retract_before_wipe",
"filament_retract_layer_change", "filament_wipe", "filament_wipe_speed", "filament_wipe_extra_perimeter", "filament_retract_before_wipe",
// Profile compatibility
"filament_vendor", "compatible_prints", "compatible_prints_condition", "compatible_printers", "compatible_printers_condition", "inherits"
//merill adds

View File

@ -184,6 +184,7 @@ bool Print::invalidate_state_by_config_options(const std::vector<t_config_option
"use_volumetric_e",
"variable_layer_height",
"wipe",
"wipe_speed",
"wipe_extra_perimeter"
};

View File

@ -4272,11 +4272,19 @@ void PrintConfigDef::init_fff_params()
def = this->add("wipe", coBools);
def->label = L("Wipe while retracting");
def->category = OptionCategory::general;
def->category = OptionCategory::extruders;
def->tooltip = L("This flag will move the nozzle while retracting to minimize the possible blob "
"on leaky extruders.");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBools { false });
def->set_default_value(new ConfigOptionBools{ false });
def = this->add("wipe_speed", coFloats);
def->label = L("Wipe speed");
def->category = OptionCategory::extruders;
def->tooltip = L("Speed in mm/s of the wipe. If it's faster, it will try to go further away, as the wipe time is set by ( 100% - 'retract before wipe') * 'retaction length' / 'retraction speed'."
"\nIf set to zero, the travel speed is used.");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloats{ 0 });
def = this->add("wipe_tower", coBool);
def->label = L("Enable");
@ -4527,7 +4535,7 @@ void PrintConfigDef::init_fff_params()
for (const char *opt_key : {
// floats
"retract_length", "retract_lift", "retract_lift_above", "retract_lift_below", "retract_speed", "deretract_speed", "retract_restart_extra", "retract_before_travel",
"wipe_extra_perimeter",
"wipe_extra_perimeter", "wipe_speed",
// bools
"retract_layer_change", "wipe",
// percents
@ -4574,6 +4582,7 @@ void PrintConfigDef::init_extruder_option_keys()
"retract_before_travel",
"wipe",
"wipe_extra_perimeter",
"wipe_speed",
"retract_layer_change",
"retract_length_toolchange",
"retract_restart_extra_toolchange",
@ -4593,6 +4602,7 @@ void PrintConfigDef::init_extruder_option_keys()
"retract_restart_extra",
"retract_speed",
"wipe",
"wipe_speed",
"wipe_extra_perimeter"
};
assert(std::is_sorted(m_extruder_retract_keys.begin(), m_extruder_retract_keys.end()));
@ -5670,6 +5680,7 @@ std::unordered_set<std::string> prusa_export_to_remove_keys = {
"wipe_advanced_nozzle_melted_volume",
"wipe_advanced",
"wipe_extra_perimeter",
"wipe_speed",
"wipe_tower_brim",
"xy_inner_size_compensation",
"z_step",

View File

@ -1143,6 +1143,7 @@ public:
ConfigOptionFloat wipe_advanced_multiplier;
ConfigOptionFloats wipe_extra_perimeter;
ConfigOptionEnum<WipeAlgo> wipe_advanced_algo;
ConfigOptionFloats wipe_speed;
ConfigOptionFloat z_step;
ConfigOptionString color_change_gcode;
ConfigOptionString pause_print_gcode;
@ -1258,6 +1259,7 @@ protected:
OPT_PTR(wipe_advanced_multiplier);
OPT_PTR(wipe_advanced_algo);
OPT_PTR(wipe_extra_perimeter);
OPT_PTR(wipe_speed);
OPT_PTR(z_step);
OPT_PTR(color_change_gcode);
OPT_PTR(pause_print_gcode);

View File

@ -2263,6 +2263,7 @@ void TabFilament::add_filament_overrides_page()
"filament_retract_before_travel",
"filament_retract_layer_change",
"filament_wipe",
"filament_wipe_speed",
"filament_wipe_extra_perimeter",
"filament_retract_before_wipe"
})
@ -2290,6 +2291,7 @@ void TabFilament::update_filament_overrides_page()
"filament_retract_before_travel",
"filament_retract_layer_change",
"filament_wipe",
"filament_wipe_speed",
"filament_wipe_extra_perimeter",
"filament_retract_before_wipe"
};
@ -2912,17 +2914,20 @@ 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" };
vec = { "retract_speed", "deretract_speed", "retract_before_wipe", "retract_restart_extra", "wipe", "wipe_speed" };
for (auto el : vec) {
field = get_field(el, i);
if (field)
field->toggle(retraction && !use_firmware_retraction);
}
bool wipe = m_config->opt_bool("wipe", i);
field = get_field("retract_before_wipe", i);
bool wipe = m_config->opt_bool("wipe", i) && have_retract_length;
vec = { "retract_before_wipe", "wipe_speed" };
for (auto el : vec) {
field = get_field(el, i);
if (field)
field->toggle(wipe);
}
if (use_firmware_retraction && wipe) {
wxMessageDialog dialog(parent(),