diff --git a/src/libslic3r/MeshBoolean.cpp b/src/libslic3r/MeshBoolean.cpp index 599ac4784..3dd5da307 100644 --- a/src/libslic3r/MeshBoolean.cpp +++ b/src/libslic3r/MeshBoolean.cpp @@ -276,6 +276,11 @@ bool does_bound_a_volume(const CGALMesh &mesh) return CGALProc::does_bound_a_volume(mesh.m); } +bool empty(const CGALMesh &mesh) +{ + return mesh.m.is_empty(); +} + } // namespace cgal } // namespace MeshBoolean diff --git a/src/libslic3r/MeshBoolean.hpp b/src/libslic3r/MeshBoolean.hpp index 4b9686231..140c96931 100644 --- a/src/libslic3r/MeshBoolean.hpp +++ b/src/libslic3r/MeshBoolean.hpp @@ -55,6 +55,7 @@ bool does_self_intersect(const TriangleMesh &mesh); bool does_self_intersect(const CGALMesh &mesh); bool does_bound_a_volume(const CGALMesh &mesh); +bool empty(const CGALMesh &mesh); } diff --git a/src/libslic3r/SLAPrintSteps.cpp b/src/libslic3r/SLAPrintSteps.cpp index 4a8d0d4be..4b377d9f1 100644 --- a/src/libslic3r/SLAPrintSteps.cpp +++ b/src/libslic3r/SLAPrintSteps.cpp @@ -391,11 +391,10 @@ void SLAPrint::Steps::drill_holes(SLAPrintObject &po) holept.normal += Vec3f{dist(m_rng), dist(m_rng), dist(m_rng)}; holept.normal.normalize(); holept.pos += Vec3f{dist(m_rng), dist(m_rng), dist(m_rng)}; - TriangleMesh m{holept.to_mesh()}; - m.require_shared_vertices(); + indexed_triangle_set m = holept.to_mesh(); part_to_drill.indices.clear(); - auto bb = m.bounding_box(); + auto bb = bounding_box(m); Eigen::AlignedBox ebb{bb.min.cast(), bb.max.cast()}; @@ -429,19 +428,23 @@ void SLAPrint::Steps::drill_holes(SLAPrintObject &po) auto hollowed_mesh_cgal = MeshBoolean::cgal::triangle_mesh_to_cgal(hollowed_mesh); if (!MeshBoolean::cgal::does_bound_a_volume(*hollowed_mesh_cgal)) { - po.active_step_add_warning(PrintStateBase::WarningLevel::NON_CRITICAL, + po.active_step_add_warning( + PrintStateBase::WarningLevel::NON_CRITICAL, L("Mesh to be hollowed is not suitable for hollowing (does not " "bound a volume).")); } - if (!MeshBoolean::cgal::does_bound_a_volume(*holes_mesh_cgal)) { - po.active_step_add_warning(PrintStateBase::WarningLevel::NON_CRITICAL, + if (!MeshBoolean::cgal::empty(*holes_mesh_cgal) + && !MeshBoolean::cgal::does_bound_a_volume(*holes_mesh_cgal)) { + po.active_step_add_warning( + PrintStateBase::WarningLevel::NON_CRITICAL, L("Unable to drill the current configuration of holes into the " "model.")); } try { - MeshBoolean::cgal::minus(*hollowed_mesh_cgal, *holes_mesh_cgal); + if (!MeshBoolean::cgal::empty(*holes_mesh_cgal)) + MeshBoolean::cgal::minus(*hollowed_mesh_cgal, *holes_mesh_cgal); hollowed_mesh = MeshBoolean::cgal::cgal_to_triangle_mesh(*hollowed_mesh_cgal); mesh_view = hollowed_mesh;