diff --git a/lib/Slic3r/Fill.pm b/lib/Slic3r/Fill.pm index 677f3c5f2..1842d4f6d 100644 --- a/lib/Slic3r/Fill.pm +++ b/lib/Slic3r/Fill.pm @@ -16,6 +16,7 @@ use Slic3r::Geometry::Clipper qw(union_ex diff_ex); has 'print' => (is => 'ro', required => 1); +has 'max_print_dimension' => (is => 'rw'); has 'fillers' => (is => 'rw', default => sub { {} }); our %FillTypes = ( @@ -31,12 +32,22 @@ our %FillTypes = ( sub BUILD { my $self = shift; - $self->fillers->{$_} ||= $FillTypes{$_}->new(print => $self->print) - for ('rectilinear', $Slic3r::fill_pattern, $Slic3r::solid_fill_pattern); my $print_size = $self->print->size; my $max_print_dimension = ($print_size->[X] > $print_size->[Y] ? $print_size->[X] : $print_size->[Y]) * sqrt(2); - $_->max_print_dimension($max_print_dimension) for values %{$self->fillers}; + $self->max_print_dimension($max_print_dimension); + + $self->filler($_) for ('rectilinear', $Slic3r::fill_pattern, $Slic3r::solid_fill_pattern); +} + +sub filler { + my $self = shift; + my ($filler) = @_; + if (!$self->fillers->{$filler}) { + $self->fillers->{$filler} = $FillTypes{$filler}->new(print => $self->print); + $self->fillers->{$filler}->max_print_dimension($self->max_print_dimension); + } + return $self->fillers->{$filler}; } sub make_fill { diff --git a/lib/Slic3r/Print/Object.pm b/lib/Slic3r/Print/Object.pm index ceae8455f..2979405be 100644 --- a/lib/Slic3r/Print/Object.pm +++ b/lib/Slic3r/Print/Object.pm @@ -443,13 +443,14 @@ sub generate_support_material { @{union_ex([ map @$_, @unsupported_expolygons ])}; my $fill = Slic3r::Fill->new(print => $params{print}); - foreach my $angle (0, 90) { + foreach my $layer (map $self->layers->[$_], 0,1,2) { # ugly hack + $fill->filler('honeycomb')->layer($layer); my @patterns = (); foreach my $expolygon (@support_material_areas) { - my @paths = $fill->fillers->{rectilinear}->fill_surface( + my @paths = $fill->filler('honeycomb')->fill_surface( Slic3r::Surface->new( expolygon => $expolygon, - bridge_angle => $Slic3r::fill_angle + 45 + $angle, + #bridge_angle => $Slic3r::fill_angle + 45 + $angle, ), density => 0.20, flow_spacing => $Slic3r::flow_spacing, @@ -483,7 +484,7 @@ sub generate_support_material { foreach my $expolygon (@$expolygons) { push @paths, map $_->clip_with_expolygon($expolygon), map $_->clip_with_polygon($expolygon->bounding_box_polygon), - @{$support_patterns->[ $layer_id % 2 ]}; + @{$support_patterns->[ $layer_id % @$support_patterns ]}; }; return @paths; };