diff --git a/lib/Slic3r/GUI/3DScene.pm b/lib/Slic3r/GUI/3DScene.pm index 9e35e32f7..34dd48ca8 100644 --- a/lib/Slic3r/GUI/3DScene.pm +++ b/lib/Slic3r/GUI/3DScene.pm @@ -1471,8 +1471,21 @@ sub draw_active_object_annotations { my $max_z = unscale($print_object->size->z); my $profile = $print_object->model_object->layer_height_profile; my $layer_height = $print_object->config->get('layer_height'); - my $layer_heights_max = $print_object->print->config->get('max_layer_height'); - my $layer_height_max = my $max = max(@{$layer_heights_max}) * 1.12; + my $layer_height_max = 10000000000.; + { + # Get a maximum layer height value. + #FIXME This is a duplicate code of Slicing.cpp. + my $nozzle_diameters = $print_object->print->config->get('nozzle_diameter'); + my $layer_heights_min = $print_object->print->config->get('min_layer_height'); + my $layer_heights_max = $print_object->print->config->get('max_layer_height'); + for (my $i = 0; $i < scalar(@{$nozzle_diameters}); $i += 1) { + my $lh_min = ($layer_heights_min->[$i] == 0.) ? 0.07 : max(0.01, $layer_heights_min->[$i]); + my $lh_max = ($layer_heights_max->[$i] == 0.) ? (0.75 * $nozzle_diameters->[$i]) : $layer_heights_max->[$i]; + $layer_height_max = min($layer_height_max, max($lh_min, $lh_max)); + } + } + # Make the vertical bar a bit wider so the layer height curve does not touch the edge of the bar region. + $layer_height_max *= 1.12; # Baseline glColor3f(0., 0., 0.); glBegin(GL_LINE_STRIP); diff --git a/xs/src/libslic3r/Slicing.cpp b/xs/src/libslic3r/Slicing.cpp index 0348af0f9..27cebdd46 100644 --- a/xs/src/libslic3r/Slicing.cpp +++ b/xs/src/libslic3r/Slicing.cpp @@ -21,7 +21,7 @@ namespace Slic3r { static const coordf_t MIN_LAYER_HEIGHT = 0.01; -static const coordf_t MIN_LAYER_HEIGHT_DEFAULT = 0.05; +static const coordf_t MIN_LAYER_HEIGHT_DEFAULT = 0.07; // Minimum layer height for the variable layer height algorithm. inline coordf_t min_layer_height_from_nozzle(const PrintConfig &print_config, int idx_nozzle)