diff options
author | remi durand <remi-j.durand@thalesgroup.com> | 2022-11-01 22:27:56 +0300 |
---|---|---|
committer | remi durand <remi-j.durand@thalesgroup.com> | 2022-11-02 00:56:26 +0300 |
commit | f36cba6f894b6d02b83b9e0be96b507da5664494 (patch) | |
tree | 24365a78768cccb625a1d67c01f8739e76eaa842 | |
parent | 6fd04ca84755527196a64612169f626d021bab0f (diff) |
add 'enforce overhang speed'dev
-rw-r--r-- | resources/ui_layout/default/print.ui | 1 | ||||
-rw-r--r-- | src/libslic3r/PerimeterGenerator.cpp | 30 | ||||
-rw-r--r-- | src/libslic3r/PerimeterGenerator.hpp | 2 | ||||
-rw-r--r-- | src/libslic3r/Preset.cpp | 1 | ||||
-rw-r--r-- | src/libslic3r/PrintConfig.cpp | 15 | ||||
-rw-r--r-- | src/libslic3r/PrintConfig.hpp | 1 | ||||
-rw-r--r-- | src/libslic3r/PrintObject.cpp | 1 |
7 files changed, 44 insertions, 7 deletions
diff --git a/resources/ui_layout/default/print.ui b/resources/ui_layout/default/print.ui index 81e8689e6..11444c8aa 100644 --- a/resources/ui_layout/default/print.ui +++ b/resources/ui_layout/default/print.ui @@ -58,6 +58,7 @@ group:label_width$12:Overhangs setting:label$Bridge speed and fan:width$5:sidetext_width$0:overhangs_width_speed setting:label_width$12:label$Bridge flow:width$5:overhangs_width end_line + setting:overhangs_speed_enforce line:Extrusion direction setting:sidetext_width$2:overhangs_reverse setting:label_width$12:width$5:overhangs_reverse_threshold diff --git a/src/libslic3r/PerimeterGenerator.cpp b/src/libslic3r/PerimeterGenerator.cpp index 6dca680f6..634750d72 100644 --- a/src/libslic3r/PerimeterGenerator.cpp +++ b/src/libslic3r/PerimeterGenerator.cpp @@ -2371,7 +2371,7 @@ static void fuzzy_paths(ExtrusionPaths& paths, coordf_t fuzzy_skin_thickness, co } ExtrusionEntityCollection PerimeterGenerator::_traverse_loops( - const PerimeterGeneratorLoops &loops, ThickPolylines &thin_walls) const + const PerimeterGeneratorLoops &loops, ThickPolylines &thin_walls, int count_since_overhang /*= 0*/) const { // loops is an arrayref of ::Loop objects // turn each one into an ExtrusionLoop object @@ -2403,11 +2403,11 @@ ExtrusionEntityCollection PerimeterGenerator::_traverse_loops( // detect overhanging/bridging perimeters ExtrusionPaths paths; - bool is_overhang = this->config->overhangs_width_speed.value > 0 + bool can_overhang = this->config->overhangs_width_speed.value > 0 && this->layer->id() > object_config->raft_layers; if(this->object_config->support_material && this->object_config->support_material_contact_distance_type.value == zdNone) - is_overhang = false; - if (is_overhang) { + can_overhang = false; + if (can_overhang) { paths = this->create_overhangs(loop.polygon.split_at_first_point(), role, is_external); } else { ExtrusionPath path(role); @@ -2479,10 +2479,28 @@ ExtrusionEntityCollection PerimeterGenerator::_traverse_loops( } } else { const PerimeterGeneratorLoop &loop = loops[idx.first]; + ExtrusionLoop* eloop = static_cast<ExtrusionLoop*>(coll[idx.first]); + bool has_overhang = false; + if (this->config->overhangs_speed_enforce.value > 0) { + for (const ExtrusionPath& path : eloop->paths) { + if (path.role() == erOverhangPerimeter) { + has_overhang = true; + break; + } + } + if (has_overhang || this->config->overhangs_speed_enforce.value > count_since_overhang) { + //enforce + for (ExtrusionPath& path : eloop->paths) { + if (path.role() == erPerimeter || path.role() == erExternalPerimeter) { + path.set_role(erOverhangPerimeter); + } + } + } + + } assert(thin_walls.empty()); - ExtrusionEntityCollection children = this->_traverse_loops(loop.children, thin_walls); + ExtrusionEntityCollection children = this->_traverse_loops(loop.children, thin_walls, has_overhang ? 1 : (count_since_overhang+1)); coll_out.set_entities().reserve(coll_out.entities().size() + children.entities().size() + 1); - ExtrusionLoop *eloop = static_cast<ExtrusionLoop*>(coll[idx.first]); coll[idx.first] = nullptr; if (loop.is_contour) { //note: this->layer->id() % 2 == 1 already taken into account in the is_steep_overhang compute (to save time). diff --git a/src/libslic3r/PerimeterGenerator.hpp b/src/libslic3r/PerimeterGenerator.hpp index bf2792fc3..34ec4e67b 100644 --- a/src/libslic3r/PerimeterGenerator.hpp +++ b/src/libslic3r/PerimeterGenerator.hpp @@ -162,7 +162,7 @@ private: ExtrusionPaths create_overhangs(const ClipperLib_Z::Path& loop_polygons, ExtrusionRole role, bool is_external) const; // transform loops into ExtrusionEntityCollection, adding also thin walls into it. - ExtrusionEntityCollection _traverse_loops(const PerimeterGeneratorLoops &loops, ThickPolylines &thin_walls) const; + ExtrusionEntityCollection _traverse_loops(const PerimeterGeneratorLoops &loops, ThickPolylines &thin_walls, int count_since_overhang = 0) const; ExtrusionEntityCollection _traverse_extrusions(std::vector<PerimeterGeneratorArachneExtrusion>& pg_extrusions); // try to merge thin walls to a current periemter exrusion or just add it to the end of the list. void _merge_thin_walls(ExtrusionEntityCollection &extrusions, ThickPolylines &thin_walls) const; diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 28ea7fbb6..4c50381bd 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -470,6 +470,7 @@ static std::vector<std::string> s_Preset_print_options { "avoid_crossing_not_first_layer", "thin_perimeters", "thin_perimeters_all", "overhangs_speed", + "overhangs_speed_enforce", "overhangs_width", "overhangs_width_speed", "overhangs_reverse", diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 1b89fbae4..865fd12e5 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -3804,6 +3804,20 @@ void PrintConfigDef::init_fff_params() def->mode = comExpert | comSuSi; def->set_default_value(new ConfigOptionFloatOrPercent(100, true)); + def = this->add("overhangs_speed_enforce", coInt); + def->label = L("Enforce overhangs speed"); + def->full_label = L("Enforce overhangs speed"); + def->category = OptionCategory::speed; + def->tooltip = L("Set the speed of the full perimeters to the overhang speed, and also the next one(s) if any." + "\nSet to 0 to disable." + "\nSet to 1 to set the overhang speed to the full periemter if there is any overhang detected in the periemter." + "\nSet to more than 1 to also set the overhang speed to the next perimeter(s)." + ); + def->sidetext = L("perimeters"); + def->min = 0; + def->mode = comExpert | comSuSi; + def->set_default_value(new ConfigOptionInt(0)); + def = this->add("overhangs_width_speed", coFloatOrPercent); def->label = L("'As bridge' speed threshold"); def->full_label = L("Overhang bridge speed threshold"); @@ -7524,6 +7538,7 @@ std::unordered_set<std::string> prusa_export_to_remove_keys = { "overhangs_reverse_threshold", "overhangs_reverse", "overhangs_speed", +"overhangs_speed_enforce", "overhangs_width_speed", "perimeter_bonding", "perimeter_extrusion_spacing", diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 76bb8d451..f2428957a 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -876,6 +876,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionFloatOrPercent, min_width_top_surface)) // Detect bridging perimeters ((ConfigOptionFloatOrPercent, overhangs_speed)) + ((ConfigOptionInt, overhangs_speed_enforce)) ((ConfigOptionFloatOrPercent, overhangs_width)) ((ConfigOptionFloatOrPercent, overhangs_width_speed)) ((ConfigOptionBool, overhangs_reverse)) diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 3cf9b201a..c929bd2aa 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -980,6 +980,7 @@ bool PrintObject::invalidate_state_by_config_options( || opt_key == "gap_fill_speed" || opt_key == "infill_speed" || opt_key == "overhangs_speed" + || opt_key == "overhangs_speed_enforce" || opt_key == "perimeter_speed" || opt_key == "seam_position" || opt_key == "seam_preferred_direction" |