mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-07 06:57:36 -06:00
FIX: issue 551: support to import prusa 3mf file
Change-Id: I6d00fab62304893cc5f1aba0d0a74e4c6194bce9
This commit is contained in:
parent
acc6d70db9
commit
09d5651c39
5 changed files with 209 additions and 14 deletions
|
@ -33,6 +33,7 @@
|
|||
|
||||
// BBS: for segment
|
||||
#include "MeshBoolean.hpp"
|
||||
#include "Format/3mf.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
// BBS initialization of static variables
|
||||
|
@ -202,7 +203,7 @@ Model Model::read_from_file(const std::string& input_file, DynamicPrintConfig* c
|
|||
//BBS: add part plate related logic
|
||||
// BBS: backup & restore
|
||||
// Loading model from a file (3MF or AMF), not from a simple geometry file (STL or OBJ).
|
||||
Model Model::read_from_archive(const std::string& input_file, DynamicPrintConfig* config, ConfigSubstitutionContext* config_substitutions, LoadStrategy options, PlateDataPtrs* plate_data, std::vector<Preset*>* project_presets, bool *is_bbl_3mf, Semver* file_version, Import3mfProgressFn proFn, BBLProject *project)
|
||||
Model Model::read_from_archive(const std::string& input_file, DynamicPrintConfig* config, ConfigSubstitutionContext* config_substitutions, En3mfType& out_file_type, LoadStrategy options, PlateDataPtrs* plate_data, std::vector<Preset*>* project_presets, Semver* file_version, Import3mfProgressFn proFn, BBLProject *project)
|
||||
{
|
||||
assert(config != nullptr);
|
||||
assert(config_substitutions != nullptr);
|
||||
|
@ -210,15 +211,28 @@ Model Model::read_from_archive(const std::string& input_file, DynamicPrintConfig
|
|||
Model model;
|
||||
|
||||
bool result = false;
|
||||
if (boost::algorithm::iends_with(input_file, ".3mf"))
|
||||
//BBS: add part plate related logic
|
||||
// BBS: backup & restore
|
||||
result = load_bbs_3mf(input_file.c_str(), config, config_substitutions, &model, plate_data, project_presets, is_bbl_3mf, file_version, proFn, options, project);
|
||||
bool is_bbl_3mf;
|
||||
if (boost::algorithm::iends_with(input_file, ".3mf")) {
|
||||
PrusaFileParser prusa_file_parser;
|
||||
if (prusa_file_parser.check_3mf_from_prusa(input_file)) {
|
||||
// for Prusa 3mf
|
||||
result = load_3mf(input_file.c_str(), *config, *config_substitutions, &model, true);
|
||||
out_file_type = En3mfType::From_Prusa;
|
||||
} else {
|
||||
// BBS: add part plate related logic
|
||||
// BBS: backup & restore
|
||||
result = load_bbs_3mf(input_file.c_str(), config, config_substitutions, &model, plate_data, project_presets, &is_bbl_3mf, file_version, proFn, options, project);
|
||||
}
|
||||
}
|
||||
else if (boost::algorithm::iends_with(input_file, ".zip.amf"))
|
||||
result = load_amf(input_file.c_str(), config, config_substitutions, &model, is_bbl_3mf);
|
||||
result = load_amf(input_file.c_str(), config, config_substitutions, &model, &is_bbl_3mf);
|
||||
else
|
||||
throw Slic3r::RuntimeError("Unknown file format. Input file must have .3mf or .zip.amf extension.");
|
||||
|
||||
if (out_file_type != En3mfType::From_Prusa) {
|
||||
out_file_type = is_bbl_3mf ? En3mfType::From_BBS : En3mfType::From_Other;
|
||||
}
|
||||
|
||||
if (!result)
|
||||
throw Slic3r::RuntimeError("Loading of a model file failed.");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue