3mf import/export of config data

This commit is contained in:
Enrico Turri 2018-02-13 15:19:55 +01:00
parent 33553e1c50
commit 8885f5e344
12 changed files with 231 additions and 76 deletions

View file

@ -280,8 +280,8 @@ void PresetBundle::load_config_file(const std::string &path)
if (boost::iends_with(path, ".gcode") || boost::iends_with(path, ".g")) {
DynamicPrintConfig config;
config.apply(FullPrintConfig::defaults());
config.load_from_gcode(path);
Preset::normalize(config);
config.load_from_gcode_file(path);
Preset::normalize(config);
load_config_file_config(path, true, std::move(config));
return;
}
@ -320,6 +320,18 @@ void PresetBundle::load_config_file(const std::string &path)
}
}
void PresetBundle::load_config_string(const char* str, const char* source_filename)
{
if (str != nullptr)
{
DynamicPrintConfig config;
config.apply(FullPrintConfig::defaults());
config.load_from_gcode_string(str);
Preset::normalize(config);
load_config_file_config((source_filename == nullptr) ? "" : source_filename, true, std::move(config));
}
}
// Load a config file from a boost property_tree. This is a private method called from load_config_file.
void PresetBundle::load_config_file_config(const std::string &name_or_path, bool is_external, DynamicPrintConfig &&config)
{