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; }