From 47302b0cf97ca9963744f8973d347cfc0dd01b4c Mon Sep 17 00:00:00 2001 From: "salt.wei" Date: Wed, 19 Oct 2022 12:29:35 +0800 Subject: [PATCH] ENH: support force cooling for outer wall only For PA-cf material, forcing cooling for all outer wall and using lower fan speed for infill and inner wall can get more high strength. Add this cooling strategy. When set overhang fan threshold to be 0%, then bridge and all outer wall will be force to cool with the overhang fan speed. Signed-off-by: salt.wei Change-Id: Ideed1ac8690f1eeb68aad760678db76bb4dae8ec --- .../BBL/filament/Bambu PA-CF @BBL X1C.json | 4 +- .../BBL/filament/Bambu PA-CF @base.json | 6 +++ .../profiles/BBL/filament/Generic PA-CF.json | 20 +++++----- src/libslic3r/GCode.cpp | 38 +++++++++++++++---- src/libslic3r/PrintConfig.cpp | 9 ++++- src/libslic3r/PrintConfig.hpp | 3 +- 6 files changed, 57 insertions(+), 23 deletions(-) diff --git a/resources/profiles/BBL/filament/Bambu PA-CF @BBL X1C.json b/resources/profiles/BBL/filament/Bambu PA-CF @BBL X1C.json index 4341e68265..7c2f2e15dc 100644 --- a/resources/profiles/BBL/filament/Bambu PA-CF @BBL X1C.json +++ b/resources/profiles/BBL/filament/Bambu PA-CF @BBL X1C.json @@ -15,13 +15,13 @@ "290" ], "fan_max_speed": [ - "40" + "30" ], "fan_min_speed": [ "10" ], "fan_cooling_layer_time": [ - "6" + "5" ], "full_fan_speed_layer": [ "2" diff --git a/resources/profiles/BBL/filament/Bambu PA-CF @base.json b/resources/profiles/BBL/filament/Bambu PA-CF @base.json index c62c5131dd..6091597136 100644 --- a/resources/profiles/BBL/filament/Bambu PA-CF @base.json +++ b/resources/profiles/BBL/filament/Bambu PA-CF @base.json @@ -20,6 +20,12 @@ "nozzle_temperature_initial_layer": [ "280" ], + "overhang_fan_threshold": [ + "0%" + ], + "overhang_fan_speed": [ + "40" + ], "filament_type": [ "PA-CF" ], diff --git a/resources/profiles/BBL/filament/Generic PA-CF.json b/resources/profiles/BBL/filament/Generic PA-CF.json index b5f1e9d86f..a2b7f3402c 100644 --- a/resources/profiles/BBL/filament/Generic PA-CF.json +++ b/resources/profiles/BBL/filament/Generic PA-CF.json @@ -19,23 +19,23 @@ "8" ], "fan_max_speed": [ - "40" + "30" ], "fan_min_speed": [ "10" ], "fan_cooling_layer_time": [ - "6" + "5" ], "full_fan_speed_layer": [ - "2" + "2" ], "compatible_printers": [ - "Bambu Lab X1 Carbon 0.4 nozzle", - "Bambu Lab X1 Carbon 0.6 nozzle", - "Bambu Lab X1 Carbon 0.8 nozzle", - "Bambu Lab X1 0.4 nozzle", - "Bambu Lab X1 0.6 nozzle", - "Bambu Lab X1 0.8 nozzle" - ] + "Bambu Lab X1 Carbon 0.4 nozzle", + "Bambu Lab X1 Carbon 0.6 nozzle", + "Bambu Lab X1 Carbon 0.8 nozzle", + "Bambu Lab X1 0.4 nozzle", + "Bambu Lab X1 0.6 nozzle", + "Bambu Lab X1 0.8 nozzle" + ] } diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 23f688ba0b..97d35e0001 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -3674,11 +3674,21 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, std::string comment; if (m_enable_cooling_markers) { - if (EXTRUDER_CONFIG(enable_overhang_bridge_fan) && - (path.get_overhang_degree() > EXTRUDER_CONFIG(overhang_fan_threshold) || is_bridge(path.role()))) - gcode += ";_OVERHANG_FAN_START\n"; - else + if (EXTRUDER_CONFIG(enable_overhang_bridge_fan)) { + //BBS: Overhang_threshold_none means Overhang_threshold_1_4 and forcing cooling for all external perimeter + int overhang_threshold = EXTRUDER_CONFIG(overhang_fan_threshold) == Overhang_threshold_none ? + Overhang_threshold_none : EXTRUDER_CONFIG(overhang_fan_threshold) - 1; + if ((EXTRUDER_CONFIG(overhang_fan_threshold) == Overhang_threshold_none && path.role() == erExternalPerimeter) || + path.get_overhang_degree() > overhang_threshold || + is_bridge(path.role())) + gcode += ";_OVERHANG_FAN_START\n"; + else + comment = ";_EXTRUDE_SET_SPEED"; + } + else { comment = ";_EXTRUDE_SET_SPEED"; + } + if (path.role() == erExternalPerimeter) comment += ";_EXTERNAL_PERIMETER"; } @@ -3742,10 +3752,22 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description, } } } - if (m_enable_cooling_markers) - gcode += (EXTRUDER_CONFIG(enable_overhang_bridge_fan) && - (is_bridge(path.role()) || path.get_overhang_degree() > EXTRUDER_CONFIG(overhang_fan_threshold))) ? - ";_OVERHANG_FAN_END\n" : ";_EXTRUDE_END\n"; + if (m_enable_cooling_markers) { + if (EXTRUDER_CONFIG(enable_overhang_bridge_fan)) { + //BBS: Overhang_threshold_none means Overhang_threshold_1_4 and forcing cooling for all external perimeter + int overhang_threshold = EXTRUDER_CONFIG(overhang_fan_threshold) == Overhang_threshold_none ? + Overhang_threshold_none : EXTRUDER_CONFIG(overhang_fan_threshold) - 1; + if ((EXTRUDER_CONFIG(overhang_fan_threshold) == Overhang_threshold_none && path.role() == erExternalPerimeter) || + path.get_overhang_degree() > overhang_threshold || + is_bridge(path.role())) + gcode += ";_OVERHANG_FAN_END\n"; + else + gcode += ";_EXTRUDE_END\n"; + } + else { + gcode += ";_EXTRUDE_END\n"; + } + } this->set_last_pos(path.last_point()); return gcode; diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 9a692f3894..b6874bc1bb 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -259,12 +259,14 @@ static const t_config_enum_values s_keys_map_ForwardCompatibilitySubstitutionRul CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(ForwardCompatibilitySubstitutionRule) static const t_config_enum_values s_keys_map_OverhangFanThreshold = { + { "0%", Overhang_threshold_none }, { "5%", Overhang_threshold_1_4 }, { "25%", Overhang_threshold_2_4 }, { "50%", Overhang_threshold_3_4 }, { "75%", Overhang_threshold_4_4 }, { "95%", Overhang_threshold_bridge } }; +CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(OverhangFanThreshold) // BBS static const t_config_enum_values s_keys_map_BedType = { @@ -628,15 +630,18 @@ void PrintConfigDef::init_fff_params() def = this->add("overhang_fan_threshold", coEnums); def->label = L("Cooling overhang threshold"); def->tooltip = L("Force cooling fan to be specific speed when overhang degree of printed part exceeds this value. " - "Expressed as percentage which indicides how much width of the line without support from lower layer"); + "Expressed as percentage which indicides how much width of the line without support from lower layer. " + "0% means forcing cooling for all outer wall no matter how much overhang degree"); def->sidetext = L(""); - def->enum_keys_map = &s_keys_map_OverhangFanThreshold; + def->enum_keys_map = &ConfigOptionEnum::get_enum_values(); def->mode = comAdvanced; + def->enum_values.emplace_back("0%"); def->enum_values.emplace_back("5%"); def->enum_values.emplace_back("25%"); def->enum_values.emplace_back("50%"); def->enum_values.emplace_back("75%"); def->enum_values.emplace_back("95%"); + def->enum_labels.emplace_back("0%"); def->enum_labels.emplace_back("10%"); def->enum_labels.emplace_back("25%"); def->enum_labels.emplace_back("50%"); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index db2c4e5524..841acb088b 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -157,7 +157,8 @@ enum DraftShield { // BBS enum OverhangFanThreshold { - Overhang_threshold_1_4 = 0, + Overhang_threshold_none = 0, + Overhang_threshold_1_4, Overhang_threshold_2_4, Overhang_threshold_3_4, Overhang_threshold_4_4,