From f2e84310d5e06e8dd2f2a86126a7163eed3ff93c Mon Sep 17 00:00:00 2001 From: igiannakas Date: Sun, 31 Dec 2023 23:21:02 +0000 Subject: [PATCH 1/6] ENH: Enabled gap fill algorithm for all solid fill types --- src/libslic3r/Fill/FillBase.cpp | 51 +++++++++++++++++++++++++- src/libslic3r/Fill/FillBase.hpp | 3 +- src/libslic3r/Fill/FillRectilinear.cpp | 19 +++++++++- src/libslic3r/Fill/FillRectilinear.hpp | 16 +++++++- 4 files changed, 83 insertions(+), 6 deletions(-) diff --git a/src/libslic3r/Fill/FillBase.cpp b/src/libslic3r/Fill/FillBase.cpp index 0a159d5d881..99ff1980154 100644 --- a/src/libslic3r/Fill/FillBase.cpp +++ b/src/libslic3r/Fill/FillBase.cpp @@ -67,7 +67,8 @@ Fill* Fill::new_from_type(const InfillPattern type) // BBS: for internal solid infill only case ipConcentricInternal: return new FillConcentricInternal(); // BBS: for bottom and top surface only - case ipMonotonicLine: return new FillMonotonicLineWGapFill(); + // Orca: Replace BBS implementation with Prusa implementation + case ipMonotonicLine: return new FillMonotonicLines(); default: throw Slic3r::InvalidArgument("unknown type"); } } @@ -173,6 +174,54 @@ void Fill::fill_surface_extrusion(const Surface* surface, const FillParams& para for (size_t i = idx; i < eec->entities.size(); i++) eec->entities[i]->set_reverse(); } + + // Orca: Enable gap fill algorithm for all selected surface types + // To-do: Potentially present option to user to select which surface types gap fill is applied to + if(surface->surface_type == stBottom || surface->surface_type == stTop || surface->surface_type == stInternalSolid){ + Flow new_flow = params.flow; + ExPolygons unextruded_areas; + unextruded_areas = diff_ex(this->no_overlap_expolygons, union_ex(eec->polygons_covered_by_spacing(10))); + ExPolygons gapfill_areas = union_ex(unextruded_areas); + if (!this->no_overlap_expolygons.empty()) + gapfill_areas = intersection_ex(gapfill_areas, this->no_overlap_expolygons); + + if (gapfill_areas.size() > 0 && params.density >= 1) { + double min = 0.2 * new_flow.scaled_spacing() * (1 - INSET_OVERLAP_TOLERANCE); + double max = 2. * new_flow.scaled_spacing(); + ExPolygons gaps_ex = diff_ex( + opening_ex(gapfill_areas, float(min / 2.)), + offset2_ex(gapfill_areas, -float(max / 2.), float(max / 2. + ClipperSafetyOffset))); + //BBS: sort the gap_ex to avoid mess travel + Points ordering_points; + ordering_points.reserve(gaps_ex.size()); + ExPolygons gaps_ex_sorted; + gaps_ex_sorted.reserve(gaps_ex.size()); + for (const ExPolygon &ex : gaps_ex) + ordering_points.push_back(ex.contour.first_point()); + std::vector order2 = chain_points(ordering_points); + for (size_t i : order2) + gaps_ex_sorted.emplace_back(std::move(gaps_ex[i])); + + ThickPolylines polylines; + for (ExPolygon& ex : gaps_ex_sorted) { + //BBS: Use DP simplify to avoid duplicated points and accelerate medial-axis calculation as well. + ex.douglas_peucker(SCALED_RESOLUTION * 0.1); + ex.medial_axis(min, max, &polylines); + } + + if (!polylines.empty() && !is_bridge(params.extrusion_role)) { + polylines.erase(std::remove_if(polylines.begin(), polylines.end(), + [&](const ThickPolyline& p) { + return p.length() < scale_(params.config->filter_out_gap_fill.value); + }), polylines.end()); + + ExtrusionEntityCollection gap_fill; + variable_width(polylines, erGapFill, params.flow, gap_fill.entities); + auto gap = std::move(gap_fill.entities); + eec->append(gap); + } + } + } } } diff --git a/src/libslic3r/Fill/FillBase.hpp b/src/libslic3r/Fill/FillBase.hpp index f4eaa20fb68..ef29392148e 100644 --- a/src/libslic3r/Fill/FillBase.hpp +++ b/src/libslic3r/Fill/FillBase.hpp @@ -19,6 +19,7 @@ #include "../Flow.hpp" #include "../ExtrusionEntity.hpp" #include "../ExtrusionEntityCollection.hpp" +#include "../ShortestPath.hpp" namespace Slic3r { @@ -134,7 +135,7 @@ class Fill // Perform the fill. virtual Polylines fill_surface(const Surface *surface, const FillParams ¶ms); virtual ThickPolylines fill_surface_arachne(const Surface* surface, const FillParams& params); - + // BBS: this method is used to fill the ExtrusionEntityCollection. // It call fill_surface by default virtual void fill_surface_extrusion(const Surface* surface, const FillParams& params, ExtrusionEntitiesPtr& out); diff --git a/src/libslic3r/Fill/FillRectilinear.cpp b/src/libslic3r/Fill/FillRectilinear.cpp index 7a3816e7925..eb128ffd5eb 100644 --- a/src/libslic3r/Fill/FillRectilinear.cpp +++ b/src/libslic3r/Fill/FillRectilinear.cpp @@ -3099,7 +3099,22 @@ Points sample_grid_pattern(const Polygons& polygons, coord_t spacing, const Boun return sample_grid_pattern(union_ex(polygons), spacing, global_bounding_box); } -void FillMonotonicLineWGapFill::fill_surface_extrusion(const Surface* surface, const FillParams& params, ExtrusionEntitiesPtr& out) +// Orca: Introduced FillMonotonicLines from Prusa slicer, inhereting from FillRectilinear +// This replaces the FillMonotonicLineWGapFill from BBS +Polylines FillMonotonicLines::fill_surface(const Surface *surface, const FillParams ¶ms) +{ + FillParams params2 = params; + params2.monotonic = true; + params2.anchor_length_max = 0.0f; + Polylines polylines_out; + if (! fill_surface_by_lines(surface, params2, 0.f, 0.f, polylines_out)) + BOOST_LOG_TRIVIAL(error) << "FillMonotonicLines::fill_surface() failed to fill a region."; + return polylines_out; +} + +// Orca: Replaced with FillMonotonicLines from Prusa slicer. Moved gap fill algorithm to +// FillBase to perform gap fill for all fill types. +/*void FillMonotonicLineWGapFill::fill_surface_extrusion(const Surface* surface, const FillParams& params, ExtrusionEntitiesPtr& out) { ExtrusionEntityCollection *coll_nosort = new ExtrusionEntityCollection(); coll_nosort->no_sort = this->no_sort(); @@ -3269,7 +3284,7 @@ void FillMonotonicLineWGapFill::fill_surface_by_lines(const Surface* surface, co //assert(! it->has_duplicate_points()); it->remove_duplicate_points(); } -} +}*/ } // namespace Slic3r diff --git a/src/libslic3r/Fill/FillRectilinear.hpp b/src/libslic3r/Fill/FillRectilinear.hpp index c1b1680431c..f85dce07e85 100644 --- a/src/libslic3r/Fill/FillRectilinear.hpp +++ b/src/libslic3r/Fill/FillRectilinear.hpp @@ -119,7 +119,19 @@ class FillSupportBase : public FillRectilinear float _layer_angle(size_t idx) const override { return 0.f; } }; -class FillMonotonicLineWGapFill : public Fill +// Orca: Introduced FillMonotonicLines from Prusa slicer, inhereting from FillRectilinear +// This replaces the FillMonotonicLineWGapFill from BBS +class FillMonotonicLines : public FillRectilinear +{ +public: + Fill* clone() const override { return new FillMonotonicLines(*this); } + ~FillMonotonicLines() override = default; + Polylines fill_surface(const Surface *surface, const FillParams ¶ms) override; + bool no_sort() const override { return true; } +}; + +//Orca: Replaced with FillMonotonicLines, inheriting from FillRectilinear +/*class FillMonotonicLineWGapFill : public Fill { public: ~FillMonotonicLineWGapFill() override = default; @@ -131,7 +143,7 @@ class FillMonotonicLineWGapFill : public Fill private: void fill_surface_by_lines(const Surface* surface, const FillParams& params, Polylines& polylines_out); -}; +};*/ Points sample_grid_pattern(const ExPolygon& expolygon, coord_t spacing, const BoundingBox& global_bounding_box); Points sample_grid_pattern(const ExPolygons& expolygons, coord_t spacing, const BoundingBox& global_bounding_box); From 8c98787a7ad105cb55532c0646df8f7b5f27d2bc Mon Sep 17 00:00:00 2001 From: igiannakas Date: Mon, 1 Jan 2024 13:59:12 +0000 Subject: [PATCH 2/6] Made gap fill an option & refactored code into its own method --- src/libslic3r/Fill/FillBase.cpp | 103 ++++++++++++++++++-------------- src/libslic3r/Fill/FillBase.hpp | 4 ++ src/libslic3r/Preset.cpp | 2 +- src/libslic3r/PrintConfig.cpp | 16 +++++ src/libslic3r/PrintConfig.hpp | 2 + src/slic3r/GUI/Tab.cpp | 2 + 6 files changed, 83 insertions(+), 46 deletions(-) diff --git a/src/libslic3r/Fill/FillBase.cpp b/src/libslic3r/Fill/FillBase.cpp index 99ff1980154..a750a7dfb33 100644 --- a/src/libslic3r/Fill/FillBase.cpp +++ b/src/libslic3r/Fill/FillBase.cpp @@ -175,52 +175,65 @@ void Fill::fill_surface_extrusion(const Surface* surface, const FillParams& para eec->entities[i]->set_reverse(); } - // Orca: Enable gap fill algorithm for all selected surface types - // To-do: Potentially present option to user to select which surface types gap fill is applied to - if(surface->surface_type == stBottom || surface->surface_type == stTop || surface->surface_type == stInternalSolid){ - Flow new_flow = params.flow; - ExPolygons unextruded_areas; - unextruded_areas = diff_ex(this->no_overlap_expolygons, union_ex(eec->polygons_covered_by_spacing(10))); - ExPolygons gapfill_areas = union_ex(unextruded_areas); - if (!this->no_overlap_expolygons.empty()) - gapfill_areas = intersection_ex(gapfill_areas, this->no_overlap_expolygons); + // Orca: run gap fill + this->_create_gap_fill(surface, params, eec); + } +} + +// Orca: Enable gap fill algorithm for all surface types based on user preference. +void Fill::_create_gap_fill(const Surface* surface, const FillParams& params, ExtrusionEntityCollection* out){ + + //Orca: just to be safe, check against null pointer for the print object config and if NULL return. + if (this->print_object_config == nullptr) return; + + // Orca: Enable gap fill as per the user preference. Return early if gap fill is to not be applied. + if(!((((surface->surface_type == stBottom || surface->surface_type == stTop) && + this->print_object_config->enable_gap_fill_for_top_bottom_surfaces) || + (surface->surface_type == stInternalSolid && this->print_object_config->enable_gap_fill_for_solid_infill)))) + return; + + + Flow new_flow = params.flow; + ExPolygons unextruded_areas; + unextruded_areas = diff_ex(this->no_overlap_expolygons, union_ex(out->polygons_covered_by_spacing(10))); + ExPolygons gapfill_areas = union_ex(unextruded_areas); + if (!this->no_overlap_expolygons.empty()) + gapfill_areas = intersection_ex(gapfill_areas, this->no_overlap_expolygons); + + if (gapfill_areas.size() > 0 && params.density >= 1) { + double min = 0.2 * new_flow.scaled_spacing() * (1 - INSET_OVERLAP_TOLERANCE); + double max = 2. * new_flow.scaled_spacing(); + ExPolygons gaps_ex = diff_ex( + opening_ex(gapfill_areas, float(min / 2.)), + offset2_ex(gapfill_areas, -float(max / 2.), float(max / 2. + ClipperSafetyOffset))); + //BBS: sort the gap_ex to avoid mess travel + Points ordering_points; + ordering_points.reserve(gaps_ex.size()); + ExPolygons gaps_ex_sorted; + gaps_ex_sorted.reserve(gaps_ex.size()); + for (const ExPolygon &ex : gaps_ex) + ordering_points.push_back(ex.contour.first_point()); + std::vector order2 = chain_points(ordering_points); + for (size_t i : order2) + gaps_ex_sorted.emplace_back(std::move(gaps_ex[i])); + + ThickPolylines polylines; + for (ExPolygon& ex : gaps_ex_sorted) { + //BBS: Use DP simplify to avoid duplicated points and accelerate medial-axis calculation as well. + ex.douglas_peucker(SCALED_RESOLUTION * 0.1); + ex.medial_axis(min, max, &polylines); + } + + if (!polylines.empty() && !is_bridge(params.extrusion_role)) { + polylines.erase(std::remove_if(polylines.begin(), polylines.end(), + [&](const ThickPolyline& p) { + return p.length() < scale_(params.config->filter_out_gap_fill.value); + }), polylines.end()); - if (gapfill_areas.size() > 0 && params.density >= 1) { - double min = 0.2 * new_flow.scaled_spacing() * (1 - INSET_OVERLAP_TOLERANCE); - double max = 2. * new_flow.scaled_spacing(); - ExPolygons gaps_ex = diff_ex( - opening_ex(gapfill_areas, float(min / 2.)), - offset2_ex(gapfill_areas, -float(max / 2.), float(max / 2. + ClipperSafetyOffset))); - //BBS: sort the gap_ex to avoid mess travel - Points ordering_points; - ordering_points.reserve(gaps_ex.size()); - ExPolygons gaps_ex_sorted; - gaps_ex_sorted.reserve(gaps_ex.size()); - for (const ExPolygon &ex : gaps_ex) - ordering_points.push_back(ex.contour.first_point()); - std::vector order2 = chain_points(ordering_points); - for (size_t i : order2) - gaps_ex_sorted.emplace_back(std::move(gaps_ex[i])); - - ThickPolylines polylines; - for (ExPolygon& ex : gaps_ex_sorted) { - //BBS: Use DP simplify to avoid duplicated points and accelerate medial-axis calculation as well. - ex.douglas_peucker(SCALED_RESOLUTION * 0.1); - ex.medial_axis(min, max, &polylines); - } - - if (!polylines.empty() && !is_bridge(params.extrusion_role)) { - polylines.erase(std::remove_if(polylines.begin(), polylines.end(), - [&](const ThickPolyline& p) { - return p.length() < scale_(params.config->filter_out_gap_fill.value); - }), polylines.end()); - - ExtrusionEntityCollection gap_fill; - variable_width(polylines, erGapFill, params.flow, gap_fill.entities); - auto gap = std::move(gap_fill.entities); - eec->append(gap); - } - } + ExtrusionEntityCollection gap_fill; + variable_width(polylines, erGapFill, params.flow, gap_fill.entities); + auto gap = std::move(gap_fill.entities); + out->append(gap); } } } diff --git a/src/libslic3r/Fill/FillBase.hpp b/src/libslic3r/Fill/FillBase.hpp index ef29392148e..e78c1b98b56 100644 --- a/src/libslic3r/Fill/FillBase.hpp +++ b/src/libslic3r/Fill/FillBase.hpp @@ -107,6 +107,7 @@ class Fill FillAdaptive::Octree* adapt_fill_octree = nullptr; // PrintConfig and PrintObjectConfig are used by infills that use Arachne (Concentric and FillEnsuring). + // Orca: also used by gap fill function. const PrintConfig *print_config = nullptr; const PrintObjectConfig *print_object_config = nullptr; @@ -173,6 +174,9 @@ class Fill virtual float _layer_angle(size_t idx) const { return (idx & 1) ? float(M_PI/2.) : 0; } virtual std::pair _infill_direction(const Surface *surface) const; + + // Orca: Enable gap fill algorithm for all surface types + void _create_gap_fill(const Surface* surface, const FillParams& params, ExtrusionEntityCollection* out); public: static void connect_infill(Polylines &&infill_ordered, const ExPolygon &boundary, Polylines &polylines_out, const double spacing, const FillParams ¶ms); diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index dba5cf05e57..a211ce8bcaa 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -771,7 +771,7 @@ static std::vector s_Preset_print_options { "extra_perimeters_on_overhangs", "ensure_vertical_shell_thickness", "reduce_crossing_wall", "detect_thin_wall", "detect_overhang_wall", "overhang_reverse", "overhang_reverse_threshold","overhang_reverse_internal_only", "seam_position", "staggered_inner_seams", "wall_sequence", "is_infill_first", "sparse_infill_density", "sparse_infill_pattern", "top_surface_pattern", "bottom_surface_pattern", "infill_direction", - "minimum_sparse_infill_area", "reduce_infill_retraction","internal_solid_infill_pattern", + "minimum_sparse_infill_area", "reduce_infill_retraction","internal_solid_infill_pattern","enable_gap_fill_for_solid_infill","enable_gap_fill_for_top_bottom_surfaces", "ironing_type", "ironing_pattern", "ironing_flow", "ironing_speed", "ironing_spacing", "ironing_angle", "max_travel_detour_distance", "fuzzy_skin", "fuzzy_skin_thickness", "fuzzy_skin_point_distance", "fuzzy_skin_first_layer", diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 1073c0d20b5..83f6d0d5010 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -745,6 +745,14 @@ void PrintConfigDef::init_fff_params() def->sidetext = L("mm"); def->min = 0; def->set_default_value(new ConfigOptionFloat(0.)); + + def = this->add("enable_gap_fill_for_top_bottom_surfaces", coBool); + def->label = L("Enable gap fill"); + def->category = L("Strength"); + def->tooltip = L("Enables gap fill for top and bottom surfaces. The minimum gap length that will be filled can be controlled" + "from the filter out tiny gaps option in the infill section below."); + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionBool(true)); def = this->add("enable_overhang_bridge_fan", coBools); def->label = L("Force cooling for overhang and bridge"); @@ -1306,6 +1314,14 @@ void PrintConfigDef::init_fff_params() def->enum_labels = def_top_fill_pattern->enum_labels; def->set_default_value(new ConfigOptionEnum(ipMonotonic)); + def = this->add("enable_gap_fill_for_solid_infill", coBool); + def->label = L("Enable gap fill"); + def->category = L("Strength"); + def->tooltip = L("Enables gap fill for internal solid infill. The minimum gap length that will be filled can be controlled" + "from the filter out tiny gaps option"); + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionBool(false)); + def = this->add("outer_wall_line_width", coFloatOrPercent); def->label = L("Outer wall"); def->category = L("Quality"); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 4b1ddc49471..dfa2d375e2c 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -784,6 +784,8 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionPercent, tree_support_top_rate)) ((ConfigOptionFloat, tree_support_branch_diameter_organic)) ((ConfigOptionFloat, tree_support_branch_angle_organic)) + ((ConfigOptionBool, enable_gap_fill_for_solid_infill)) + ((ConfigOptionBool, enable_gap_fill_for_top_bottom_surfaces)) // Move all acceleration and jerk settings to object ((ConfigOptionFloat, default_acceleration)) diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index bdff8121128..6ab27684e3b 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -2000,6 +2000,7 @@ void TabPrint::build() optgroup->append_single_option_line("bottom_surface_pattern", "fill-patterns#Infill of the top surface and bottom surface"); optgroup->append_single_option_line("bottom_shell_layers"); optgroup->append_single_option_line("bottom_shell_thickness"); + optgroup->append_single_option_line("enable_gap_fill_for_top_bottom_surfaces"); optgroup = page->new_optgroup(L("Infill"), L"param_infill"); optgroup->append_single_option_line("sparse_infill_density"); @@ -2007,6 +2008,7 @@ void TabPrint::build() optgroup->append_single_option_line("infill_anchor"); optgroup->append_single_option_line("infill_anchor_max"); optgroup->append_single_option_line("internal_solid_infill_pattern"); + optgroup->append_single_option_line("enable_gap_fill_for_solid_infill"); optgroup->append_single_option_line("filter_out_gap_fill"); optgroup = page->new_optgroup(L("Advanced"), L"param_advanced"); From bfafa5447697155dee881ff74d34435a2a00b2fd Mon Sep 17 00:00:00 2001 From: igiannakas Date: Mon, 1 Jan 2024 19:10:12 +0000 Subject: [PATCH 3/6] Code comment updates --- src/libslic3r/Fill/FillBase.cpp | 3 ++- src/libslic3r/Fill/FillBase.hpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/Fill/FillBase.cpp b/src/libslic3r/Fill/FillBase.cpp index a750a7dfb33..bc5a03d6f69 100644 --- a/src/libslic3r/Fill/FillBase.cpp +++ b/src/libslic3r/Fill/FillBase.cpp @@ -180,7 +180,8 @@ void Fill::fill_surface_extrusion(const Surface* surface, const FillParams& para } } -// Orca: Enable gap fill algorithm for all surface types based on user preference. +// Orca: Dedicated function to calculate gap fill lines for the provided surface, according to the print object parameters +// and append them to the out ExtrusionEntityCollection. void Fill::_create_gap_fill(const Surface* surface, const FillParams& params, ExtrusionEntityCollection* out){ //Orca: just to be safe, check against null pointer for the print object config and if NULL return. diff --git a/src/libslic3r/Fill/FillBase.hpp b/src/libslic3r/Fill/FillBase.hpp index e78c1b98b56..38f8c722b5d 100644 --- a/src/libslic3r/Fill/FillBase.hpp +++ b/src/libslic3r/Fill/FillBase.hpp @@ -175,7 +175,8 @@ class Fill virtual std::pair _infill_direction(const Surface *surface) const; - // Orca: Enable gap fill algorithm for all surface types + // Orca: Dedicated function to calculate gap fill lines for the provided surface, according to the print object parameters + // and append them to the out ExtrusionEntityCollection. void _create_gap_fill(const Surface* surface, const FillParams& params, ExtrusionEntityCollection* out); public: From ca70ff9a35f61e1985e515d449c3a1c09a9c2d22 Mon Sep 17 00:00:00 2001 From: igiannakas Date: Thu, 18 Jan 2024 10:53:52 +0000 Subject: [PATCH 4/6] Converted gap fill to enum and control filter out gap fill in the UI --- src/libslic3r/Fill/FillBase.cpp | 8 ++---- src/libslic3r/Preset.cpp | 2 +- src/libslic3r/PrintConfig.cpp | 41 ++++++++++++++++++--------- src/libslic3r/PrintConfig.hpp | 10 +++++-- src/slic3r/GUI/ConfigManipulation.cpp | 4 +++ src/slic3r/GUI/Tab.cpp | 3 +- 6 files changed, 44 insertions(+), 24 deletions(-) diff --git a/src/libslic3r/Fill/FillBase.cpp b/src/libslic3r/Fill/FillBase.cpp index bc5a03d6f69..772395f9bc4 100644 --- a/src/libslic3r/Fill/FillBase.cpp +++ b/src/libslic3r/Fill/FillBase.cpp @@ -188,11 +188,9 @@ void Fill::_create_gap_fill(const Surface* surface, const FillParams& params, Ex if (this->print_object_config == nullptr) return; // Orca: Enable gap fill as per the user preference. Return early if gap fill is to not be applied. - if(!((((surface->surface_type == stBottom || surface->surface_type == stTop) && - this->print_object_config->enable_gap_fill_for_top_bottom_surfaces) || - (surface->surface_type == stInternalSolid && this->print_object_config->enable_gap_fill_for_solid_infill)))) - return; - + if ((this->print_object_config->gap_fill_target.value == gftNowhere) || + (surface->surface_type == stInternalSolid && this->print_object_config->gap_fill_target.value != gftEverywhere)) + return; Flow new_flow = params.flow; ExPolygons unextruded_areas; diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 3e220f311f9..8503e07d8f7 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -771,7 +771,7 @@ static std::vector s_Preset_print_options { "extra_perimeters_on_overhangs", "ensure_vertical_shell_thickness", "reduce_crossing_wall", "detect_thin_wall", "detect_overhang_wall", "overhang_reverse", "overhang_reverse_threshold","overhang_reverse_internal_only", "seam_position", "staggered_inner_seams", "wall_sequence", "is_infill_first", "sparse_infill_density", "sparse_infill_pattern", "top_surface_pattern", "bottom_surface_pattern", "infill_direction", - "minimum_sparse_infill_area", "reduce_infill_retraction","internal_solid_infill_pattern","enable_gap_fill_for_solid_infill","enable_gap_fill_for_top_bottom_surfaces", + "minimum_sparse_infill_area", "reduce_infill_retraction","internal_solid_infill_pattern","gap_fill_target", "ironing_type", "ironing_pattern", "ironing_flow", "ironing_speed", "ironing_spacing", "ironing_angle", "max_travel_detour_distance", "fuzzy_skin", "fuzzy_skin_thickness", "fuzzy_skin_point_distance", "fuzzy_skin_first_layer", diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index d2788f991ad..1d7d24ca25a 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -248,6 +248,7 @@ static t_config_enum_values s_keys_map_SeamPosition { }; CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(SeamPosition) +// Orca static t_config_enum_values s_keys_map_InternalBridgeFilter { { "disabled", ibfDisabled }, { "limited", ibfLimited }, @@ -255,6 +256,14 @@ static t_config_enum_values s_keys_map_InternalBridgeFilter { }; CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(InternalBridgeFilter) +// Orca +static t_config_enum_values s_keys_map_GapFillTarget { + { "everywhere", gftEverywhere }, + { "topbottom", gftTopBottom }, + { "nowhere", gftNowhere }, +}; +CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(GapFillTarget) + static const t_config_enum_values s_keys_map_SLADisplayOrientation = { { "landscape", sladoLandscape}, { "portrait", sladoPortrait} @@ -753,13 +762,25 @@ void PrintConfigDef::init_fff_params() def->min = 0; def->set_default_value(new ConfigOptionFloat(0.)); - def = this->add("enable_gap_fill_for_top_bottom_surfaces", coBool); - def->label = L("Enable gap fill"); + def = this->add("gap_fill_target", coEnum); + def->label = L("Apply gap fill"); def->category = L("Strength"); - def->tooltip = L("Enables gap fill for top and bottom surfaces. The minimum gap length that will be filled can be controlled" - "from the filter out tiny gaps option in the infill section below."); - def->mode = comAdvanced; - def->set_default_value(new ConfigOptionBool(true)); + def->tooltip = L("Enables gap fill for the selected surfaces. The minimum gap length that will be filled can be controlled" + "from the filter out tiny gaps option below.\n\n" + "Options:\n" + "1. Everywhere: Applies gap fill to top, bottom and internal solid surfaces\n" + "2. Top and Bottom surfaces: Applies gap fill to top and bottom surfaces only\n" + "3. Nowhere: Disables gap fill\n"); + def->enum_keys_map = &ConfigOptionEnum::get_enum_values(); + def->enum_values.push_back("everywhere"); + def->enum_values.push_back("topbottom"); + def->enum_values.push_back("nowhere"); + def->enum_labels.push_back(L("Everywhere")); + def->enum_labels.push_back(L("Top and Bottom surfaces")); + def->enum_labels.push_back(L("Nowhere")); + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionEnum(gftEverywhere)); + def = this->add("enable_overhang_bridge_fan", coBools); def->label = L("Force cooling for overhang and bridge"); @@ -1347,14 +1368,6 @@ void PrintConfigDef::init_fff_params() def->enum_labels = def_top_fill_pattern->enum_labels; def->set_default_value(new ConfigOptionEnum(ipMonotonic)); - def = this->add("enable_gap_fill_for_solid_infill", coBool); - def->label = L("Enable gap fill"); - def->category = L("Strength"); - def->tooltip = L("Enables gap fill for internal solid infill. The minimum gap length that will be filled can be controlled" - "from the filter out tiny gaps option"); - def->mode = comAdvanced; - def->set_default_value(new ConfigOptionBool(false)); - def = this->add("outer_wall_line_width", coFloatOrPercent); def->label = L("Outer wall"); def->category = L("Quality"); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 2db5ef33d9e..1059474fdea 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -152,10 +152,17 @@ enum SeamPosition { spNearest, spAligned, spRear, spRandom }; +//Orca enum InternalBridgeFilter { ibfDisabled, ibfLimited, ibfNofilter }; +//Orca +enum GapFillTarget { + gftEverywhere, gftTopBottom, gftNowhere + }; + + enum LiftType { NormalLift, SpiralLift, @@ -789,8 +796,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionPercent, tree_support_top_rate)) ((ConfigOptionFloat, tree_support_branch_diameter_organic)) ((ConfigOptionFloat, tree_support_branch_angle_organic)) - ((ConfigOptionBool, enable_gap_fill_for_solid_infill)) - ((ConfigOptionBool, enable_gap_fill_for_top_bottom_surfaces)) + ((ConfigOptionEnum,gap_fill_target)) ((ConfigOptionFloat, min_length_factor)) // Move all acceleration and jerk settings to object diff --git a/src/slic3r/GUI/ConfigManipulation.cpp b/src/slic3r/GUI/ConfigManipulation.cpp index 3a0b5fe390e..50d009a7c0f 100644 --- a/src/slic3r/GUI/ConfigManipulation.cpp +++ b/src/slic3r/GUI/ConfigManipulation.cpp @@ -510,6 +510,10 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co apply(config, &new_conf); } + // Orca: Hide the filter out tiny gaps field when gap fill target is nowhere as no gap fill will be applied. + bool have_gap_fill = config->opt_enum("gap_fill_target") != gftNowhere; + toggle_line("filter_out_gap_fill", have_gap_fill); + bool have_perimeters = config->opt_int("wall_loops") > 0; for (auto el : { "extra_perimeters_on_overhangs", "ensure_vertical_shell_thickness", "detect_thin_wall", "detect_overhang_wall", "seam_position", "staggered_inner_seams", "wall_sequence", "outer_wall_line_width", diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index cbea685e9eb..963af51e6bb 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -2002,7 +2002,6 @@ void TabPrint::build() optgroup->append_single_option_line("bottom_surface_pattern", "fill-patterns#Infill of the top surface and bottom surface"); optgroup->append_single_option_line("bottom_shell_layers"); optgroup->append_single_option_line("bottom_shell_thickness"); - optgroup->append_single_option_line("enable_gap_fill_for_top_bottom_surfaces"); optgroup = page->new_optgroup(L("Infill"), L"param_infill"); optgroup->append_single_option_line("sparse_infill_density"); @@ -2010,7 +2009,7 @@ void TabPrint::build() optgroup->append_single_option_line("infill_anchor"); optgroup->append_single_option_line("infill_anchor_max"); optgroup->append_single_option_line("internal_solid_infill_pattern"); - optgroup->append_single_option_line("enable_gap_fill_for_solid_infill"); + optgroup->append_single_option_line("gap_fill_target"); optgroup->append_single_option_line("filter_out_gap_fill"); optgroup = page->new_optgroup(L("Advanced"), L"param_advanced"); From 7e243a8105c578275b1462844a66f21faca995a5 Mon Sep 17 00:00:00 2001 From: igiannakas Date: Thu, 18 Jan 2024 11:29:00 +0000 Subject: [PATCH 5/6] Update label for consistency --- src/libslic3r/PrintConfig.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 1d7d24ca25a..15b0c799177 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -776,7 +776,7 @@ void PrintConfigDef::init_fff_params() def->enum_values.push_back("topbottom"); def->enum_values.push_back("nowhere"); def->enum_labels.push_back(L("Everywhere")); - def->enum_labels.push_back(L("Top and Bottom surfaces")); + def->enum_labels.push_back(L("Top and bottom surfaces")); def->enum_labels.push_back(L("Nowhere")); def->mode = comAdvanced; def->set_default_value(new ConfigOptionEnum(gftEverywhere)); From 95134e81367063e7e53d8377836427dd3c883fbe Mon Sep 17 00:00:00 2001 From: igiannakas Date: Thu, 18 Jan 2024 11:30:23 +0000 Subject: [PATCH 6/6] Spelling mistake --- src/libslic3r/PrintConfig.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 15b0c799177..89f485dca9a 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -765,7 +765,7 @@ void PrintConfigDef::init_fff_params() def = this->add("gap_fill_target", coEnum); def->label = L("Apply gap fill"); def->category = L("Strength"); - def->tooltip = L("Enables gap fill for the selected surfaces. The minimum gap length that will be filled can be controlled" + def->tooltip = L("Enables gap fill for the selected surfaces. The minimum gap length that will be filled can be controlled " "from the filter out tiny gaps option below.\n\n" "Options:\n" "1. Everywhere: Applies gap fill to top, bottom and internal solid surfaces\n"