ConfigWizard: Allow to install and select SLA printer preset, when multipart object is in on the bed.

However, it is still not impossible to select an SLA printer when the object has a modifier.
For this case info dialog will be shown.

+ Model: Deleted model_has_multi_part_objects()

SPE-2547
This commit is contained in:
YuSanka 2024-11-04 13:12:24 +01:00 committed by Lukas Matena
parent 6d19776942
commit 0a57de800c
4 changed files with 14 additions and 22 deletions

View File

@ -2302,14 +2302,6 @@ bool model_has_parameter_modifiers_in_objects(const Model &model)
return false;
}
bool model_has_multi_part_objects(const Model &model)
{
for (const ModelObject *model_object : model.objects)
if (model_object->volumes.size() != 1 || ! model_object->volumes.front()->is_model_part())
return true;
return false;
}
bool model_has_advanced_features(const Model &model)
{
auto config_is_advanced = [](const ModelConfig &config) {

View File

@ -1449,9 +1449,6 @@ extern bool model_fuzzy_skin_data_changed(const ModelObject &mo, const ModelObje
// If the model has object(s) which contains a modofoer, then it is currently not supported by the SLA mode.
// Either the model cannot be loaded, or a SLA printer has to be activated.
bool model_has_parameter_modifiers_in_objects(const Model& model);
// If the model has multi-part objects, then it is currently not supported by the SLA mode.
// Either the model cannot be loaded, or a SLA printer has to be activated.
bool model_has_multi_part_objects(const Model &model);
// If the model has advanced features, then it cannot be processed in simple mode.
bool model_has_advanced_features(const Model &model);

View File

@ -3311,9 +3311,10 @@ bool ConfigWizard::priv::apply_config(AppConfig *app_config, PresetBundle *prese
const auto enabled_vendors = appconfig_new.vendors();
const auto enabled_vendors_old = app_config->vendors();
bool suppress_sla_printer = model_has_multi_part_objects(wxGetApp().model());
bool show_info_msg = false;
bool suppress_sla_printer = model_has_parameter_modifiers_in_objects(wxGetApp().model());
PrinterTechnology preferred_pt = ptAny;
auto get_preferred_printer_technology = [enabled_vendors, enabled_vendors_old, suppress_sla_printer](const std::string& bundle_name, const Bundle& bundle) {
auto get_preferred_printer_technology = [enabled_vendors, enabled_vendors_old, suppress_sla_printer, &show_info_msg](const std::string& bundle_name, const Bundle& bundle) {
const auto config = enabled_vendors.find(bundle_name);
PrinterTechnology pt = ptAny;
if (config != enabled_vendors.end()) {
@ -3323,17 +3324,21 @@ bool ConfigWizard::priv::apply_config(AppConfig *app_config, PresetBundle *prese
pt = model.technology;
const auto config_old = enabled_vendors_old.find(bundle_name);
if (config_old == enabled_vendors_old.end() || config_old->second.find(model.id) == config_old->second.end()) {
// if preferred printer model has SLA printer technology it's important to check the model for multi-part state
if (pt == ptSLA && suppress_sla_printer)
// if preferred printer model has SLA printer technology it's important to check the model for modifiers
if (pt == ptSLA && suppress_sla_printer) {
show_info_msg = true;
continue;
}
return pt;
}
if (const auto model_it_old = config_old->second.find(model.id);
model_it_old == config_old->second.end() || model_it_old->second != model_it->second) {
// if preferred printer model has SLA printer technology it's important to check the model for multi-part state
if (pt == ptSLA && suppress_sla_printer)
// if preferred printer model has SLA printer technology it's important to check the model for modifiers
if (pt == ptSLA && suppress_sla_printer) {
show_info_msg = true;
continue;
}
return pt;
}
}
@ -3355,8 +3360,9 @@ bool ConfigWizard::priv::apply_config(AppConfig *app_config, PresetBundle *prese
}
}
if (preferred_pt == ptSLA && !wxGetApp().may_switch_to_SLA_preset(caption))
return false;
if (show_info_msg)
show_info(nullptr, _L("It's impossible to print object(s) which contains parameter modifiers with SLA technology.\n\n"
"SLA-printer preset will not be selected"), caption);
bool check_unsaved_preset_changes = page_welcome->reset_user_profile();
if (check_unsaved_preset_changes)

View File

@ -3350,9 +3350,6 @@ bool GUI_App::run_wizard(ConfigWizard::RunReason reason, ConfigWizard::StartPage
break;
}
}
// #ysFIXME - delete after testing: This part of code looks redundant. All checks are inside ConfigWizard::priv::apply_config()
if (preset_bundle->printers.get_edited_preset().printer_technology() == ptSLA)
may_switch_to_SLA_preset(_L("Configuration is editing from ConfigWizard"));
}
return res;
}