From 7134df4638e6fee0ba1ae1f480c9d1c0574a0502 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Mon, 3 Jun 2013 11:39:23 +0200 Subject: [PATCH] Only skip objects with no layers without stopping the whole job --- lib/Slic3r/Print.pm | 7 +++++++ lib/Slic3r/Print/Object.pm | 4 ---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index c3fbb7b34..0d5830614 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -322,6 +322,13 @@ sub export_gcode { $status_cb->(10, "Processing triangulated mesh"); $_->slice for @{$self->objects}; + # remove empty layers and abort if there are no more + # as some algorithms assume all objects have at least one layer + # note: this will change object indexes + @{$self->objects} = grep @{$_->layers}, @{$self->objects}; + die "No layers were detected. You might want to repair your STL file(s) or check their size and retry.\n" + if !@{$self->objects}; + if ($Slic3r::Config->resolution) { $status_cb->(15, "Simplifying input"); $self->_simplify_slices(scale $Slic3r::Config->resolution); diff --git a/lib/Slic3r/Print/Object.pm b/lib/Slic3r/Print/Object.pm index 6e8067382..dc5428dc9 100644 --- a/lib/Slic3r/Print/Object.pm +++ b/lib/Slic3r/Print/Object.pm @@ -190,7 +190,6 @@ sub slice { # remove last layer(s) if empty pop @{$self->layers} while @{$self->layers} && (!map @{$_->lines}, @{$self->layers->[-1]->regions}); - die "Invalid or too thin input file: no layers could be generated\n" if !@{$self->layers}; foreach my $layer (@{ $self->layers }) { # make sure all layers contain layer region objects for all regions @@ -277,9 +276,6 @@ sub slice { $self->layers->[$i]->id($i); } } - - warn "No layers were detected. You might want to repair your STL file and retry.\n" - if !@{$self->layers}; } sub make_perimeters {