From 52fc7a84392f34af663339d7fcc576ff0c09825f Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Thu, 11 May 2023 14:26:16 +0200 Subject: [PATCH] Organic supports: bring "lost" branches down to an object or print bed. --- src/libslic3r/Support/TreeSupport.cpp | 6 +++++- src/libslic3r/Support/TreeSupport.hpp | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/Support/TreeSupport.cpp b/src/libslic3r/Support/TreeSupport.cpp index d53b3e785..7b11955d9 100644 --- a/src/libslic3r/Support/TreeSupport.cpp +++ b/src/libslic3r/Support/TreeSupport.cpp @@ -2249,6 +2249,7 @@ static void increase_areas_one_layer( // But as branches connecting with the model that are to small have to be culled, the bottom most point has to be not set. // A point can be set on the top most tip layer (maybe more if it should not move for a few layers). parent.state.result_on_layer_reset(); + parent.state.to_model_gracious = false; #ifdef TREE_SUPPORTS_TRACK_LOST parent.state.verylost = true; #endif // TREE_SUPPORTS_TRACK_LOST @@ -4410,7 +4411,10 @@ static void draw_branches( // Don't propagate further than 1.5 * bottom radius. //LayerIndex layers_propagate_max = 2 * bottom_radius / config.layer_height; LayerIndex layers_propagate_max = 5 * bottom_radius / config.layer_height; - LayerIndex layer_bottommost = std::max(0, layer_begin - layers_propagate_max); + LayerIndex layer_bottommost = branch.path.front()->state.verylost ? + // If the tree bottom is hanging in the air, bring it down to some surface. + 0 : + std::max(0, layer_begin - layers_propagate_max); // Only propagate until the rest area is smaller than this threshold. double support_area_stop = 0.2 * M_PI * sqr(double(bottom_radius)); // Only propagate until the rest area is smaller than this threshold. diff --git a/src/libslic3r/Support/TreeSupport.hpp b/src/libslic3r/Support/TreeSupport.hpp index 899f02724..66010b5b0 100644 --- a/src/libslic3r/Support/TreeSupport.hpp +++ b/src/libslic3r/Support/TreeSupport.hpp @@ -91,7 +91,7 @@ struct AreaIncreaseSettings struct TreeSupportSettings; -// #define TREE_SUPPORTS_TRACK_LOST +#define TREE_SUPPORTS_TRACK_LOST // C++17 does not support in place initializers of bit values, thus a constructor zeroing the bits is provided. struct SupportElementStateBits {