From 99816e07a6621912af9fe945f8d14e2e83c6339c Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Fri, 9 Aug 2013 14:30:43 +0200 Subject: [PATCH] New --first-layer-acceleration option --- README.markdown | 3 +++ lib/Slic3r/Config.pm | 8 ++++++++ lib/Slic3r/GCode.pm | 23 ++++++++++++++++------- lib/Slic3r/GUI/Tab.pm | 2 +- slic3r.pl | 3 +++ 5 files changed, 31 insertions(+), 8 deletions(-) diff --git a/README.markdown b/README.markdown index ad304dc1b..ca8e7a346 100644 --- a/README.markdown +++ b/README.markdown @@ -172,6 +172,9 @@ The author of the Silk icon set is Mark James. --bridge-acceleration Overrides firmware's default acceleration for bridges. (mm/s^2, set zero to disable; default: 0) + --first-layer-acceleration + Overrides firmware's default acceleration for first layer. (mm/s^2, set zero + to disable; default: 0) --default-acceleration Acceleration will be reset to this value after the specific settings above have been applied. (mm/s^2, set zero to disable; default: 130) diff --git a/lib/Slic3r/Config.pm b/lib/Slic3r/Config.pm index 0d89b79ee..ddf3fe6e3 100644 --- a/lib/Slic3r/Config.pm +++ b/lib/Slic3r/Config.pm @@ -369,6 +369,14 @@ our $Options = { type => 'f', default => 0, }, + 'first_layer_acceleration' => { + label => 'First layer', + tooltip => 'This is the acceleration your printer will use for first layer. Set zero to disable acceleration control for first layer.', + sidetext => 'mm/s²', + cli => 'first-layer-acceleration=f', + type => 'f', + default => 0, + }, # accuracy options 'layer_height' => { diff --git a/lib/Slic3r/GCode.pm b/lib/Slic3r/GCode.pm index 08c5c89be..752ead5c1 100644 --- a/lib/Slic3r/GCode.pm +++ b/lib/Slic3r/GCode.pm @@ -116,6 +116,13 @@ sub change_layer { int(99 * ($layer->id / ($self->layer_count - 1))), ($self->config->gcode_comments ? ' ; update progress' : ''); } + if ($self->config->first_layer_acceleration) { + if ($layer->id == 0) { + $gcode .= $self->set_acceleration($self->config->first_layer_acceleration); + } elsif ($layer->id == 1) { + $gcode .= $self->set_acceleration($self->config->default_acceleration); + } + } return $gcode; } @@ -289,14 +296,16 @@ sub extrude_path { # adjust acceleration my $acceleration; - if ($self->config->perimeter_acceleration && $path->is_perimeter) { - $acceleration = $self->config->perimeter_acceleration; - } elsif ($self->config->infill_acceleration && $path->is_fill) { - $acceleration = $self->config->infill_acceleration; - } elsif ($self->config->infill_acceleration && $path->is_bridge) { - $acceleration = $self->config->bridge_acceleration; + if (!$self->config->first_layer_acceleration || $self->layer->id != 0) { + if ($self->config->perimeter_acceleration && $path->is_perimeter) { + $acceleration = $self->config->perimeter_acceleration; + } elsif ($self->config->infill_acceleration && $path->is_fill) { + $acceleration = $self->config->infill_acceleration; + } elsif ($self->config->infill_acceleration && $path->is_bridge) { + $acceleration = $self->config->bridge_acceleration; + } + $gcode .= $self->set_acceleration($acceleration) if $acceleration; } - $gcode .= $self->set_acceleration($acceleration) if $acceleration; my $area; # mm^3 of extrudate per mm of tool movement if ($path->is_bridge) { diff --git a/lib/Slic3r/GUI/Tab.pm b/lib/Slic3r/GUI/Tab.pm index 70fd3962a..bdf5d8269 100644 --- a/lib/Slic3r/GUI/Tab.pm +++ b/lib/Slic3r/GUI/Tab.pm @@ -461,7 +461,7 @@ sub build { }, { title => 'Acceleration control (advanced)', - options => [qw(perimeter_acceleration infill_acceleration bridge_acceleration default_acceleration)], + options => [qw(perimeter_acceleration infill_acceleration bridge_acceleration first_layer_acceleration default_acceleration)], }, ]); diff --git a/slic3r.pl b/slic3r.pl index b96b112ed..8818c9151 100755 --- a/slic3r.pl +++ b/slic3r.pl @@ -255,6 +255,9 @@ $j --bridge-acceleration Overrides firmware's default acceleration for bridges. (mm/s^2, set zero to disable; default: $config->{bridge_acceleration}) + --first-layer-acceleration + Overrides firmware's default acceleration for first layer. (mm/s^2, set zero + to disable; default: $config->{first_layer_acceleration}) --default-acceleration Acceleration will be reset to this value after the specific settings above have been applied. (mm/s^2, set zero to disable; default: $config->{travel_speed})