mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 07:27:41 -06:00
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:
parent
37e7b0e234
commit
d8ba43d979
5 changed files with 16 additions and 4 deletions
|
@ -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;
|
||||
|
|
|
@ -53,7 +53,8 @@ struct ArrangePolygon {
|
|||
int locked_plate{ -1 };
|
||||
bool is_virt_object{ false };
|
||||
bool is_extrusion_cali_object{ false };
|
||||
bool is_wipe_tower{false};
|
||||
bool is_wipe_tower{ false };
|
||||
bool has_tree_support{false};
|
||||
//BBS: add row/col for sudoku-style layout
|
||||
int row{0};
|
||||
int col{0};
|
||||
|
|
|
@ -159,7 +159,8 @@ ArrangePolygon get_instance_arrange_poly(ModelInstance* instance, const Slic3r::
|
|||
if (enable_support && (support_type == stNormalAuto || support_type == stNormal))
|
||||
ap.brim_width = 6.0;
|
||||
else if (enable_support) {
|
||||
ap.brim_width = 22.0;
|
||||
ap.brim_width = 24.0; // 2*MAX_BRANCH_RADIUS_FIRST_LAYER
|
||||
ap.has_tree_support = true;
|
||||
}
|
||||
|
||||
ap.height = obj->bounding_box().size().z();
|
||||
|
|
|
@ -2205,7 +2205,7 @@ void TreeSupport::draw_circles(const std::vector<std::vector<Node*>>& contact_no
|
|||
}
|
||||
}
|
||||
if (layer_nr == 0 && m_raft_layers == 0) {
|
||||
double brim_width = tree_brim_width > 0 ? tree_brim_width : layers_to_top * layer_height / (scale * branch_radius) * 0.5;
|
||||
double brim_width = tree_brim_width > 0 ? tree_brim_width : std::max(0.0, std::min(node.radius + node.dist_mm_to_top / (scale * branch_radius) * 0.5, MAX_BRANCH_RADIUS_FIRST_LAYER) - node.radius);
|
||||
circle = offset(circle, scale_(brim_width))[0];
|
||||
}
|
||||
area.emplace_back(ExPolygon(circle));
|
||||
|
|
|
@ -419,6 +419,7 @@ private:
|
|||
std::vector<std::vector<MinimumSpanningTree>> m_spanning_trees;
|
||||
std::vector< std::unordered_map<Line, bool, LineHash>> m_mst_line_x_layer_contour_caches;
|
||||
coordf_t MAX_BRANCH_RADIUS = 10.0;
|
||||
coordf_t MAX_BRANCH_RADIUS_FIRST_LAYER = 12.0;
|
||||
coordf_t MIN_BRANCH_RADIUS = 0.5;
|
||||
float tree_support_branch_diameter_angle = 5.0;
|
||||
bool is_strong = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue