From 5c557b2e76e3ac13c45da94e22c6a4edf680e0d3 Mon Sep 17 00:00:00 2001 From: SoftFever Date: Sun, 10 Mar 2024 00:03:09 +0800 Subject: [PATCH] fix an issue that pressure eq may cause 0 feedrate --- src/libslic3r/GCode/PressureEqualizer.cpp | 5 ++- src/libslic3r/GCode/PressureEqualizer.hpp | 3 +- src/slic3r/GUI/Plater.cpp | 37 +++++++++++++---------- 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/src/libslic3r/GCode/PressureEqualizer.cpp b/src/libslic3r/GCode/PressureEqualizer.cpp index 06563ebb148..0a1ffaa1312 100644 --- a/src/libslic3r/GCode/PressureEqualizer.cpp +++ b/src/libslic3r/GCode/PressureEqualizer.cpp @@ -769,8 +769,11 @@ inline bool is_just_line_with_extrude_set_speed_tag(const std::string &line) return p_line <= line_end && is_eol(*p_line); } -void PressureEqualizer::push_line_to_output(const size_t line_idx, const float new_feedrate, const char *comment) +void PressureEqualizer::push_line_to_output(const size_t line_idx, float new_feedrate, const char *comment) { + // Orca: sanity check, 1 mm/s is the minimum feedrate. + if (new_feedrate < 60) + new_feedrate = 60; const GCodeLine &line = m_gcode_lines[line_idx]; if (line_idx > 0 && output_buffer_length > 0) { const std::string prev_line_str = std::string(output_buffer.begin() + int(this->output_buffer_prev_length), diff --git a/src/libslic3r/GCode/PressureEqualizer.hpp b/src/libslic3r/GCode/PressureEqualizer.hpp index 6eb799bbedd..f03ecaeaec7 100644 --- a/src/libslic3r/GCode/PressureEqualizer.hpp +++ b/src/libslic3r/GCode/PressureEqualizer.hpp @@ -132,7 +132,8 @@ class PressureEqualizer float time() const { return dist_xyz() / feedrate(); } float time_inv() const { return feedrate() / dist_xyz(); } float volumetric_correction_avg() const { - float avg_correction = 0.5f * (volumetric_extrusion_rate_start + volumetric_extrusion_rate_end) / volumetric_extrusion_rate; + // Orca: cap the correction to 0.05 - 1.00000001 to avoid zero feedrate + float avg_correction = std::max(0.05f,0.5f * (volumetric_extrusion_rate_start + volumetric_extrusion_rate_end) / volumetric_extrusion_rate); assert(avg_correction > 0.f); assert(avg_correction <= 1.00000001f); return avg_correction; diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 45b55a01915..5536fa0eead 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -9108,7 +9108,7 @@ void Plater::cut_horizontal(size_t obj_idx, size_t instance_idx, double z, Model void Plater::_calib_pa_tower(const Calib_Params& params) { add_model(false, Slic3r::resources_dir() + "/calib/pressure_advance/tower_with_seam.stl"); - auto print_config = &wxGetApp().preset_bundle->prints.get_edited_preset().config; + auto& print_config = wxGetApp().preset_bundle->prints.get_edited_preset().config; auto printer_config = &wxGetApp().preset_bundle->printers.get_edited_preset().config; auto filament_config = &wxGetApp().preset_bundle->filaments.get_edited_preset().config; @@ -9135,6 +9135,8 @@ void Plater::_calib_pa_tower(const Calib_Params& params) { obj_cfg.set_key_value("brim_object_gap", new ConfigOptionFloat(.0f)); obj_cfg.set_key_value("brim_ears_max_angle", new ConfigOptionFloat(135.f)); obj_cfg.set_key_value("brim_width", new ConfigOptionFloat(6.f)); + obj_cfg.set_key_value("seam_slope_type", new ConfigOptionEnum(SeamScarfType::None)); + print_config.set_key_value("max_volumetric_extrusion_rate_slope", new ConfigOptionFloat(0)); changed_objects({ 0 }); wxGetApp().get_tab(Preset::TYPE_PRINT)->update_dirty(); @@ -9232,11 +9234,12 @@ void Plater::calib_flowrate(int pass) { _obj->config.set_key_value("internal_solid_infill_line_width", new ConfigOptionFloatOrPercent(nozzle_diameter * 1.2f, false)); _obj->config.set_key_value("top_surface_pattern", new ConfigOptionEnum(ipMonotonic)); _obj->config.set_key_value("top_solid_infill_flow_ratio", new ConfigOptionFloat(1.0f)); - _obj->config.set_key_value("top_surface_pattern", new ConfigOptionEnum(ipMonotonic)); _obj->config.set_key_value("infill_direction", new ConfigOptionFloat(45)); _obj->config.set_key_value("ironing_type", new ConfigOptionEnum(IroningType::NoIroning)); _obj->config.set_key_value("internal_solid_infill_speed", new ConfigOptionFloat(internal_solid_speed)); _obj->config.set_key_value("top_surface_speed", new ConfigOptionFloat(top_surface_speed)); + _obj->config.set_key_value("seam_slope_type", new ConfigOptionEnum(SeamScarfType::None)); + print_config->set_key_value("max_volumetric_extrusion_rate_slope", new ConfigOptionFloat(0)); // extract flowrate from name, filename format: flowrate_xxx std::string obj_name = _obj->name; @@ -9278,6 +9281,7 @@ void Plater::calib_temp(const Calib_Params& params) { model().objects[0]->config.set_key_value("brim_width", new ConfigOptionFloat(5.0)); model().objects[0]->config.set_key_value("brim_object_gap", new ConfigOptionFloat(0.0)); model().objects[0]->config.set_key_value("alternate_extra_wall", new ConfigOptionBool(false)); + model().objects[0]->config.set_key_value("seam_slope_type", new ConfigOptionEnum(SeamScarfType::None)); changed_objects({ 0 }); wxGetApp().get_tab(Preset::TYPE_PRINT)->update_dirty(); @@ -9323,6 +9327,7 @@ void Plater::calib_max_vol_speed(const Calib_Params& params) auto filament_config = &wxGetApp().preset_bundle->filaments.get_edited_preset().config; auto printer_config = &wxGetApp().preset_bundle->printers.get_edited_preset().config; auto obj = model().objects[0]; + auto& obj_cfg = obj->config; auto bed_shape = printer_config->option("printable_area")->values; BoundingBoxf bed_ext = get_extents(bed_shape); @@ -9343,21 +9348,21 @@ void Plater::calib_max_vol_speed(const Calib_Params& params) filament_config->set_key_value("filament_max_volumetric_speed", new ConfigOptionFloats { 200 }); filament_config->set_key_value("slow_down_layer_time", new ConfigOptionFloats{0.0}); - print_config->set_key_value("enable_overhang_speed", new ConfigOptionBool { false }); + obj_cfg.set_key_value("enable_overhang_speed", new ConfigOptionBool { false }); + obj_cfg.set_key_value("wall_loops", new ConfigOptionInt(1)); + obj_cfg.set_key_value("alternate_extra_wall", new ConfigOptionBool(false)); + obj_cfg.set_key_value("top_shell_layers", new ConfigOptionInt(0)); + obj_cfg.set_key_value("bottom_shell_layers", new ConfigOptionInt(0)); + obj_cfg.set_key_value("sparse_infill_density", new ConfigOptionPercent(0)); + obj_cfg.set_key_value("overhang_reverse", new ConfigOptionBool(false)); + obj_cfg.set_key_value("outer_wall_line_width", new ConfigOptionFloatOrPercent(line_width, false)); + obj_cfg.set_key_value("layer_height", new ConfigOptionFloat(layer_height)); + obj_cfg.set_key_value("brim_type", new ConfigOptionEnum(btOuterAndInner)); + obj_cfg.set_key_value("brim_width", new ConfigOptionFloat(5.0)); + obj_cfg.set_key_value("brim_object_gap", new ConfigOptionFloat(0.0)); print_config->set_key_value("timelapse_type", new ConfigOptionEnum(tlTraditional)); - print_config->set_key_value("wall_loops", new ConfigOptionInt(1)); - print_config->set_key_value("alternate_extra_wall", new ConfigOptionBool(false)); - print_config->set_key_value("top_shell_layers", new ConfigOptionInt(0)); - print_config->set_key_value("bottom_shell_layers", new ConfigOptionInt(0)); - print_config->set_key_value("sparse_infill_density", new ConfigOptionPercent(0)); - print_config->set_key_value("overhang_reverse", new ConfigOptionBool(false)); print_config->set_key_value("spiral_mode", new ConfigOptionBool(true)); - print_config->set_key_value("outer_wall_line_width", new ConfigOptionFloatOrPercent(line_width, false)); - print_config->set_key_value("initial_layer_print_height", new ConfigOptionFloat(layer_height)); - print_config->set_key_value("layer_height", new ConfigOptionFloat(layer_height)); - obj->config.set_key_value("brim_type", new ConfigOptionEnum(btOuterAndInner)); - obj->config.set_key_value("brim_width", new ConfigOptionFloat(5.0)); - obj->config.set_key_value("brim_object_gap", new ConfigOptionFloat(0.0)); + print_config->set_key_value("max_volumetric_extrusion_rate_slope", new ConfigOptionFloat(0)); changed_objects({ 0 }); wxGetApp().get_tab(Preset::TYPE_PRINT)->update_dirty(); @@ -9410,7 +9415,7 @@ void Plater::calib_retraction(const Calib_Params& params) obj->config.set_key_value("top_shell_layers", new ConfigOptionInt(0)); obj->config.set_key_value("bottom_shell_layers", new ConfigOptionInt(3)); obj->config.set_key_value("sparse_infill_density", new ConfigOptionPercent(0)); - obj->config.set_key_value("initial_layer_print_height", new ConfigOptionFloat(layer_height)); + print_config->set_key_value("initial_layer_print_height", new ConfigOptionFloat(layer_height)); obj->config.set_key_value("layer_height", new ConfigOptionFloat(layer_height)); obj->config.set_key_value("alternate_extra_wall", new ConfigOptionBool(false));