Renamed ExtrusionPath->depth_layers to height
This commit is contained in:
parent
2796041a6c
commit
f35cdef2aa
@ -18,8 +18,8 @@ has 'polyline' => (
|
|||||||
handles => [qw(merge_continuous_lines lines length reverse)],
|
handles => [qw(merge_continuous_lines lines length reverse)],
|
||||||
);
|
);
|
||||||
|
|
||||||
# depth_layers is the vertical thickness of the extrusion expressed in layers
|
# height is the vertical thickness of the extrusion expressed in mm
|
||||||
has 'depth_layers' => (is => 'ro', default => sub {1});
|
has 'height' => (is => 'ro');
|
||||||
has 'flow_spacing' => (is => 'rw');
|
has 'flow_spacing' => (is => 'rw');
|
||||||
has 'role' => (is => 'rw', required => 1);
|
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_SKIRT => 8;
|
||||||
use constant EXTR_ROLE_SUPPORTMATERIAL => 9;
|
use constant EXTR_ROLE_SUPPORTMATERIAL => 9;
|
||||||
|
|
||||||
use constant PACK_FMT => 'cfca*';
|
use constant PACK_FMT => 'ffca*';
|
||||||
|
|
||||||
# class or object method
|
# class or object method
|
||||||
sub pack {
|
sub pack {
|
||||||
@ -42,11 +42,11 @@ sub pack {
|
|||||||
my %args = @_;
|
my %args = @_;
|
||||||
|
|
||||||
if (ref $self) {
|
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,
|
my $o = \ pack PACK_FMT,
|
||||||
$args{depth_layers} || 1,
|
$args{height} // -1,
|
||||||
$args{flow_spacing} || -1,
|
$args{flow_spacing} || -1,
|
||||||
$args{role} // (die "Missing mandatory attribute 'role'"), #/
|
$args{role} // (die "Missing mandatory attribute 'role'"), #/
|
||||||
$args{polyline}->serialize;
|
$args{polyline}->serialize;
|
||||||
@ -93,7 +93,7 @@ sub clip_with_expolygon {
|
|||||||
foreach my $polyline ($self->polyline->clip_with_expolygon($expolygon)) {
|
foreach my $polyline ($self->polyline->clip_with_expolygon($expolygon)) {
|
||||||
push @paths, (ref $self)->new(
|
push @paths, (ref $self)->new(
|
||||||
polyline => $polyline,
|
polyline => $polyline,
|
||||||
depth_layers => $self->depth_layers,
|
height => $self->height,
|
||||||
flow_spacing => $self->flow_spacing,
|
flow_spacing => $self->flow_spacing,
|
||||||
role => $self->role,
|
role => $self->role,
|
||||||
);
|
);
|
||||||
@ -137,7 +137,7 @@ sub split_at_acute_angles {
|
|||||||
push @paths, (ref $self)->new(
|
push @paths, (ref $self)->new(
|
||||||
polyline => Slic3r::Polyline->new(\@p),
|
polyline => Slic3r::Polyline->new(\@p),
|
||||||
role => $self->role,
|
role => $self->role,
|
||||||
depth_layers => $self->depth_layers,
|
height => $self->height,
|
||||||
);
|
);
|
||||||
@p = ($p3);
|
@p = ($p3);
|
||||||
push @p, grep $_, shift @points or last;
|
push @p, grep $_, shift @points or last;
|
||||||
@ -148,7 +148,7 @@ sub split_at_acute_angles {
|
|||||||
push @paths, (ref $self)->new(
|
push @paths, (ref $self)->new(
|
||||||
polyline => Slic3r::Polyline->new(\@p),
|
polyline => Slic3r::Polyline->new(\@p),
|
||||||
role => $self->role,
|
role => $self->role,
|
||||||
depth_layers => $self->depth_layers,
|
height => $self->height,
|
||||||
) if @p > 1;
|
) if @p > 1;
|
||||||
|
|
||||||
return @paths;
|
return @paths;
|
||||||
@ -246,7 +246,7 @@ sub detect_arcs {
|
|||||||
push @paths, (ref $self)->new(
|
push @paths, (ref $self)->new(
|
||||||
polyline => Slic3r::Polyline->new(@points[0..$i]),
|
polyline => Slic3r::Polyline->new(@points[0..$i]),
|
||||||
role => $self->role,
|
role => $self->role,
|
||||||
depth_layers => $self->depth_layers,
|
height => $self->height,
|
||||||
) if $i > 0;
|
) if $i > 0;
|
||||||
|
|
||||||
# add our arc
|
# add our arc
|
||||||
@ -265,7 +265,7 @@ sub detect_arcs {
|
|||||||
push @paths, (ref $self)->new(
|
push @paths, (ref $self)->new(
|
||||||
polyline => Slic3r::Polyline->new(\@points),
|
polyline => Slic3r::Polyline->new(\@points),
|
||||||
role => $self->role,
|
role => $self->role,
|
||||||
depth_layers => $self->depth_layers,
|
height => $self->height,
|
||||||
) if @points > 1;
|
) if @points > 1;
|
||||||
|
|
||||||
return @paths;
|
return @paths;
|
||||||
@ -275,11 +275,11 @@ package Slic3r::ExtrusionPath::Packed;
|
|||||||
sub unpack {
|
sub unpack {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
my ($depth_layers, $flow_spacing, $role, $polyline_s)
|
my ($height, $flow_spacing, $role, $polyline_s)
|
||||||
= unpack Slic3r::ExtrusionPath::PACK_FMT, $$self;
|
= unpack Slic3r::ExtrusionPath::PACK_FMT, $$self;
|
||||||
|
|
||||||
return Slic3r::ExtrusionPath->new(
|
return Slic3r::ExtrusionPath->new(
|
||||||
depth_layers => $depth_layers,
|
height => ($height == -1) ? undef : $height,
|
||||||
flow_spacing => ($flow_spacing == -1) ? undef : $flow_spacing,
|
flow_spacing => ($flow_spacing == -1) ? undef : $flow_spacing,
|
||||||
role => $role,
|
role => $role,
|
||||||
polyline => Slic3r::Polyline->deserialize($polyline_s),
|
polyline => Slic3r::Polyline->deserialize($polyline_s),
|
||||||
|
@ -169,7 +169,7 @@ sub make_fill {
|
|||||||
: $is_solid
|
: $is_solid
|
||||||
? ($surface->surface_type == S_TYPE_TOP ? EXTR_ROLE_TOPSOLIDFILL : EXTR_ROLE_SOLIDFILL)
|
? ($surface->surface_type == S_TYPE_TOP ? EXTR_ROLE_TOPSOLIDFILL : EXTR_ROLE_SOLIDFILL)
|
||||||
: EXTR_ROLE_FILL),
|
: 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"),
|
flow_spacing => $params->{flow_spacing} || (warn "Warning: no flow_spacing was returned by the infill engine, please report this to the developer\n"),
|
||||||
), @paths,
|
), @paths,
|
||||||
],
|
],
|
||||||
|
@ -149,7 +149,7 @@ sub extrude_path {
|
|||||||
$area = ($s**2) * PI/4;
|
$area = ($s**2) * PI/4;
|
||||||
} else {
|
} else {
|
||||||
my $s = $path->flow_spacing || ($self->layer ? $self->layer->flow->spacing : $Slic3r::flow->spacing);
|
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);
|
$area = $self->extruder->mm3_per_mm($s, $h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ sub make_perimeters {
|
|||||||
map Slic3r::ExtrusionPath->pack(
|
map Slic3r::ExtrusionPath->pack(
|
||||||
polyline => Slic3r::Polyline->new(@$_),
|
polyline => Slic3r::Polyline->new(@$_),
|
||||||
role => EXTR_ROLE_SOLIDFILL,
|
role => EXTR_ROLE_SOLIDFILL,
|
||||||
depth_layers => 1,
|
height => $self->height,
|
||||||
flow_spacing => $params->{flow_spacing},
|
flow_spacing => $params->{flow_spacing},
|
||||||
), @paths;
|
), @paths;
|
||||||
}
|
}
|
||||||
|
@ -579,7 +579,7 @@ sub generate_support_material {
|
|||||||
map Slic3r::ExtrusionPath->new(
|
map Slic3r::ExtrusionPath->new(
|
||||||
polyline => Slic3r::Polyline->new(@$_),
|
polyline => Slic3r::Polyline->new(@$_),
|
||||||
role => EXTR_ROLE_SUPPORTMATERIAL,
|
role => EXTR_ROLE_SUPPORTMATERIAL,
|
||||||
depth_layers => 1,
|
height => undef,
|
||||||
flow_spacing => $params->{flow_spacing},
|
flow_spacing => $params->{flow_spacing},
|
||||||
), @paths;
|
), @paths;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user