mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-06-02 18:29:50 +08:00
Put hole drilling into separate step
This commit is contained in:
parent
7f476f38b9
commit
36e92b0141
@ -678,7 +678,7 @@ void SLAPrint::process()
|
|||||||
|
|
||||||
// We want to first process all objects...
|
// We want to first process all objects...
|
||||||
std::vector<SLAPrintObjectStep> level1_obj_steps = {
|
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
|
// 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
|
// propagate to dependent steps
|
||||||
if (step == slaposHollowing) {
|
if (step == slaposHollowing) {
|
||||||
invalidated |= this->invalidate_all_steps();
|
invalidated |= this->invalidate_all_steps();
|
||||||
} else if (step == slaposObjectSlice) {
|
} else if (step == slaposDrillHoles) {
|
||||||
invalidated |= this->invalidate_steps({ slaposDrillHolesIfHollowed, slaposSupportPoints, slaposSupportTree, slaposPad, slaposSliceSupports });
|
invalidated |= this->invalidate_steps({ slaposObjectSlice, slaposSupportPoints, slaposSupportTree, slaposPad, slaposSliceSupports });
|
||||||
invalidated |= m_print->invalidate_step(slapsMergeSlicesAndEval);
|
invalidated |= m_print->invalidate_step(slapsMergeSlicesAndEval);
|
||||||
} else if (step == slaposDrillHolesIfHollowed) {
|
} else if (step == slaposObjectSlice) {
|
||||||
invalidated |= this->invalidate_steps({ slaposSupportPoints, slaposSupportTree, slaposPad, slaposSliceSupports });
|
invalidated |= this->invalidate_steps({ slaposSupportPoints, slaposSupportTree, slaposPad, slaposSliceSupports });
|
||||||
invalidated |= m_print->invalidate_step(slapsMergeSlicesAndEval);
|
invalidated |= m_print->invalidate_step(slapsMergeSlicesAndEval);
|
||||||
} else if (step == slaposSupportPoints) {
|
} else if (step == slaposSupportPoints) {
|
||||||
|
@ -20,8 +20,8 @@ enum SLAPrintStep : unsigned int {
|
|||||||
|
|
||||||
enum SLAPrintObjectStep : unsigned int {
|
enum SLAPrintObjectStep : unsigned int {
|
||||||
slaposHollowing,
|
slaposHollowing,
|
||||||
|
slaposDrillHoles,
|
||||||
slaposObjectSlice,
|
slaposObjectSlice,
|
||||||
slaposDrillHolesIfHollowed,
|
|
||||||
slaposSupportPoints,
|
slaposSupportPoints,
|
||||||
slaposSupportTree,
|
slaposSupportTree,
|
||||||
slaposPad,
|
slaposPad,
|
||||||
|
@ -26,9 +26,9 @@ namespace Slic3r {
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
const std::array<unsigned, slaposCount> OBJ_STEP_LEVELS = {
|
const std::array<unsigned, slaposCount> OBJ_STEP_LEVELS = {
|
||||||
5, // slaposHollowing,
|
10, // slaposHollowing,
|
||||||
20, // slaposObjectSlice,
|
10, // slaposDrillHolesIfHollowed
|
||||||
5, // slaposDrillHolesIfHollowed
|
10, // slaposObjectSlice,
|
||||||
20, // slaposSupportPoints,
|
20, // slaposSupportPoints,
|
||||||
10, // slaposSupportTree,
|
10, // slaposSupportTree,
|
||||||
10, // slaposPad,
|
10, // slaposPad,
|
||||||
@ -38,9 +38,9 @@ const std::array<unsigned, slaposCount> OBJ_STEP_LEVELS = {
|
|||||||
std::string OBJ_STEP_LABELS(size_t idx)
|
std::string OBJ_STEP_LABELS(size_t idx)
|
||||||
{
|
{
|
||||||
switch (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 slaposObjectSlice: return L("Slicing model");
|
||||||
case slaposDrillHolesIfHollowed: return L("Drilling holes into hollowed model.");
|
|
||||||
case slaposSupportPoints: return L("Generating support points");
|
case slaposSupportPoints: return L("Generating support points");
|
||||||
case slaposSupportTree: return L("Generating support tree");
|
case slaposSupportTree: return L("Generating support tree");
|
||||||
case slaposPad: return L("Generating pad");
|
case slaposPad: return L("Generating pad");
|
||||||
@ -80,9 +80,11 @@ SLAPrint::Steps::Steps(SLAPrint *print)
|
|||||||
void SLAPrint::Steps::hollow_model(SLAPrintObject &po)
|
void SLAPrint::Steps::hollow_model(SLAPrintObject &po)
|
||||||
{
|
{
|
||||||
po.m_hollowing_data.reset();
|
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!";
|
BOOST_LOG_TRIVIAL(info) << "Skipping hollowing step!";
|
||||||
else {
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(info) << "Performing hollowing step!";
|
BOOST_LOG_TRIVIAL(info) << "Performing hollowing step!";
|
||||||
|
|
||||||
double thickness = po.m_config.hollowing_min_thickness.getFloat();
|
double thickness = po.m_config.hollowing_min_thickness.getFloat();
|
||||||
@ -103,10 +105,14 @@ void SLAPrint::Steps::hollow_model(SLAPrintObject &po)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SLAPrint::Steps::drill_holes(SLAPrintObject &po)
|
||||||
|
{
|
||||||
// Drill holes into the hollowed/original mesh.
|
// Drill holes into the hollowed/original mesh.
|
||||||
if (po.m_model_object->sla_drain_holes.empty())
|
if (po.m_model_object->sla_drain_holes.empty()) {
|
||||||
BOOST_LOG_TRIVIAL(info) << "Drilling skipped (no holes).";
|
BOOST_LOG_TRIVIAL(info) << "Drilling skipped (no holes).";
|
||||||
else {
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(info) << "Drilling drainage holes.";
|
BOOST_LOG_TRIVIAL(info) << "Drilling drainage holes.";
|
||||||
sla::DrainHoles drainholes = po.transformed_drainhole_points();
|
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.merge(sla::to_triangle_mesh(holept.to_mesh()));
|
||||||
|
|
||||||
holes_mesh.require_shared_vertices();
|
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 there is no hollowed mesh yet, copy the original mesh.
|
||||||
if (! po.m_hollowing_data) {
|
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;
|
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);
|
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
|
// 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) {
|
switch(step) {
|
||||||
case slaposHollowing: hollow_model(obj); break;
|
case slaposHollowing: hollow_model(obj); break;
|
||||||
|
case slaposDrillHoles: drill_holes(obj); break;
|
||||||
case slaposObjectSlice: slice_model(obj); break;
|
case slaposObjectSlice: slice_model(obj); break;
|
||||||
case slaposDrillHolesIfHollowed: break;
|
|
||||||
case slaposSupportPoints: support_points(obj); break;
|
case slaposSupportPoints: support_points(obj); break;
|
||||||
case slaposSupportTree: support_tree(obj); break;
|
case slaposSupportTree: support_tree(obj); break;
|
||||||
case slaposPad: generate_pad(obj); break;
|
case slaposPad: generate_pad(obj); break;
|
||||||
|
@ -44,6 +44,7 @@ public:
|
|||||||
Steps(SLAPrint *print);
|
Steps(SLAPrint *print);
|
||||||
|
|
||||||
void hollow_model(SLAPrintObject &po);
|
void hollow_model(SLAPrintObject &po);
|
||||||
|
void drill_holes (SLAPrintObject &po);
|
||||||
void slice_model(SLAPrintObject& po);
|
void slice_model(SLAPrintObject& po);
|
||||||
void support_points(SLAPrintObject& po);
|
void support_points(SLAPrintObject& po);
|
||||||
void support_tree(SLAPrintObject& po);
|
void support_tree(SLAPrintObject& po);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user