No need for a role to identify small perimeters

This commit is contained in:
Alessandro Ranellucci 2012-12-05 10:47:41 +01:00
parent 2564317fb4
commit 283809f5c2
3 changed files with 10 additions and 5 deletions

View File

@ -3,7 +3,7 @@ use Moo;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(EXTR_ROLE_PERIMETER EXTR_ROLE_SMALLPERIMETER EXTR_ROLE_EXTERNAL_PERIMETER
our @EXPORT_OK = qw(EXTR_ROLE_PERIMETER EXTR_ROLE_EXTERNAL_PERIMETER
EXTR_ROLE_CONTOUR_INTERNAL_PERIMETER
EXTR_ROLE_FILL EXTR_ROLE_SOLIDFILL EXTR_ROLE_TOPSOLIDFILL EXTR_ROLE_BRIDGE EXTR_ROLE_SKIRT
EXTR_ROLE_SUPPORTMATERIAL EXTR_ROLE_GAPFILL);
@ -24,7 +24,6 @@ has 'flow_spacing' => (is => 'rw');
has 'role' => (is => 'rw', required => 1);
use constant EXTR_ROLE_PERIMETER => 0;
use constant EXTR_ROLE_SMALLPERIMETER => 1;
use constant EXTR_ROLE_EXTERNAL_PERIMETER => 2;
use constant EXTR_ROLE_CONTOUR_INTERNAL_PERIMETER => 3;
use constant EXTR_ROLE_FILL => 4;

View File

@ -42,7 +42,6 @@ has 'speeds' => (
# assign speeds to roles
my %role_speeds = (
&EXTR_ROLE_PERIMETER => 'perimeter',
&EXTR_ROLE_SMALLPERIMETER => 'small_perimeter',
&EXTR_ROLE_EXTERNAL_PERIMETER => 'external_perimeter',
&EXTR_ROLE_CONTOUR_INTERNAL_PERIMETER => 'perimeter',
&EXTR_ROLE_FILL => 'infill',
@ -179,8 +178,15 @@ sub extrude_path {
# calculate extrusion length per distance unit
my $e = $self->extruder->e_per_mm3 * $area;
# extrude arc or line
# set speed
$self->speed( $role_speeds{$path->role} || die "Unknown role: " . $path->role );
if ($path->role == EXTR_ROLE_PERIMETER || $path->role == EXTR_ROLE_EXTERNAL_PERIMETER || $path->role == EXTR_ROLE_CONTOUR_INTERNAL_PERIMETER) {
if (abs($path->length) <= &Slic3r::SMALL_PERIMETER_LENGTH) {
$self->speed('small_perimeter');
}
}
# extrude arc or line
my $path_length = 0;
if ($path->isa('Slic3r::ExtrusionPath::Arc')) {
$path_length = unscale $path->length;

View File

@ -382,7 +382,7 @@ sub _add_perimeter {
return unless $polygon->is_printable($self->perimeter_flow->width);
push @{ $self->perimeters }, Slic3r::ExtrusionLoop->pack(
polygon => $polygon,
role => (abs($polygon->length) <= &Slic3r::SMALL_PERIMETER_LENGTH) ? EXTR_ROLE_SMALLPERIMETER : ($role // EXTR_ROLE_PERIMETER), #/
role => ($role // EXTR_ROLE_PERIMETER),
flow_spacing => $self->perimeter_flow->spacing,
);
}