From 83c42c3d4f6cf0314a316954671f031743006331 Mon Sep 17 00:00:00 2001 From: Wang YB <94800665+Gradbb@users.noreply.github.com> Date: Thu, 18 Jan 2024 09:16:21 +0800 Subject: [PATCH 1/5] Modify variable name --- src/libslic3r/PerimeterGenerator.cpp | 2 +- src/libslic3r/PrintConfig.cpp | 14 +++++++------- src/libslic3r/PrintConfig.hpp | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/libslic3r/PerimeterGenerator.cpp b/src/libslic3r/PerimeterGenerator.cpp index 24d73e3..b951b66 100644 --- a/src/libslic3r/PerimeterGenerator.cpp +++ b/src/libslic3r/PerimeterGenerator.cpp @@ -1784,7 +1784,7 @@ void PerimeterGenerator::process_classic( //w16 ExPolygons fill_clip; ExPolygons top_fills; - if (loop_number > 0 && params.object_config.top_one_wall_type != TopOneWallType::None && upper_slices == nullptr) + if (loop_number > 0 && params.object_config.top_one_wall_type != TopOneWallType::Disable && upper_slices == nullptr) loop_number = 0; if (loop_number >= 0) { // In case no perimeters are to be generated, loop_number will equal to -1. diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index db1156d..e2e8a30 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -237,9 +237,9 @@ static t_config_enum_values s_keys_map_PerimeterGeneratorType { CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(PerimeterGeneratorType) //w16 -static t_config_enum_values s_keys_map_TopOneWallType{{"not apply", int(TopOneWallType::None)}, - {"all top", int(TopOneWallType::Alltop)}, - {"Only top most", int(TopOneWallType::Onlytopmost)}}; +static t_config_enum_values s_keys_map_TopOneWallType{{"Disable", int(TopOneWallType::Disable)}, + {"all_top", int(TopOneWallType::Alltop)}, + {"Only_top_most", int(TopOneWallType::Onlytopmost)}}; CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(TopOneWallType) static void assign_printer_technology_to_unknown(t_optiondef_map &options, PrinterTechnology printer_technology) @@ -3543,12 +3543,12 @@ void PrintConfigDef::init_fff_params() def->category = L("Layers and Perimeters"); def->tooltip = L("Use only one wall on flat top surface, to give more space to the top infill pattern. Could be applyed on topmost surface or all top surface."); def->set_enum({ - { "none", L("None") }, - { "Only top most", L("Onlytopmost") }, - { "all top", L("Alltop") } + { "Disable", L("Disable") }, + { "all_top", L("All top") }, + { "Only_top_most", L("Only top most") } }); def->mode = comAdvanced; - def->set_default_value(new ConfigOptionEnum(TopOneWallType::None)); + def->set_default_value(new ConfigOptionEnum(TopOneWallType::Disable)); def = this->add("wall_transition_length", coFloatOrPercent); def->label = L("Perimeter transition length"); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index af9aad5..bdcd6ac 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -145,7 +145,7 @@ enum class PerimeterGeneratorType enum class GCodeThumbnailsFormat { QIDI,PNG, JPG, QOI }; //w16 -enum class TopOneWallType { None, Alltop, Onlytopmost }; +enum class TopOneWallType { Disable, Alltop, Onlytopmost }; #define CONFIG_OPTION_ENUM_DECLARE_STATIC_MAPS(NAME) \ template<> const t_config_enum_names& ConfigOptionEnum::get_enum_names(); \ From 12da7dac6a152878324d9b8caccc12641c26e7d1 Mon Sep 17 00:00:00 2001 From: Wang YB <94800665+Gradbb@users.noreply.github.com> Date: Thu, 18 Jan 2024 09:17:50 +0800 Subject: [PATCH 2/5] Modify default values --- 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 e2e8a30..3bab28d 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -3548,7 +3548,7 @@ void PrintConfigDef::init_fff_params() { "Only_top_most", L("Only top most") } }); def->mode = comAdvanced; - def->set_default_value(new ConfigOptionEnum(TopOneWallType::Disable)); + def->set_default_value(new ConfigOptionEnum(TopOneWallType::Alltop)); def = this->add("wall_transition_length", coFloatOrPercent); def->label = L("Perimeter transition length"); From 2eecb1ce8a4f96b8709a5127e1304ddccdaed026 Mon Sep 17 00:00:00 2001 From: Wang YB <94800665+Gradbb@users.noreply.github.com> Date: Thu, 18 Jan 2024 10:16:47 +0800 Subject: [PATCH 3/5] add top area threshold --- src/libslic3r/PerimeterGenerator.cpp | 11 +++++++++-- src/libslic3r/Preset.cpp | 2 ++ src/libslic3r/PrintConfig.cpp | 10 ++++++++++ src/libslic3r/PrintConfig.hpp | 2 ++ src/libslic3r/PrintObject.cpp | 6 ++++-- src/slic3r/GUI/Tab.cpp | 2 ++ 6 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/libslic3r/PerimeterGenerator.cpp b/src/libslic3r/PerimeterGenerator.cpp index b951b66..0cb1f45 100644 --- a/src/libslic3r/PerimeterGenerator.cpp +++ b/src/libslic3r/PerimeterGenerator.cpp @@ -1302,9 +1302,14 @@ void PerimeterGenerator::process_arachne( out_loops.append(extrusion_coll); ExPolygons infill_contour = union_ex(wallToolPaths.getInnerContour()); + //w17 const coord_t spacing = (perimeters.size() == 1) ? ext_perimeter_spacing2 : perimeter_spacing; if (offset_ex(infill_contour, -float(spacing / 2.)).empty()) infill_contour.clear(); // Infill region is too small, so let's filter it out. + coord_t perimeter_width = params.perimeter_flow.scaled_width(); + double min_width_top_surface = (params.object_config.top_area_threshold / 100) * + std::max(double(ext_perimeter_spacing / 4 + 10), double(perimeter_width / 4)); + infill_contour = offset2_ex(infill_contour, -min_width_top_surface, min_width_top_surface + perimeter_width); // create one more offset to be used as boundary for fill // we offset by half the perimeter spacing (to get to the actual infill boundary) @@ -1440,7 +1445,8 @@ void PerimeterGenerator::process_with_one_wall_arachne( std::max(ext_perimeter_spacing, perimeter_width)); infill_contour = diff_ex(infill_contour, bridge_area); } - double min_width_top_surface = std::max(double(ext_perimeter_spacing / 4 + 10), double(perimeter_width / 4)); + //w17 + double min_width_top_surface = (params.object_config.top_area_threshold / 100) * std::max(double(ext_perimeter_spacing / 4 + 10), double(perimeter_width / 4)); infill_contour = offset2_ex(infill_contour, -min_width_top_surface, min_width_top_surface + perimeter_width); ExPolygons surface_not_export_to_top = diff_ex(the_layer_surface, infill_contour); @@ -1891,7 +1897,8 @@ void PerimeterGenerator::process_classic( 0.9 * (params.config.perimeters.value <= 1 ? 0. : (perimeter_spacing * (params.config.perimeters.value - 1)))); else offset_top_surface = 0; - double min_width_top_surface = (100) * + //w17 + double min_width_top_surface = (params.object_config.top_area_threshold/100 ) * std::max(double(ext_perimeter_spacing / 2 + 10), 1.0 * (double(perimeter_width))); BoundingBox last_box = get_extents(last); last_box.offset(SCALED_EPSILON); diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index c03e1a5..8859081 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -477,6 +477,8 @@ static std::vector s_Preset_print_options { ,"seam_gap" //w16 , "top_one_wall_type" + //w17 + ,"top_area_threshold" }; static std::vector s_Preset_filament_options { diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 3bab28d..ca50339 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -3550,6 +3550,16 @@ void PrintConfigDef::init_fff_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionEnum(TopOneWallType::Alltop)); + //w17 + def = this->add("top_area_threshold", coPercent); + def->label = L("Top area threshold"); + def->tooltip = L("This factor affects the acreage of top area. The small the number the big the top area."); + def->sidetext = L("%"); + def->min = 0; + def->max = 500; + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionPercent(100)); + def = this->add("wall_transition_length", coFloatOrPercent); def->label = L("Perimeter transition length"); def->category = L("Advanced"); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index bdcd6ac..c391800 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -592,6 +592,8 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionBool, detect_narrow_internal_solid_infill)) //w16 ((ConfigOptionEnum, top_one_wall_type)) + //w17 + ((ConfigOptionPercent, top_area_threshold)) ) PRINT_CONFIG_CLASS_DEFINE( diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 167fe63..d3b2193 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -865,8 +865,10 @@ bool PrintObject::invalidate_state_by_config_options( || opt_key == "wall_distribution_count" || opt_key == "min_feature_size" || opt_key == "min_bead_width" - //w15 - || opt_key == "top_one_wall_type"){ + //w16 + || opt_key == "top_one_wall_type" + //w17 + || opt_key == "top_area_threshold") { steps.emplace_back(posSlice); } else if ( opt_key == "seam_position" diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index ff4ba14..c67f0ab 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -1469,6 +1469,8 @@ void TabPrint::build() optgroup->append_single_option_line("perimeter_generator"); //w16 optgroup->append_single_option_line("top_one_wall_type"); + //w17 + optgroup->append_single_option_line("top_area_threshold"); optgroup = page->new_optgroup(L("Fuzzy skin (experimental)")); category_path = "fuzzy-skin_246186/#"; From 821eb8ebe9f5a611016bf7127373ffb00c858ff1 Mon Sep 17 00:00:00 2001 From: Wang YB <94800665+Gradbb@users.noreply.github.com> Date: Thu, 18 Jan 2024 13:22:03 +0800 Subject: [PATCH 4/5] reverse fill path --- src/libslic3r/Fill/FillRectilinear.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libslic3r/Fill/FillRectilinear.cpp b/src/libslic3r/Fill/FillRectilinear.cpp index e27017b..2389f72 100644 --- a/src/libslic3r/Fill/FillRectilinear.cpp +++ b/src/libslic3r/Fill/FillRectilinear.cpp @@ -2993,6 +2993,10 @@ Polylines FillGrid::fill_surface(const Surface *surface, const FillParams ¶m { { 0.f, 0.f }, { float(M_PI / 2.), 0.f } }, polylines_out)) BOOST_LOG_TRIVIAL(error) << "FillGrid::fill_surface() failed to fill a region."; + //w18 reverse fill path + if (this->layer_id % 2 == 1) + for (int i = 0; i < polylines_out.size(); i++) + std::reverse(polylines_out[i].begin(), polylines_out[i].end()); return polylines_out; } From b6f5986a9ae463e6fd649d7bd9349f72dc1ca06a Mon Sep 17 00:00:00 2001 From: QIDI TECH <893239786@qq.com> Date: Thu, 18 Jan 2024 13:45:11 +0800 Subject: [PATCH 5/5] Update PrintConfig.cpp --- src/libslic3r/PrintConfig.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index ca50339..5871d0c 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -237,9 +237,9 @@ static t_config_enum_values s_keys_map_PerimeterGeneratorType { CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(PerimeterGeneratorType) //w16 -static t_config_enum_values s_keys_map_TopOneWallType{{"Disable", int(TopOneWallType::Disable)}, +static t_config_enum_values s_keys_map_TopOneWallType{{"disable", int(TopOneWallType::Disable)}, {"all_top", int(TopOneWallType::Alltop)}, - {"Only_top_most", int(TopOneWallType::Onlytopmost)}}; + {"only_top_most", int(TopOneWallType::Onlytopmost)}}; CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(TopOneWallType) static void assign_printer_technology_to_unknown(t_optiondef_map &options, PrinterTechnology printer_technology) @@ -3543,9 +3543,9 @@ void PrintConfigDef::init_fff_params() def->category = L("Layers and Perimeters"); def->tooltip = L("Use only one wall on flat top surface, to give more space to the top infill pattern. Could be applyed on topmost surface or all top surface."); def->set_enum({ - { "Disable", L("Disable") }, + { "disable", L("Disable") }, { "all_top", L("All top") }, - { "Only_top_most", L("Only top most") } + { "only_top_most", L("Only top most") } }); def->mode = comAdvanced; def->set_default_value(new ConfigOptionEnum(TopOneWallType::Alltop));