Fix regression in cut

This commit is contained in:
Alessandro Ranellucci 2014-06-14 22:36:49 +02:00
parent 182c5eb809
commit 87383250de
3 changed files with 11 additions and 12 deletions

View file

@ -553,14 +553,12 @@ sub print_info {
sub cut {
my ($self, $z) = @_;
# clone this one
my $upper = $self->model->add_object($self);
my $lower = $self->model->add_object($self);
foreach my $instance (@{$self->instances}) {
$upper->add_instance(offset => Slic3r::Pointf->new(@{$instance->offset}));
$lower->add_instance(offset => Slic3r::Pointf->new(@{$instance->offset}));
}
# clone this one to duplicate instances, materials etc.
my $model = Slic3r::Model->new;
my $upper = $model->add_object($self);
my $lower = $model->add_object($self);
$upper->clear_volumes;
$lower->clear_volumes;
foreach my $volume (@{$self->volumes}) {
if ($volume->modifier) {
@ -584,7 +582,7 @@ sub cut {
);
}
if ($lower_mesh->facets_count > 0) {
$lower->add_volume(
$lower->add_volume(
material_id => $volume->material_id,
mesh => $lower_mesh,
modifier => $volume->modifier,
@ -595,7 +593,7 @@ sub cut {
$upper = undef if !@{$upper->volumes};
$lower = undef if !@{$lower->volumes};
return ($upper, $lower);
return ($model, $upper, $lower);
}
package Slic3r::Model::Volume;