mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 16:57:53 -06:00
Merge branch 'tm_openvdb_integration' into lm_tm_hollowing
* Refactor file names in SLA dir
This commit is contained in:
commit
c22423a219
55 changed files with 1644 additions and 592 deletions
|
@ -1,7 +1,8 @@
|
|||
#include "SLAPrint.hpp"
|
||||
#include "SLA/SLASupportTree.hpp"
|
||||
#include "SLA/SLAPad.hpp"
|
||||
#include "SLA/SLAAutoSupports.hpp"
|
||||
#include "SLA/SupportTree.hpp"
|
||||
#include "SLA/Pad.hpp"
|
||||
#include "SLA/SupportPointGenerator.hpp"
|
||||
#include "SLA/Hollowing.hpp"
|
||||
#include "ClipperUtils.hpp"
|
||||
#include "Geometry.hpp"
|
||||
#include "MTUtils.hpp"
|
||||
|
@ -47,6 +48,14 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class SLAPrintObject::HollowingData
|
||||
{
|
||||
public:
|
||||
|
||||
TriangleMesh interior;
|
||||
// std::vector<drillpoints>
|
||||
};
|
||||
|
||||
namespace {
|
||||
|
||||
// should add up to 100 (%)
|
||||
|
@ -752,6 +761,29 @@ void SLAPrint::process()
|
|||
// the coefficient that multiplies the per object status values which
|
||||
// are set up for <0, 100>. They need to be scaled into the whole process
|
||||
const double ostepd = (max_objstatus - min_objstatus) / (objcount * 100.0);
|
||||
|
||||
auto hollow_model = [](SLAPrintObject &po) {
|
||||
|
||||
if (!po.m_config.hollowing_enable.getBool()) {
|
||||
BOOST_LOG_TRIVIAL(info) << "Skipping hollowing step!";
|
||||
po.m_hollowing_data.reset();
|
||||
return;
|
||||
} else {
|
||||
BOOST_LOG_TRIVIAL(info) << "Performing hollowing step!";
|
||||
}
|
||||
|
||||
if (!po.m_hollowing_data)
|
||||
po.m_hollowing_data.reset(new SLAPrintObject::HollowingData());
|
||||
|
||||
double thickness = po.m_config.hollowing_min_thickness.getFloat();
|
||||
double quality = po.m_config.hollowing_quality.getFloat();
|
||||
double closing_d = po.m_config.hollowing_closing_distance.getFloat();
|
||||
po.m_hollowing_data->interior =
|
||||
generate_interior(po.transformed_mesh(), {thickness, quality, closing_d});
|
||||
|
||||
if (po.m_hollowing_data->interior.empty())
|
||||
BOOST_LOG_TRIVIAL(warning) << "Hollowed interior is empty!";
|
||||
};
|
||||
|
||||
// The slicing will be performed on an imaginary 1D grid which starts from
|
||||
// the bottom of the bounding box created around the supported model. So
|
||||
|
@ -765,7 +797,20 @@ void SLAPrint::process()
|
|||
// Slicing the model object. This method is oversimplified and needs to
|
||||
// be compared with the fff slicing algorithm for verification
|
||||
auto slice_model = [this, ilhs, ilh](SLAPrintObject& po) {
|
||||
const TriangleMesh& mesh = po.transformed_mesh();
|
||||
|
||||
TriangleMesh hollowed_mesh;
|
||||
|
||||
bool is_hollowing = po.m_config.hollowing_enable.getBool() &&
|
||||
po.m_hollowing_data;
|
||||
|
||||
if (is_hollowing) {
|
||||
hollowed_mesh = po.transformed_mesh();
|
||||
hollowed_mesh.merge(po.m_hollowing_data->interior);
|
||||
hollowed_mesh.require_shared_vertices();
|
||||
}
|
||||
|
||||
const TriangleMesh &mesh = is_hollowing ? hollowed_mesh :
|
||||
po.transformed_mesh();
|
||||
|
||||
// We need to prepare the slice index...
|
||||
|
||||
|
@ -865,7 +910,7 @@ void SLAPrint::process()
|
|||
const std::vector<float>& heights = po.m_model_height_levels;
|
||||
|
||||
this->throw_if_canceled();
|
||||
SLAAutoSupports::Config config;
|
||||
SupportPointGenerator::Config config;
|
||||
const SLAPrintObjectConfig& cfg = po.config();
|
||||
|
||||
// the density config value is in percents:
|
||||
|
@ -888,12 +933,9 @@ void SLAPrint::process()
|
|||
|
||||
// Construction of this object does the calculation.
|
||||
this->throw_if_canceled();
|
||||
SLAAutoSupports auto_supports(po.m_supportdata->emesh,
|
||||
po.get_model_slices(),
|
||||
heights,
|
||||
config,
|
||||
[this]() { throw_if_canceled(); },
|
||||
statuscb);
|
||||
SupportPointGenerator auto_supports(
|
||||
po.m_supportdata->emesh, po.get_model_slices(), heights,
|
||||
config, [this]() { throw_if_canceled(); }, statuscb);
|
||||
|
||||
// Now let's extract the result.
|
||||
const std::vector<sla::SupportPoint>& points = auto_supports.output();
|
||||
|
@ -1465,12 +1507,12 @@ void SLAPrint::process()
|
|||
|
||||
slaposFn pobj_program[] =
|
||||
{
|
||||
[](SLAPrintObject&){}, slice_model, [](SLAPrintObject&){}, support_points, support_tree, generate_pad, slice_supports
|
||||
hollow_model, slice_model, [](SLAPrintObject&){}, support_points, support_tree, generate_pad, slice_supports
|
||||
};
|
||||
|
||||
// We want to first process all objects...
|
||||
std::vector<SLAPrintObjectStep> level1_obj_steps = {
|
||||
slaposObjectSlice, slaposSupportPoints, slaposSupportTree, slaposPad
|
||||
slaposHollowing, slaposObjectSlice, slaposSupportPoints, slaposSupportTree, slaposPad
|
||||
};
|
||||
|
||||
// and then slice all supports to allow preview to be displayed ASAP
|
||||
|
@ -1707,7 +1749,14 @@ bool SLAPrintObject::invalidate_state_by_config_options(const std::vector<t_conf
|
|||
std::vector<SLAPrintObjectStep> steps;
|
||||
bool invalidated = false;
|
||||
for (const t_config_option_key &opt_key : opt_keys) {
|
||||
if ( opt_key == "layer_height"
|
||||
if ( opt_key == "hollowing_enable"
|
||||
|| opt_key == "hollowing_min_thickness"
|
||||
|| opt_key == "hollowing_quality"
|
||||
|| opt_key == "hollowing_closing_distance"
|
||||
) {
|
||||
steps.emplace_back(slaposHollowing);
|
||||
} else if (
|
||||
opt_key == "layer_height"
|
||||
|| opt_key == "faded_layers"
|
||||
|| opt_key == "pad_enable"
|
||||
|| opt_key == "pad_wall_thickness"
|
||||
|
@ -1927,6 +1976,14 @@ const TriangleMesh& SLAPrintObject::pad_mesh() const
|
|||
return EMPTY_MESH;
|
||||
}
|
||||
|
||||
const TriangleMesh &SLAPrintObject::hollowed_interior_mesh() const
|
||||
{
|
||||
if (m_hollowing_data && m_config.hollowing_enable.getBool())
|
||||
return m_hollowing_data->interior;
|
||||
|
||||
return EMPTY_MESH;
|
||||
}
|
||||
|
||||
const TriangleMesh &SLAPrintObject::transformed_mesh() const {
|
||||
// we need to transform the raw mesh...
|
||||
// currently all the instances share the same x and y rotation and scaling
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue