FIX: Checking support necessity not working

Only early stop detect_overhangs if support is disabled AND not checking support necessity.

jira: STUDIO-6158
Change-Id: I2d9662231d941827d6392d57344f7d911f641e09
(cherry picked from commit b811a6031d1afe0e7b1cb73050fe6391a65411ef)
This commit is contained in:
Arthur 2024-02-01 17:39:37 +08:00 committed by Lane.Wei
parent 27843c1601
commit fa61ee6abd
3 changed files with 17 additions and 16 deletions

View File

@ -454,13 +454,9 @@ void PrintObject::generate_support_material()
if (this->set_started(posSupportMaterial)) {
this->clear_support_layers();
if ((this->has_support() && m_layers.size() > 1) || (this->has_raft() && ! m_layers.empty())) {
m_print->set_status(50, L("Generating support"));
this->_generate_support_material();
m_print->throw_if_canceled();
} else if(!m_print->get_no_check_flag()) {
if(!has_support() && !m_print->get_no_check_flag()) {
// BBS: pop a warning if objects have significant amount of overhangs but support material is not enabled
// Note: we also need to pop warning if support is disabled and only raft is enabled
m_print->set_status(50, L("Checking support necessity"));
typedef std::chrono::high_resolution_clock clock_;
typedef std::chrono::duration<double, std::ratio<1> > second_;
@ -490,6 +486,12 @@ void PrintObject::generate_support_material()
#endif
}
if ((this->has_support() && m_layers.size() > 1) || (this->has_raft() && !m_layers.empty())) {
m_print->set_status(50, L("Generating support"));
this->_generate_support_material();
m_print->throw_if_canceled();
}
this->set_done(posSupportMaterial);
}
}

View File

@ -647,7 +647,7 @@ TreeSupport::TreeSupport(PrintObject& object, const SlicingParameters &slicing_p
#define SUPPORT_SURFACES_OFFSET_PARAMETERS ClipperLib::jtSquare, 0.
void TreeSupport::detect_overhangs(bool detect_first_sharp_tail_only)
void TreeSupport::detect_overhangs(bool check_support_necessity/* = false*/)
{
// overhangs are already detected
if (m_object->support_layer_count() >= m_object->layer_count())
@ -658,8 +658,8 @@ void TreeSupport::detect_overhangs(bool detect_first_sharp_tail_only)
// Clear and create Tree Support Layers
m_object->clear_support_layers();
m_object->clear_tree_support_preview_cache();
create_tree_support_layers(tree_support_enable);
if (!tree_support_enable)
create_tree_support_layers();
if (!tree_support_enable && !check_support_necessity)
return;
const PrintObjectConfig& config = m_object->config();
@ -878,9 +878,11 @@ void TreeSupport::detect_overhangs(bool detect_first_sharp_tail_only)
); // end tbb::parallel_for
BOOST_LOG_TRIVIAL(info) << "max_cantilever_dist=" << max_cantilever_dist;
if (check_support_necessity)
return;
// check if the sharp tails should be extended higher
if (is_auto(stype) && g_config_support_sharp_tails && !detect_first_sharp_tail_only) {
if (is_auto(stype) && g_config_support_sharp_tails) {
for (size_t layer_nr = 0; layer_nr < m_object->layer_count(); layer_nr++) {
if (m_object->print()->canceled())
break;
@ -1119,7 +1121,7 @@ void TreeSupport::detect_overhangs(bool detect_first_sharp_tail_only)
// create support layers for raft and tree support
// if support is disabled, only raft layers are created
void TreeSupport::create_tree_support_layers(bool support_enabled)
void TreeSupport::create_tree_support_layers()
{
int layer_id = 0;
{ //create raft layers
@ -1148,9 +1150,6 @@ void TreeSupport::create_tree_support_layers(bool support_enabled)
}
}
if (!support_enabled)
return;
for (Layer *layer : m_object->layers()) {
SupportLayer* ts_layer = m_object->add_tree_support_layer(layer_id++, layer->height, layer->print_z, layer->slice_z);
if (ts_layer->id() > m_raft_layers) {

View File

@ -375,7 +375,7 @@ public:
*/
void generate();
void detect_overhangs(bool detect_first_sharp_tail_only=false);
void detect_overhangs(bool check_support_necessity = false);
int avg_node_per_layer = 0;
float nodes_angle = 0;
@ -484,7 +484,7 @@ private:
* If a node is already at that position in the layer, the nodes are merged.
*/
void insert_dropped_node(std::vector<SupportNode*>& nodes_layer, SupportNode* node);
void create_tree_support_layers(bool support_enabled=true);
void create_tree_support_layers();
void generate_toolpaths();
// get unscaled radius of node
coordf_t calc_branch_radius(coordf_t base_radius, size_t layers_to_top, size_t tip_layers, double diameter_angle_scale_factor);