From 14c7a8ad7fbc9392f70ca11e352e70e7682e3b1f Mon Sep 17 00:00:00 2001 From: supermerill Date: Wed, 30 Sep 2020 22:59:03 +0200 Subject: [PATCH] gap fill overlap also move the perimeter & extperi overlap to region --- resources/ui_layout/print.ui | 5 +++-- src/libslic3r/Config.hpp | 2 +- src/libslic3r/Layer.cpp | 11 +++++++---- src/libslic3r/PerimeterGenerator.cpp | 14 +++++++++----- src/libslic3r/PrintConfig.cpp | 13 +++++++++++++ src/libslic3r/PrintConfig.hpp | 18 ++++++++++-------- src/slic3r/GUI/Preset.cpp | 1 + 7 files changed, 44 insertions(+), 20 deletions(-) diff --git a/resources/ui_layout/print.ui b/resources/ui_layout/print.ui index 4379ea320..3e5f5a09a 100644 --- a/resources/ui_layout/print.ui +++ b/resources/ui_layout/print.ui @@ -224,8 +224,8 @@ group:Acceleration control (advanced) setting:first_layer_acceleration setting:default_acceleration group:Autospeed (advanced) + setting:label$Volumetric speed for Autospeed:max_volumetric_speed setting:max_print_speed - setting:max_volumetric_speed page:Width & Flow:width group:Extrusion width @@ -241,8 +241,9 @@ group:Extrusion width recommended_extrusion_width_description group:Overlap line:Perimeter overlap + setting:label$Default:perimeter_overlap setting:label$External:external_perimeter_overlap - setting:label$Inner:perimeter_overlap + setting:label$Gap Fill:gap_fill_overlap end_line setting:infill_overlap setting:bridge_overlap diff --git a/src/libslic3r/Config.hpp b/src/libslic3r/Config.hpp index 05fe265c0..58f4521e2 100644 --- a/src/libslic3r/Config.hpp +++ b/src/libslic3r/Config.hpp @@ -827,7 +827,7 @@ public: ConfigOption* clone() const override { return new ConfigOptionPercent(*this); } ConfigOptionPercent& operator=(const ConfigOption *opt) { this->set(opt); return *this; } bool operator==(const ConfigOptionPercent &rhs) const { return this->value == rhs.value; } - double get_abs_value(double ratio_over) const { return ratio_over * this->value / 100; } + double get_abs_value(double ratio_over) const { return ratio_over * this->value / 100.; } std::string serialize() const override { diff --git a/src/libslic3r/Layer.cpp b/src/libslic3r/Layer.cpp index 746d6e70d..d8fa37bb4 100644 --- a/src/libslic3r/Layer.cpp +++ b/src/libslic3r/Layer.cpp @@ -136,17 +136,18 @@ void Layer::make_perimeters() /// if you don't do that, objects will share the same region, and the same settings. if (config.perimeter_extruder == other_config.perimeter_extruder && config.perimeters == other_config.perimeters - && config.perimeter_speed == other_config.perimeter_speed // it os mandatory? can't this be set at gcode.cpp? && config.external_perimeter_extrusion_width == other_config.external_perimeter_extrusion_width + && config.external_perimeter_overlap == other_config.external_perimeter_overlap + && config.external_perimeter_speed == other_config.external_perimeter_speed // it os mandatory? can't this be set at gcode.cpp? && config.external_perimeters_first == other_config.external_perimeters_first - && config.external_perimeters_vase == other_config.external_perimeters_vase && config.external_perimeters_hole == other_config.external_perimeters_hole && config.external_perimeters_nothole == other_config.external_perimeters_nothole - && config.external_perimeter_speed == other_config.external_perimeter_speed + && config.external_perimeters_vase == other_config.external_perimeters_vase && config.extra_perimeters_odd_layers == other_config.extra_perimeters_odd_layers && config.extra_perimeters_overhangs == other_config.extra_perimeters_overhangs && config.gap_fill == other_config.gap_fill && config.gap_fill_min_area == other_config.gap_fill_min_area + && config.gap_fill_overlap == other_config.gap_fill_overlap && config.gap_fill_speed == other_config.gap_fill_speed && config.infill_dense == other_config.infill_dense && config.infill_dense_algo == other_config.infill_dense_algo @@ -159,13 +160,15 @@ void Layer::make_perimeters() && config.perimeter_extrusion_width == other_config.perimeter_extrusion_width && config.perimeter_loop == other_config.perimeter_loop && config.perimeter_loop_seam == other_config.perimeter_loop_seam - && config.perimeter_speed == other_config.perimeter_speed + && config.perimeter_overlap == other_config.perimeter_overlap + && config.perimeter_speed == other_config.perimeter_speed // it os mandatory? can't this be set at gcode.cpp? && config.small_perimeter_speed == other_config.small_perimeter_speed && config.thin_walls == other_config.thin_walls && config.thin_walls_min_width == other_config.thin_walls_min_width && config.thin_walls_overlap == other_config.thin_walls_overlap && config.thin_perimeters == other_config.thin_perimeters && config.thin_perimeters_all == other_config.thin_perimeters_all + && config.thin_walls_speed == other_config.thin_walls_speed && config.infill_overlap == other_config.infill_overlap && config.perimeter_loop == other_config.perimeter_loop) { layerms.push_back(other_layerm); diff --git a/src/libslic3r/PerimeterGenerator.cpp b/src/libslic3r/PerimeterGenerator.cpp index dd858250b..a17cda600 100644 --- a/src/libslic3r/PerimeterGenerator.cpp +++ b/src/libslic3r/PerimeterGenerator.cpp @@ -38,8 +38,8 @@ namespace Slic3r { void PerimeterGenerator::process() { //set spacing - this->perimeter_flow.spacing_ratio = this->object_config->perimeter_overlap.get_abs_value(1); - this->ext_perimeter_flow.spacing_ratio = this->object_config->external_perimeter_overlap.get_abs_value(1); + this->perimeter_flow.spacing_ratio = this->config->perimeter_overlap.get_abs_value(1); + this->ext_perimeter_flow.spacing_ratio = this->config->external_perimeter_overlap.get_abs_value(1); // other perimeters this->_mm3_per_mm = this->perimeter_flow.mm3_per_mm(); @@ -58,12 +58,16 @@ void PerimeterGenerator::process() // overhang perimeters this->_mm3_per_mm_overhang = this->overhang_flow.mm3_per_mm(); + //gap fill + coord_t gap_fill_spacing = this->config->gap_fill_overlap.get_abs_value(this->perimeter_flow.scaled_spacing()) + + this->perimeter_flow.scaled_width() * (100 - this->config->gap_fill_overlap.value) / 100.; + // solid infill coord_t solid_infill_spacing = this->solid_infill_flow.scaled_spacing(); //infill / perimeter coord_t infill_peri_overlap = (coord_t)scale_(this->config->get_abs_value("infill_overlap", unscale(perimeter_spacing + solid_infill_spacing) / 2)); - // infill gap to add vs periemter (useful if using perimeter bonding) + // infill gap to add vs perimeter (useful if using perimeter bonding) coord_t infill_gap = 0; @@ -541,7 +545,7 @@ void PerimeterGenerator::process() } } else { - // If "detect thin walls" is not enabled, this paths will be entered, which + // If "overlapping_perimeters" is enabled, this paths will be entered, which // leads to overflows, as in prusa3d/Slic3r GH #32 next_onion = offset_ex(last, double( - good_spacing)); } @@ -553,7 +557,7 @@ void PerimeterGenerator::process() // (but still long enough to escape the area threshold) that gap fill // won't be able to fill but we'd still remove from infill area append(gaps, diff_ex( - offset(last, -0.5f*good_spacing), + offset(last, -0.5f * gap_fill_spacing), offset(next_onion, 0.5f * good_spacing + 10))); // safety offset } diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 376a1ef8c..8e4931c6b 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -1676,6 +1676,19 @@ void PrintConfigDef::init_fff_params() def->mode = comExpert; def->set_default_value(new ConfigOptionFloatOrPercent{ 100,true }); + def = this->add("gap_fill_overlap", coPercent); + def->label = L("Gap fill overlap"); + def->full_label = L("Gap fill overlap"); + def->category = OptionCategory::width; + def->tooltip = L("This setting allow you to reduce the overlap between the perimeters and the gap fill." + " 100% means that no gaps is left, and 0% means that the gap fill won't touch the perimeters." + "\nIt's very experimental, please report about the usefulness. It may be removed if there is no use for it."); + def->sidetext = L("%"); + def->min = 0; + def->max = 100; + def->mode = comExpert; + def->set_default_value(new ConfigOptionPercent(100)); + def = this->add("gap_fill_speed", coFloat); def->label = L("Gap fill"); def->full_label = L("Gap fill speed"); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 6d606aeeb..16308a423 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -525,7 +525,6 @@ public: ConfigOptionBool dont_support_bridges; ConfigOptionPercent external_perimeter_cut_corners; ConfigOptionBool exact_last_layer_height; - ConfigOptionPercent external_perimeter_overlap; ConfigOptionFloatOrPercent extrusion_width; ConfigOptionFloatOrPercent first_layer_height; ConfigOptionFloat first_layer_size_compensation; @@ -536,7 +535,6 @@ public: ConfigOptionFloat layer_height; ConfigOptionFloat model_precision; ConfigOptionPercent perimeter_bonding; - ConfigOptionPercent perimeter_overlap; ConfigOptionInt raft_layers; ConfigOptionEnum seam_position; ConfigOptionBool seam_travel; @@ -591,7 +589,6 @@ protected: OPT_PTR(dont_support_bridges); OPT_PTR(external_perimeter_cut_corners); OPT_PTR(exact_last_layer_height); - OPT_PTR(external_perimeter_overlap); OPT_PTR(extrusion_width); OPT_PTR(hole_size_compensation); OPT_PTR(first_layer_height); @@ -601,7 +598,6 @@ protected: OPT_PTR(layer_height); OPT_PTR(model_precision); OPT_PTR(perimeter_bonding); - OPT_PTR(perimeter_overlap); OPT_PTR(raft_layers); OPT_PTR(seam_position); OPT_PTR(seam_travel); @@ -661,11 +657,12 @@ public: ConfigOptionBool enforce_full_fill_volume; ConfigOptionFloatOrPercent external_infill_margin; ConfigOptionFloatOrPercent external_perimeter_extrusion_width; + ConfigOptionPercent external_perimeter_overlap; ConfigOptionFloatOrPercent external_perimeter_speed; ConfigOptionBool external_perimeters_first; - ConfigOptionBool external_perimeters_vase; - ConfigOptionBool external_perimeters_nothole; ConfigOptionBool external_perimeters_hole; + ConfigOptionBool external_perimeters_nothole; + ConfigOptionBool external_perimeters_vase; ConfigOptionBool extra_perimeters; ConfigOptionBool extra_perimeters_odd_layers; ConfigOptionBool extra_perimeters_overhangs; @@ -679,6 +676,7 @@ public: ConfigOptionFloatOrPercent fill_smooth_width; ConfigOptionBool gap_fill; ConfigOptionFloatOrPercent gap_fill_min_area; + ConfigOptionPercent gap_fill_overlap; ConfigOptionFloat gap_fill_speed; ConfigOptionBool hole_to_polyhole; ConfigOptionInt infill_extruder; @@ -705,6 +703,7 @@ public: ConfigOptionFloatOrPercent perimeter_extrusion_width; ConfigOptionBool perimeter_loop; ConfigOptionEnum perimeter_loop_seam; + ConfigOptionPercent perimeter_overlap; ConfigOptionFloat perimeter_speed; // Total number of perimeters. ConfigOptionInt perimeters; @@ -751,11 +750,12 @@ protected: OPT_PTR(enforce_full_fill_volume); OPT_PTR(external_infill_margin); OPT_PTR(external_perimeter_extrusion_width); + OPT_PTR(external_perimeter_overlap); OPT_PTR(external_perimeter_speed); OPT_PTR(external_perimeters_first); - OPT_PTR(external_perimeters_vase); - OPT_PTR(external_perimeters_nothole); OPT_PTR(external_perimeters_hole); + OPT_PTR(external_perimeters_nothole); + OPT_PTR(external_perimeters_vase); OPT_PTR(extra_perimeters); OPT_PTR(extra_perimeters_odd_layers); OPT_PTR(extra_perimeters_overhangs); @@ -769,6 +769,7 @@ protected: OPT_PTR(fill_smooth_width); OPT_PTR(gap_fill); OPT_PTR(gap_fill_min_area); + OPT_PTR(gap_fill_overlap); OPT_PTR(gap_fill_speed); OPT_PTR(hole_to_polyhole); OPT_PTR(infill_extruder); @@ -794,6 +795,7 @@ protected: OPT_PTR(perimeter_extrusion_width); OPT_PTR(perimeter_loop); OPT_PTR(perimeter_loop_seam); + OPT_PTR(perimeter_overlap); OPT_PTR(perimeter_speed); OPT_PTR(perimeters); OPT_PTR(print_extrusion_multiplier); diff --git a/src/slic3r/GUI/Preset.cpp b/src/slic3r/GUI/Preset.cpp index 220e6e4fb..2c1111c94 100644 --- a/src/slic3r/GUI/Preset.cpp +++ b/src/slic3r/GUI/Preset.cpp @@ -472,6 +472,7 @@ const std::vector& Preset::print_options() "bridge_speed", "gap_fill", "gap_fill_min_area", + "gap_fill_overlap", "gap_fill_speed", "travel_speed", "first_layer_speed", "perimeter_acceleration", "infill_acceleration", "bridge_acceleration", "first_layer_acceleration", "default_acceleration",