Explicitely clip support material with object slices (test case from #1397)

This commit is contained in:
Alessandro Ranellucci 2013-10-27 23:20:06 +01:00
parent 29b83517cb
commit ff25cc97fa

View File

@ -46,10 +46,12 @@ sub generate {
# Propagate contact layers downwards to generate interface layers # Propagate contact layers downwards to generate interface layers
my ($interface) = $self->generate_interface_layers($support_z, $contact, $top); my ($interface) = $self->generate_interface_layers($support_z, $contact, $top);
$self->clip_with_object($interface, $support_z, $object);
# Propagate contact layers and interface layers downwards to generate # Propagate contact layers and interface layers downwards to generate
# the main support layers. # the main support layers.
my ($base) = $self->generate_base_layers($support_z, $contact, $interface, $top); my ($base) = $self->generate_base_layers($support_z, $contact, $interface, $top);
$self->clip_with_object($base, $support_z, $object);
# Install support layers into object. # Install support layers into object.
push @{$object->support_layers}, map Slic3r::Layer::Support->new( push @{$object->support_layers}, map Slic3r::Layer::Support->new(
@ -200,7 +202,7 @@ sub object_top {
# grow top surfaces so that interface and support generation are generated # grow top surfaces so that interface and support generation are generated
# with some spacing from object - it looks we don't need the actual # with some spacing from object - it looks we don't need the actual
# top shapes so this can be done here # top shapes so this can be done here
$top{ $layer->print_z } = offset($touching, $self->flow->scaled_spacing); $top{ $layer->print_z } = offset($touching, $self->flow->scaled_width);
} }
# remove the areas that touched from the projection that will continue on # remove the areas that touched from the projection that will continue on
@ -329,6 +331,24 @@ sub generate_base_layers {
return $base; return $base;
} }
sub clip_with_object {
my ($self, $support, $support_z, $object) = @_;
foreach my $i (keys %$support) {
next if !@{$support->{$i}};
my $zmax = $support_z->[$i];
my $zmin = ($i == 0) ? 0 : $support_z->[$i-1];
my @layers = grep { $_->print_z > $zmin && ($_->print_z - $_->height) < $zmax }
@{$object->layers};
$support->{$i} = diff(
$support->{$i},
offset([ map @$_, map @{$_->slices}, @layers ], +$self->flow->scaled_width),
);
}
}
sub generate_toolpaths { sub generate_toolpaths {
my ($self, $object, $overhang, $contact, $interface, $base) = @_; my ($self, $object, $overhang, $contact, $interface, $base) = @_;