Put hole drilling into separate step
This commit is contained in:
parent
7f476f38b9
commit
36e92b0141
4 changed files with 68 additions and 55 deletions
|
@ -678,7 +678,7 @@ void SLAPrint::process()
|
|||
|
||||
// We want to first process all objects...
|
||||
std::vector<SLAPrintObjectStep> level1_obj_steps = {
|
||||
slaposHollowing, slaposObjectSlice, slaposSupportPoints, slaposSupportTree, slaposPad
|
||||
slaposHollowing, slaposDrillHoles, slaposObjectSlice, slaposSupportPoints, slaposSupportTree, slaposPad
|
||||
};
|
||||
|
||||
// and then slice all supports to allow preview to be displayed ASAP
|
||||
|
@ -984,10 +984,10 @@ bool SLAPrintObject::invalidate_step(SLAPrintObjectStep step)
|
|||
// propagate to dependent steps
|
||||
if (step == slaposHollowing) {
|
||||
invalidated |= this->invalidate_all_steps();
|
||||
} else if (step == slaposObjectSlice) {
|
||||
invalidated |= this->invalidate_steps({ slaposDrillHolesIfHollowed, slaposSupportPoints, slaposSupportTree, slaposPad, slaposSliceSupports });
|
||||
} else if (step == slaposDrillHoles) {
|
||||
invalidated |= this->invalidate_steps({ slaposObjectSlice, slaposSupportPoints, slaposSupportTree, slaposPad, slaposSliceSupports });
|
||||
invalidated |= m_print->invalidate_step(slapsMergeSlicesAndEval);
|
||||
} else if (step == slaposDrillHolesIfHollowed) {
|
||||
} else if (step == slaposObjectSlice) {
|
||||
invalidated |= this->invalidate_steps({ slaposSupportPoints, slaposSupportTree, slaposPad, slaposSliceSupports });
|
||||
invalidated |= m_print->invalidate_step(slapsMergeSlicesAndEval);
|
||||
} else if (step == slaposSupportPoints) {
|
||||
|
|
|
@ -20,8 +20,8 @@ enum SLAPrintStep : unsigned int {
|
|||
|
||||
enum SLAPrintObjectStep : unsigned int {
|
||||
slaposHollowing,
|
||||
slaposDrillHoles,
|
||||
slaposObjectSlice,
|
||||
slaposDrillHolesIfHollowed,
|
||||
slaposSupportPoints,
|
||||
slaposSupportTree,
|
||||
slaposPad,
|
||||
|
|
|
@ -26,9 +26,9 @@ namespace Slic3r {
|
|||
namespace {
|
||||
|
||||
const std::array<unsigned, slaposCount> OBJ_STEP_LEVELS = {
|
||||
5, // slaposHollowing,
|
||||
20, // slaposObjectSlice,
|
||||
5, // slaposDrillHolesIfHollowed
|
||||
10, // slaposHollowing,
|
||||
10, // slaposDrillHolesIfHollowed
|
||||
10, // slaposObjectSlice,
|
||||
20, // slaposSupportPoints,
|
||||
10, // slaposSupportTree,
|
||||
10, // slaposPad,
|
||||
|
@ -38,9 +38,9 @@ const std::array<unsigned, slaposCount> OBJ_STEP_LEVELS = {
|
|||
std::string OBJ_STEP_LABELS(size_t idx)
|
||||
{
|
||||
switch (idx) {
|
||||
case slaposHollowing: return L("Hollowing and drilling holes");
|
||||
case slaposHollowing: return L("Hollowing model");
|
||||
case slaposDrillHoles: return L("Drilling holes into hollowed model.");
|
||||
case slaposObjectSlice: return L("Slicing model");
|
||||
case slaposDrillHolesIfHollowed: return L("Drilling holes into hollowed model.");
|
||||
case slaposSupportPoints: return L("Generating support points");
|
||||
case slaposSupportTree: return L("Generating support tree");
|
||||
case slaposPad: return L("Generating pad");
|
||||
|
@ -80,9 +80,11 @@ SLAPrint::Steps::Steps(SLAPrint *print)
|
|||
void SLAPrint::Steps::hollow_model(SLAPrintObject &po)
|
||||
{
|
||||
po.m_hollowing_data.reset();
|
||||
if (! po.m_config.hollowing_enable.getBool())
|
||||
if (! po.m_config.hollowing_enable.getBool()) {
|
||||
BOOST_LOG_TRIVIAL(info) << "Skipping hollowing step!";
|
||||
else {
|
||||
return;
|
||||
}
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "Performing hollowing step!";
|
||||
|
||||
double thickness = po.m_config.hollowing_min_thickness.getFloat();
|
||||
|
@ -101,12 +103,16 @@ void SLAPrint::Steps::hollow_model(SLAPrintObject &po)
|
|||
hollowed_mesh.merge(po.m_hollowing_data->interior);
|
||||
hollowed_mesh.require_shared_vertices();
|
||||
}
|
||||
}
|
||||
|
||||
void SLAPrint::Steps::drill_holes(SLAPrintObject &po)
|
||||
{
|
||||
// Drill holes into the hollowed/original mesh.
|
||||
if (po.m_model_object->sla_drain_holes.empty()) {
|
||||
BOOST_LOG_TRIVIAL(info) << "Drilling skipped (no holes).";
|
||||
return;
|
||||
}
|
||||
|
||||
// Drill holes into the hollowed/original mesh.
|
||||
if (po.m_model_object->sla_drain_holes.empty())
|
||||
BOOST_LOG_TRIVIAL(info) << "Drilling skipped (no holes).";
|
||||
else {
|
||||
BOOST_LOG_TRIVIAL(info) << "Drilling drainage holes.";
|
||||
sla::DrainHoles drainholes = po.transformed_drainhole_points();
|
||||
|
||||
|
@ -116,7 +122,7 @@ void SLAPrint::Steps::hollow_model(SLAPrintObject &po)
|
|||
holes_mesh.merge(sla::to_triangle_mesh(holept.to_mesh()));
|
||||
|
||||
holes_mesh.require_shared_vertices();
|
||||
MeshBoolean::self_union(holes_mesh); //FIXME-fix and use the cgal version
|
||||
MeshBoolean::cgal::self_union(holes_mesh); //FIXME-fix and use the cgal version
|
||||
|
||||
// If there is no hollowed mesh yet, copy the original mesh.
|
||||
if (! po.m_hollowing_data) {
|
||||
|
@ -125,10 +131,16 @@ void SLAPrint::Steps::hollow_model(SLAPrintObject &po)
|
|||
}
|
||||
|
||||
TriangleMesh &hollowed_mesh = po.m_hollowing_data->hollow_mesh_with_holes;
|
||||
hollowed_mesh = po.get_mesh_to_print();
|
||||
|
||||
try {
|
||||
MeshBoolean::cgal::minus(hollowed_mesh, holes_mesh);
|
||||
hollowed_mesh.require_shared_vertices();
|
||||
} catch (const std::runtime_error &ex) {
|
||||
throw std::runtime_error(L(
|
||||
"Drilling holes into the mesh failed. "
|
||||
"This is usually caused by broken model. Try to fix it first."));
|
||||
}
|
||||
|
||||
hollowed_mesh.require_shared_vertices();
|
||||
}
|
||||
|
||||
// The slicing will be performed on an imaginary 1D grid which starts from
|
||||
|
@ -850,8 +862,8 @@ void SLAPrint::Steps::execute(SLAPrintObjectStep step, SLAPrintObject &obj)
|
|||
{
|
||||
switch(step) {
|
||||
case slaposHollowing: hollow_model(obj); break;
|
||||
case slaposDrillHoles: drill_holes(obj); break;
|
||||
case slaposObjectSlice: slice_model(obj); break;
|
||||
case slaposDrillHolesIfHollowed: break;
|
||||
case slaposSupportPoints: support_points(obj); break;
|
||||
case slaposSupportTree: support_tree(obj); break;
|
||||
case slaposPad: generate_pad(obj); break;
|
||||
|
|
|
@ -44,6 +44,7 @@ public:
|
|||
Steps(SLAPrint *print);
|
||||
|
||||
void hollow_model(SLAPrintObject &po);
|
||||
void drill_holes (SLAPrintObject &po);
|
||||
void slice_model(SLAPrintObject& po);
|
||||
void support_points(SLAPrintObject& po);
|
||||
void support_tree(SLAPrintObject& po);
|
||||
|
|
Loading…
Reference in a new issue