From 027b744ea3a4b6624964bebd10dd9d04e5b2d10f Mon Sep 17 00:00:00 2001 From: supermerill Date: Tue, 26 Nov 2019 17:37:32 +0100 Subject: [PATCH] re-enable the option for adaptive quality (auto layer height) tested on a cube with a round horizontal hole, the result is not good. --- src/libslic3r/PrintConfig.cpp | 11 ++++++++++- src/libslic3r/PrintConfig.hpp | 2 ++ src/libslic3r/PrintObject.cpp | 4 +++- src/libslic3r/Slicing.cpp | 1 + src/libslic3r/Slicing.hpp | 2 ++ src/slic3r/GUI/Preset.cpp | 4 +++- src/slic3r/GUI/Tab.cpp | 1 + 7 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 02a3869ea..89147afc1 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -71,12 +71,21 @@ void PrintConfigDef::init_common_params() def->label = L("Base Layer height"); def->category = OptionCategory::perimeter; def->tooltip = L("This setting controls the height (and thus the total number) of the slices/layers. " - "Thinner layers give better accuracy but take more time to print."); + "Thinner layers give better accuracy but take more time to print."); def->sidetext = L("mm"); def->min = 0; def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloat(0.2)); + def = this->add("layer_height_adaptive", coBool); + def->label = L("Automatic questionable layer height"); + def->category = OptionCategory::perimeter; + def->tooltip = L("This setting enable the adaptive layer height algorithm. It erase the layer height table but it's also erased by the result of the manual variable layer height feature. " + "Personally, I don't recommand to use it, it's not that good and you can do a much better job in some seconds with the manual 'variable layer height' tool.\n" + "note: it uses the min_height and max_height defined in the printer/hardware profile."); + def->mode = comExpert; + def->set_default_value(new ConfigOptionBool(false)); + def = this->add("max_print_height", coFloat); def->label = L("Max print height"); def->category = OptionCategory::general; diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index c4c830579..84a6fdbab 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -476,6 +476,7 @@ public: // Force the generation of solid shells between adjacent materials/volumes. ConfigOptionBool interface_shells; ConfigOptionFloat layer_height; + ConfigOptionBool layer_height_adaptive; ConfigOptionFloat model_precision; ConfigOptionInt raft_layers; ConfigOptionEnum seam_position; @@ -529,6 +530,7 @@ protected: OPT_PTR(infill_only_where_needed); OPT_PTR(interface_shells); OPT_PTR(layer_height); + OPT_PTR(layer_height_adaptive); OPT_PTR(model_precision); OPT_PTR(raft_layers); OPT_PTR(seam_position); diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 4e26c8c0e..8717aaf20 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -1963,7 +1963,9 @@ bool PrintObject::update_layer_height_profile(const ModelObject &model_object, c layer_height_profile.clear(); if (layer_height_profile.empty()) { - //layer_height_profile = layer_height_profile_adaptive(slicing_parameters, model_object.layer_config_ranges, model_object.volumes); + if(slicing_parameters.layer_height_adaptive) + layer_height_profile = layer_height_profile_adaptive(slicing_parameters, model_object.layer_config_ranges, model_object.volumes); + else layer_height_profile = layer_height_profile_from_ranges(slicing_parameters, model_object.layer_config_ranges); updated = true; } diff --git a/src/libslic3r/Slicing.cpp b/src/libslic3r/Slicing.cpp index 04efe87ee..2c809dadf 100644 --- a/src/libslic3r/Slicing.cpp +++ b/src/libslic3r/Slicing.cpp @@ -63,6 +63,7 @@ SlicingParameters SlicingParameters::create_from_config( SlicingParameters params; params.layer_height = object_config.layer_height.value; + params.layer_height_adaptive = object_config.layer_height_adaptive.value; params.first_print_layer_height = first_layer_height; params.first_object_layer_height = first_layer_height; params.object_print_z_min = 0.; diff --git a/src/libslic3r/Slicing.hpp b/src/libslic3r/Slicing.hpp index bf2893d95..244d4f06b 100644 --- a/src/libslic3r/Slicing.hpp +++ b/src/libslic3r/Slicing.hpp @@ -60,6 +60,8 @@ struct SlicingParameters // The regular layer height, applied for all but the first layer, if not overridden by layer ranges // or by the variable layer thickness table. coordf_t layer_height; + // enable the adpatative algorithm + bool layer_height_adaptive; // Minimum / maximum layer height, to be used for the automatic adaptive layer height algorithm, // or by an interactive layer height editor. coordf_t min_layer_height; diff --git a/src/slic3r/GUI/Preset.cpp b/src/slic3r/GUI/Preset.cpp index f1ceae7b7..f650d5087 100644 --- a/src/slic3r/GUI/Preset.cpp +++ b/src/slic3r/GUI/Preset.cpp @@ -378,7 +378,9 @@ void Preset::set_visible_from_appconfig(const AppConfig &app_config) const std::vector& Preset::print_options() { static std::vector s_opts { - "layer_height", "first_layer_height", "perimeters", "spiral_vase", "slice_closing_radius", "top_solid_layers", "bottom_solid_layers", + "layer_height", + "layer_height_adaptive", + "first_layer_height", "perimeters", "spiral_vase", "slice_closing_radius", "top_solid_layers", "bottom_solid_layers", "extra_perimeters", "extra_perimeters_odd_layers", "only_one_perimeter_top", "ensure_vertical_shell_thickness", "avoid_crossing_perimeters", diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 3cfee9131..9cb02a2d4 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -1093,6 +1093,7 @@ void TabPrint::build() optgroup = page->new_optgroup(_(L("Layer height"))); optgroup->append_single_option_line("layer_height"); optgroup->append_single_option_line("first_layer_height"); + optgroup->append_single_option_line("layer_height_adaptive"); //optgroup->append_single_option_line("exact_last_layer_height"); optgroup = page->new_optgroup(_(L("Filtering")));