diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index 91a4dca6a..894676867 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -538,7 +538,7 @@ sub write_gcode { # print objects from the smallest to the tallest to avoid collisions # when moving onto next object starting point - my @obj_idx = sort { $a->layer_count <=> $b->layer_count } 0..$#{$self->objects}; + my @obj_idx = sort { $self->objects->[$a]->layer_count <=> $self->objects->[$b]->layer_count } 0..$#{$self->objects}; my $finished_objects = 0; for my $obj_idx (@obj_idx) {