ENH: improve tree supports

1. speedup organic tree support by using parallel for intersection of bed area
jira: STUDIO-8451
2. add extra wall for hybrid tree support's tall branches
3. disable circle fitting for tree support. This feature produces inconsistent
   circles for tree supports.
4. expose the option tree_support_branch_diameter_angle. Tree supports'
   strength can be improved by increasing this value.

Change-Id: If3688ca895df98a77f6ca538077daf8fe94e53f1
(cherry picked from commit 7697eb3dc8f87204d28e6be9adaf55dfcdadbc74)
This commit is contained in:
Arthur
2024-10-15 14:48:31 +08:00
committed by Noisyfox
parent 07c7e2f910
commit 1c686b3c04
9 changed files with 49 additions and 108 deletions

View File

@@ -1540,7 +1540,10 @@ void TreeSupport::generate_toolpaths()
erSupportMaterial, filler_support.get(), support_density);
}
else {
tree_supports_generate_paths(ts_layer->support_fills.entities, loops, flow, m_support_params);
SupportParameters support_params = m_support_params;
if (area_group.need_extra_wall && object_config.tree_support_wall_count.value == 0)
support_params.tree_branch_diameter_double_wall_area_scaled = 0.1;
tree_supports_generate_paths(ts_layer->support_fills.entities, loops, flow, support_params);
}
}
}
@@ -2917,6 +2920,10 @@ void TreeSupport::smooth_nodes()
}
float max_move = scale_(m_object_config->support_line_width / 2);
// if the branch is very tall, the tip also needs extra wall
float thresh_tall_branch = 100;
float thresh_dist_to_top = 30;
for (int layer_nr = 0; layer_nr< contact_nodes.size(); layer_nr++) {
std::vector<SupportNode *> &curr_layer_nodes = contact_nodes[layer_nr];
if (curr_layer_nodes.empty()) continue;
@@ -2926,17 +2933,20 @@ void TreeSupport::smooth_nodes()
std::vector<double> radii;
std::vector<SupportNode *> branch;
SupportNode * p_node = node;
float total_height = 0;
// add a fixed head if it's not a polygon node, see STUDIO-4403
// Polygon node can't be added because the move distance might be huge, making the nodes in between jump and dangling
if (node->child && node->child->type!=ePolygon) {
pts.push_back(p_node->child->position);
radii.push_back(p_node->child->radius);
branch.push_back(p_node->child);
total_height += p_node->child->height;
}
do {
pts.push_back(p_node->position);
radii.push_back(p_node->radius);
branch.push_back(p_node);
total_height += p_node->height;
p_node = p_node->parent;
} while (p_node && !p_node->is_processed);
if (pts.size() < 3) continue;
@@ -2955,7 +2965,8 @@ void TreeSupport::smooth_nodes()
branch[i]->radius = radii1[i];
branch[i]->movement = (pts[i + 1] - pts[i - 1]) / 2;
branch[i]->is_processed = true;
if (branch[i]->parents.size()>1 || (branch[i]->movement.x() > max_move || branch[i]->movement.y() > max_move))
if (branch[i]->parents.size() > 1 || (branch[i]->movement.x() > max_move || branch[i]->movement.y() > max_move) ||
(total_height > thresh_tall_branch && branch[i]->dist_mm_to_top < thresh_dist_to_top))
branch[i]->need_extra_wall = true;
BOOST_LOG_TRIVIAL(info) << "smooth_nodes: layer_nr=" << layer_nr << ", i=" << i << ", pt=" << pt << ", movement=" << branch[i]->movement << ", radius=" << branch[i]->radius;
}