Remove the change_layer method

This commit is contained in:
Alessandro Ranellucci 2012-10-30 14:11:32 +01:00
parent 52ed2c6ea4
commit 25d88bddff
2 changed files with 5 additions and 16 deletions

View file

@ -6,7 +6,7 @@ use Slic3r::ExtrusionPath ':roles';
use Slic3r::Geometry qw(scale unscale scaled_epsilon points_coincide PI X Y A B);
has 'multiple_extruders' => (is => 'ro', default => sub {0} );
has 'layer' => (is => 'rw'); # this is not very correct, we should replace it with explicit layer_id and avoid using $self->layer->flow at all here because it's too general
has 'layer' => (is => 'rw');
has 'shift_x' => (is => 'rw', default => sub {0} );
has 'shift_y' => (is => 'rw', default => sub {0} );
has 'z' => (is => 'rw');
@ -51,19 +51,6 @@ my %role_speeds = (
&EXTR_ROLE_SUPPORTMATERIAL => 'perimeter',
);
sub change_layer {
my $self = shift;
my ($layer) = @_;
$self->layer($layer);
my $gcode = "";
$gcode .= $Slic3r::Config->replace_options($Slic3r::Config->layer_gcode) . "\n"
if $Slic3r::Config->layer_gcode;
return $gcode;
}
# this method accepts Z in scaled coordinates
sub move_z {
my $self = shift;
@ -76,7 +63,7 @@ sub move_z {
my $current_z = $self->z;
if (!defined $current_z || $current_z != ($z + $self->lifted)) {
$gcode .= $self->retract(move_z => $z);
$gcode .= $self->G0(undef, $z, 0, $comment || 'move to next layer (' . $self->layer->id . ')')
$gcode .= $self->G0(undef, $z, 0, $comment || ('move to next layer (' . $self->layer->id . ')'))
unless ($current_z // -1) != ($self->z // -1);
}

View file

@ -737,8 +737,10 @@ sub write_gcode {
}
# set new layer, but don't move Z as support material interfaces may need an intermediate one
$gcode .= $gcodegen->change_layer($self->objects->[$object_copies->[0][0]]->layers->[$layer_id]);
$gcodegen->layer($self->objects->[$object_copies->[0][0]]->layers->[$layer_id]);
$gcodegen->elapsed_time(0);
$gcode .= $Slic3r::Config->replace_options($Slic3r::Config->layer_gcode) . "\n"
if $Slic3r::Config->layer_gcode;
# extrude skirt
if ($skirt_done < $Slic3r::Config->skirt_height) {