mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-09-20 13:33:15 +08:00
ENH: improve hybrid tree support
1. do not add interface for small overhangs so supports are easier to remove 2. calculate avoidance more accurately using real layer height jira: STUDIO-6285 3. hybrid nodes won't collide with lower layers 4. calculate max move more accurately 5. do not increase radius if next layer has collision jira: STUDIO-2296, STUDIO-7883 6. rewrite plan_layer_heights to prevent support layers overlap. Now the tree support layers are completely independent to object layers. 6. increase collision areas for interface. The top layers may be too close to interface with adaptive layer heights and very small overhang angle Change-Id: I052c3f66e68afb7663e2d70c846dd09ed7086071 (cherry picked from commit aca511caebfdeec270d4fc0ec6bbbadde77cddc9)
This commit is contained in:
parent
69cf816b94
commit
f2fc996652
@ -649,14 +649,8 @@ void PrintObject::clear_support_layers()
|
||||
std::shared_ptr<TreeSupportData> PrintObject::alloc_tree_support_preview_cache()
|
||||
{
|
||||
if (!m_tree_support_preview_cache) {
|
||||
const coordf_t layer_height = m_config.layer_height.value;
|
||||
const coordf_t xy_distance = m_config.support_object_xy_distance.value;
|
||||
const double angle = m_config.tree_support_branch_angle.value * M_PI / 180.;
|
||||
const coordf_t max_move_distance
|
||||
= (angle < M_PI / 2) ? (coordf_t)(tan(angle) * layer_height) : std::numeric_limits<coordf_t>::max();
|
||||
const coordf_t radius_sample_resolution = g_config_tree_support_collision_resolution;
|
||||
|
||||
m_tree_support_preview_cache = std::make_shared<TreeSupportData>(*this, xy_distance, max_move_distance, radius_sample_resolution);
|
||||
m_tree_support_preview_cache = std::make_shared<TreeSupportData>(*this, xy_distance, g_config_tree_support_collision_resolution);
|
||||
}
|
||||
|
||||
return m_tree_support_preview_cache;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -28,9 +28,9 @@ struct LayerHeightData
|
||||
{
|
||||
coordf_t print_z = 0;
|
||||
coordf_t height = 0;
|
||||
size_t next_layer_nr = 0;
|
||||
size_t obj_layer_nr = 0;
|
||||
LayerHeightData() = default;
|
||||
LayerHeightData(coordf_t z, coordf_t h, size_t next_layer) : print_z(z), height(h), next_layer_nr(next_layer) {}
|
||||
LayerHeightData(coordf_t z, coordf_t h, size_t obj_layer) : print_z(z), height(h), obj_layer_nr(obj_layer) {}
|
||||
coordf_t bottom_z() {
|
||||
return print_z - height;
|
||||
}
|
||||
@ -202,7 +202,7 @@ public:
|
||||
* \param radius_sample_resolution Sample size used to round requested node radii.
|
||||
* \param collision_resolution
|
||||
*/
|
||||
TreeSupportData(const PrintObject& object, coordf_t max_move, coordf_t radius_sample_resolution, coordf_t collision_resolution);
|
||||
TreeSupportData(const PrintObject& object, coordf_t radius_sample_resolution, coordf_t collision_resolution);
|
||||
~TreeSupportData() {
|
||||
clear_nodes();
|
||||
}
|
||||
@ -305,11 +305,7 @@ public:
|
||||
*/
|
||||
coordf_t m_xy_distance;
|
||||
|
||||
/*!
|
||||
* \brief The maximum distance that the centrepoint of a tree branch may
|
||||
* move in consequtive layers
|
||||
*/
|
||||
coordf_t m_max_move;
|
||||
double branch_scale_factor = 1.0; // tan(45 degrees)
|
||||
|
||||
/*!
|
||||
* \brief Sample resolution for radius values.
|
||||
@ -328,6 +324,8 @@ public:
|
||||
// union contours of all layers below
|
||||
std::vector<ExPolygons> m_layer_outlines_below;
|
||||
|
||||
std::vector<double> m_max_move_distances;
|
||||
|
||||
/*!
|
||||
* \brief Caches for the collision, avoidance and internal model polygons
|
||||
* at given radius and layer indices.
|
||||
@ -366,6 +364,10 @@ public:
|
||||
*/
|
||||
TreeSupport(PrintObject& object, const SlicingParameters &slicing_params);
|
||||
|
||||
void move_bounds_to_contact_nodes(std::vector<TreeSupport3D::SupportElements> &move_bounds,
|
||||
PrintObject &print_object,
|
||||
const TreeSupport3D::TreeSupportSettings &config);
|
||||
|
||||
/*!
|
||||
* \brief Create the areas that need support.
|
||||
*
|
||||
@ -377,6 +379,20 @@ public:
|
||||
|
||||
void detect_overhangs(bool check_support_necessity = false);
|
||||
|
||||
SupportNode* create_node(const Point position,
|
||||
const int distance_to_top,
|
||||
const int obj_layer_nr,
|
||||
const int support_roof_layers_below,
|
||||
const bool to_buildplate,
|
||||
SupportNode* parent,
|
||||
coordf_t print_z_,
|
||||
coordf_t height_,
|
||||
coordf_t dist_mm_to_top_ = 0,
|
||||
coordf_t radius_ = 0)
|
||||
{
|
||||
return m_ts_data->create_node(position, distance_to_top, obj_layer_nr, support_roof_layers_below, to_buildplate, parent, print_z_, height_, dist_mm_to_top_, radius_);
|
||||
}
|
||||
|
||||
int avg_node_per_layer = 0;
|
||||
float nodes_angle = 0;
|
||||
bool has_sharp_tails = false;
|
||||
@ -419,12 +435,17 @@ private:
|
||||
std::vector< std::unordered_map<Line, bool, LineHash>> m_mst_line_x_layer_contour_caches;
|
||||
|
||||
float DO_NOT_MOVER_UNDER_MM = 0.0;
|
||||
coordf_t MAX_BRANCH_RADIUS = 10.0;
|
||||
coordf_t MIN_BRANCH_RADIUS = 0.5;
|
||||
coordf_t MAX_BRANCH_RADIUS_FIRST_LAYER = 12.0;
|
||||
coordf_t MIN_BRANCH_RADIUS_FIRST_LAYER = 2.0;
|
||||
float tree_support_branch_diameter_angle = 5.0;
|
||||
coord_t m_min_radius = scale_(1); // in mm
|
||||
coordf_t base_radius = 0.0;
|
||||
const coordf_t MAX_BRANCH_RADIUS = 10.0;
|
||||
const coordf_t MIN_BRANCH_RADIUS = 0.4;
|
||||
const coordf_t MAX_BRANCH_RADIUS_FIRST_LAYER = 12.0;
|
||||
const coordf_t MIN_BRANCH_RADIUS_FIRST_LAYER = 2.0;
|
||||
const double tree_support_branch_diameter_angle = 5.0;
|
||||
const double diameter_angle_scale_factor = tan(tree_support_branch_diameter_angle*M_PI/180.0);
|
||||
// minimum roof area (1 mm^2), area smaller than this value will not have interface
|
||||
const double minimum_roof_area{SQ(scaled<double>(1.))};
|
||||
float top_z_distance = 0.0;
|
||||
|
||||
bool is_strong = false;
|
||||
bool is_slim = false;
|
||||
bool with_infill = false;
|
||||
@ -494,8 +515,10 @@ private:
|
||||
coordf_t calc_branch_radius(coordf_t base_radius, size_t layers_to_top, size_t tip_layers, double diameter_angle_scale_factor);
|
||||
// get unscaled radius(mm) of node based on the distance mm to top
|
||||
coordf_t calc_branch_radius(coordf_t base_radius, coordf_t mm_to_top, double diameter_angle_scale_factor, bool use_min_distance=true);
|
||||
coordf_t get_radius(const SupportNode* node, coordf_t base_radius);
|
||||
coordf_t calc_radius(coordf_t mm_to_top);
|
||||
coordf_t get_radius(const SupportNode* node);
|
||||
ExPolygons get_avoidance(coordf_t radius, size_t obj_layer_nr);
|
||||
// layer's expolygon expanded by radius+m_xy_distance
|
||||
ExPolygons get_collision(coordf_t radius, size_t layer_nr);
|
||||
// get Polygons instead of ExPolygons
|
||||
Polygons get_collision_polys(coordf_t radius, size_t layer_nr);
|
||||
|
@ -4173,8 +4173,7 @@ static void generate_support_areas(Print &print, TreeSupport* tree_support, cons
|
||||
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));
|
||||
if (tree_support->overhang_types[&expoly] == TreeSupport::SharpTail) { polys = offset(polys, scale_(0.2));
|
||||
}
|
||||
append(overhangs[i + num_raft_layers], polys);
|
||||
}
|
||||
@ -4280,6 +4279,8 @@ static void generate_support_areas(Print &print, TreeSupport* tree_support, cons
|
||||
throw_on_cancel);
|
||||
#endif
|
||||
|
||||
//tree_support->move_bounds_to_contact_nodes(move_bounds, print_object, config);
|
||||
|
||||
remove_undefined_layers();
|
||||
|
||||
std::tie(interface_layers, base_interface_layers) = generate_interface_layers(print_object.config(), support_params,
|
||||
|
Loading…
x
Reference in New Issue
Block a user