ENH: improve supporting sharp tails of tree support

1. sharp tails are supported by a sparse set of contact points which are
easier to remove than previously dense surrounding support.
   Organic tree support also has this feature, including all other smart
overhang detection techniques (small overhang and cantilever detection),
with the cost of slightly longer time to detect overhangs.
2. improve supporting overhang contours by adding contact points along
   contours.
  jira: STUDIO-3876
2. remove some redundant data structure.

Change-Id: If7f595348506a14aba2d0132d23f97d3539c1e1f
(cherry picked from commit e3cce09b9db12ced2841045ffd337b1f35494e6c)
(cherry picked from commit 507345deb193d895d0813fc913f00b0def7e62f9)
This commit is contained in:
Arthur 2024-03-26 11:39:30 +08:00 committed by Noisyfox
parent 0b671e8852
commit 2577b9b3a6
5 changed files with 159 additions and 149 deletions

View file

@ -3367,10 +3367,28 @@ static void generate_support_areas(Print &print, const BuildVolume &build_volume
#endif // SLIC3R_TREESUPPORTS_PROGRESS
/* additional_excluded_areas */{} };
//FIXME generating overhangs just for the furst mesh of the group.
//FIXME generating overhangs just for the first mesh of the group.
assert(processing.second.size() == 1);
std::vector<Polygons> overhangs = generate_overhangs(config, *print.get_object(processing.second.front()), throw_on_cancel);
#if 1
// use smart overhang detection
std::vector<Polygons> overhangs;
tree_support->detect_overhangs();
const int num_raft_layers = int(config.raft_layers.size());
const int num_layers = int(print_object.layer_count()) + num_raft_layers;
overhangs.resize(num_layers);
for (size_t i = 0; i < print_object.layer_count(); i++) {
for (ExPolygon& expoly : print_object.get_layer(i)->loverhangs) {
Polygons polys = to_polygons(expoly);
if (tree_support->overhang_types[&expoly] == TreeSupport::SharpTail) {
polys = offset(to_polygons(expoly), scale_(0.2));
}
append(overhangs[i + num_raft_layers], polys);
}
}
#else
std::vector<Polygons> overhangs = generate_overhangs(config, *print.get_object(processing.second.front()), throw_on_cancel);
#endif
// ### Precalculate avoidances, collision etc.
size_t num_support_layers = precalculate(print, overhangs, processing.first, processing.second, volumes, throw_on_cancel);
bool has_support = num_support_layers > 0;
@ -3443,6 +3461,7 @@ static void generate_support_areas(Print &print, const BuildVolume &build_volume
#endif // TREESUPPORT_DEBUG_SVG
// ### Propagate the influence areas downwards. This is an inherently serial operation.
print.set_status(60, _L("Generating support"));
create_layer_pathing(volumes, config, move_bounds, throw_on_cancel);
auto t_path = std::chrono::high_resolution_clock::now();
@ -3496,6 +3515,7 @@ static void generate_support_areas(Print &print, const BuildVolume &build_volume
});
// Don't fill in the tree supports, make them hollow with just a single sheath line.
print.set_status(69, _L("Generating support"));
generate_support_toolpaths(print_object.support_layers(), print_object.config(), support_params, print_object.slicing_parameters(),
raft_layers, bottom_contacts, top_contacts, intermediate_layers, interface_layers, base_interface_layers);