ENH: Format: Add ModelIO support on macOS

Github pull request: #2439

Change-Id: I4464a735a0a20b3e8103a344a64500b3d14b70e6
This commit is contained in:
Merikesh Dev 2023-09-01 20:30:14 -07:00 committed by Lane.Wei
parent 607f4ca526
commit 570a98fd45
5 changed files with 80 additions and 1 deletions

View file

@ -40,6 +40,11 @@
// Transtltion
#include "I18N.hpp"
// ModelIO support
#ifdef __APPLE__
#include "Format/ModelIO.hpp"
#endif
#define _L(s) Slic3r::I18N::translate(s)
namespace Slic3r {
@ -200,6 +205,18 @@ Model Model::read_from_file(const std::string& input_file, DynamicPrintConfig* c
//FIXME options & LoadStrategy::CheckVersion ?
//BBS: is_xxx is used for is_bbs_3mf when load 3mf
result = load_bbs_3mf(input_file.c_str(), config, config_substitutions, &model, plate_data, project_presets, is_xxx, file_version, proFn, options, project, plate_id);
#ifdef __APPLE__
else if (boost::algorithm::iends_with(input_file, ".usd") || boost::algorithm::iends_with(input_file, ".usda") ||
boost::algorithm::iends_with(input_file, ".usdc") || boost::algorithm::iends_with(input_file, ".usdz") ||
boost::algorithm::iends_with(input_file, ".abc") || boost::algorithm::iends_with(input_file, ".ply")) {
std::string temp_stl = make_temp_stl_with_modelio(input_file);
if (temp_stl.empty()) {
throw Slic3r::RuntimeError("Failed to convert asset to STL via ModelIO.");
}
result = load_stl(temp_stl.c_str(), &model);
delete_temp_file(temp_stl);
}
#endif
else
throw Slic3r::RuntimeError(_L("Unknown file format. Input file must have .stl, .obj, .amf(.xml) extension."));