From 0a7e0ffecfdbe6196a3d8f5f32f25f14e9cf202d Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Fri, 5 Jul 2013 22:06:58 +0200 Subject: [PATCH] New options: start_perimeters_at_concave_points start_perimeters_at_non_overhang --- lib/Slic3r/Config.pm | 14 ++++++++++++++ lib/Slic3r/GCode.pm | 11 ++++++++--- lib/Slic3r/GUI/Tab.pm | 10 +++++++++- slic3r.pl | 10 ++++++++-- 4 files changed, 39 insertions(+), 6 deletions(-) diff --git a/lib/Slic3r/Config.pm b/lib/Slic3r/Config.pm index d8182e835e..bf4119fc08 100644 --- a/lib/Slic3r/Config.pm +++ b/lib/Slic3r/Config.pm @@ -573,6 +573,20 @@ our $Options = { type => 'bool', default => 0, }, + 'start_perimeters_at_concave_points' => { + label => 'Concave points', + tooltip => 'Prefer to start perimeters at a concave point.', + cli => 'start-perimeters-at-concave-points!', + type => 'bool', + default => 0, + }, + 'start_perimeters_at_non_overhang' => { + label => 'Non-overhang points', + tooltip => 'Prefer to start perimeters at non-overhanging points.', + cli => 'start-perimeters-at-non-overhang!', + type => 'bool', + default => 0, + }, 'avoid_crossing_perimeters' => { label => 'Avoid crossing perimeters', tooltip => 'Optimize travel moves in order to minimize the crossing of perimeters. This is mostly useful with Bowden extruders which suffer from oozing. This feature slows down both the print and the G-code generation.', diff --git a/lib/Slic3r/GCode.pm b/lib/Slic3r/GCode.pm index 403303d3dc..3bf8717a93 100644 --- a/lib/Slic3r/GCode.pm +++ b/lib/Slic3r/GCode.pm @@ -155,9 +155,14 @@ sub extrude_loop { # find candidate starting points # start looking for concave vertices not being overhangs - my @concave = $loop->polygon->concave_points; - my @candidates = grep !Boost::Geometry::Utils::point_covered_by_multi_polygon($_, $self->_layer_overhangs), - @concave; + my @concave = (); + if ($Slic3r::Config->start_perimeters_at_concave_points) { + @concave = $loop->polygon->concave_points; + } + my @candidates = (); + if ($Slic3r::Config->start_perimeters_at_non_overhang) { + @candidates = grep !Boost::Geometry::Utils::point_covered_by_multi_polygon($_, $self->_layer_overhangs), @concave; + } if (!@candidates) { # if none, look for any concave vertex @candidates = @concave; diff --git a/lib/Slic3r/GUI/Tab.pm b/lib/Slic3r/GUI/Tab.pm index 372f3c9093..1a102f90c3 100644 --- a/lib/Slic3r/GUI/Tab.pm +++ b/lib/Slic3r/GUI/Tab.pm @@ -412,7 +412,15 @@ sub build { }, { title => 'Quality (slower slicing)', - options => [qw(extra_perimeters avoid_crossing_perimeters)], + options => [qw(extra_perimeters avoid_crossing_perimeters start_perimeters_at_concave_points start_perimeters_at_non_overhang)], + lines => [ + Slic3r::GUI::OptionsGroup->single_option_line('extra_perimeters'), + Slic3r::GUI::OptionsGroup->single_option_line('avoid_crossing_perimeters'), + { + label => 'Start perimeters at', + options => [qw(start_perimeters_at_concave_points start_perimeters_at_non_overhang)], + }, + ], }, { title => 'Advanced', diff --git a/slic3r.pl b/slic3r.pl index 0b05cd0436..217e182db7 100755 --- a/slic3r.pl +++ b/slic3r.pl @@ -256,9 +256,7 @@ $j home X axis [G28 X], disable motors [M84]). --layer-gcode Load layer-change G-code from the supplied file (default: nothing). --toolchange-gcode Load tool-change G-code from the supplied file (default: nothing). - --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) --spiral-vase Experimental option to raise Z gradually when printing single-walled vases (default: no) @@ -272,6 +270,14 @@ $j Only infill under ceilings (default: no) --infill-first Make infill before perimeters (default: no) + Quality options (slower slicing): + --extra-perimeters Add more perimeters when needed (default: yes) + --avoid-crossing-perimeters Optimize travel moves so that no perimeters are crossed (default: no) + --start-perimeters-at-concave-points + Try to start perimeters at concave points if any (default: no) + --start-perimeters-at-non-overhang + Try to start perimeters at non-overhang points if any (default: no) + Support material options: --support-material Generate support material for overhangs --support-material-threshold