Concider projects with .zip extension that are 3mf projects as it would have .3mf extension.
This commit is contained in:
parent
80b88c542a
commit
d8e39519f2
@ -121,7 +121,7 @@ Model Model::read_from_file(const std::string& input_file, DynamicPrintConfig* c
|
|||||||
result = load_step(input_file.c_str(), &model);
|
result = load_step(input_file.c_str(), &model);
|
||||||
else if (boost::algorithm::iends_with(input_file, ".amf") || boost::algorithm::iends_with(input_file, ".amf.xml"))
|
else if (boost::algorithm::iends_with(input_file, ".amf") || boost::algorithm::iends_with(input_file, ".amf.xml"))
|
||||||
result = load_amf(input_file.c_str(), config, config_substitutions, &model, options & LoadAttribute::CheckVersion);
|
result = load_amf(input_file.c_str(), config, config_substitutions, &model, options & LoadAttribute::CheckVersion);
|
||||||
else if (boost::algorithm::iends_with(input_file, ".3mf"))
|
else if (boost::algorithm::iends_with(input_file, ".3mf") || boost::algorithm::iends_with(input_file, ".zip"))
|
||||||
//FIXME options & LoadAttribute::CheckVersion ?
|
//FIXME options & LoadAttribute::CheckVersion ?
|
||||||
result = load_3mf(input_file.c_str(), *config, *config_substitutions, &model, false);
|
result = load_3mf(input_file.c_str(), *config, *config_substitutions, &model, false);
|
||||||
else
|
else
|
||||||
@ -155,7 +155,7 @@ Model Model::read_from_archive(const std::string& input_file, DynamicPrintConfig
|
|||||||
Model model;
|
Model model;
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
if (boost::algorithm::iends_with(input_file, ".3mf"))
|
if (boost::algorithm::iends_with(input_file, ".3mf") || boost::algorithm::iends_with(input_file, ".zip"))
|
||||||
result = load_3mf(input_file.c_str(), *config, *config_substitutions, &model, options & LoadAttribute::CheckVersion);
|
result = load_3mf(input_file.c_str(), *config, *config_substitutions, &model, options & LoadAttribute::CheckVersion);
|
||||||
else if (boost::algorithm::iends_with(input_file, ".zip.amf"))
|
else if (boost::algorithm::iends_with(input_file, ".zip.amf"))
|
||||||
result = load_amf(input_file.c_str(), config, config_substitutions, &model, options & LoadAttribute::CheckVersion);
|
result = load_amf(input_file.c_str(), config, config_substitutions, &model, options & LoadAttribute::CheckVersion);
|
||||||
|
@ -1702,6 +1702,7 @@ struct Plater::priv
|
|||||||
static const std::regex pattern_zip_amf;
|
static const std::regex pattern_zip_amf;
|
||||||
static const std::regex pattern_any_amf;
|
static const std::regex pattern_any_amf;
|
||||||
static const std::regex pattern_prusa;
|
static const std::regex pattern_prusa;
|
||||||
|
static const std::regex pattern_zip;
|
||||||
|
|
||||||
priv(Plater *q, MainFrame *main_frame);
|
priv(Plater *q, MainFrame *main_frame);
|
||||||
~priv();
|
~priv();
|
||||||
@ -1998,6 +1999,7 @@ const std::regex Plater::priv::pattern_3mf(".*3mf", std::regex::icase);
|
|||||||
const std::regex Plater::priv::pattern_zip_amf(".*[.]zip[.]amf", std::regex::icase);
|
const std::regex Plater::priv::pattern_zip_amf(".*[.]zip[.]amf", std::regex::icase);
|
||||||
const std::regex Plater::priv::pattern_any_amf(".*[.](amf|amf[.]xml|zip[.]amf)", std::regex::icase);
|
const std::regex Plater::priv::pattern_any_amf(".*[.](amf|amf[.]xml|zip[.]amf)", std::regex::icase);
|
||||||
const std::regex Plater::priv::pattern_prusa(".*prusa", std::regex::icase);
|
const std::regex Plater::priv::pattern_prusa(".*prusa", std::regex::icase);
|
||||||
|
const std::regex Plater::priv::pattern_zip(".*zip", std::regex::icase);
|
||||||
|
|
||||||
Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
||||||
: q(q)
|
: q(q)
|
||||||
@ -2423,7 +2425,7 @@ void Plater::check_selected_presets_visibility(PrinterTechnology loaded_printer_
|
|||||||
|
|
||||||
std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_files, bool load_model, bool load_config, bool imperial_units/* = false*/)
|
std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_files, bool load_model, bool load_config, bool imperial_units/* = false*/)
|
||||||
{
|
{
|
||||||
if (input_files.empty()) { return std::vector<size_t>(); }
|
if (input_files.empty()) { return std::vector<size_t>(); }
|
||||||
|
|
||||||
auto *nozzle_dmrs = config->opt<ConfigOptionFloats>("nozzle_diameter");
|
auto *nozzle_dmrs = config->opt<ConfigOptionFloats>("nozzle_diameter");
|
||||||
|
|
||||||
@ -2484,7 +2486,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
|||||||
progress_dlg->Fit();
|
progress_dlg->Fit();
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool type_3mf = std::regex_match(path.string(), pattern_3mf);
|
const bool type_3mf = std::regex_match(path.string(), pattern_3mf) || std::regex_match(path.string(), pattern_zip);
|
||||||
const bool type_zip_amf = !type_3mf && std::regex_match(path.string(), pattern_zip_amf);
|
const bool type_zip_amf = !type_3mf && std::regex_match(path.string(), pattern_zip_amf);
|
||||||
const bool type_any_amf = !type_3mf && std::regex_match(path.string(), pattern_any_amf);
|
const bool type_any_amf = !type_3mf && std::regex_match(path.string(), pattern_any_amf);
|
||||||
const bool type_prusa = std::regex_match(path.string(), pattern_prusa);
|
const bool type_prusa = std::regex_match(path.string(), pattern_prusa);
|
||||||
@ -5935,7 +5937,13 @@ bool Plater::load_files(const wxArrayString& filenames, bool delete_after_load/*
|
|||||||
// searches for project files
|
// searches for project files
|
||||||
for (std::vector<fs::path>::const_reverse_iterator it = paths.rbegin(); it != paths.rend(); ++it) {
|
for (std::vector<fs::path>::const_reverse_iterator it = paths.rbegin(); it != paths.rend(); ++it) {
|
||||||
std::string filename = (*it).filename().string();
|
std::string filename = (*it).filename().string();
|
||||||
if (boost::algorithm::iends_with(filename, ".3mf") || boost::algorithm::iends_with(filename, ".amf")) {
|
|
||||||
|
bool handle_as_project = (boost::algorithm::iends_with(filename, ".3mf") || boost::algorithm::iends_with(filename, ".amf"));
|
||||||
|
if (boost::algorithm::iends_with(filename, ".zip") && is_project_3mf(it->string())) {
|
||||||
|
BOOST_LOG_TRIVIAL(warning) << "File with .zip extension is 3mf project, opening as it would have .3mf extension: " << *it;
|
||||||
|
handle_as_project = true;
|
||||||
|
}
|
||||||
|
if (handle_as_project) {
|
||||||
ProjectDropDialog::LoadType load_type = ProjectDropDialog::LoadType::Unknown;
|
ProjectDropDialog::LoadType load_type = ProjectDropDialog::LoadType::Unknown;
|
||||||
{
|
{
|
||||||
if ((boost::algorithm::iends_with(filename, ".3mf") && !is_project_3mf(it->string())) ||
|
if ((boost::algorithm::iends_with(filename, ".3mf") && !is_project_3mf(it->string())) ||
|
||||||
|
Loading…
Reference in New Issue
Block a user