From 5843f5df6c1697fec65faab8372c83567035c0c4 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Wed, 19 Jun 2013 17:34:37 +0200 Subject: [PATCH] Fix regression in --complete-objects causing fatal error and/or wrong warnings about object heights --- lib/Slic3r/Print.pm | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index 7a9d5ed9f..0fd3ddc52 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -188,10 +188,16 @@ sub validate { # check vertical clearance { - my @obj_copies = $self->object_copies; - pop @obj_copies; # ignore the last copy: its height doesn't matter - my $scaled_clearance = scale $Slic3r::Config->extruder_clearance_height; - if (grep { +($_->size)[Z] > $scaled_clearance } map @{$self->objects->[$_->[0]]->meshes}, @obj_copies) { + my @object_height = (); + foreach my $object (@{$self->objects}) { + my $height = $object->size->[Z]; + push @object_height, $height for @{$object->copies}; + } + @object_height = sort { $a <=> $b } @object_height; + # ignore the tallest *copy* (this is why we repeat height for all of them): + # it will be printed as last one so its height doesn't matter + pop @object_height; + if (max(@object_height) > scale $Slic3r::Config->extruder_clearance_height) { die "Some objects are too tall and cannot be printed without extruder collisions.\n"; } } @@ -265,15 +271,6 @@ sub init_extruders { } } -sub object_copies { - my $self = shift; - my @oc = (); - for my $obj_idx (0 .. $#{$self->objects}) { - push @oc, map [ $obj_idx, $_ ], @{$self->objects->[$obj_idx]->copies}; - } - return @oc; -} - sub layer_count { my $self = shift; return max(map { scalar @{$_->layers} } @{$self->objects});