diff options
author | supermerill <merill@free.fr> | 2022-04-15 19:21:12 +0300 |
---|---|---|
committer | supermerill <merill@free.fr> | 2022-04-15 16:23:07 +0300 |
commit | 64f6ee8c18f5fdadc362ac7d44ac00af051c0452 (patch) | |
tree | f29af253b79359a17722f7a57fdf5a407ce692d3 /src | |
parent | 775f5be7e1a4cb2fe3a5c1613cbdad7bed2aceee (diff) |
support interface fan speed
supermerill/SuperSlicer#937
Diffstat (limited to 'src')
-rw-r--r-- | src/libslic3r/GCode.cpp | 4 | ||||
-rw-r--r-- | src/libslic3r/GCode/CoolingBuffer.cpp | 54 | ||||
-rw-r--r-- | src/libslic3r/Preset.cpp | 1 | ||||
-rw-r--r-- | src/libslic3r/Print.cpp | 1 | ||||
-rw-r--r-- | src/libslic3r/PrintConfig.cpp | 16 | ||||
-rw-r--r-- | src/libslic3r/PrintConfig.hpp | 1 | ||||
-rw-r--r-- | src/slic3r/GUI/PresetHints.cpp | 9 |
7 files changed, 72 insertions, 14 deletions
diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index eea351f02..82b7f2925 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -5036,6 +5036,8 @@ std::string GCode::_before_extrude(const ExtrusionPath &path, const std::string gcode += ";_BRIDGE_FAN_START\n"; else if (ExtrusionRole::erTopSolidInfill == path.role()) gcode += ";_TOP_FAN_START\n"; + else if (ExtrusionRole::erSupportMaterialInterface == path.role()) + gcode += ";_SUPP_INTER_FAN_START\n"; else comment = ";_EXTRUDE_SET_SPEED"; if (path.role() == erExternalPerimeter) @@ -5058,6 +5060,8 @@ std::string GCode::_after_extrude(const ExtrusionPath &path) { gcode += ";_BRIDGE_FAN_END\n"; else if (ExtrusionRole::erTopSolidInfill == path.role()) gcode += ";_TOP_FAN_END\n"; + else if (ExtrusionRole::erSupportMaterialInterface == path.role()) + gcode += ";_SUPP_INTER_FAN_END\n"; else gcode += ";_EXTRUDE_END\n"; diff --git a/src/libslic3r/GCode/CoolingBuffer.cpp b/src/libslic3r/GCode/CoolingBuffer.cpp index a63f3b933..c2ed5fc5c 100644 --- a/src/libslic3r/GCode/CoolingBuffer.cpp +++ b/src/libslic3r/GCode/CoolingBuffer.cpp @@ -50,17 +50,19 @@ struct CoolingLine TYPE_BRIDGE_INTERNAL_FAN_END = 1 << 5, TYPE_TOP_FAN_START = 1 << 6, TYPE_TOP_FAN_END = 1 << 7, - TYPE_G0 = 1 << 8, - TYPE_G1 = 1 << 9, - TYPE_ADJUSTABLE = 1 << 10, - TYPE_EXTERNAL_PERIMETER = 1 << 11, + TYPE_SUPP_INTER_FAN_START = 1 << 8, + TYPE_SUPP_INTER_FAN_END = 1 << 9, + TYPE_G0 = 1 << 10, + TYPE_G1 = 1 << 11, + TYPE_ADJUSTABLE = 1 << 12, + TYPE_EXTERNAL_PERIMETER = 1 << 13, // The line sets a feedrate. - TYPE_HAS_F = 1 << 12, - TYPE_WIPE = 1 << 13, - TYPE_G4 = 1 << 14, - TYPE_G92 = 1 << 15, - TYPE_STORE_FOR_WT = 1 << 16, - TYPE_RESTORE_AFTER_WT = 1 << 17, + TYPE_HAS_F = 1 << 14, + TYPE_WIPE = 1 << 15, + TYPE_G4 = 1 << 16, + TYPE_G92 = 1 << 17, + TYPE_STORE_FOR_WT = 1 << 18, + TYPE_RESTORE_AFTER_WT = 1 << 19, }; CoolingLine(unsigned int type, size_t line_start, size_t line_end) : @@ -512,6 +514,10 @@ std::vector<PerExtruderAdjustments> CoolingBuffer::parse_layer_gcode(const std:: line.type = CoolingLine::TYPE_TOP_FAN_START; } else if (boost::starts_with(sline, ";_TOP_FAN_END")) { line.type = CoolingLine::TYPE_TOP_FAN_END; + } else if (boost::starts_with(sline, ";_SUPP_INTER_FAN_START")) { + line.type = CoolingLine::TYPE_SUPP_INTER_FAN_START; + } else if (boost::starts_with(sline, ";_SUPP_INTER_FAN_END")) { + line.type = CoolingLine::TYPE_SUPP_INTER_FAN_END; } else if (boost::starts_with(sline, "G4 ")) { // Parse the wait time. line.type = CoolingLine::TYPE_G4; @@ -764,14 +770,21 @@ std::string CoolingBuffer::apply_layer_cooldown( int bridge_internal_fan_speed = 0; bool top_fan_control = false; int top_fan_speed = 0; + bool supp_inter_fan_control = false; + int supp_inter_fan_speed = 0; bool ext_peri_fan_control = false; int ext_peri_fan_speed = 0; #define EXTRUDER_CONFIG(OPT) m_config.OPT.get_at(m_current_extruder) - auto change_extruder_set_fan = [this, layer_id, layer_time, &new_gcode, &bridge_fan_control, &bridge_fan_speed, &bridge_internal_fan_control, &bridge_internal_fan_speed, &top_fan_control, &top_fan_speed, &ext_peri_fan_control, &ext_peri_fan_speed]() { + auto change_extruder_set_fan = [this, layer_id, layer_time, &new_gcode, + &bridge_fan_control, &bridge_fan_speed, &bridge_internal_fan_control, &bridge_internal_fan_speed, + &top_fan_control, &top_fan_speed, + &ext_peri_fan_control, &ext_peri_fan_speed, + &supp_inter_fan_control, &supp_inter_fan_speed]() { int min_fan_speed = EXTRUDER_CONFIG(min_fan_speed); bridge_fan_speed = EXTRUDER_CONFIG(bridge_fan_speed); bridge_internal_fan_speed = EXTRUDER_CONFIG(bridge_internal_fan_speed); top_fan_speed = EXTRUDER_CONFIG(top_fan_speed); + supp_inter_fan_speed = EXTRUDER_CONFIG(support_material_interface_fan_speed); ext_peri_fan_speed = EXTRUDER_CONFIG(external_perimeter_fan_speed); // 0 is deprecated for disable: take care of temp settings. if (bridge_fan_speed == 0) bridge_fan_speed = -1; @@ -836,7 +849,8 @@ std::string CoolingBuffer::apply_layer_cooldown( } bridge_fan_control = bridge_fan_speed > fan_speed_new && bridge_fan_speed >= 0; bridge_internal_fan_control = bridge_internal_fan_speed > fan_speed_new && bridge_internal_fan_speed >= 0; - top_fan_control = top_fan_speed != fan_speed_new && top_fan_speed >= 0; + top_fan_control = top_fan_speed != fan_speed_new && top_fan_speed >= 0; + supp_inter_fan_control = supp_inter_fan_speed != fan_speed_new && supp_inter_fan_speed >= 0; ext_peri_fan_control = ext_peri_fan_speed != fan_speed_new && ext_peri_fan_speed >= 0; // if bridge_internal_fan is disabled, it takes the value of bridge_fan_control // if bridge_internal_fan_speed is too low, it takes the value of fan_speed_new @@ -855,6 +869,8 @@ std::string CoolingBuffer::apply_layer_cooldown( bridge_internal_fan_speed = 0; top_fan_control = false; top_fan_speed = 0; + supp_inter_fan_control = false; + supp_inter_fan_speed = 0; ext_peri_fan_control = false; ext_peri_fan_speed = 0; fan_speed_new = 0; @@ -864,7 +880,7 @@ std::string CoolingBuffer::apply_layer_cooldown( new_gcode += GCodeWriter::set_fan(m_config.gcode_flavor, m_config.gcode_comments, m_fan_speed, EXTRUDER_CONFIG(extruder_fan_offset), m_config.fan_percentage); } }; - //set to know all fan modifiers that can be applied ( TYPE_BRIDGE_FAN_END, TYPE_TOP_FAN_START, TYPE_EXTERNAL_PERIMETER). + //set to know all fan modifiers that can be applied ( TYPE_BRIDGE_FAN_END, TYPE_TOP_FAN_START, TYPE_SUPP_INTER_FAN_START, TYPE_EXTERNAL_PERIMETER). std::unordered_set<CoolingLine::Type> current_fan_sections; const char *pos = gcode.c_str(); int current_feedrate = 0; @@ -917,6 +933,16 @@ std::string CoolingBuffer::apply_layer_cooldown( fan_need_set = true; current_fan_sections.erase(CoolingLine::TYPE_TOP_FAN_START); } + } else if (line->type & CoolingLine::TYPE_SUPP_INTER_FAN_START) { + if (supp_inter_fan_control && current_fan_sections.find(CoolingLine::TYPE_SUPP_INTER_FAN_START) == current_fan_sections.end()) { + fan_need_set = true; + current_fan_sections.insert(CoolingLine::TYPE_SUPP_INTER_FAN_START); + } + } else if (line->type & CoolingLine::TYPE_SUPP_INTER_FAN_END) { + if (supp_inter_fan_control || current_fan_sections.find(CoolingLine::TYPE_SUPP_INTER_FAN_START) != current_fan_sections.end()) { + fan_need_set = true; + current_fan_sections.erase(CoolingLine::TYPE_SUPP_INTER_FAN_START); + } } else if (line->type & CoolingLine::TYPE_EXTRUDE_END) { if (ext_peri_fan_control || current_fan_sections.find(CoolingLine::TYPE_EXTERNAL_PERIMETER) != current_fan_sections.end()) { fan_need_set = true; @@ -1015,6 +1041,8 @@ std::string CoolingBuffer::apply_layer_cooldown( new_gcode += GCodeWriter::set_fan(m_config.gcode_flavor, m_config.gcode_comments, bridge_internal_fan_speed, EXTRUDER_CONFIG(extruder_fan_offset), m_config.fan_percentage); else if (current_fan_sections.find(CoolingLine::TYPE_TOP_FAN_START) != current_fan_sections.end()) new_gcode += GCodeWriter::set_fan(m_config.gcode_flavor, m_config.gcode_comments, top_fan_speed, EXTRUDER_CONFIG(extruder_fan_offset), m_config.fan_percentage); + else if (current_fan_sections.find(CoolingLine::TYPE_SUPP_INTER_FAN_START) != current_fan_sections.end()) + new_gcode += GCodeWriter::set_fan(m_config.gcode_flavor, m_config.gcode_comments, supp_inter_fan_speed, EXTRUDER_CONFIG(extruder_fan_offset), m_config.fan_percentage); else if (current_fan_sections.find(CoolingLine::TYPE_EXTERNAL_PERIMETER) != current_fan_sections.end()) new_gcode += GCodeWriter::set_fan(m_config.gcode_flavor, m_config.gcode_comments, ext_peri_fan_speed, EXTRUDER_CONFIG(extruder_fan_offset), m_config.fan_percentage); else diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 0449f7ce2..8bfacbde2 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -724,6 +724,7 @@ static std::vector<std::string> s_Preset_filament_options { "max_fan_speed", "bridge_fan_speed", "bridge_internal_fan_speed", + "support_material_interface_fan_speed", "top_fan_speed", "disable_fan_first_layers", "fan_below_layer_time", diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index b521079e9..c16c15e4d 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -167,6 +167,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver& /* ne "solid_infill_acceleration", "support_material_acceleration", "support_material_interface_acceleration", + "support_material_interface_fan_speed", "standby_temperature_delta", "start_gcode", "start_gcode_manual", diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index d5a858949..80897e3fb 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -4881,6 +4881,21 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvancedE | comPrusa; def->set_default_value(new ConfigOptionFloatOrPercent(0, false)); + def = this->add("support_material_interface_fan_speed", coInts); + def->label = L("Support interface fan speed"); + def->category = OptionCategory::cooling; + def->tooltip = L("This fan speed is enforced during all support interfaces, to be able to weaken their bonding with a high fan speed." + "\nSet to 1 to disable the fan." + "\nSet to -1 to disable this override." + "\nCan only be overriden by disable_fan_first_layers."); + def->sidetext = L("%"); + def->min = -1; + def->max = 100; + def->mode = comAdvancedE | comSuSi; + def->is_vector_extruder = true; + def->set_default_value(new ConfigOptionInts{ -1 }); + + def = this->add("support_material_interface_contact_loops", coBool); def->label = L("Interface loops"); def->category = OptionCategory::support; @@ -7203,6 +7218,7 @@ std::unordered_set<std::string> prusa_export_to_remove_keys = { "support_material_acceleration", "support_material_contact_distance_type", "support_material_interface_acceleration", +"support_material_interface_fan_speed", "support_material_interface_pattern", "thin_perimeters_all", "thin_perimeters", diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index ae4fc590f..53918b7fa 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -1167,6 +1167,7 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE( ((ConfigOptionInt, standby_temperature_delta)) ((ConfigOptionFloatOrPercent, support_material_acceleration)) ((ConfigOptionFloatOrPercent, support_material_interface_acceleration)) + ((ConfigOptionInts, support_material_interface_fan_speed)) ((ConfigOptionInts, temperature)) ((ConfigOptionFloatOrPercent, thin_walls_acceleration)) ((ConfigOptionInt, threads)) diff --git a/src/slic3r/GUI/PresetHints.cpp b/src/slic3r/GUI/PresetHints.cpp index 6a9d1d722..e4b9f0f36 100644 --- a/src/slic3r/GUI/PresetHints.cpp +++ b/src/slic3r/GUI/PresetHints.cpp @@ -21,6 +21,7 @@ std::string PresetHints::cooling_description(const Preset &preset) int min_fan_speed = preset.config.opt_int("min_fan_speed", 0); int max_fan_speed = preset.config.opt_int("max_fan_speed", 0); int top_fan_speed = preset.config.opt_int("top_fan_speed", 0); + int supp_inter_fan_speed = preset.config.opt_int("support_material_interface_fan_speed", 0); int bridge_fan_speed = preset.config.opt_int("bridge_fan_speed", 0); int bridge_internal_fan_speed = preset.config.opt_int("bridge_internal_fan_speed", 0); int ext_peri_fan_speed = preset.config.opt_int("external_perimeter_fan_speed", 0); @@ -31,7 +32,7 @@ std::string PresetHints::cooling_description(const Preset &preset) int max_speed_reduc = int(preset.config.opt_float("max_speed_reduction", 0)); float fan_below_layer_time = preset.config.opt_float("fan_below_layer_time", 0); - //for the time being, -1 shoudl eb for disabel, but it's 0 from legacy. + //for the time being, -1 shoudl eb for disable, but it's 0 from legacy. if (top_fan_speed == 0) top_fan_speed = -1; if (bridge_fan_speed == 0) bridge_fan_speed = -1; if (bridge_internal_fan_speed == 0) bridge_internal_fan_speed = -1; @@ -53,6 +54,9 @@ std::string PresetHints::cooling_description(const Preset &preset) if (top_fan_speed >= 0 && top_fan_speed != min_fan_speed) { out += ", " + (boost::format(_utf8(L("at %1%%% over top fill surfaces"))) % top_fan_speed).str(); } + if (supp_inter_fan_speed >= 0 && supp_inter_fan_speed != min_fan_speed) { + out += ", " + (boost::format(_utf8(L("at %1%%% over support interface surfaces"))) % supp_inter_fan_speed).str(); + } if (bridge_fan_speed >= 0 && bridge_fan_speed > min_fan_speed) { if (bridge_internal_fan_speed < 0) out += ", " + (boost::format(_utf8(L("at %1%%% over all bridges"))) % bridge_fan_speed).str(); @@ -93,6 +97,9 @@ std::string PresetHints::cooling_description(const Preset &preset) if (top_fan_speed >= 0) { out += ", " + (boost::format(_utf8(L("at %1%%% over top fill surfaces"))) % top_fan_speed).str(); } + if (supp_inter_fan_speed >= 0) { + out += ", " + (boost::format(_utf8(L("at %1%%% over support interface surfaces"))) % supp_inter_fan_speed).str(); + } if (bridge_fan_speed > max_fan_speed) { out += ", " + (boost::format(_utf8(L("at %1%%% over bridges"))) % bridge_fan_speed).str(); } else if (bridge_fan_speed > min_fan_speed) { |