ENH: improve auto-arranging objects with tree support

We decide to set brim width of all objects to MAX_BRANCH_RADIUS_FIRST_LAYER if there is an object with tree support after discussion.

Jira: MAK-2009
Change-Id: I4c4940800632c433235966b01c44ac910e33a51c
This commit is contained in:
Arthur 2023-09-18 15:47:04 +08:00 committed by Lane.Wei
parent 37e7b0e234
commit d8ba43d979
5 changed files with 16 additions and 4 deletions

View file

@ -102,8 +102,17 @@ void update_selected_items_inflation(ArrangePolygons& selected, const DynamicPri
// do not inflate brim_width. Objects are allowed to have overlapped brim.
Points bedpts = get_shrink_bedpts(print_cfg, params);
BoundingBox bedbb = Polygon(bedpts).bounding_box();
double brim_max = 0;
bool plate_has_tree_support = false;
std::for_each(selected.begin(), selected.end(), [&](ArrangePolygon& ap) {
ap.inflation = params.min_obj_distance == 0 ? scaled(ap.brim_width) : params.min_obj_distance / 2;
brim_max = std::max(brim_max, ap.brim_width);
if (ap.has_tree_support) plate_has_tree_support = true; });
std::for_each(selected.begin(), selected.end(), [&](ArrangePolygon& ap) {
// 1. if user input a distance, use it
// 2. if there is an object with tree support, all objects use the max tree branch radius (brim_max=branch diameter)
// 3. otherwise, use each object's own brim width
ap.inflation = params.min_obj_distance != 0 ? params.min_obj_distance / 2 :
plate_has_tree_support ? scaled(brim_max / 2) : scaled(ap.brim_width);
BoundingBox apbb = ap.poly.contour.bounding_box();
auto diffx = bedbb.size().x() - apbb.size().x() - 5;
auto diffy = bedbb.size().y() - apbb.size().y() - 5;