Only skip objects with no layers without stopping the whole job

This commit is contained in:
Alessandro Ranellucci 2013-06-03 11:39:23 +02:00
parent 8c74d2f41e
commit 7134df4638
2 changed files with 7 additions and 4 deletions

View File

@ -322,6 +322,13 @@ sub export_gcode {
$status_cb->(10, "Processing triangulated mesh"); $status_cb->(10, "Processing triangulated mesh");
$_->slice for @{$self->objects}; $_->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) { if ($Slic3r::Config->resolution) {
$status_cb->(15, "Simplifying input"); $status_cb->(15, "Simplifying input");
$self->_simplify_slices(scale $Slic3r::Config->resolution); $self->_simplify_slices(scale $Slic3r::Config->resolution);

View File

@ -190,7 +190,6 @@ sub slice {
# remove last layer(s) if empty # remove last layer(s) if empty
pop @{$self->layers} while @{$self->layers} && (!map @{$_->lines}, @{$self->layers->[-1]->regions}); 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 }) { foreach my $layer (@{ $self->layers }) {
# make sure all layers contain layer region objects for all regions # make sure all layers contain layer region objects for all regions
@ -277,9 +276,6 @@ sub slice {
$self->layers->[$i]->id($i); $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 { sub make_perimeters {