mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-30 21:02:02 +08:00
ProfilesSharingUtils : Implemented load_full_print_config() function to load full print config from PresetBundle.
This commit is contained in:
parent
61ceac8ea2
commit
02b65b2366
@ -964,7 +964,12 @@ std::set<std::string> query_options = {
|
||||
bool CLI::processed_profiles_sharing()
|
||||
{
|
||||
if (m_profiles_sharing.empty())
|
||||
#if 0 // fsFIXME !!! just for the test
|
||||
DynamicPrintConfig config = Slic3r::load_full_print_config("0.20mm QUALITY @MINI", "Prusament PLA", "Original Prusa MINI & MINI+");
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
|
||||
std::string ret;
|
||||
for (auto const& opt_key : m_profiles_sharing) {
|
||||
|
@ -452,4 +452,40 @@ std::string get_json_print_filament_profiles(const std::string& printer_profile)
|
||||
return "";
|
||||
}
|
||||
|
||||
// Helper function for FS
|
||||
DynamicPrintConfig load_full_print_config(const std::string& print_preset_name, const std::string& filament_preset_name, const std::string& printer_preset_name)
|
||||
{
|
||||
DynamicPrintConfig config = {};
|
||||
|
||||
if (is_datadir()) {
|
||||
PresetBundle preset_bundle;
|
||||
|
||||
if (load_preset_bandle_from_datadir(preset_bundle)) {
|
||||
config.apply(FullPrintConfig::defaults());
|
||||
|
||||
const Preset* print_preset = preset_bundle.prints.find_preset(print_preset_name);
|
||||
if (print_preset)
|
||||
config.apply_only(print_preset->config, print_preset->config.keys());
|
||||
else
|
||||
printf("Print profile '%s' wasn't found.\n", print_preset->name.c_str());
|
||||
|
||||
const Preset* filament_preset = preset_bundle.filaments.find_preset(filament_preset_name);
|
||||
if (filament_preset)
|
||||
config.apply_only(filament_preset->config, filament_preset->config.keys());
|
||||
else
|
||||
printf("Filament profile '%s' wasn't found.\n", filament_preset->name.c_str());
|
||||
|
||||
const Preset* printer_preset = preset_bundle.printers.find_preset(printer_preset_name);
|
||||
if (printer_preset)
|
||||
config.apply_only(printer_preset->config, printer_preset->config.keys());
|
||||
else
|
||||
printf("Printer profile '%s' wasn't found.\n", printer_preset->name.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
printf("Datadir wasn't found\n");
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
} // namespace Slic3r
|
||||
|
@ -5,7 +5,7 @@
|
||||
#ifndef slic3r_ProfilesSharingUtils_hpp_
|
||||
#define slic3r_ProfilesSharingUtils_hpp_
|
||||
|
||||
#include "libslic3r/Config.hpp"
|
||||
#include "libslic3r/PrintConfig.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
@ -18,6 +18,8 @@ std::string get_json_print_filament_profiles(const std::string& printer_profile)
|
||||
std::string GetDataDir();
|
||||
#endif //__APPLE__
|
||||
|
||||
DynamicPrintConfig load_full_print_config(const std::string& print_preset, const std::string& filament_preset, const std::string& printer_preset);
|
||||
|
||||
} // namespace Slic3r
|
||||
|
||||
#endif // slic3r_ProfilesSharingUtils_hpp_
|
||||
|
Loading…
x
Reference in New Issue
Block a user