NEW:add step mesh parameters

jira: STUDIO-7415
Change-Id: I5e09a1eb1ad31063ad56d08d5738907a804dc112
(cherry picked from commit ccbe9630076b754ab440e98977c4164afff96250)
(cherry picked from commit 84e7063c54a99e8a1440e74f831c6d1f6828f3f8)
This commit is contained in:
Mack
2024-09-09 11:52:59 +08:00
committed by Noisyfox
parent 00811ee5bb
commit 61ebddf9b8
8 changed files with 314 additions and 13 deletions

View File

@@ -27,6 +27,7 @@
#include "SVG.hpp"
#include <Eigen/Dense>
#include <functional>
#include "GCodeWriter.hpp"
// BBS: for segment
@@ -186,7 +187,8 @@ Model Model::read_from_file(const std::string& input_file, DynamicPrintConfig* c
StepIsUtf8Fn stepIsUtf8Fn,
BBLProject * project,
int plate_id,
ObjImportColorFn objFn)
ObjImportColorFn objFn,
std::function<int(double&, double&)> step_mesh_fn)
{
Model model;
@@ -211,9 +213,19 @@ Model Model::read_from_file(const std::string& input_file, DynamicPrintConfig* c
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, is_cb_cancel, stepFn, stepIsUtf8Fn);
else if (boost::algorithm::iends_with(input_file, ".stl"))
boost::algorithm::iends_with(input_file, ".step")) {
double linear_defletion = 0.003;
double angle_defletion = 0.5;
if (step_mesh_fn) {
if (step_mesh_fn(linear_defletion, angle_defletion) == -1) {
result = false;
goto end;
}
}
result = load_step(input_file.c_str(), &model, is_cb_cancel, linear_defletion, angle_defletion, stepFn, stepIsUtf8Fn);
end:
BOOST_LOG_TRIVIAL(info) << "Cancel step mesh dialog";
} 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, ".oltp"))
result = load_stl(input_file.c_str(), &model, nullptr, stlFn,256);