Renamed ExtrusionPath->depth_layers to height

This commit is contained in:
Alessandro Ranellucci 2012-10-28 14:22:51 +01:00
parent 2796041a6c
commit f35cdef2aa
5 changed files with 16 additions and 16 deletions

View File

@ -18,8 +18,8 @@ has 'polyline' => (
handles => [qw(merge_continuous_lines lines length reverse)],
);
# depth_layers is the vertical thickness of the extrusion expressed in layers
has 'depth_layers' => (is => 'ro', default => sub {1});
# height is the vertical thickness of the extrusion expressed in mm
has 'height' => (is => 'ro');
has 'flow_spacing' => (is => 'rw');
has 'role' => (is => 'rw', required => 1);
@ -34,7 +34,7 @@ use constant EXTR_ROLE_BRIDGE => 7;
use constant EXTR_ROLE_SKIRT => 8;
use constant EXTR_ROLE_SUPPORTMATERIAL => 9;
use constant PACK_FMT => 'cfca*';
use constant PACK_FMT => 'ffca*';
# class or object method
sub pack {
@ -42,11 +42,11 @@ sub pack {
my %args = @_;
if (ref $self) {
%args = map { $_ => $self->$_ } qw(depth_layers flow_spacing role polyline);
%args = map { $_ => $self->$_ } qw(height flow_spacing role polyline);
}
my $o = \ pack PACK_FMT,
$args{depth_layers} || 1,
$args{height} // -1,
$args{flow_spacing} || -1,
$args{role} // (die "Missing mandatory attribute 'role'"), #/
$args{polyline}->serialize;
@ -93,7 +93,7 @@ sub clip_with_expolygon {
foreach my $polyline ($self->polyline->clip_with_expolygon($expolygon)) {
push @paths, (ref $self)->new(
polyline => $polyline,
depth_layers => $self->depth_layers,
height => $self->height,
flow_spacing => $self->flow_spacing,
role => $self->role,
);
@ -137,7 +137,7 @@ sub split_at_acute_angles {
push @paths, (ref $self)->new(
polyline => Slic3r::Polyline->new(\@p),
role => $self->role,
depth_layers => $self->depth_layers,
height => $self->height,
);
@p = ($p3);
push @p, grep $_, shift @points or last;
@ -148,7 +148,7 @@ sub split_at_acute_angles {
push @paths, (ref $self)->new(
polyline => Slic3r::Polyline->new(\@p),
role => $self->role,
depth_layers => $self->depth_layers,
height => $self->height,
) if @p > 1;
return @paths;
@ -246,7 +246,7 @@ sub detect_arcs {
push @paths, (ref $self)->new(
polyline => Slic3r::Polyline->new(@points[0..$i]),
role => $self->role,
depth_layers => $self->depth_layers,
height => $self->height,
) if $i > 0;
# add our arc
@ -265,7 +265,7 @@ sub detect_arcs {
push @paths, (ref $self)->new(
polyline => Slic3r::Polyline->new(\@points),
role => $self->role,
depth_layers => $self->depth_layers,
height => $self->height,
) if @points > 1;
return @paths;
@ -275,11 +275,11 @@ package Slic3r::ExtrusionPath::Packed;
sub unpack {
my $self = shift;
my ($depth_layers, $flow_spacing, $role, $polyline_s)
my ($height, $flow_spacing, $role, $polyline_s)
= unpack Slic3r::ExtrusionPath::PACK_FMT, $$self;
return Slic3r::ExtrusionPath->new(
depth_layers => $depth_layers,
height => ($height == -1) ? undef : $height,
flow_spacing => ($flow_spacing == -1) ? undef : $flow_spacing,
role => $role,
polyline => Slic3r::Polyline->deserialize($polyline_s),

View File

@ -169,7 +169,7 @@ sub make_fill {
: $is_solid
? ($surface->surface_type == S_TYPE_TOP ? EXTR_ROLE_TOPSOLIDFILL : EXTR_ROLE_SOLIDFILL)
: EXTR_ROLE_FILL),
depth_layers => $surface->depth_layers,
height => $surface->depth_layers * $Slic3r::Config->layer_height,
flow_spacing => $params->{flow_spacing} || (warn "Warning: no flow_spacing was returned by the infill engine, please report this to the developer\n"),
), @paths,
],

View File

@ -149,7 +149,7 @@ sub extrude_path {
$area = ($s**2) * PI/4;
} else {
my $s = $path->flow_spacing || ($self->layer ? $self->layer->flow->spacing : $Slic3r::flow->spacing);
my $h = $path->depth_layers * $self->layer->height;
my $h = $path->height // $self->layer->height;
$area = $self->extruder->mm3_per_mm($s, $h);
}

View File

@ -279,7 +279,7 @@ sub make_perimeters {
map Slic3r::ExtrusionPath->pack(
polyline => Slic3r::Polyline->new(@$_),
role => EXTR_ROLE_SOLIDFILL,
depth_layers => 1,
height => $self->height,
flow_spacing => $params->{flow_spacing},
), @paths;
}

View File

@ -579,7 +579,7 @@ sub generate_support_material {
map Slic3r::ExtrusionPath->new(
polyline => Slic3r::Polyline->new(@$_),
role => EXTR_ROLE_SUPPORTMATERIAL,
depth_layers => 1,
height => undef,
flow_spacing => $params->{flow_spacing},
), @paths;
}