Don't require the print object in filler objects
This commit is contained in:
parent
5943114574
commit
6c97e588b1
2 changed files with 10 additions and 6 deletions
|
@ -45,9 +45,13 @@ sub BUILD {
|
|||
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);
|
||||
my $f = $FillTypes{$filler}->new(
|
||||
max_print_dimension => $self->max_print_dimension
|
||||
);
|
||||
$f->bounding_box([ $self->print->bounding_box ]) if $filler->can('bounding_box');
|
||||
$self->fillers->{$filler} = $f;
|
||||
}
|
||||
return $self->fillers->{$filler};
|
||||
}
|
||||
|
|
|
@ -3,7 +3,8 @@ use Moo;
|
|||
|
||||
extends 'Slic3r::Fill::Base';
|
||||
|
||||
has 'cache' => (is => 'rw', default => sub {{}});
|
||||
has 'bounding_box' => (is => 'rw');
|
||||
has 'cache' => (is => 'rw', default => sub {{}});
|
||||
|
||||
use Slic3r::Geometry qw(PI X1 Y1 X2 Y2 X Y scale);
|
||||
use Slic3r::Geometry::Clipper qw(intersection_ex);
|
||||
|
@ -39,8 +40,8 @@ sub fill_surface {
|
|||
|
||||
# adjust actual bounding box to the nearest multiple of our hex pattern
|
||||
# and align it so that it matches across layers
|
||||
my $print_bounding_box = [ $self->print->bounding_box ];
|
||||
my $bounding_box = [ 0, 0, $print_bounding_box->[X2], $print_bounding_box->[Y2] ];
|
||||
$self->bounding_box([ $expolygon->bounding_box ]) if !defined $self->bounding_box;
|
||||
my $bounding_box = [ 0, 0, $self->bounding_box->[X2], $self->bounding_box->[Y2] ];
|
||||
{
|
||||
my $bb_polygon = Slic3r::Polygon->new([
|
||||
[ $bounding_box->[X1], $bounding_box->[Y1] ],
|
||||
|
@ -92,7 +93,6 @@ sub fill_surface {
|
|||
)};
|
||||
|
||||
return { flow_spacing => $params{flow_spacing} },
|
||||
map $_->polyline,
|
||||
Slic3r::Polyline::Collection->new(polylines => \@paths)->shortest_path;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue