Assign extruders and flows to materials

This commit is contained in:
Alessandro Ranellucci 2012-09-23 02:40:25 +02:00
parent e2ab340edb
commit e696764af8
10 changed files with 161 additions and 120 deletions

View file

@ -11,8 +11,11 @@ has 'layer' => (
is => 'ro',
weak_ref => 1,
required => 1,
handles => [qw(id slice_z print_z height flow perimeter_flow infill_flow)],
handles => [qw(id slice_z print_z height flow)],
);
has 'material' => (is => 'ro', required => 1);
has 'perimeter_flow' => (is => 'lazy');
has 'infill_flow' => (is => 'lazy');
# collection of spare segments generated by slicing the original geometry;
# these need to be merged in continuos (closed) polylines
@ -44,6 +47,20 @@ has 'perimeters' => (is => 'rw', default => sub { [] });
# ordered collection of extrusion paths to fill surfaces
has 'fills' => (is => 'rw', default => sub { [] });
sub _build_perimeter_flow {
my $self = shift;
return $self->id == 0
? $self->material->first_layer_flows->{perimeter}
: $self->material->flows->{perimeter}
}
sub _build_infill_flow {
my $self = shift;
return $self->id == 0
? $self->material->first_layer_flows->{infill}
: $self->material->flows->{infill}
}
# build polylines from lines
sub make_surfaces {
my $self = shift;