Only take layer_id instead of layer in filler objects

This commit is contained in:
Alessandro Ranellucci 2012-10-30 14:25:48 +01:00
parent 61047f0df5
commit 5943114574
2 changed files with 4 additions and 4 deletions

View file

@ -56,7 +56,7 @@ sub make_fill {
my $self = shift;
my ($layer) = @_;
$_->layer($layer) for values %{$self->fillers};
$_->layer_id($layer->id) for values %{$self->fillers};
Slic3r::debugf "Filling layer %d:\n", $layer->id;

View file

@ -4,7 +4,7 @@ use Moo;
use Slic3r::Geometry qw(PI);
has 'print' => (is => 'rw');
has 'layer' => (is => 'rw');
has 'layer_id' => (is => 'rw');
has 'max_print_dimension' => (is => 'rw');
has 'angle' => (is => 'rw', default => sub { $Slic3r::Config->fill_angle });
@ -20,9 +20,9 @@ sub infill_direction {
$rotate[1] = [ $self->max_print_dimension * sqrt(2) / 2, $self->max_print_dimension * sqrt(2) / 2 ];
@shift = @{$rotate[1]};
if ($self->layer) {
if (defined $self->layer_id) {
# alternate fill direction
my $layer_num = $self->layer->id / $surface->depth_layers;
my $layer_num = $self->layer_id / $surface->depth_layers;
my $angle = $self->angles->[$layer_num % @{$self->angles}];
$rotate[0] = Slic3r::Geometry::deg2rad($self->angle) + $angle if $angle;
}