From 5dba02fdeb146759eedef3ca1ab003fae8698d8c Mon Sep 17 00:00:00 2001
From: Alessandro Ranellucci <aar@cpan.org>
Date: Fri, 23 Nov 2012 11:25:02 +0100
Subject: [PATCH] New separate speed setting for gap fill. #785

---
 README.markdown      | 1 +
 lib/Slic3r/Config.pm | 8 ++++++++
 lib/Slic3r/GCode.pm  | 4 ++--
 slic3r.pl            | 1 +
 4 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/README.markdown b/README.markdown
index 72e961a45..7a9553340 100644
--- a/README.markdown
+++ b/README.markdown
@@ -145,6 +145,7 @@ The author of the Silk icon set is Mark James.
         --top-solid-infill-speed Speed of print moves for top surfaces in mm/s or % over solid infill speed
                             (default: 50)
         --bridge-speed      Speed of bridge print moves in mm/s (default: 60)
+        --gap-fill-speed    Speed of gap fill print moves in mm/s (default: 20)
         --first-layer-speed Speed of print moves for bottom layer, expressed either as an absolute
                             value or as a percentage over normal speeds (default: 30%)
         
diff --git a/lib/Slic3r/Config.pm b/lib/Slic3r/Config.pm
index b20f0ee17..6ef3d8ca6 100644
--- a/lib/Slic3r/Config.pm
+++ b/lib/Slic3r/Config.pm
@@ -293,6 +293,14 @@ our $Options = {
         aliases => [qw(bridge_feed_rate)],
         default => 60,
     },
+    'gap_fill_speed' => {
+        label   => 'Gap fill',
+        tooltip => 'Speed for filling small gaps using short zigzag moves. Keep this reasonably low to avoid too much shaking and resonance issues.',
+        sidetext => 'mm/s',
+        cli     => 'gap-fill-speed=f',
+        type    => 'f',
+        default => 20,
+    },
     'first_layer_speed' => {
         label   => 'First layer speed',
         tooltip => 'If expressed as absolute value in mm/s, this speed will be applied to all the print moves of the first layer, regardless of their type. If expressed as a percentage (for example: 40%) it will scale the default speeds.',
diff --git a/lib/Slic3r/GCode.pm b/lib/Slic3r/GCode.pm
index d11035e53..5cb86e56a 100644
--- a/lib/Slic3r/GCode.pm
+++ b/lib/Slic3r/GCode.pm
@@ -36,7 +36,7 @@ has 'speeds' => (
     default => sub {+{
         map { $_ => 60 * $Slic3r::Config->get_value("${_}_speed") }
             qw(travel perimeter small_perimeter external_perimeter infill
-                solid_infill top_solid_infill bridge),
+                solid_infill top_solid_infill bridge gap_fill),
     }},
 );
 
@@ -52,7 +52,7 @@ my %role_speeds = (
     &EXTR_ROLE_BRIDGE                       => 'bridge',
     &EXTR_ROLE_SKIRT                        => 'perimeter',
     &EXTR_ROLE_SUPPORTMATERIAL              => 'perimeter',
-    &EXTR_ROLE_GAPFILL                      => 'solid_infill',
+    &EXTR_ROLE_GAPFILL                      => 'gap_fill',
 );
 
 sub set_shift {
diff --git a/slic3r.pl b/slic3r.pl
index d540fcae4..6f0938241 100755
--- a/slic3r.pl
+++ b/slic3r.pl
@@ -193,6 +193,7 @@ $j
     --top-solid-infill-speed Speed of print moves for top surfaces in mm/s or % over solid infill speed
                         (default: $config->{top_solid_infill_speed})
     --bridge-speed      Speed of bridge print moves in mm/s (default: $config->{bridge_speed})
+    --gap-fill-speed    Speed of gap fill print moves in mm/s (default: $config->{gap_fill_speed})
     --first-layer-speed Speed of print moves for bottom layer, expressed either as an absolute
                         value or as a percentage over normal speeds (default: $config->{first_layer_speed})