diff --git a/lib/Slic3r/Fill.pm b/lib/Slic3r/Fill.pm index 4b0354cee..bd7faf866 100644 --- a/lib/Slic3r/Fill.pm +++ b/lib/Slic3r/Fill.pm @@ -17,7 +17,7 @@ use Slic3r::Geometry::Clipper qw(union union_ex diff diff_ex intersection_ex off use Slic3r::Surface ':types'; -has 'object' => (is => 'ro', required => 1, weak_ref => 1); +has 'bounding_box' => (is => 'ro', required => 0); has 'fillers' => (is => 'rw', default => sub { {} }); our %FillTypes = ( @@ -40,7 +40,7 @@ sub filler { } $self->fillers->{$filler} ||= $FillTypes{$filler}->new( - bounding_box => $self->object->bounding_box, + bounding_box => $self->bounding_box, ); return $self->fillers->{$filler}; } diff --git a/lib/Slic3r/Fill/Base.pm b/lib/Slic3r/Fill/Base.pm index e63ce8843..f7d62284c 100644 --- a/lib/Slic3r/Fill/Base.pm +++ b/lib/Slic3r/Fill/Base.pm @@ -5,7 +5,7 @@ use Slic3r::Geometry qw(PI); has 'layer_id' => (is => 'rw'); has 'angle' => (is => 'rw', default => sub { $Slic3r::Config->fill_angle }); -has 'bounding_box' => (is => 'ro', required => 1); # Slic3r::Geometry::BoundingBox object +has 'bounding_box' => (is => 'ro', required => 0); # Slic3r::Geometry::BoundingBox object sub angles () { [0, PI/2] } @@ -16,7 +16,9 @@ sub infill_direction { # set infill angle my (@rotate, @shift); $rotate[0] = Slic3r::Geometry::deg2rad($self->angle); - $rotate[1] = $self->bounding_box->center_2D; + $rotate[1] = $self->bounding_box + ? $self->bounding_box->center_2D + : $surface->expolygon->bounding_box->center_2D; @shift = @{$rotate[1]}; if (defined $self->layer_id) { diff --git a/lib/Slic3r/Layer/Region.pm b/lib/Slic3r/Layer/Region.pm index b37f73f38..387de20dd 100644 --- a/lib/Slic3r/Layer/Region.pm +++ b/lib/Slic3r/Layer/Region.pm @@ -328,7 +328,7 @@ sub _fill_gaps { return unless @$gaps; - my $filler = $self->layer->object->fill_maker->filler('rectilinear'); + my $filler = Slic3r::Fill->new->filler('rectilinear'); $filler->layer_id($self->layer->id); # we should probably use this code to handle thin walls and remove that logic from diff --git a/lib/Slic3r/Print/Object.pm b/lib/Slic3r/Print/Object.pm index b0b0115bf..4d5a5e600 100644 --- a/lib/Slic3r/Print/Object.pm +++ b/lib/Slic3r/Print/Object.pm @@ -76,7 +76,7 @@ sub BUILD { sub _build_fill_maker { my $self = shift; - return Slic3r::Fill->new(object => $self); + return Slic3r::Fill->new(bounding_box => $self->bounding_box); } # This should be probably moved in Print.pm at the point where we sort Layer objects