diff --git a/README.markdown b/README.markdown index 5015e23142..df651b6a05 100644 --- a/README.markdown +++ b/README.markdown @@ -197,6 +197,7 @@ The author of the Silk icon set is Mark James. --extra-perimeters Add more perimeters when needed (default: yes) --randomize-start Randomize starting point across layers (default: yes) --avoid-crossing-perimeters Optimize travel moves so that no perimeters are crossed (default: no) + --external-perimeters-first Reverse perimeter order. (default: no) --only-retract-when-crossing-perimeters Disable retraction when travelling between infill paths inside the same island. (default: yes) diff --git a/lib/Slic3r/Config.pm b/lib/Slic3r/Config.pm index 0017d92577..454afd40c3 100644 --- a/lib/Slic3r/Config.pm +++ b/lib/Slic3r/Config.pm @@ -562,6 +562,13 @@ our $Options = { type => 'bool', default => 0, }, + 'external_perimeters_first' => { + label => 'External perimeters first', + tooltip => 'Print contour perimeters from the outermost one to the innermost one instead of the default inverse order.', + cli => 'external-perimeters-first!', + type => 'bool', + default => 0, + }, 'only_retract_when_crossing_perimeters' => { label => 'Only retract when crossing perimeters', tooltip => 'Disables retraction when travelling between infill paths inside the same island.', diff --git a/lib/Slic3r/GUI/Tab.pm b/lib/Slic3r/GUI/Tab.pm index 35637c886b..79f9af96ec 100644 --- a/lib/Slic3r/GUI/Tab.pm +++ b/lib/Slic3r/GUI/Tab.pm @@ -407,7 +407,7 @@ sub build { }, { title => 'Advanced', - options => [qw(avoid_crossing_perimeters)], + options => [qw(avoid_crossing_perimeters external_perimeters_first)], }, ]); diff --git a/lib/Slic3r/Layer/Region.pm b/lib/Slic3r/Layer/Region.pm index 99bdbfc15d..1c365dd42b 100644 --- a/lib/Slic3r/Layer/Region.pm +++ b/lib/Slic3r/Layer/Region.pm @@ -404,10 +404,14 @@ sub make_perimeters { } } - # do holes, then contours starting from innermost one + # first do holes $self->_add_perimeter($holes[$_], $is_external{$_} ? EXTR_ROLE_EXTERNAL_PERIMETER : undef) for reverse 0 .. $#holes; - for my $depth (reverse 0 .. $#$island) { + + # then do contours according to the user settings + my @contour_order = 0 .. $#$island; + @contour_order = reverse @contour_order if !$Slic3r::Config->external_perimeters_first; + for my $depth (@contour_order) { my $role = $depth == $#$island ? EXTR_ROLE_CONTOUR_INTERNAL_PERIMETER : $depth == 0 ? EXTR_ROLE_EXTERNAL_PERIMETER : EXTR_ROLE_PERIMETER; diff --git a/slic3r.pl b/slic3r.pl index 301c6b85d8..4290ceb8ed 100755 --- a/slic3r.pl +++ b/slic3r.pl @@ -250,6 +250,7 @@ $j --extra-perimeters Add more perimeters when needed (default: yes) --randomize-start Randomize starting point across layers (default: yes) --avoid-crossing-perimeters Optimize travel moves so that no perimeters are crossed (default: no) + --external-perimeters-first Reverse perimeter order. (default: no) --only-retract-when-crossing-perimeters Disable retraction when travelling between infill paths inside the same island. (default: no)