From 02c6ac4e5438d6d74f3b0c5d2c08b8e13c5ebc65 Mon Sep 17 00:00:00 2001 From: "c.lamboo" Date: Tue, 29 Aug 2023 13:30:45 +0200 Subject: [PATCH 1/5] Don't group outerwalls CURA-10971 --- src/InsetOrderOptimizer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/InsetOrderOptimizer.cpp b/src/InsetOrderOptimizer.cpp index 46f8c97e44..006296fc68 100644 --- a/src/InsetOrderOptimizer.cpp +++ b/src/InsetOrderOptimizer.cpp @@ -93,7 +93,7 @@ bool InsetOrderOptimizer::addToLayer() constexpr bool detect_loops = false; constexpr Polygons* combing_boundary = nullptr; - constexpr bool group_outer_walls = true; + constexpr bool group_outer_walls = false; // When we alternate walls, also alternate the direction at which the first wall starts in. // On even layers we start with normal direction, on odd layers with inverted direction. PathOrderOptimizer From c755fb1f11b0767d74e8b84ae3c0eac77f77d52e Mon Sep 17 00:00:00 2001 From: "saumya.jain" Date: Tue, 29 Aug 2023 14:52:16 +0200 Subject: [PATCH 2/5] Use arcus from GRPC build conan build fix --- conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conanfile.py b/conanfile.py index aca65ece35..8ce9d7a7e1 100644 --- a/conanfile.py +++ b/conanfile.py @@ -72,7 +72,7 @@ def build_requirements(self): def requirements(self): if self.options.enable_arcus: - self.requires("arcus/5.2.2") + self.requires("arcus/(latest)@ultimaker/cura_10475") self.requires("zlib/1.2.12") self.requires("clipper/6.4.2") self.requires("boost/1.79.0") From e23740839befc688084b465f892323e4d37758b5 Mon Sep 17 00:00:00 2001 From: "saumya.jain" Date: Tue, 29 Aug 2023 15:01:16 +0200 Subject: [PATCH 3/5] protobuf bumpup conan build fix --- conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conanfile.py b/conanfile.py index 8ce9d7a7e1..adfca7304e 100644 --- a/conanfile.py +++ b/conanfile.py @@ -64,7 +64,7 @@ def validate(self): def build_requirements(self): self.test_requires("standardprojectsettings/[>=0.1.0]@ultimaker/stable") if self.options.enable_arcus: - self.test_requires("protobuf/3.21.4") + self.test_requires("protobuf/3.21.9") if self.options.enable_testing: self.test_requires("gtest/1.12.1") if self.options.enable_benchmarks: From a56ffc63fb5580bf75b0e738cd4a13ae935c2cce Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Tue, 29 Aug 2023 15:37:53 +0200 Subject: [PATCH 4/5] Proposed fix min support area for X/Y-Z override when tree-supports are on. part of CURA-10854 co-authored-by: Thomas Rahm --- include/TreeSupport.h | 2 +- include/TreeSupportTipGenerator.h | 8 ++++---- src/TreeSupportTipGenerator.cpp | 7 ++++++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/include/TreeSupport.h b/include/TreeSupport.h index 32f67cd074..1236b6fbb7 100644 --- a/include/TreeSupport.h +++ b/include/TreeSupport.h @@ -32,7 +32,7 @@ constexpr auto TREE_PROGRESS_GENERATE_BRANCH_AREAS = TREE_PROGRESS_DRAW_AREAS / constexpr auto TREE_PROGRESS_SMOOTH_BRANCH_AREAS = TREE_PROGRESS_DRAW_AREAS / 3; constexpr auto TREE_PROGRESS_FINALIZE_BRANCH_AREAS = TREE_PROGRESS_DRAW_AREAS / 3; -constexpr auto SUPPORT_TREE_MINIMUM_FAKE_ROOF_AREA = 100; +constexpr auto SUPPORT_TREE_MINIMUM_FAKE_ROOF_AREA = 100.0; constexpr auto SUPPORT_TREE_MINIMUM_FAKE_ROOF_LAYERS = 1; constexpr auto SUPPORT_TREE_MINIMUM_ROOF_AREA_HARD_LIMIT = false; constexpr auto SUPPORT_TREE_ONLY_GRACIOUS_TO_MODEL = false; diff --git a/include/TreeSupportTipGenerator.h b/include/TreeSupportTipGenerator.h index 16985e90dc..7c34f9147c 100644 --- a/include/TreeSupportTipGenerator.h +++ b/include/TreeSupportTipGenerator.h @@ -183,14 +183,14 @@ class TreeSupportTipGenerator /*! - * \brief Minimum area an overhang has to have to become a roof. + * \brief Minimum area an overhang has to have to be supported. */ - const double minimum_roof_area; + const double minimum_support_area; /*! - * \brief Minimum area an overhang has to have to be supported. + * \brief Minimum area an overhang has to have to become a roof. */ - const double minimum_support_area; + const double minimum_roof_area; /*! * \brief Amount of layers of roof. Zero if roof is disabled diff --git a/src/TreeSupportTipGenerator.cpp b/src/TreeSupportTipGenerator.cpp index b0ddb5a41b..05d2d989f0 100644 --- a/src/TreeSupportTipGenerator.cpp +++ b/src/TreeSupportTipGenerator.cpp @@ -31,8 +31,8 @@ namespace cura TreeSupportTipGenerator::TreeSupportTipGenerator(const SliceDataStorage& storage, const SliceMeshStorage& mesh, TreeModelVolumes& volumes_s) : config(mesh.settings) , use_fake_roof(! mesh.settings.get("support_roof_enable")) - , minimum_roof_area(! use_fake_roof ? mesh.settings.get("minimum_roof_area") : SUPPORT_TREE_MINIMUM_FAKE_ROOF_AREA) , minimum_support_area(mesh.settings.get("minimum_support_area")) + , minimum_roof_area(! use_fake_roof ? mesh.settings.get("minimum_roof_area") : std::max(SUPPORT_TREE_MINIMUM_FAKE_ROOF_AREA, minimum_support_area)) , support_roof_layers( mesh.settings.get("support_roof_enable") ? round_divide(mesh.settings.get("support_roof_height"), config.layer_height) : use_fake_roof ? SUPPORT_TREE_MINIMUM_FAKE_ROOF_LAYERS @@ -976,6 +976,11 @@ void TreeSupportTipGenerator::generateTips( { for (Polygons& remaining_overhang_part : remaining_overhang.splitIntoParts(false)) { + if (remaining_overhang_part.area() <= MM2_2INT(minimum_support_area)) + { + continue; + } + std::vector overhang_lines; Polygons polylines = ensureMaximumDistancePolyline(generateLines(remaining_overhang_part, false, layer_idx), config.min_radius, 1, false); // ^^^ Support_line_width to form a line here as otherwise most will be unsupported. From 49461d4c85b3eb4322f8bbf53049d2ceeec0f105 Mon Sep 17 00:00:00 2001 From: rburema Date: Tue, 29 Aug 2023 13:43:28 +0000 Subject: [PATCH 5/5] Applied clang-format. --- include/TreeSupport.h | 105 ++++++++++++------------------ include/TreeSupportTipGenerator.h | 58 ++++++++++------- 2 files changed, 78 insertions(+), 85 deletions(-) diff --git a/include/TreeSupport.h b/include/TreeSupport.h index 1236b6fbb7..6ad2a5fac4 100644 --- a/include/TreeSupport.h +++ b/include/TreeSupport.h @@ -1,5 +1,5 @@ -//Copyright (c) 2021 Ultimaker B.V. -//CuraEngine is released under the terms of the AGPLv3 or higher. +// Copyright (c) 2021 Ultimaker B.V. +// CuraEngine is released under the terms of the AGPLv3 or higher. #ifndef TREESUPPORT_H #define TREESUPPORT_H @@ -69,8 +69,6 @@ class TreeSupport private: - - /*! * \brief Precalculates all avoidances, that could be required. * @@ -101,17 +99,14 @@ class TreeSupport * \param reduced_aabb[in,out] The already processed elements. * \param input_aabb[in] Not yet processed elements * \param to_bp_areas[in] The Elements of the current Layer that will reach the buildplate. Value is the influence area where the center of a circle of support may be placed. - * \param to_model_areas[in] The Elements of the current Layer that do not have to reach the buildplate. Also contains main as every element that can reach the buildplate is not forced to. - * Value is the influence area where the center of a circle of support may be placed. - * \param influence_areas[in] The influence areas without avoidance removed. + * \param to_model_areas[in] The Elements of the current Layer that do not have to reach the buildplate. Also contains main as every element that can reach the buildplate is + * not forced to. Value is the influence area where the center of a circle of support may be placed. \param influence_areas[in] The influence areas without avoidance removed. * \param insert_bp_areas[out] Elements to be inserted into the main dictionary after the Helper terminates. * \param insert_model_areas[out] Elements to be inserted into the secondary dictionary after the Helper terminates. - * \param insert_influence[out] Elements to be inserted into the dictionary containing the largest possibly valid influence area (ignoring if the area may not be there because of avoidance) - * \param erase[out] Elements that should be deleted from the above dictionaries. - * \param layer_idx[in] The Index of the current Layer. + * \param insert_influence[out] Elements to be inserted into the dictionary containing the largest possibly valid influence area (ignoring if the area may not be there because + * of avoidance) \param erase[out] Elements that should be deleted from the above dictionaries. \param layer_idx[in] The Index of the current Layer. */ - void mergeHelper - ( + void mergeHelper( std::map& reduced_aabb, std::map& input_aabb, const PropertyAreasUnordered& to_bp_areas, @@ -121,8 +116,7 @@ class TreeSupport PropertyAreasUnordered& insert_model_areas, PropertyAreasUnordered& insert_influence, std::vector& erase, - const LayerIndex layer_idx - ); + const LayerIndex layer_idx); /*! * \brief Merges Influence Areas if possible. @@ -132,28 +126,23 @@ class TreeSupport * * \param to_bp_areas[in] The Elements of the current Layer that will reach the buildplate. * Value is the influence area where the center of a circle of support may be placed. - * \param to_model_areas[in] The Elements of the current Layer that do not have to reach the buildplate. Also contains main as every element that can reach the buildplate is not forced to. - * Value is the influence area where the center of a circle of support may be placed. - * \param influence_areas[in] The Elements of the current Layer without avoidances removed. This is the largest possible influence area for this layer. - * Value is the influence area where the center of a circle of support may be placed. - * \param layer_idx[in] The current layer. + * \param to_model_areas[in] The Elements of the current Layer that do not have to reach the buildplate. Also contains main as every element that can reach the buildplate is + * not forced to. Value is the influence area where the center of a circle of support may be placed. \param influence_areas[in] The Elements of the current Layer without + * avoidances removed. This is the largest possible influence area for this layer. Value is the influence area where the center of a circle of support may be placed. \param + * layer_idx[in] The current layer. */ - void mergeInfluenceAreas - ( - PropertyAreasUnordered& to_bp_areas, - PropertyAreas& to_model_areas, - PropertyAreas& influence_areas, - LayerIndex layer_idx - ); + void mergeInfluenceAreas(PropertyAreasUnordered& to_bp_areas, PropertyAreas& to_model_areas, PropertyAreas& influence_areas, LayerIndex layer_idx); /*! * \brief Checks if an influence area contains a valid subsection and returns the corresponding metadata and the new Influence area. * * Calculates an influence areas of the layer below, based on the influence area of one element on the current layer. - * Increases every influence area by maximum_move_distance_slow. If this is not enough, as in we would change our gracious or to_buildplate status the influence areas are instead increased by maximum_move_distance_slow. - * Also ensures that increasing the radius of a branch, does not cause it to change its status (like to_buildplate ). If this were the case, the radius is not increased instead. + * Increases every influence area by maximum_move_distance_slow. If this is not enough, as in we would change our gracious or to_buildplate status the influence areas are + * instead increased by maximum_move_distance_slow. Also ensures that increasing the radius of a branch, does not cause it to change its status (like to_buildplate ). If this + * were the case, the radius is not increased instead. * - * Warning: The used format inside this is different as the SupportElement does not have a valid area member. Instead this area is saved as value of the dictionary. This was done to avoid not needed heap allocations. + * Warning: The used format inside this is different as the SupportElement does not have a valid area member. Instead this area is saved as value of the dictionary. This was + * done to avoid not needed heap allocations. * * \param settings[in] Which settings have to be used to check validity. * \param layer_idx[in] Number of the current layer. @@ -161,13 +150,12 @@ class TreeSupport * \param relevant_offset[in] The maximal possible influence area. No guarantee regarding validity with current layer collision required, as it is ensured in-function! * \param to_bp_data[out] The part of the Influence area that can reach the buildplate. * \param to_model_data[out] The part of the Influence area that do not have to reach the buildplate. This has overlap with new_layer_data. - * \param increased[out] Area than can reach all further up support points. No assurance is made that the buildplate or the model can be reached in accordance to the user-supplied settings. - * \param overspeed[in] How much should the already offset area be offset again. Usually this is 0. - * \param mergelayer[in] Will the merge method be called on this layer. This information is required as some calculation can be avoided if they are not required for merging. - * \return A valid support element for the next layer regarding the calculated influence areas. Empty if no influence are can be created using the supplied influence area and settings. + * \param increased[out] Area than can reach all further up support points. No assurance is made that the buildplate or the model can be reached in accordance to the + * user-supplied settings. \param overspeed[in] How much should the already offset area be offset again. Usually this is 0. \param mergelayer[in] Will the merge method be + * called on this layer. This information is required as some calculation can be avoided if they are not required for merging. \return A valid support element for the next + * layer regarding the calculated influence areas. Empty if no influence are can be created using the supplied influence area and settings. */ - std::optional increaseSingleArea - ( + std::optional increaseSingleArea( AreaIncreaseSettings settings, LayerIndex layer_idx, TreeSupportElement* parent, @@ -176,37 +164,35 @@ class TreeSupport Polygons& to_model_data, Polygons& increased, const coord_t overspeed, - const bool mergelayer - ); + const bool mergelayer); /*! * \brief Increases influence areas as far as required. * * Calculates influence areas of the layer below, based on the influence areas of the current layer. - * Increases every influence area by maximum_move_distance_slow. If this is not enough, as in it would change the gracious or to_buildplate status, the influence areas are instead increased by maximum_move_distance. - * Also ensures that increasing the radius of a branch, does not cause it to change its status (like to_buildplate ). If this were the case, the radius is not increased instead. + * Increases every influence area by maximum_move_distance_slow. If this is not enough, as in it would change the gracious or to_buildplate status, the influence areas are + * instead increased by maximum_move_distance. Also ensures that increasing the radius of a branch, does not cause it to change its status (like to_buildplate ). If this were + * the case, the radius is not increased instead. * - * Warning: The used format inside this is different as the SupportElement does not have a valid area member. Instead this area is saved as value of the dictionary. This was done to avoid not needed heap allocations. + * Warning: The used format inside this is different as the SupportElement does not have a valid area member. Instead this area is saved as value of the dictionary. This was + * done to avoid not needed heap allocations. * * \param to_bp_areas[out] Influence areas that can reach the buildplate - * \param to_model_areas[out] Influence areas that do not have to reach the buildplate. This has overlap with new_layer_data, as areas that can reach the buildplate are also considered valid areas to the model. - * This redundancy is required if a to_buildplate influence area is allowed to merge with a to model influence area. - * \param influence_areas[out] Area than can reach all further up support points. No assurance is made that the buildplate or the model can be reached in accordance to the user-supplied settings. - * \param bypass_merge_areas[out] Influence areas ready to be added to the layer below that do not need merging. - * \param last_layer[in] Influence areas of the current layer. - * \param layer_idx[in] Number of the current layer. - * \param mergelayer[in] Will the merge method be called on this layer. This information is required as some calculation can be avoided if they are not required for merging. + * \param to_model_areas[out] Influence areas that do not have to reach the buildplate. This has overlap with new_layer_data, as areas that can reach the buildplate are also + * considered valid areas to the model. This redundancy is required if a to_buildplate influence area is allowed to merge with a to model influence area. \param + * influence_areas[out] Area than can reach all further up support points. No assurance is made that the buildplate or the model can be reached in accordance to the + * user-supplied settings. \param bypass_merge_areas[out] Influence areas ready to be added to the layer below that do not need merging. \param last_layer[in] Influence areas + * of the current layer. \param layer_idx[in] Number of the current layer. \param mergelayer[in] Will the merge method be called on this layer. This information is required as + * some calculation can be avoided if they are not required for merging. */ - void increaseAreas - ( + void increaseAreas( PropertyAreasUnordered& to_bp_areas, PropertyAreas& to_model_areas, PropertyAreas& influence_areas, std::vector& bypass_merge_areas, const std::vector& last_layer, const LayerIndex layer_idx, - const bool mergelayer - ); + const bool mergelayer); /*! * \brief Propagates influence downwards, and merges overlapping ones. @@ -245,15 +231,13 @@ class TreeSupport * * \param linear_data[in] All currently existing influence areas with the layer they are on * \param layer_tree_polygons[out] Resulting branch areas with the layerindex they appear on. - * layer_tree_polygons.size() has to be at least linear_data.size() as each Influence area in linear_data will save have at least one (that's why it's a vector) corresponding branch area in layer_tree_polygons. - * \param inverse_tree_order[in] A mapping that returns the child of every influence area. + * layer_tree_polygons.size() has to be at least linear_data.size() as each Influence area in linear_data will save have at least one (that's why it's a vector) + * corresponding branch area in layer_tree_polygons. \param inverse_tree_order[in] A mapping that returns the child of every influence area. */ - void generateBranchAreas - ( + void generateBranchAreas( std::vector>& linear_data, std::vector>& layer_tree_polygons, - const std::map& inverse_tree_order - ); + const std::map& inverse_tree_order); /*! * \brief Applies some smoothing to the outer wall, intended to smooth out sudden jumps as they can happen when a branch moves though a hole. @@ -270,13 +254,11 @@ class TreeSupport * \param dropped_down_areas[out] Areas that have to be added to support all non-graceful areas. * \param inverse_tree_order[in] A mapping that returns the child of every influence area. */ - void dropNonGraciousAreas - ( + void dropNonGraciousAreas( std::vector>& layer_tree_polygons, const std::vector>& linear_data, std::vector>>& dropped_down_areas, - const std::map& inverse_tree_order - ); + const std::map& inverse_tree_order); void filterFloatingLines(std::vector& support_layer_storage); @@ -335,7 +317,6 @@ class TreeSupport * Required for the progress bar the behave as expected when areas have to be calculated multiple times */ double progress_offset = 0; - }; diff --git a/include/TreeSupportTipGenerator.h b/include/TreeSupportTipGenerator.h index 7c34f9147c..8d5def3997 100644 --- a/include/TreeSupportTipGenerator.h +++ b/include/TreeSupportTipGenerator.h @@ -2,6 +2,7 @@ #define TREESUPPORTTIPGENERATOR_H #include "TreeModelVolumes.h" +#include "TreeSupport.h" #include "TreeSupportBaseCircle.h" #include "TreeSupportElement.h" #include "TreeSupportEnums.h" @@ -12,7 +13,6 @@ #include "sliceDataStorage.h" #include "utils/Coord_t.h" #include "utils/polygon.h" -#include "TreeSupport.h" namespace cura { @@ -20,12 +20,10 @@ namespace cura class TreeSupportTipGenerator { - public: - TreeSupportTipGenerator(const SliceDataStorage& storage, const SliceMeshStorage& mesh, TreeModelVolumes& volumes_); - ~ TreeSupportTipGenerator() + ~TreeSupportTipGenerator() { if (cross_fill_provider) { @@ -43,10 +41,14 @@ class TreeSupportTipGenerator * \return All lines of the \p polylines object, with information for each point regarding in which avoidance it is currently valid in. */ - void generateTips(SliceDataStorage& storage,const SliceMeshStorage& mesh ,std::vector>& move_bounds, std::vector& additional_support_areas, std::vector& placed_support_lines_support_areas); + void generateTips( + SliceDataStorage& storage, + const SliceMeshStorage& mesh, + std::vector>& move_bounds, + std::vector& additional_support_areas, + std::vector& placed_support_lines_support_areas); private: - enum class LineStatus { INVALID, @@ -85,17 +87,16 @@ class TreeSupportTipGenerator std::function)> getEvaluatePointForNextLayerFunction(size_t current_layer); /*! - * \brief Evaluates which points of some lines are not valid one layer below and which are. Assumes all points are valid on the current layer. Validity is evaluated using supplied lambda. + * \brief Evaluates which points of some lines are not valid one layer below and which are. Assumes all points are valid on the current layer. Validity is evaluated using + * supplied lambda. * * \param lines[in] The lines that have to be evaluated. * \param evaluatePoint[in] The function used to evaluate the points. * \return A pair with which points are still valid in the first slot and which are not in the second slot. */ - std::pair, std::vector> splitLines - ( - std::vector lines, - std::function)> evaluatePoint - ); // assumes all Points on the current line are valid + std::pair, std::vector> splitLines( + std::vector lines, + std::function)> evaluatePoint); // assumes all Points on the current line are valid /*! * \brief Ensures that every line segment is about distance in length. The resulting lines may differ from the original but all points are on the original @@ -125,7 +126,7 @@ class TreeSupportTipGenerator * \param result[out] The dropped overhang ares * \param roof[in] Whether the result is for roof generation. */ - void dropOverhangAreas(const SliceMeshStorage& mesh, std::vector& result, bool roof ); + void dropOverhangAreas(const SliceMeshStorage& mesh, std::vector& result, bool roof); /*! * \brief Calculates which areas should be supported with roof, and saves these in roof support_roof_drawn @@ -143,7 +144,15 @@ class TreeSupportTipGenerator * \param roof[in] Whether the tip supports a roof. * \param skip_ovalisation[in] Whether the tip may be ovalized when drawn later. */ - void addPointAsInfluenceArea(std::vector>& move_bounds, std::pair p, size_t dtt, LayerIndex insert_layer, size_t dont_move_until, bool roof, bool skip_ovalisation, std::vector additional_ovalization_targets = std::vector()); + void addPointAsInfluenceArea( + std::vector>& move_bounds, + std::pair p, + size_t dtt, + LayerIndex insert_layer, + size_t dont_move_until, + bool roof, + bool skip_ovalisation, + std::vector additional_ovalization_targets = std::vector()); /*! @@ -155,7 +164,14 @@ class TreeSupportTipGenerator * \param supports_roof[in] Whether the tip supports a roof. * \param dont_move_until[in] Until which dtt the branch should not move if possible. */ - void addLinesAsInfluenceAreas(std::vector>& move_bounds, std::vector lines, size_t roof_tip_layers, LayerIndex insert_layer_idx, bool supports_roof, size_t dont_move_until, bool connect_points); + void addLinesAsInfluenceAreas( + std::vector>& move_bounds, + std::vector lines, + size_t roof_tip_layers, + LayerIndex insert_layer_idx, + bool supports_roof, + size_t dont_move_until, + bool connect_points); /*! * \brief Remove tips that should not have been added in the first place. @@ -163,7 +179,7 @@ class TreeSupportTipGenerator * \param storage[in] Background storage, required for adding roofs. * \param additional_support_areas[in] Areas that should have been roofs, but are now support, as they would not generate any lines as roof. */ - void removeUselessAddedPoints(std::vector>& move_bounds,SliceDataStorage& storage, std::vector& additional_support_areas); + void removeUselessAddedPoints(std::vector>& move_bounds, SliceDataStorage& storage, std::vector& additional_support_areas); /*! @@ -264,7 +280,8 @@ class TreeSupportTipGenerator const bool only_gracious = SUPPORT_TREE_ONLY_GRACIOUS_TO_MODEL; /*! - * \brief Whether minimum_roof_area is a hard limit. If false the roof will be combined with roof above and below, to see if a part of this roof may be part of a valid roof further up/down. + * \brief Whether minimum_roof_area is a hard limit. If false the roof will be combined with roof above and below, to see if a part of this roof may be part of a valid roof + * further up/down. */ const bool force_minimum_roof_area = SUPPORT_TREE_MINIMUM_ROOF_AREA_HARD_LIMIT; @@ -294,15 +311,10 @@ class TreeSupportTipGenerator std::vector roof_tips_drawn; - - std::mutex critical_move_bounds; std::mutex critical_roof_tips; - - - }; -} +} // namespace cura #endif /* TREESUPPORT_H */ \ No newline at end of file