mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-31 23:02:06 +00:00
ENH:Add 'Don't show again' to the step mesh
jira: STUDIO-8606 Change-Id: I2382b9052e2c994a458ad36ca61eb94c517927c6 (cherry picked from commit 0cce6619ce12aa8540f6dfca6d9ee79ffba65c19)
This commit is contained in:
@@ -409,6 +409,14 @@ void AppConfig::set_defaults()
|
||||
set_str("print", "timelapse", "1");
|
||||
}
|
||||
|
||||
if (get("enable_step_mesh_setting").empty()) {
|
||||
set_bool("enable_step_mesh_setting", true);
|
||||
}
|
||||
if (get("linear_defletion", "angle_defletion").empty()) {
|
||||
set("linear_defletion", "0.003");
|
||||
set("angle_defletion", "0.5");
|
||||
}
|
||||
|
||||
// Remove legacy window positions/sizes
|
||||
erase("app", "main_frame_maximized");
|
||||
erase("app", "main_frame_pos");
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "../libslic3r.h"
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <cfloat>
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
|
||||
@@ -177,18 +177,67 @@ Model::~Model()
|
||||
Slic3r::remove_backup(*this, true);
|
||||
}
|
||||
|
||||
Model Model::read_from_step(const std::string& input_file,
|
||||
LoadStrategy options,
|
||||
ImportStepProgressFn stepFn,
|
||||
StepIsUtf8Fn stepIsUtf8Fn,
|
||||
std::function<int(Slic3r::Step&, double&, double&)> step_mesh_fn,
|
||||
double linear_defletion,
|
||||
double angle_defletion)
|
||||
{
|
||||
Model model;
|
||||
bool result = false;
|
||||
bool is_cb_cancel = false;
|
||||
std::string message;
|
||||
Step step_file(input_file);
|
||||
step_file.load();
|
||||
if (step_mesh_fn) {
|
||||
if (step_mesh_fn(step_file, linear_defletion, angle_defletion) == -1) {
|
||||
Model empty_model;
|
||||
return empty_model;
|
||||
}
|
||||
}
|
||||
result = load_step(input_file.c_str(), &model, is_cb_cancel, linear_defletion, angle_defletion, stepFn, stepIsUtf8Fn);
|
||||
if (is_cb_cancel) {
|
||||
Model empty_model;
|
||||
return empty_model;
|
||||
}
|
||||
|
||||
if (!result) {
|
||||
if (message.empty())
|
||||
throw Slic3r::RuntimeError(_L("Loading of a model file failed."));
|
||||
else
|
||||
throw Slic3r::RuntimeError(message);
|
||||
}
|
||||
|
||||
if (model.objects.empty())
|
||||
throw Slic3r::RuntimeError(_L("The supplied file couldn't be read because it's empty"));
|
||||
|
||||
for (ModelObject *o : model.objects)
|
||||
o->input_file = input_file;
|
||||
|
||||
if (options & LoadStrategy::AddDefaultInstances)
|
||||
model.add_default_instances();
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
// BBS: add part plate related logic
|
||||
// BBS: backup & restore
|
||||
// Loading model from a file, it may be a simple geometry file as STL or OBJ, however it may be a project file as well.
|
||||
Model Model::read_from_file(const std::string& input_file, DynamicPrintConfig* config, ConfigSubstitutionContext* config_substitutions,
|
||||
LoadStrategy options, PlateDataPtrs* plate_data, std::vector<Preset*>* project_presets, bool *is_xxx, Semver* file_version, Import3mfProgressFn proFn,
|
||||
ImportstlProgressFn stlFn,
|
||||
ImportStepProgressFn stepFn,
|
||||
StepIsUtf8Fn stepIsUtf8Fn,
|
||||
BBLProject * project,
|
||||
int plate_id,
|
||||
ObjImportColorFn objFn,
|
||||
std::function<int(Slic3r::Step&, double&, double&)> step_mesh_fn)
|
||||
Model Model::read_from_file(const std::string& input_file,
|
||||
DynamicPrintConfig* config,
|
||||
ConfigSubstitutionContext* config_substitutions,
|
||||
LoadStrategy options,
|
||||
PlateDataPtrs* plate_data,
|
||||
std::vector<Preset*>* project_presets,
|
||||
bool *is_xxx,
|
||||
Semver* file_version,
|
||||
Import3mfProgressFn proFn,
|
||||
ImportstlProgressFn stlFn,
|
||||
BBLProject * project,
|
||||
int plate_id,
|
||||
ObjImportColorFn objFn)
|
||||
{
|
||||
Model model;
|
||||
|
||||
@@ -212,20 +261,7 @@ Model Model::read_from_file(const std::string& input_file, DynamicPrintConfig* c
|
||||
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")) {
|
||||
double linear_defletion = 0.003;
|
||||
double angle_defletion = 0.5;
|
||||
Step step_file(input_file);
|
||||
step_file.load();
|
||||
if (step_mesh_fn) {
|
||||
if (step_mesh_fn(step_file, linear_defletion, angle_defletion) == -1) {
|
||||
Model empty_model;
|
||||
return empty_model;
|
||||
}
|
||||
}
|
||||
result = load_step(input_file.c_str(), &model, is_cb_cancel, linear_defletion, angle_defletion, stepFn, stepIsUtf8Fn);
|
||||
} else if (boost::algorithm::iends_with(input_file, ".stl"))
|
||||
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, ".oltp"))
|
||||
result = load_stl(input_file.c_str(), &model, nullptr, stlFn,256);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "Geometry.hpp"
|
||||
#include "ObjectID.hpp"
|
||||
#include "Point.hpp"
|
||||
#include "AppConfig.hpp"
|
||||
#include "PrintConfig.hpp"
|
||||
#include "Slicing.hpp"
|
||||
#include "SLA/SupportPoint.hpp"
|
||||
@@ -1530,6 +1531,14 @@ public:
|
||||
|
||||
OBJECTBASE_DERIVED_COPY_MOVE_CLONE(Model)
|
||||
|
||||
static Model read_from_step(const std::string& input_file,
|
||||
LoadStrategy options,
|
||||
ImportStepProgressFn stepFn,
|
||||
StepIsUtf8Fn stepIsUtf8Fn,
|
||||
std::function<int(Slic3r::Step&, double&, double&)> step_mesh_fn,
|
||||
double linear_defletion,
|
||||
double angle_defletion);
|
||||
|
||||
//BBS: add part plate related logic
|
||||
// BBS: backup
|
||||
//BBS: is_xxx is used for is_bbs_3mf when loading 3mf, is used for is_inches when loading amf
|
||||
@@ -1539,12 +1548,9 @@ public:
|
||||
LoadStrategy options = LoadStrategy::AddDefaultInstances, PlateDataPtrs* plate_data = nullptr,
|
||||
std::vector<Preset*>* project_presets = nullptr, bool* is_xxx = nullptr, Semver* file_version = nullptr, Import3mfProgressFn proFn = nullptr,
|
||||
ImportstlProgressFn stlFn = nullptr,
|
||||
ImportStepProgressFn stepFn = nullptr,
|
||||
StepIsUtf8Fn stepIsUtf8Fn = nullptr,
|
||||
BBLProject * project = nullptr,
|
||||
int plate_id = 0,
|
||||
ObjImportColorFn objFn = nullptr,
|
||||
std::function<int(Slic3r::Step&, double&, double&)> step_mesh_fn = nullptr
|
||||
ObjImportColorFn objFn = nullptr
|
||||
);
|
||||
// BBS
|
||||
static bool obj_import_vertex_color_deal(const std::vector<unsigned char> &vertex_filament_ids, const unsigned char &first_extruder_id, Model *model);
|
||||
|
||||
Reference in New Issue
Block a user