Don't apply acceleration settings to travel moves

This commit is contained in:
Alessandro Ranellucci 2013-03-09 20:28:03 +01:00
parent b7b89ff7f2
commit 2acda9973e
3 changed files with 19 additions and 6 deletions

View File

@ -93,6 +93,13 @@ sub endpoints {
sub is_printable { 1 } sub is_printable { 1 }
sub is_perimeter {
my $self = shift;
return $self->role == EXTR_ROLE_PERIMETER
|| $self->role == EXTR_ROLE_EXTERNAL_PERIMETER
|| $self->role == EXTR_ROLE_CONTOUR_INTERNAL_PERIMETER;
}
sub is_fill { sub is_fill {
my $self = shift; my $self = shift;
return $self->role == EXTR_ROLE_FILL return $self->role == EXTR_ROLE_FILL

View File

@ -197,6 +197,14 @@ sub extrude_path {
# compensate retraction # compensate retraction
$gcode .= $self->unretract; $gcode .= $self->unretract;
# adjust acceleration
my $acceleration;
$acceleration = $Slic3r::Config->perimeter_acceleration
if $Slic3r::Config->perimeter_acceleration && $path->is_perimeter;
$acceleration = $Slic3r::Config->infill_acceleration
if $Slic3r::Config->infill_acceleration && $path->is_fill;
$gcode .= $self->set_acceleration($acceleration) if $acceleration;
my $area; # mm^3 of extrudate per mm of tool movement my $area; # mm^3 of extrudate per mm of tool movement
if ($path->role == EXTR_ROLE_BRIDGE) { if ($path->role == EXTR_ROLE_BRIDGE) {
my $s = $path->flow_spacing; my $s = $path->flow_spacing;
@ -242,6 +250,10 @@ sub extrude_path {
$self->elapsed_time($self->elapsed_time + $path_time); $self->elapsed_time($self->elapsed_time + $path_time);
} }
# reset acceleration
$gcode .= $self->set_acceleration($Slic3r::Config->default_acceleration)
if $acceleration && $Slic3r::Config->default_acceleration;
return $gcode; return $gcode;
} }

View File

@ -853,16 +853,12 @@ sub write_gcode {
# extrude perimeters # extrude perimeters
if (@{ $layerm->perimeters }) { if (@{ $layerm->perimeters }) {
$gcode .= $gcodegen->set_extruder($region->extruders->{perimeter}); $gcode .= $gcodegen->set_extruder($region->extruders->{perimeter});
$gcode .= $gcodegen->set_acceleration($Slic3r::Config->perimeter_acceleration);
$gcode .= $gcodegen->extrude($_, 'perimeter') for @{ $layerm->perimeters }; $gcode .= $gcodegen->extrude($_, 'perimeter') for @{ $layerm->perimeters };
$gcode .= $gcodegen->set_acceleration($Slic3r::Config->default_acceleration)
if $Slic3r::Config->perimeter_acceleration;
} }
# extrude fills # extrude fills
if (@{ $layerm->fills }) { if (@{ $layerm->fills }) {
$gcode .= $gcodegen->set_extruder($region->extruders->{infill}); $gcode .= $gcodegen->set_extruder($region->extruders->{infill});
$gcode .= $gcodegen->set_acceleration($Slic3r::Config->infill_acceleration);
for my $fill (@{ $layerm->fills }) { for my $fill (@{ $layerm->fills }) {
if ($fill->isa('Slic3r::ExtrusionPath::Collection')) { if ($fill->isa('Slic3r::ExtrusionPath::Collection')) {
$gcode .= $gcodegen->extrude($_, 'fill') $gcode .= $gcodegen->extrude($_, 'fill')
@ -871,8 +867,6 @@ sub write_gcode {
$gcode .= $gcodegen->extrude($fill, 'fill') ; $gcode .= $gcodegen->extrude($fill, 'fill') ;
} }
} }
$gcode .= $gcodegen->set_acceleration($Slic3r::Config->default_acceleration)
if $Slic3r::Config->infill_acceleration;
} }
} }
} }