ConfigWizard: Select an appropriate printer based on the bundle order

This commit is contained in:
Vojtech Kral 2019-04-26 16:53:04 +02:00
parent c8815041e2
commit fb0836b0b2
6 changed files with 57 additions and 21 deletions

View file

@ -1330,4 +1330,15 @@ const Preset& PrinterPresetCollection::default_preset_for(const DynamicPrintConf
return this->default_preset((opt_printer_technology == nullptr || opt_printer_technology->value == ptFFF) ? 0 : 1);
}
const Preset* PrinterPresetCollection::find_by_model_id(const std::string &model_id) const
{
if (model_id.empty()) { return nullptr; }
const auto it = std::find_if(cbegin(), cend(), [&](const Preset &preset) {
return preset.config.opt_string("printer_model") == model_id;
});
return it != cend() ? &*it : nullptr;
}
} // namespace Slic3r