Optimization: don't store wipe path if wipe is not requested
This commit is contained in:
parent
be4eb3762f
commit
d074b98aba
2 changed files with 16 additions and 4 deletions
|
@ -8,7 +8,9 @@ use Slic3r::Geometry::Clipper qw(union_ex);
|
||||||
use Slic3r::Surface ':types';
|
use Slic3r::Surface ':types';
|
||||||
|
|
||||||
has 'config' => (is => 'ro', required => 1);
|
has 'config' => (is => 'ro', required => 1);
|
||||||
has 'multiple_extruders' => (is => 'ro', default => sub {0} );
|
has 'extruders' => (is => 'ro', default => sub {0}, required => 1);
|
||||||
|
has 'multiple_extruders' => (is => 'lazy');
|
||||||
|
has 'enable_wipe' => (is => 'lazy'); # at least one extruder has wipe enabled
|
||||||
has 'layer_count' => (is => 'ro', required => 1 );
|
has 'layer_count' => (is => 'ro', required => 1 );
|
||||||
has 'layer' => (is => 'rw');
|
has 'layer' => (is => 'rw');
|
||||||
has '_layer_overhangs' => (is => 'rw');
|
has '_layer_overhangs' => (is => 'rw');
|
||||||
|
@ -63,6 +65,16 @@ my %role_speeds = (
|
||||||
&EXTR_ROLE_GAPFILL => 'gap_fill',
|
&EXTR_ROLE_GAPFILL => 'gap_fill',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
sub _build_multiple_extruders {
|
||||||
|
my $self = shift;
|
||||||
|
return @{$self->extruders} > 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub _build_enable_wipe {
|
||||||
|
my $self = shift;
|
||||||
|
return (first { $_->wipe } @{$self->extruders}) ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
sub set_shift {
|
sub set_shift {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my @shift = @_;
|
my @shift = @_;
|
||||||
|
@ -205,7 +217,7 @@ sub extrude_loop {
|
||||||
|
|
||||||
# extrude along the path
|
# extrude along the path
|
||||||
my $gcode = join '', map $self->extrude_path($_, $description, %params), @paths;
|
my $gcode = join '', map $self->extrude_path($_, $description, %params), @paths;
|
||||||
$self->wipe_path($extrusion_path->polyline);
|
$self->wipe_path($extrusion_path->polyline) if $self->enable_wipe;
|
||||||
|
|
||||||
# make a little move inwards before leaving loop
|
# make a little move inwards before leaving loop
|
||||||
if ($loop->role == EXTR_ROLE_EXTERNAL_PERIMETER && $self->config->perimeters > 1) {
|
if ($loop->role == EXTR_ROLE_EXTERNAL_PERIMETER && $self->config->perimeters > 1) {
|
||||||
|
@ -296,7 +308,7 @@ sub extrude_path {
|
||||||
$gcode .= $self->G1($line->[B], undef, $e * $line_length, $description);
|
$gcode .= $self->G1($line->[B], undef, $e * $line_length, $description);
|
||||||
}
|
}
|
||||||
$self->wipe_path(Slic3r::Polyline->new(reverse @{$path->points}))
|
$self->wipe_path(Slic3r::Polyline->new(reverse @{$path->points}))
|
||||||
if $self->extruder->wipe;
|
if $self->enable_wipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($self->config->cooling) {
|
if ($self->config->cooling) {
|
||||||
|
|
|
@ -711,7 +711,7 @@ sub write_gcode {
|
||||||
# set up our extruder object
|
# set up our extruder object
|
||||||
my $gcodegen = Slic3r::GCode->new(
|
my $gcodegen = Slic3r::GCode->new(
|
||||||
config => $self->config,
|
config => $self->config,
|
||||||
multiple_extruders => (@{$self->extruders} > 1),
|
extruders => $self->extruders,
|
||||||
layer_count => $self->layer_count,
|
layer_count => $self->layer_count,
|
||||||
);
|
);
|
||||||
print $fh "G21 ; set units to millimeters\n" if $Slic3r::Config->gcode_flavor ne 'makerware';
|
print $fh "G21 ; set units to millimeters\n" if $Slic3r::Config->gcode_flavor ne 'makerware';
|
||||||
|
|
Loading…
Reference in a new issue