diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 46b0c0f7e9..e040e7dfbe 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -4530,39 +4530,72 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, if (m_config.enable_overhang_speed && !m_config.overhang_speed_classic && !this->on_first_layer() && ( is_perimeter(path.role()))) { - double out_wall_ref_speed = m_config.get_abs_value("outer_wall_speed"); - ConfigOptionPercents overhang_overlap_levels({75, 50, 25, 13, 12.99, 0}); - ConfigOptionFloatsOrPercents dynamic_overhang_speeds( - {(m_config.get_abs_value("overhang_1_4_speed") < 0.5) ? - FloatOrPercent{100, true} : - FloatOrPercent{m_config.get_abs_value("overhang_1_4_speed") * 100 / out_wall_ref_speed, true}, - (m_config.get_abs_value("overhang_2_4_speed") < 0.5) ? - FloatOrPercent{100, true} : - FloatOrPercent{m_config.get_abs_value("overhang_2_4_speed") * 100 / out_wall_ref_speed, true}, - (m_config.get_abs_value("overhang_3_4_speed") < 0.5) ? - FloatOrPercent{100, true} : - FloatOrPercent{m_config.get_abs_value("overhang_3_4_speed") * 100 / out_wall_ref_speed, true}, - (m_config.get_abs_value("overhang_4_4_speed") < 0.5) ? - FloatOrPercent{100, true} : - FloatOrPercent{m_config.get_abs_value("overhang_4_4_speed") * 100 / out_wall_ref_speed, true}, - (m_config.get_abs_value("overhang_4_4_speed") < 0.5) ? - FloatOrPercent{100, true} : - FloatOrPercent{m_config.get_abs_value("overhang_4_4_speed") * 100 / out_wall_ref_speed, true}, - (m_config.get_abs_value("overhang_4_4_speed") < 0.5) ? - FloatOrPercent{100, true} : - FloatOrPercent{m_config.get_abs_value("overhang_4_4_speed") * 100 / out_wall_ref_speed, true}}); + + double out_wall_ref_speed = m_config.get_abs_value("outer_wall_speed"); + ConfigOptionPercents overhang_overlap_levels({75, 50, 25, 13, 12.99, 0}); - if (out_wall_ref_speed == 0) - out_wall_ref_speed = EXTRUDER_CONFIG(filament_max_volumetric_speed) / _mm3_per_mm; + if (m_config.slowdown_for_curled_perimeters){ + ConfigOptionFloatsOrPercents dynamic_overhang_speeds( + {(m_config.get_abs_value("overhang_1_4_speed") < 0.5) ? + FloatOrPercent{100, true} : + FloatOrPercent{m_config.get_abs_value("overhang_1_4_speed") * 100 / out_wall_ref_speed, true}, + (m_config.get_abs_value("overhang_2_4_speed") < 0.5) ? + FloatOrPercent{100, true} : + FloatOrPercent{m_config.get_abs_value("overhang_2_4_speed") * 100 / out_wall_ref_speed, true}, + (m_config.get_abs_value("overhang_3_4_speed") < 0.5) ? + FloatOrPercent{100, true} : + FloatOrPercent{m_config.get_abs_value("overhang_3_4_speed") * 100 / out_wall_ref_speed, true}, + (m_config.get_abs_value("overhang_4_4_speed") < 0.5) ? + FloatOrPercent{100, true} : + FloatOrPercent{m_config.get_abs_value("overhang_4_4_speed") * 100 / out_wall_ref_speed, true}, + (m_config.get_abs_value("overhang_4_4_speed") < 0.5) ? + FloatOrPercent{100, true} : + FloatOrPercent{m_config.get_abs_value("overhang_4_4_speed") * 100 / out_wall_ref_speed, true}, + (m_config.get_abs_value("overhang_4_4_speed") < 0.5) ? + FloatOrPercent{100, true} : + FloatOrPercent{m_config.get_abs_value("overhang_4_4_speed") * 100 / out_wall_ref_speed, true}}); + if (out_wall_ref_speed == 0) + out_wall_ref_speed = EXTRUDER_CONFIG(filament_max_volumetric_speed) / _mm3_per_mm; - if (EXTRUDER_CONFIG(filament_max_volumetric_speed) > 0) { - out_wall_ref_speed = std::min(out_wall_ref_speed, EXTRUDER_CONFIG(filament_max_volumetric_speed) / path.mm3_per_mm); - } + if (EXTRUDER_CONFIG(filament_max_volumetric_speed) > 0) { + out_wall_ref_speed = std::min(out_wall_ref_speed, EXTRUDER_CONFIG(filament_max_volumetric_speed) / path.mm3_per_mm); + } - new_points = m_extrusion_quality_estimator.estimate_extrusion_quality(path, overhang_overlap_levels, dynamic_overhang_speeds, - out_wall_ref_speed, speed); + new_points = m_extrusion_quality_estimator.estimate_extrusion_quality(path, overhang_overlap_levels, dynamic_overhang_speeds, + out_wall_ref_speed, speed, true); + + variable_speed = std::any_of(new_points.begin(), new_points.end(), [speed](const ProcessedPoint &p) { return p.speed != speed; }); + + }else{ + ConfigOptionFloatsOrPercents dynamic_overhang_speeds( + {(m_config.get_abs_value("overhang_1_4_speed") < 0.5) ? + FloatOrPercent{100, true} : + FloatOrPercent{m_config.get_abs_value("overhang_1_4_speed") * 100 / out_wall_ref_speed, true}, + (m_config.get_abs_value("overhang_2_4_speed") < 0.5) ? + FloatOrPercent{100, true} : + FloatOrPercent{m_config.get_abs_value("overhang_2_4_speed") * 100 / out_wall_ref_speed, true}, + (m_config.get_abs_value("overhang_3_4_speed") < 0.5) ? + FloatOrPercent{100, true} : + FloatOrPercent{m_config.get_abs_value("overhang_3_4_speed") * 100 / out_wall_ref_speed, true}, + (m_config.get_abs_value("overhang_4_4_speed") < 0.5) ? + FloatOrPercent{100, true} : + FloatOrPercent{m_config.get_abs_value("overhang_4_4_speed") * 100 / out_wall_ref_speed, true}, + FloatOrPercent{m_config.get_abs_value("bridge_speed") * 100 / out_wall_ref_speed, true}, + FloatOrPercent{m_config.get_abs_value("bridge_speed") * 100 / out_wall_ref_speed, true}}); + + if (out_wall_ref_speed == 0) + out_wall_ref_speed = EXTRUDER_CONFIG(filament_max_volumetric_speed) / _mm3_per_mm; + + if (EXTRUDER_CONFIG(filament_max_volumetric_speed) > 0) { + out_wall_ref_speed = std::min(out_wall_ref_speed, EXTRUDER_CONFIG(filament_max_volumetric_speed) / path.mm3_per_mm); + } + + new_points = m_extrusion_quality_estimator.estimate_extrusion_quality(path, overhang_overlap_levels, dynamic_overhang_speeds, + out_wall_ref_speed, speed, false); + + variable_speed = std::any_of(new_points.begin(), new_points.end(), [speed](const ProcessedPoint &p) { return p.speed != speed; }); + } - variable_speed = std::any_of(new_points.begin(), new_points.end(), [speed](const ProcessedPoint &p) { return p.speed != speed; }); } double F = speed * 60; // convert mm/sec to mm/min diff --git a/src/libslic3r/GCode/ExtrusionProcessor.hpp b/src/libslic3r/GCode/ExtrusionProcessor.hpp index 5463697916..fa7a29cafe 100644 --- a/src/libslic3r/GCode/ExtrusionProcessor.hpp +++ b/src/libslic3r/GCode/ExtrusionProcessor.hpp @@ -268,11 +268,14 @@ public: const ConfigOptionPercents &overlaps, const ConfigOptionFloatsOrPercents &speeds, float ext_perimeter_speed, - float original_speed) + float original_speed, + bool slowdown_for_curled_edges) { size_t speed_sections_count = std::min(overlaps.values.size(), speeds.values.size()); std::vector> speed_sections; + + for (size_t i = 0; i < speed_sections_count; i++) { float distance = path.width * (1.0 - (overlaps.get_at(i) / 100.0)); float speed = speeds.get_at(i).percent ? (ext_perimeter_speed * speeds.get_at(i).value / 100.0) : speeds.get_at(i).value; @@ -371,8 +374,10 @@ public: }; float extrusion_speed = std::min(calculate_speed(curr.distance), calculate_speed(next.distance)); - float curled_speed = calculate_speed(artificial_distance_to_curled_lines); - extrusion_speed = std::min(curled_speed, extrusion_speed); // adjust extrusion speed based on what is smallest - the calculated overhang speed or the artificial curled speed + if(slowdown_for_curled_edges) { + float curled_speed = calculate_speed(artificial_distance_to_curled_lines); + extrusion_speed = std::min(curled_speed, extrusion_speed); // adjust extrusion speed based on what is smallest - the calculated overhang speed or the artificial curled speed + } float overlap = std::min(1 - curr.distance * width_inv, 1 - next.distance * width_inv); diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 276eea4f2f..f8e3bba5c7 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -752,7 +752,7 @@ static std::vector s_Preset_print_options { "tree_support_branch_diameter", "tree_support_branch_diameter_angle", "tree_support_branch_diameter_double_wall", "detect_narrow_internal_solid_infill", "gcode_add_line_number", "enable_arc_fitting", "infill_combination", /*"adaptive_layer_height",*/ - "support_bottom_interface_spacing", "enable_overhang_speed", "overhang_1_4_speed", "overhang_2_4_speed", "overhang_3_4_speed", "overhang_4_4_speed", + "support_bottom_interface_spacing", "enable_overhang_speed", "slowdown_for_curled_perimeters", "overhang_1_4_speed", "overhang_2_4_speed", "overhang_3_4_speed", "overhang_4_4_speed", "initial_layer_infill_speed", "only_one_wall_top", "timelapse_type", "internal_bridge_support_thickness", "wall_generator", "wall_transition_length", "wall_transition_filter_deviation", "wall_transition_angle", diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index a4b9603fc5..88bb5633b7 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -800,6 +800,13 @@ void PrintConfigDef::init_fff_params() def->tooltip = L("Enable this option to slow printing down for different overhang degree"); def->mode = comAdvanced; def->set_default_value(new ConfigOptionBool{ true }); + + def = this->add("slowdown_for_curled_perimeters", coBool); + def->label = L("Slow down at curled perimeters"); + def->category = L("Speed"); + def->tooltip = L("Enable this option to slow printing down in areas where potential curled perimeters may exist"); + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionBool{ true }); def = this->add("overhang_1_4_speed", coFloatOrPercent); def->label = "(10%, 25%)"; diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 03c1f75c30..ac6242efec 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -812,6 +812,7 @@ PRINT_CONFIG_CLASS_DEFINE( // Orca ((ConfigOptionBool, make_overhang_printable)) ((ConfigOptionBool, extra_perimeters_on_overhangs)) + ((ConfigOptionBool, slowdown_for_curled_perimeters)) ) PRINT_CONFIG_CLASS_DEFINE( diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 5ece69a8d4..4bb6a2f07b 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -775,6 +775,7 @@ bool PrintObject::invalidate_state_by_config_options( || opt_key == "raft_contact_distance" || opt_key == "slice_closing_radius" || opt_key == "slicing_mode" + || opt_key == "slowdown_for_curled_perimeters" || opt_key == "make_overhang_printable" || opt_key == "make_overhang_printable_angle" || opt_key == "make_overhang_printable_hole_size") { diff --git a/src/slic3r/GUI/ConfigManipulation.cpp b/src/slic3r/GUI/ConfigManipulation.cpp index 28f5189a72..b9f7ae4f69 100644 --- a/src/slic3r/GUI/ConfigManipulation.cpp +++ b/src/slic3r/GUI/ConfigManipulation.cpp @@ -692,6 +692,9 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co // Orca auto is_role_based_wipe_speed = config->opt_bool("role_based_wipe_speed"); toggle_field("wipe_speed",!is_role_based_wipe_speed); + // Orca + bool has_slowdown_for_curled_perimeters = config->opt_bool("slowdown_for_curled_perimeters"); + //toggle_field("slowdown_for_curled_perimeters",has_slowdown_for_curled_perimeters); for (auto el : {"accel_to_decel_enable", "accel_to_decel_factor"}) toggle_line(el, gcflavor == gcfKlipper); diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index d183e4528d..f869d61ca5 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -1957,6 +1957,7 @@ void TabPrint::build() optgroup = page->new_optgroup(L("Overhang speed"), L"param_speed", 15); optgroup->append_single_option_line("enable_overhang_speed", "slow-down-for-overhang"); optgroup->append_single_option_line("overhang_speed_classic", "slow-down-for-overhang"); + optgroup->append_single_option_line("slowdown_for_curled_perimeters"); Line line = { L("Overhang speed"), L("This is the speed for various overhang degrees. Overhang degrees are expressed as a percentage of line width. 0 speed means no slowing down for the overhang degree range and wall speed is used") }; line.label_path = "slow-down-for-overhang"; line.append_option(optgroup->get_option("overhang_1_4_speed"));