From 159fc4e28e963db2f120b93f276c4528c9e32c78 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Mon, 2 Jan 2023 13:40:04 +0100 Subject: [PATCH] Minor improvements Fix bad function call exception with empty interrupter (OpenVDB) --- src/libslic3r/CSGMesh/ModelToCSGMesh.hpp | 3 +++ src/libslic3r/OpenVDBUtils.cpp | 2 +- src/libslic3r/SLAPrintSteps.cpp | 6 ++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/libslic3r/CSGMesh/ModelToCSGMesh.hpp b/src/libslic3r/CSGMesh/ModelToCSGMesh.hpp index 8a3773bfde..ecf9d8168b 100644 --- a/src/libslic3r/CSGMesh/ModelToCSGMesh.hpp +++ b/src/libslic3r/CSGMesh/ModelToCSGMesh.hpp @@ -43,6 +43,9 @@ void model_to_csgmesh(const ModelObject &mo, ++out; its_split(vol->mesh().its, SplitOutputFn{[&out, &vol, &trafo](indexed_triangle_set &&its) { + if (its.empty()) + return; + CSGPart part{std::make_unique(std::move(its)), CSGType::Union, (trafo * vol->get_matrix()).cast()}; diff --git a/src/libslic3r/OpenVDBUtils.cpp b/src/libslic3r/OpenVDBUtils.cpp index 44a5b172ed..5d00fac0da 100644 --- a/src/libslic3r/OpenVDBUtils.cpp +++ b/src/libslic3r/OpenVDBUtils.cpp @@ -81,7 +81,7 @@ struct Interrupter void start(const char* name = nullptr) { (void)name; } void end() {} - inline bool wasInterrupted(int percent = -1) { return statusfn(percent); } + inline bool wasInterrupted(int percent = -1) { return statusfn && statusfn(percent); } }; VoxelGridPtr mesh_to_grid(const indexed_triangle_set &mesh, diff --git a/src/libslic3r/SLAPrintSteps.cpp b/src/libslic3r/SLAPrintSteps.cpp index c1b0356810..1c56b8946a 100644 --- a/src/libslic3r/SLAPrintSteps.cpp +++ b/src/libslic3r/SLAPrintSteps.cpp @@ -196,7 +196,7 @@ void SLAPrint::Steps::generate_preview(SLAPrintObject &po, SLAPrintObjectStep st auto r = range(po.m_mesh_to_slice); auto m = indexed_triangle_set{}; - if (r.size() == 1 || is_all_positive(r)) { + if (is_all_positive(r)) { m = csgmesh_merge_positive_parts(r); } else if (csg::check_csgmesh_booleans(r) == r.end()) { auto cgalmeshptr = csg::perform_csgmesh_booleans(r); @@ -204,7 +204,9 @@ void SLAPrint::Steps::generate_preview(SLAPrintObject &po, SLAPrintObjectStep st m = MeshBoolean::cgal::cgal_to_indexed_triangle_set(*cgalmeshptr); } else { po.active_step_add_warning(PrintStateBase::WarningLevel::NON_CRITICAL, - L("Can't do proper mesh booleans!")); + L("Can't perform full mesh booleans! " + "Some parts of the print will be previewed with approximated meshes. " + "This does not affect the quality of slices or the physical print in any way.")); m = generate_preview_vdb(po, step); }