From db2e76a0df1d030b48fa66d44f384dffd2bd4802 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Sat, 16 Mar 2013 18:56:49 +0100 Subject: [PATCH] New option to change perimeter order. #534 --- README.markdown | 1 + lib/Slic3r/Config.pm | 7 +++++++ lib/Slic3r/GUI/Tab.pm | 2 +- lib/Slic3r/Layer/Region.pm | 8 ++++++-- slic3r.pl | 1 + 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/README.markdown b/README.markdown index 5015e2314..df651b6a0 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 0017d9257..454afd40c 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 35637c886..79f9af96e 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 99bdbfc15..1c365dd42 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 301c6b85d..4290ceb8e 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)