Fix retraction tests and fix retract_extra_length and lift in multiple extruders environments

This commit is contained in:
Alessandro Ranellucci 2012-12-21 15:14:44 +01:00
parent 701c98c5a7
commit dc4ada2374
4 changed files with 35 additions and 15 deletions

View file

@ -14,6 +14,7 @@ has 'id' => (is => 'rw', required => 1);
has $_ => (is => 'ro', required => 1) for @{&OPTIONS};
has 'retracted' => (is => 'rw', default => sub {0} );
has 'restart_extra' => (is => 'rw', default => sub {0} );
has 'e_per_mm3' => (is => 'lazy');
has 'retract_speed_mm_min' => (is => 'lazy');
has '_mm3_per_mm_cache' => (is => 'ro', default => sub {{}});

View file

@ -181,7 +181,7 @@ sub extrude_path {
if !points_coincide($self->last_pos, $path->points->[0]);
# compensate retraction
$gcode .= $self->unretract if $self->extruder->retracted;
$gcode .= $self->unretract;
my $area; # mm^3 of extrudate per mm of tool movement
if ($path->role == EXTR_ROLE_BRIDGE) {
@ -276,7 +276,8 @@ sub retract {
$gcode .= $self->G1(@$lift);
}
}
$self->extruder->retracted($self->extruder->retracted + $length + $restart_extra);
$self->extruder->retracted($self->extruder->retracted + $length);
$self->extruder->restart_extra($restart_extra);
$self->lifted($self->extruder->retract_lift) if $lift;
# reset extrusion distance during retracts
@ -297,9 +298,13 @@ sub unretract {
$self->lifted(0);
}
$self->speed('retract');
$gcode .= $self->G0(undef, undef, $self->extruder->retracted, "compensate retraction");
$self->extruder->retracted(0);
my $to_unretract = $self->extruder->retracted + $self->extruder->restart_extra;
if ($to_unretract) {
$self->speed('retract');
$gcode .= $self->G0(undef, undef, $to_unretract, "compensate retraction");
$self->extruder->retracted(0);
$self->extruder->restart_extra(0);
}
return $gcode;
}

View file

@ -34,6 +34,7 @@ sub init_print {
my $config = Slic3r::Config->new_from_defaults;
$config->apply($params{config}) if $params{config};
$config->set('gcode_comments', 1) if $ENV{SLIC3R_TESTS_GCODE};
my $print = Slic3r::Print->new(config => $config);
$print->add_model($model);