Allowed to do drilling without hollowing
This commit is contained in:
parent
6b0af43665
commit
022cc0871a
@ -84,8 +84,7 @@ public:
|
||||
// Get the mesh that is going to be printed with all the modifications
|
||||
// like hollowing and drilled holes.
|
||||
const TriangleMesh & get_mesh_to_print() const {
|
||||
bool is_hollowing = m_config.hollowing_enable.getBool() && m_hollowing_data;
|
||||
return is_hollowing ? m_hollowing_data->hollow_mesh_with_holes : transformed_mesh();
|
||||
return m_hollowing_data ? m_hollowing_data->hollow_mesh_with_holes : transformed_mesh();
|
||||
}
|
||||
|
||||
// This will return the transformed mesh which is cached
|
||||
|
@ -38,7 +38,7 @@ const std::array<unsigned, slaposCount> OBJ_STEP_LEVELS = {
|
||||
std::string OBJ_STEP_LABELS(size_t idx)
|
||||
{
|
||||
switch (idx) {
|
||||
case slaposHollowing: return L("Hollowing out the model");
|
||||
case slaposHollowing: return L("Hollowing and drilling holes");
|
||||
case slaposObjectSlice: return L("Slicing model");
|
||||
case slaposDrillHolesIfHollowed: return L("Drilling holes into hollowed model.");
|
||||
case slaposSupportPoints: return L("Generating support points");
|
||||
@ -79,32 +79,35 @@ SLAPrint::Steps::Steps(SLAPrint *print)
|
||||
|
||||
void SLAPrint::Steps::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 {
|
||||
if (! po.m_config.hollowing_enable.getBool())
|
||||
BOOST_LOG_TRIVIAL(info) << "Skipping hollowing step!";
|
||||
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();
|
||||
sla::HollowingConfig hlwcfg{thickness, quality, closing_d};
|
||||
auto meshptr = generate_interior(po.transformed_mesh(), hlwcfg);
|
||||
if (meshptr) po.m_hollowing_data->interior = *meshptr;
|
||||
|
||||
if (po.m_hollowing_data->interior.empty())
|
||||
if (meshptr->empty())
|
||||
BOOST_LOG_TRIVIAL(warning) << "Hollowed interior is empty!";
|
||||
|
||||
else {
|
||||
po.m_hollowing_data.reset(new SLAPrintObject::HollowingData());
|
||||
po.m_hollowing_data->interior = *meshptr;
|
||||
auto &hollowed_mesh = po.m_hollowing_data->hollow_mesh_with_holes;
|
||||
hollowed_mesh = po.transformed_mesh();
|
||||
hollowed_mesh.merge(po.m_hollowing_data->interior);
|
||||
hollowed_mesh.require_shared_vertices();
|
||||
}
|
||||
}
|
||||
|
||||
// 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();
|
||||
|
||||
TriangleMesh holes_mesh;
|
||||
@ -113,10 +116,20 @@ void SLAPrint::Steps::hollow_model(SLAPrintObject &po)
|
||||
holes_mesh.merge(sla::to_triangle_mesh(holept.to_mesh()));
|
||||
|
||||
holes_mesh.require_shared_vertices();
|
||||
MeshBoolean::minus(hollowed_mesh, holes_mesh);
|
||||
MeshBoolean::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) {
|
||||
po.m_hollowing_data.reset(new SLAPrintObject::HollowingData());
|
||||
po.m_hollowing_data->hollow_mesh_with_holes = po.transformed_mesh();
|
||||
}
|
||||
|
||||
TriangleMesh &hollowed_mesh = po.m_hollowing_data->hollow_mesh_with_holes;
|
||||
hollowed_mesh = po.get_mesh_to_print();
|
||||
MeshBoolean::cgal::minus(hollowed_mesh, holes_mesh);
|
||||
hollowed_mesh.require_shared_vertices();
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
|
Loading…
Reference in New Issue
Block a user