From c1df01fd8ec93ea54bee54b1eb4d148e4a6445de Mon Sep 17 00:00:00 2001 From: Arthur Date: Sun, 27 Oct 2024 13:26:03 +0800 Subject: [PATCH] FIX: hybrid tree support may crash due to empty extrusion entities jira: none Change-Id: I521e27e7a4d12189efc77768d10d264d0d6db111 (cherry picked from commit 64ab78298bc0c9a32ea5bcec5beddfc103074f53) --- src/libslic3r/Support/TreeSupport.cpp | 3 ++- src/libslic3r/Support/TreeSupport.hpp | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libslic3r/Support/TreeSupport.cpp b/src/libslic3r/Support/TreeSupport.cpp index efbb3b8191..dbf462c113 100644 --- a/src/libslic3r/Support/TreeSupport.cpp +++ b/src/libslic3r/Support/TreeSupport.cpp @@ -611,7 +611,7 @@ TreeSupport::TreeSupport(PrintObject& object, const SlicingParameters &slicing_p if(support_pattern == smpLightning) m_support_params.base_fill_pattern = ipLightning; - + diameter_angle_scale_factor = std::clamp(m_object_config->tree_support_branch_diameter_angle * M_PI / 180., 0., 0.5 * M_PI - EPSILON); is_slim = is_tree_slim(support_type, m_support_params.support_style); is_strong = is_tree(support_type) && m_support_params.support_style == smsTreeStrong; base_radius = std::max(MIN_BRANCH_RADIUS, m_object_config->tree_support_branch_diameter.value / 2); @@ -1293,6 +1293,7 @@ static void make_perimeter_and_infill(ExtrusionEntitiesPtr& dst, const ExPolygon dst = std::move(loops_entities); } } + dst.erase(std::remove_if(dst.begin(), dst.end(), [](ExtrusionEntity *entity) { return static_cast(entity)->empty(); }), dst.end()); if (infill_first) { // sort regions to reduce travel Points ordering_points; diff --git a/src/libslic3r/Support/TreeSupport.hpp b/src/libslic3r/Support/TreeSupport.hpp index 86bd3a28df..8afc241926 100644 --- a/src/libslic3r/Support/TreeSupport.hpp +++ b/src/libslic3r/Support/TreeSupport.hpp @@ -440,8 +440,7 @@ private: const coordf_t MIN_BRANCH_RADIUS = 0.4; const coordf_t MAX_BRANCH_RADIUS_FIRST_LAYER = 12.0; const coordf_t MIN_BRANCH_RADIUS_FIRST_LAYER = 2.0; - const double tree_support_branch_diameter_angle = 5.0; - const double diameter_angle_scale_factor = tan(tree_support_branch_diameter_angle*M_PI/180.0); + double diameter_angle_scale_factor = tan(5.0*M_PI/180.0); // minimum roof area (1 mm^2), area smaller than this value will not have interface const double minimum_roof_area{SQ(scaled(1.))}; float top_z_distance = 0.0;