mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-12-26 09:38:37 -07:00
FIX: sync_ams_list find filament_type
Change-Id: If6d95c26fa128377d8b4414470b07ed5a40f0b09 Github: 6152 (cherry picked from commit f076d95d8847d80ed466d118d718ec7584293e97)
This commit is contained in:
parent
d513914dd3
commit
d2754f4c36
1 changed files with 11 additions and 6 deletions
|
|
@ -2091,11 +2091,13 @@ unsigned int PresetBundle::sync_ams_list(std::vector<std::pair<DynamicPrintConfi
|
|||
ams_multi_color_filment.push_back(filament_multi_color);
|
||||
continue;
|
||||
}
|
||||
auto iter = std::find_if(filaments.begin(), filaments.end(), [this, &filament_id](auto &f) {
|
||||
bool has_type = false;
|
||||
auto filament_type = ams.opt_string("filament_type", 0u);
|
||||
auto iter = std::find_if(filaments.begin(), filaments.end(), [this, &filament_id, &has_type, filament_type](auto &f) {
|
||||
has_type |= f.config.opt_string("filament_type", 0u) == filament_type;
|
||||
return f.is_compatible && filaments.get_preset_base(f) == &f && f.filament_id == filament_id; });
|
||||
if (iter == filaments.end()) {
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": filament_id %1% not found or system or compatible") % filament_id;
|
||||
auto filament_type = ams.opt_string("filament_type", 0u);
|
||||
if (!filament_type.empty()) {
|
||||
filament_type = "Generic " + filament_type;
|
||||
iter = std::find_if(filaments.begin(), filaments.end(), [&filament_type](auto &f) {
|
||||
|
|
@ -2109,7 +2111,8 @@ unsigned int PresetBundle::sync_ams_list(std::vector<std::pair<DynamicPrintConfi
|
|||
ams_filament_presets.push_back(this->filament_presets[ams_filament_presets.size()]);
|
||||
ams_filament_colors.push_back(filament_color);
|
||||
ams_multi_color_filment.push_back(filament_multi_color);
|
||||
unknowns.emplace_back(&ams, L("The filament model is unknown. Still using the previous filament preset."));
|
||||
unknowns.emplace_back(&ams, has_type ? L("The filament may not be compatible with the current machine settings. Generic filament presets will be used.") :
|
||||
L("The filament model is unknown. Still using the previous filament preset."));
|
||||
continue;
|
||||
}
|
||||
iter = std::find_if(filaments.begin(), filaments.end(), [](auto &f) {
|
||||
|
|
@ -2118,9 +2121,11 @@ unsigned int PresetBundle::sync_ams_list(std::vector<std::pair<DynamicPrintConfi
|
|||
if (iter == filaments.end())
|
||||
continue;
|
||||
}
|
||||
unknowns.emplace_back(&ams, boost::algorithm::starts_with(iter->name, filament_type)
|
||||
? L("The filament may not be compatible with the current machine settings. Generic filament presets will be used.")
|
||||
: L("The filament model is unknown. A random filament preset will be used."));
|
||||
unknowns.emplace_back(&ams, boost::algorithm::starts_with(iter->name, filament_type) ?
|
||||
(has_type ? L("The filament may not be compatible with the current machine settings. Generic filament presets will be used.") :
|
||||
L("The filament model is unknown. Generic filament presets will be used.")) :
|
||||
(has_type ? L("The filament may not be compatible with the current machine settings. A random filament preset will be used.") :
|
||||
L("The filament model is unknown. A random filament preset will be used.")));
|
||||
filament_id = iter->filament_id;
|
||||
}
|
||||
ams_filament_presets.push_back(iter->name);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue