From 94ed6cd2397c495f2d38b57dac3086e2cda8bdce Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci <aar@cpan.org> Date: Mon, 8 Apr 2013 22:23:51 +0200 Subject: [PATCH] Always move Z at travel speed. #1093 --- lib/Slic3r/GCode.pm | 5 ++++- t/fill.t | 5 +++++ t/retraction.t | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/Slic3r/GCode.pm b/lib/Slic3r/GCode.pm index 72744eba5..d2a667ef6 100644 --- a/lib/Slic3r/GCode.pm +++ b/lib/Slic3r/GCode.pm @@ -364,13 +364,13 @@ sub retract { } # prepare moves - $self->speed('retract'); my $retract = [undef, undef, -$length, $comment]; my $lift = ($self->extruder->retract_lift == 0 || defined $params{move_z}) && !$self->lifted ? undef : [undef, $self->z + $self->extruder->retract_lift, 0, 'lift plate during travel']; if (($Slic3r::Config->g0 || $Slic3r::Config->gcode_flavor eq 'mach3') && $params{travel_to}) { + $self->speed('travel'); if ($lift) { # combine lift and retract $lift->[2] = $retract->[2]; @@ -382,6 +382,7 @@ sub retract { } } elsif (($Slic3r::Config->g0 || $Slic3r::Config->gcode_flavor eq 'mach3') && defined $params{move_z}) { # combine Z change and retraction + $self->speed('travel'); my $travel = [undef, $params{move_z}, $retract->[2], "change layer and $comment"]; $gcode .= $self->G0(@$travel); } else { @@ -395,9 +396,11 @@ sub retract { $gcode .= $self->G1($wipe_path->[$_], undef, $retract->[2] * ($segment_length / $total_wipe_length), $retract->[3] . ";_WIPE"); } } else { + $self->speed('retract'); $gcode .= $self->G1(@$retract); } if (!$self->lifted) { + $self->speed('travel'); if (defined $params{move_z} && $self->extruder->retract_lift > 0) { my $travel = [undef, $params{move_z} + $self->extruder->retract_lift, 0, 'move to next layer (' . $self->layer->id . ') and lift']; $gcode .= $self->G0(@$travel); diff --git a/t/fill.t b/t/fill.t index cbffd7dab..7cc1e5d3f 100644 --- a/t/fill.t +++ b/t/fill.t @@ -39,6 +39,11 @@ sub scale_points (@) { map [scale $_->[X], scale $_->[Y]], @_ } $surface->expolygon->rotate(Slic3r::Geometry::deg2rad($angle), [0,0]); my ($params, @paths) = $filler->fill_surface($surface, flow_spacing => 0.69, density => 0.4); is scalar @paths, 1, 'one continuous path'; + use Slic3r::SVG; + Slic3r::SVG::output("fill.svg", + expolygons => [$surface->expolygon], + polylines => [@paths], + );exit; } } diff --git a/t/retraction.t b/t/retraction.t index a23e6f818..1c028893d 100644 --- a/t/retraction.t +++ b/t/retraction.t @@ -52,6 +52,7 @@ my $test = sub { if !_eq($info->{dist_Z}, -$print->extruders->[$tool]->retract_lift); $lifted = 0; } + fail 'move Z at travel speed' if ($args->{F} // $self->F) != $conf->travel_speed * 60; } if ($info->{retracting}) { $retracted[$tool] = 1; @@ -89,6 +90,7 @@ my $test = sub { }; $config->set('first_layer_height', $config->layer_height); +$config->set('first_layer_speed', '100%'); $config->set('start_gcode', ''); # to avoid dealing with the nozzle lift in start G-code $config->set('retract_length', [1.5]); $config->set('retract_before_travel', [3]);