role_based_wipe_speed and wipe_speed

Signed-off-by: SoftFever <103989404+SoftFever@users.noreply.github.com>
This commit is contained in:
SoftFever 2023-01-15 21:05:35 +08:00
parent cdbd2fe042
commit 8350895513
10 changed files with 50 additions and 11 deletions

View file

@ -167,7 +167,11 @@ bool GCode::gcode_label_objects = true;
/* Reduce feedrate a bit; travel speed is often too high to move on existing material. /* 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. */ 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; double _wipe_speed = gcodegen.config().get_abs_value("wipe_speed");// gcodegen.writer().config.travel_speed.value * 0.8;
if(gcodegen.config().role_based_wipe_speed)
_wipe_speed = gcodegen.writer().get_current_speed() / 60.0;
if(_wipe_speed < 60)
_wipe_speed = 60;
// get the retraction length // get the retraction length
double length = toolchange double length = toolchange
@ -206,7 +210,7 @@ bool GCode::gcode_label_objects = true;
// add tag for processor // add tag for processor
gcode += ";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Wipe_Start) + "\n"; gcode += ";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Wipe_Start) + "\n";
//BBS: don't need to enable cooling makers when this is the last wipe. Because no more cooling layer will clean this "_WIPE" //BBS: don't need to enable cooling makers when this is the last wipe. Because no more cooling layer will clean this "_WIPE"
gcode += gcodegen.writer().set_speed(wipe_speed * 60, "", (gcodegen.enable_cooling_markers() && !is_last) ? ";_WIPE" : ""); gcode += gcodegen.writer().set_speed(_wipe_speed * 60, "", (gcodegen.enable_cooling_markers() && !is_last) ? ";_WIPE" : "");
for (const Line& line : wipe_path.lines()) { for (const Line& line : wipe_path.lines()) {
double segment_length = line.length(); double segment_length = line.length();
/* Reduce retraction length a bit to avoid effective retraction speed to be greater than the configured one /* Reduce retraction length a bit to avoid effective retraction speed to be greater than the configured one

View file

@ -301,11 +301,12 @@ std::string GCodeWriter::toolchange(unsigned int extruder_id)
return gcode.str(); return gcode.str();
} }
std::string GCodeWriter::set_speed(double F, const std::string &comment, const std::string &cooling_marker) const std::string GCodeWriter::set_speed(double F, const std::string &comment, const std::string &cooling_marker)
{ {
assert(F > 0.); assert(F > 0.);
assert(F < 100000.); assert(F < 100000.);
m_current_speed = F;
GCodeG1Formatter w; GCodeG1Formatter w;
w.emit_f(F); w.emit_f(F);
//BBS //BBS

View file

@ -24,7 +24,8 @@ public:
/*m_last_bed_temperature(0), */m_last_bed_temperature_reached(true), /*m_last_bed_temperature(0), */m_last_bed_temperature_reached(true),
m_lifted(0), m_lifted(0),
m_to_lift(0), m_to_lift(0),
m_to_lift_type(LiftType::NormalLift) m_to_lift_type(LiftType::NormalLift),
m_current_speed(3600)
{} {}
Extruder* extruder() { return m_extruder; } Extruder* extruder() { return m_extruder; }
const Extruder* extruder() const { return m_extruder; } const Extruder* extruder() const { return m_extruder; }
@ -58,7 +59,9 @@ public:
// printed with the same extruder. // printed with the same extruder.
std::string toolchange_prefix() const; std::string toolchange_prefix() const;
std::string toolchange(unsigned int extruder_id); std::string toolchange(unsigned int extruder_id);
std::string set_speed(double F, const std::string &comment = std::string(), const std::string &cooling_marker = std::string()) const; std::string set_speed(double F, const std::string &comment = std::string(), const std::string &cooling_marker = std::string());
// SoftFever NOTE: the returned speed is mm/minute
double get_current_speed() const { return m_current_speed;}
std::string travel_to_xy(const Vec2d &point, const std::string &comment = std::string()); std::string travel_to_xy(const Vec2d &point, const std::string &comment = std::string());
std::string travel_to_xyz(const Vec3d &point, const std::string &comment = std::string()); std::string travel_to_xyz(const Vec3d &point, const std::string &comment = std::string());
std::string travel_to_z(double z, const std::string &comment = std::string()); std::string travel_to_z(double z, const std::string &comment = std::string());
@ -134,6 +137,7 @@ private:
//SoftFever //SoftFever
bool m_is_bbl_printers = false; bool m_is_bbl_printers = false;
double m_current_speed;
std::string _travel_to_z(double z, const std::string &comment); std::string _travel_to_z(double z, const std::string &comment);
std::string _spiral_travel_to_z(double z, const Vec2d &ij_offset, const std::string &comment); std::string _spiral_travel_to_z(double z, const Vec2d &ij_offset, const std::string &comment);

View file

@ -752,7 +752,7 @@ static std::vector<std::string> s_Preset_print_options {
"small_perimeter_speed", "small_perimeter_threshold","bridge_angle", "filter_out_gap_fill", "post_process", "travel_acceleration","inner_wall_acceleration", "small_perimeter_speed", "small_perimeter_threshold","bridge_angle", "filter_out_gap_fill", "post_process", "travel_acceleration","inner_wall_acceleration",
"default_jerk", "outer_wall_jerk", "inner_wall_jerk", "top_surface_jerk", "initial_layer_jerk","travel_jerk", "default_jerk", "outer_wall_jerk", "inner_wall_jerk", "top_surface_jerk", "initial_layer_jerk","travel_jerk",
"top_solid_infill_flow_ratio","bottom_solid_infill_flow_ratio","only_one_wall_first_layer", "top_solid_infill_flow_ratio","bottom_solid_infill_flow_ratio","only_one_wall_first_layer",
"print_flow_ratio","seam_gap" "print_flow_ratio","seam_gap","role_based_wipe_speed","wipe_speed"
}; };

View file

@ -150,7 +150,9 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
"required_nozzle_HRC", "required_nozzle_HRC",
"upward_compatible_machine", "upward_compatible_machine",
// SoftFever // SoftFever
"seam_gap" "seam_gap",
"role_based_wipe_speed",
"wipe_speed"
}; };
static std::unordered_set<std::string> steps_ignore; static std::unordered_set<std::string> steps_ignore;

