From 8da7ef41c0186dd685568b24a9505093be03067b Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Fri, 8 Feb 2019 10:33:07 +0100 Subject: [PATCH] Infer printer family for pre-existing printers --- src/slic3r/GUI/Preset.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/slic3r/GUI/Preset.cpp b/src/slic3r/GUI/Preset.cpp index 4e2a747596..19626847f4 100644 --- a/src/slic3r/GUI/Preset.cpp +++ b/src/slic3r/GUI/Preset.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -84,6 +85,16 @@ VendorProfile VendorProfile::from_ini(const boost::filesystem::path &path, bool return VendorProfile::from_ini(tree, path, load_all); } +static const std::unordered_map pre_family_model_map {{ + { "MK3", "MK3" }, + { "MK3MMU2", "MK3" }, + { "MK2.5", "MK2.5" }, + { "MK2.5MMU2", "MK2.5" }, + { "MK2S", "MK2" }, + { "MK2SMM", "MK2" }, + { "SL1", "SL1" }, +}}; + VendorProfile VendorProfile::from_ini(const ptree &tree, const boost::filesystem::path &path, bool load_all) { static const std::string printer_model_key = "printer_model:"; @@ -139,6 +150,11 @@ VendorProfile VendorProfile::from_ini(const ptree &tree, const boost::filesystem } model.family = section.second.get("family", std::string()); + if (model.family.empty() && res.name == "Prusa Research") { + // If no family is specified, it can be inferred for known printers + const auto from_pre_map = pre_family_model_map.find(model.id); + if (from_pre_map != pre_family_model_map.end()) { model.family = from_pre_map->second; } + } #if 0 // Remove SLA printers from the initial alpha. if (model.technology == ptSLA)