diff --git a/conanfile.py b/conanfile.py index 4778c863bb..616d927b40 100644 --- a/conanfile.py +++ b/conanfile.py @@ -77,7 +77,7 @@ def validate(self): def build_requirements(self): self.test_requires("standardprojectsettings/[>=0.1.0]@ultimaker/stable") - self.tool_requires("protobuf/3.21.9") + self.test_requires("protobuf/3.21.9") if self.options.enable_testing: self.test_requires("gtest/1.12.1") if self.options.enable_benchmarks: diff --git a/include/TreeSupport.h b/include/TreeSupport.h index 32f67cd074..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 @@ -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; @@ -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 d19e1a99b0..13c9dc6a80 100644 --- a/include/TreeSupportTipGenerator.h +++ b/include/TreeSupportTipGenerator.h @@ -194,14 +194,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/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 diff --git a/src/TreeSupportTipGenerator.cpp b/src/TreeSupportTipGenerator.cpp index 35419aef1e..99677f9c09 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 @@ -973,6 +973,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.