View file

@ -2371,7 +2371,6 @@ void PrintConfigDef::init_fff_params()
def->mode = comSimple; def->mode = comSimple;
def->set_default_value(new ConfigOptionEnum<SeamPosition>(spAligned)); def->set_default_value(new ConfigOptionEnum<SeamPosition>(spAligned));
def = this->add("seam_gap", coFloatOrPercent); def = this->add("seam_gap", coFloatOrPercent);
def->label = L("Seam gap"); def->label = L("Seam gap");
def->tooltip = L("When extruding a closed loop, the loop is interrupted and shortened a bit to reduce the seam." def->tooltip = L("When extruding a closed loop, the loop is interrupted and shortened a bit to reduce the seam."
@ -2381,6 +2380,23 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced; def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloatOrPercent(15,true)); def->set_default_value(new ConfigOptionFloatOrPercent(15,true));
def = this->add("role_based_wipe_speed", coBool);
def->label = L("Role base wipe speed");
def->tooltip = L("The wipe speed is same as the current extrusion role's speed.\n"
"e.g. if wipe action is followed by a outer wall extrusion, the outer wall speed will be used for this wipe action.");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(false));
def = this->add("wipe_speed", coFloatOrPercent);
def->label = L("Wipe speed");
def->tooltip = L("This setting will affect the speed of wipe."
" If expressed as percentage (for example: 80%) it will be calculated "
"on the travel speed setting above. Default value is 80%");
def->sidetext = L("mm/s or %");
def->ratio_over = "travel_speed";
def->min = 0;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloatOrPercent(80,true));
def = this->add("skirt_distance", coFloat); def = this->add("skirt_distance", coFloat);
def->label = L("Skirt distance"); def->label = L("Skirt distance");

View file

@ -757,6 +757,9 @@ PRINT_CONFIG_CLASS_DEFINE(
//SoftFever //SoftFever
((ConfigOptionFloat, print_flow_ratio)) ((ConfigOptionFloat, print_flow_ratio))
((ConfigOptionFloatOrPercent, seam_gap)) ((ConfigOptionFloatOrPercent, seam_gap))
((ConfigOptionBool, role_based_wipe_speed))
((ConfigOptionFloatOrPercent, wipe_speed))
) )
PRINT_CONFIG_CLASS_DEFINE( PRINT_CONFIG_CLASS_DEFINE(

View file

@ -680,7 +680,9 @@ bool PrintObject::invalidate_state_by_config_options(
|| opt_key == "initial_layer_line_width" || opt_key == "initial_layer_line_width"
|| opt_key == "inner_wall_line_width" || opt_key == "inner_wall_line_width"
|| opt_key == "infill_wall_overlap" || opt_key == "infill_wall_overlap"
|| opt_key == "seam_gap") { || opt_key == "seam_gap"
|| opt_key == "role_based_wipe_speed"
|| opt_key == "wipe_speed") {
steps.emplace_back(posPerimeters); steps.emplace_back(posPerimeters);
} else if (opt_key == "gap_infill_speed" } else if (opt_key == "gap_infill_speed"
|| opt_key == "filter_out_gap_fill" ) { || opt_key == "filter_out_gap_fill" ) {

View file

@ -655,6 +655,11 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co
toggle_field("detect_thin_wall", !have_arachne); toggle_field("detect_thin_wall", !have_arachne);
toggle_field("enable_overhang_speed", !have_arachne); toggle_field("enable_overhang_speed", !have_arachne);
toggle_field("only_one_wall_top", !have_arachne); toggle_field("only_one_wall_top", !have_arachne);
// SoftFever
auto is_role_based_wipe_speed = config->opt_bool("role_based_wipe_speed");
toggle_field("wipe_speed",!is_role_based_wipe_speed);
} }
void ConfigManipulation::update_print_sla_config(DynamicPrintConfig* config, const bool is_global_config/* = false*/) void ConfigManipulation::update_print_sla_config(DynamicPrintConfig* config, const bool is_global_config/* = false*/)

View file

@ -1835,6 +1835,8 @@ void TabPrint::build()
optgroup = page->new_optgroup(L("Seam"), L"param_seam"); optgroup = page->new_optgroup(L("Seam"), L"param_seam");
optgroup->append_single_option_line("seam_position", "Seam"); optgroup->append_single_option_line("seam_position", "Seam");
optgroup->append_single_option_line("seam_gap","Seam"); optgroup->append_single_option_line("seam_gap","Seam");
optgroup->append_single_option_line("role_based_wipe_speed","Seam");
optgroup->append_single_option_line("wipe_speed","Seam");
optgroup = page->new_optgroup(L("Precision"), L"param_precision"); optgroup = page->new_optgroup(L("Precision"), L"param_precision");