mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-17 10:32:20 +00:00
FIX: cancel loading .step without warning
Change-Id: I5274b744c223fbd92dbca669f3d57c01b5558f88
This commit is contained in:
@@ -165,10 +165,11 @@ Model Model::read_from_file(const std::string& input_file, DynamicPrintConfig* c
|
||||
file_version = &temp_version;
|
||||
|
||||
bool result = false;
|
||||
bool is_cb_cancel = false;
|
||||
std::string message;
|
||||
if (boost::algorithm::iends_with(input_file, ".stp") ||
|
||||
boost::algorithm::iends_with(input_file, ".step"))
|
||||
result = load_step(input_file.c_str(), &model, stepFn, stepIsUtf8Fn);
|
||||
result = load_step(input_file.c_str(), &model, is_cb_cancel, stepFn, stepIsUtf8Fn);
|
||||
else if (boost::algorithm::iends_with(input_file, ".stl"))
|
||||
result = load_stl(input_file.c_str(), &model, nullptr, stlFn);
|
||||
else if (boost::algorithm::iends_with(input_file, ".obj"))
|
||||
@@ -189,6 +190,11 @@ Model Model::read_from_file(const std::string& input_file, DynamicPrintConfig* c
|
||||
else
|
||||
throw Slic3r::RuntimeError("Unknown file format. Input file must have .stl, .obj, .amf(.xml) extension.");
|
||||
|
||||
if (is_cb_cancel) {
|
||||
Model empty_model;
|
||||
return empty_model;
|
||||
}
|
||||
|
||||
if (!result) {
|
||||
if (message.empty())
|
||||
throw Slic3r::RuntimeError("Loading of a model file failed.");
|
||||
|
||||
Reference in New Issue
Block a user