From 1f64a01ed4611174cf3968db1b67746eb4439e9e Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Thu, 8 Dec 2011 10:25:19 +0100 Subject: [PATCH] Remove empty layers from bottom. They could be caused by little contact with the print bed, resulting in the need of thin walls. While thin walls will be supported one day, it's still not optimal to have so little contact on bottom layer(s), so we remove such layers. #96 --- lib/Slic3r/Layer.pm | 2 +- lib/Slic3r/Print.pm | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/Slic3r/Layer.pm b/lib/Slic3r/Layer.pm index 56ede956c..322f1025c 100644 --- a/lib/Slic3r/Layer.pm +++ b/lib/Slic3r/Layer.pm @@ -8,7 +8,7 @@ use XXX; # a sequential number of layer, starting at 0 has 'id' => ( - is => 'ro', + is => 'rw', #isa => 'Int', required => 1, ); diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index 72410d752..240f3626c 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -135,6 +135,14 @@ sub new_from_mesh { @$diff; } + # remove empty layers from bottom + while (!@{$print->layers->[0]->slices}) { + shift @{$print->layers}; + for (my $i = 0; $i <= $#{$print->layers}; $i++) { + $print->layers->[$i]->id($i); + } + } + return $print; }