diff options
author | Joey de l'Arago <joeydelarago@gmail.com> | 2022-11-01 17:34:40 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-01 17:34:40 +0300 |
commit | 4585a7d3294aa49549de7f6f83ea30d0bcda2944 (patch) | |
tree | f4bd69dd5d33ab4f2f2bd8e9f050b6985e0a2a85 | |
parent | c7adeae0d19a5511143ab382eb537c34dd0386ac (diff) | |
parent | 7f588ec45417af690149191cb4dfad653c413bfc (diff) |
Merge pull request #1753 from Ultimaker/CURA-9549_fix_tower_support
CURA-9074 fix tower support
-rw-r--r-- | include/support.h | 4 | ||||
-rw-r--r-- | src/support.cpp | 36 |
2 files changed, 20 insertions, 20 deletions
diff --git a/include/support.h b/include/support.h index d696df223..fe55fc16f 100644 --- a/include/support.h +++ b/include/support.h @@ -259,7 +259,7 @@ private: * \param settings The settings to use for towers. * \param supportLayer_this The support areas in the layer for which we are * creating towers/struts - * \param towerRoofs The parts of roofs which need to expand downward until + * \param tower_roofs The parts of roofs which need to expand downward until * they have the required diameter * \param overhang_points stores overhang_points of each layer * \param layer_idx The index of the layer at which to handle towers @@ -268,7 +268,7 @@ private: static void handleTowers( const Settings& settings, Polygons& supportLayer_this, - std::vector<Polygons>& towerRoofs, + std::vector<Polygons>& tower_roofs, std::vector<std::vector<Polygons>>& overhang_points, LayerIndex layer_idx, size_t layer_count diff --git a/src/support.cpp b/src/support.cpp index fc2728ee7..372c4cbc4 100644 --- a/src/support.cpp +++ b/src/support.cpp @@ -1027,12 +1027,11 @@ void AreaSupport::generateSupportAreasForMesh(SliceDataStorage& storage, constexpr size_t tower_top_layer_count = 6; // number of layers after which to conclude that a tiny support area needs a tower if (layer_idx < layer_count - tower_top_layer_count && layer_idx >= tower_top_layer_count + bottom_empty_layer_count) { + const Polygons& layer_below = xy_disallowed_per_layer[layer_idx - tower_top_layer_count - bottom_empty_layer_count]; const Polygons& layer_above = support_areas[layer_idx + tower_top_layer_count]; const Point middle = AABB(poly).getMiddle(); const bool has_support_above = layer_above.inside(middle); - constexpr bool no_support = false; - constexpr bool no_prime_tower = false; - const bool has_model_below = storage.getLayerOutlines(layer_idx - tower_top_layer_count - bottom_empty_layer_count, no_support, no_prime_tower).inside(middle); + const bool has_model_below = layer_below.inside(middle); if (has_support_above && ! has_model_below) { Polygons tiny_tower_here; @@ -1321,7 +1320,7 @@ void AreaSupport::detectOverhangPoints(const SliceDataStorage& storage, SliceMes } -void AreaSupport::handleTowers(const Settings& settings, Polygons& supportLayer_this, std::vector<Polygons>& towerRoofs, std::vector<std::vector<Polygons>>& overhang_points, LayerIndex layer_idx, size_t layer_count) +void AreaSupport::handleTowers(const Settings& settings, Polygons& supportLayer_this, std::vector<Polygons>& tower_roofs, std::vector<std::vector<Polygons>>& overhang_points, LayerIndex layer_idx, size_t layer_count) { LayerIndex layer_overhang_point = layer_idx + 1; // Start tower 1 layer below overhang point. if (layer_overhang_point >= static_cast<LayerIndex>(layer_count) - 1) @@ -1329,7 +1328,7 @@ void AreaSupport::handleTowers(const Settings& settings, Polygons& supportLayer_ return; } std::vector<Polygons>& overhang_points_here = overhang_points[layer_overhang_point]; // may be changed if an overhang point has a (smaller) overhang point directly below - // handle new tower roof tops + // handle new tower rooftops if (overhang_points_here.size() > 0) { { // make sure we have the lowest point (make polys empty if they have small parts below) @@ -1350,7 +1349,7 @@ void AreaSupport::handleTowers(const Settings& settings, Polygons& supportLayer_ { if (poly.size() > 0) { - towerRoofs.push_back(poly); + tower_roofs.push_back(poly); } } } @@ -1361,21 +1360,22 @@ void AreaSupport::handleTowers(const Settings& settings, Polygons& supportLayer_ const double tan_tower_roof_angle = tan(tower_roof_angle); const coord_t tower_roof_expansion_distance = layer_thickness / tan_tower_roof_angle; const coord_t tower_diameter = settings.get<coord_t>("support_tower_diameter"); - for (size_t roof_idx = 0; roof_idx < towerRoofs.size(); roof_idx++) + for (Polygons& tower_roof: tower_roofs) { - Polygons& tower_roof = towerRoofs[roof_idx]; - if (tower_roof.size() > 0) + if (tower_roof.size() == 0) { - supportLayer_this = supportLayer_this.unionPolygons(tower_roof); + continue; + } - if (tower_roof[0].area() < tower_diameter * tower_diameter) - { - tower_roof = tower_roof.offset(tower_roof_expansion_distance); - } - else - { - tower_roof.clear(); - } + supportLayer_this = supportLayer_this.unionPolygons(tower_roof); + + if (tower_roof[0].area() < tower_diameter * tower_diameter) + { + tower_roof = tower_roof.offset(tower_roof_expansion_distance); + } + else + { + tower_roof.clear(); } } } |