FIX: All extruder layer heights must be consistent in mutli-extruder

jira: STUDIO-8901
Change-Id: I713cfb298d26133daf86b94cf03a02833e8245cd
This commit is contained in:
zhimin.zeng 2024-12-27 09:46:25 +08:00 committed by lane.wei
parent a312425f5f
commit e02482bcce
1 changed files with 24 additions and 0 deletions

View File

@ -1618,6 +1618,30 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
}
}
if (m_preset_bundle->get_printer_extruder_count() > 1){
int extruder_idx = std::atoi(opt_key.substr(opt_key.find_last_of('#') + 1).c_str());
if (opt_key.find("min_layer_height") != std::string::npos) {
auto min_layer_height_from_nozzle = m_preset_bundle->full_config().option<ConfigOptionFloatsNullable>("min_layer_height")->values;
if (extruder_idx < min_layer_height_from_nozzle.size()) {
double value = min_layer_height_from_nozzle[extruder_idx];
std::fill(min_layer_height_from_nozzle.begin(), min_layer_height_from_nozzle.end(), value);
}
auto new_conf = *m_config;
new_conf.set_key_value("min_layer_height", new ConfigOptionFloatsNullable(min_layer_height_from_nozzle));
m_config_manipulation.apply(m_config, &new_conf);
}
else if (opt_key.find("max_layer_height") != std::string::npos) {
auto max_layer_height_from_nozzle = m_preset_bundle->full_config().option<ConfigOptionFloatsNullable>("max_layer_height")->values;
if (extruder_idx < max_layer_height_from_nozzle.size()) {
double value = max_layer_height_from_nozzle[extruder_idx];
std::fill(max_layer_height_from_nozzle.begin(), max_layer_height_from_nozzle.end(), value);
}
auto new_conf = *m_config;
new_conf.set_key_value("max_layer_height", new ConfigOptionFloatsNullable(max_layer_height_from_nozzle));
m_config_manipulation.apply(m_config, &new_conf);
}
}
if (m_postpone_update_ui) {
// It means that not all values are rolled to the system/last saved values jet.
// And call of the update() can causes a redundant check of the config values,