mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 08:47:52 -06:00
Updated AMF/3MF import to pass configuration into a DynamicPrintConfig
instead of PresetBundle.
This commit is contained in:
parent
1398d5d09a
commit
9a3db200a5
10 changed files with 81 additions and 134 deletions
|
@ -44,10 +44,14 @@ void Model::swap(Model &other)
|
|||
std::swap(this->objects, other.objects);
|
||||
}
|
||||
|
||||
Model Model::read_from_file(const std::string &input_file, bool add_default_instances)
|
||||
Model Model::read_from_file(const std::string &input_file, DynamicPrintConfig *config, bool add_default_instances)
|
||||
{
|
||||
Model model;
|
||||
|
||||
|
||||
DynamicPrintConfig temp_config;
|
||||
if (config == nullptr)
|
||||
config = &temp_config;
|
||||
|
||||
bool result = false;
|
||||
if (boost::algorithm::iends_with(input_file, ".stl"))
|
||||
result = load_stl(input_file.c_str(), &model);
|
||||
|
@ -55,7 +59,9 @@ Model Model::read_from_file(const std::string &input_file, bool add_default_inst
|
|||
result = load_obj(input_file.c_str(), &model);
|
||||
else if (!boost::algorithm::iends_with(input_file, ".zip.amf") && (boost::algorithm::iends_with(input_file, ".amf") ||
|
||||
boost::algorithm::iends_with(input_file, ".amf.xml")))
|
||||
result = load_amf(input_file.c_str(), nullptr, &model);
|
||||
result = load_amf(input_file.c_str(), config, &model);
|
||||
else if (boost::algorithm::iends_with(input_file, ".3mf"))
|
||||
result = load_3mf(input_file.c_str(), config, &model);
|
||||
#ifdef SLIC3R_PRUS
|
||||
else if (boost::algorithm::iends_with(input_file, ".prusa"))
|
||||
result = load_prus(input_file.c_str(), &model);
|
||||
|
@ -78,15 +84,15 @@ Model Model::read_from_file(const std::string &input_file, bool add_default_inst
|
|||
return model;
|
||||
}
|
||||
|
||||
Model Model::read_from_archive(const std::string &input_file, PresetBundle* bundle, bool add_default_instances)
|
||||
Model Model::read_from_archive(const std::string &input_file, DynamicPrintConfig *config, bool add_default_instances)
|
||||
{
|
||||
Model model;
|
||||
|
||||
bool result = false;
|
||||
if (boost::algorithm::iends_with(input_file, ".3mf"))
|
||||
result = load_3mf(input_file.c_str(), bundle, &model);
|
||||
result = load_3mf(input_file.c_str(), config, &model);
|
||||
else if (boost::algorithm::iends_with(input_file, ".zip.amf"))
|
||||
result = load_amf(input_file.c_str(), bundle, &model);
|
||||
result = load_amf(input_file.c_str(), config, &model);
|
||||
else
|
||||
throw std::runtime_error("Unknown file format. Input file must have .3mf or .zip.amf extension.");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue