From 361a5dce6fac210abc3858ac36ececee125eadbc Mon Sep 17 00:00:00 2001 From: SoftFever Date: Sat, 18 Feb 2023 19:10:32 +0800 Subject: [PATCH] tweak overhang fan Signed-off-by: SoftFever --- src/libslic3r/GCode.cpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 6ad5ac6415..52f07764cf 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -3943,7 +3943,7 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, gcode += m_writer.set_speed(F, "", comment); double path_length = 0.; { - if (m_enable_cooling_markers && enable_overhang_bridge_fan && m_config.overhang_speed_classic) { + if (m_enable_cooling_markers && enable_overhang_bridge_fan) { // BBS: Overhang_threshold_none means Overhang_threshold_1_4 and forcing cooling for all external // perimeter int overhang_threshold = overhang_fan_threshold == Overhang_threshold_none ? Overhang_threshold_none @@ -4020,17 +4020,21 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, Vec2d p = this->point_to_gcode_quantized(processed_point.p); const double line_length = (p - prev).norm(); if (m_enable_cooling_markers && enable_overhang_bridge_fan) { - if (is_bridge(path.role()) || check_overhang_fan(new_points[i - 1].overlap)) { - gcode += ";_OVERHANG_FAN_START\n"; + if (is_bridge(path.role()) || check_overhang_fan(new_points[i - 1].overlap) ) { + if(!is_overhang_fan_on) + gcode += ";_OVERHANG_FAN_START\n"; is_overhang_fan_on = true; - } + }else { + if (is_overhang_fan_on) { + gcode += ";_OVERHANG_FAN_END\n"; + is_overhang_fan_on = false; + } + + } } gcode += m_writer.extrude_to_xy(p, e_per_mm * line_length, GCodeWriter::full_gcode_comment ? description : ""); - if (is_overhang_fan_on) { - is_overhang_fan_on = false; - gcode += ";_OVERHANG_FAN_END\n"; - } + prev = p; double new_speed = std::max((float)EXTRUDER_CONFIG(slow_down_min_speed), processed_point.speed) * 60.0; if (last_set_speed != new_speed) { @@ -4038,6 +4042,10 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, last_set_speed = new_speed; } } + if (is_overhang_fan_on) { + is_overhang_fan_on = false; + gcode += ";_OVERHANG_FAN_END\n"; + } } if (m_enable_cooling_markers) { gcode += ";_EXTRUDE_END\n";