From 96a3234eaadfa45f97cc74c67034cbee1a621671 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Wed, 27 Jun 2012 19:37:34 +0200 Subject: [PATCH] Different speed for external perimeters. #488 --- README.markdown | 3 +++ lib/Slic3r.pm | 1 + lib/Slic3r/Config.pm | 6 ++++++ lib/Slic3r/Extruder.pm | 2 ++ lib/Slic3r/ExtrusionPath.pm | 18 ++++++++++-------- lib/Slic3r/GUI/SkeinPanel.pm | 2 +- lib/Slic3r/Layer.pm | 9 +++++++-- slic3r.pl | 3 +++ 8 files changed, 33 insertions(+), 11 deletions(-) diff --git a/README.markdown b/README.markdown index 0bc6a7e1a..4f253655f 100644 --- a/README.markdown +++ b/README.markdown @@ -130,6 +130,9 @@ The author is Alessandro Ranellucci. --small-perimeter-speed Speed of print moves for small perimeters in mm/s or % over perimeter speed (default: 30) + --external-perimeter-speed + Speed of print moves for the external perimeter in mm/s or % over perimeter speed + (default: 100%) --infill-speed Speed of print moves in mm/s (default: 60) --solid-infill-speed Speed of print moves for solid surfaces in mm/s or % over infill speed (default: 60) diff --git a/lib/Slic3r.pm b/lib/Slic3r.pm index a0d2c858a..3efc166a2 100644 --- a/lib/Slic3r.pm +++ b/lib/Slic3r.pm @@ -81,6 +81,7 @@ our $first_layer_bed_temperature; our $travel_speed = 130; # mm/s our $perimeter_speed = 30; # mm/s our $small_perimeter_speed = 30; # mm/s or % +our $external_perimeter_speed = '100%'; # mm/s or % our $infill_speed = 60; # mm/s our $solid_infill_speed = 60; # mm/s or % our $top_solid_infill_speed = 50; # mm/s or % diff --git a/lib/Slic3r/Config.pm b/lib/Slic3r/Config.pm index 0306fd703..0307566be 100644 --- a/lib/Slic3r/Config.pm +++ b/lib/Slic3r/Config.pm @@ -140,6 +140,12 @@ our $Options = { type => 'f', ratio_over => 'perimeter_speed', }, + 'external_perimeter_speed' => { + label => 'External perimeters (mm/s or %)', + cli => 'external-perimeter-speed=s', + type => 'f', + ratio_over => 'perimeter_speed', + }, 'infill_speed' => { label => 'Infill (mm/s)', cli => 'infill-speed=f', diff --git a/lib/Slic3r/Extruder.pm b/lib/Slic3r/Extruder.pm index 1ac5ed8a8..6a666519c 100644 --- a/lib/Slic3r/Extruder.pm +++ b/lib/Slic3r/Extruder.pm @@ -27,6 +27,7 @@ has 'speeds' => ( travel => 60 * Slic3r::Config->get('travel_speed'), perimeter => 60 * Slic3r::Config->get('perimeter_speed'), small_perimeter => 60 * Slic3r::Config->get('small_perimeter_speed'), + external_perimeter => 60 * Slic3r::Config->get('external_perimeter_speed'), infill => 60 * Slic3r::Config->get('infill_speed'), solid_infill => 60 * Slic3r::Config->get('solid_infill_speed'), top_solid_infill => 60 * Slic3r::Config->get('top_solid_infill_speed'), @@ -38,6 +39,7 @@ has 'speeds' => ( my %role_speeds = ( &EXTR_ROLE_PERIMETER => 'perimeter', &EXTR_ROLE_SMALLPERIMETER => 'small_perimeter', + &EXTR_ROLE_EXTERNAL_PERIMETER => 'external_perimeter', &EXTR_ROLE_CONTOUR_INTERNAL_PERIMETER => 'perimeter', &EXTR_ROLE_FILL => 'infill', &EXTR_ROLE_SOLIDFILL => 'solid_infill', diff --git a/lib/Slic3r/ExtrusionPath.pm b/lib/Slic3r/ExtrusionPath.pm index 6a2df2740..6745541ee 100644 --- a/lib/Slic3r/ExtrusionPath.pm +++ b/lib/Slic3r/ExtrusionPath.pm @@ -3,7 +3,8 @@ use Moo; require Exporter; our @ISA = qw(Exporter); -our @EXPORT_OK = qw(EXTR_ROLE_PERIMETER EXTR_ROLE_SMALLPERIMETER EXTR_ROLE_CONTOUR_INTERNAL_PERIMETER +our @EXPORT_OK = qw(EXTR_ROLE_PERIMETER EXTR_ROLE_SMALLPERIMETER EXTR_ROLE_EXTERNAL_PERIMETER + EXTR_ROLE_CONTOUR_INTERNAL_PERIMETER EXTR_ROLE_FILL EXTR_ROLE_SOLIDFILL EXTR_ROLE_TOPSOLIDFILL EXTR_ROLE_BRIDGE EXTR_ROLE_SKIRT EXTR_ROLE_SUPPORTMATERIAL); our %EXPORT_TAGS = (roles => \@EXPORT_OK); @@ -26,13 +27,14 @@ has 'flow_spacing' => (is => 'rw'); has 'role' => (is => 'rw', required => 1); use constant EXTR_ROLE_PERIMETER => 0; use constant EXTR_ROLE_SMALLPERIMETER => 1; -use constant EXTR_ROLE_CONTOUR_INTERNAL_PERIMETER => 2; -use constant EXTR_ROLE_FILL => 3; -use constant EXTR_ROLE_SOLIDFILL => 4; -use constant EXTR_ROLE_TOPSOLIDFILL => 5; -use constant EXTR_ROLE_BRIDGE => 6; -use constant EXTR_ROLE_SKIRT => 7; -use constant EXTR_ROLE_SUPPORTMATERIAL => 8; +use constant EXTR_ROLE_EXTERNAL_PERIMETER => 2; +use constant EXTR_ROLE_CONTOUR_INTERNAL_PERIMETER => 3; +use constant EXTR_ROLE_FILL => 4; +use constant EXTR_ROLE_SOLIDFILL => 5; +use constant EXTR_ROLE_TOPSOLIDFILL => 6; +use constant EXTR_ROLE_BRIDGE => 7; +use constant EXTR_ROLE_SKIRT => 8; +use constant EXTR_ROLE_SUPPORTMATERIAL => 9; sub BUILD { my $self = shift; diff --git a/lib/Slic3r/GUI/SkeinPanel.pm b/lib/Slic3r/GUI/SkeinPanel.pm index f62067798..474700959 100644 --- a/lib/Slic3r/GUI/SkeinPanel.pm +++ b/lib/Slic3r/GUI/SkeinPanel.pm @@ -32,7 +32,7 @@ sub new { }, print_speed => { title => 'Print speed', - options => [qw(perimeter_speed small_perimeter_speed infill_speed solid_infill_speed top_solid_infill_speed bridge_speed)], + options => [qw(perimeter_speed small_perimeter_speed external_perimeter_speed infill_speed solid_infill_speed top_solid_infill_speed bridge_speed)], }, speed => { title => 'Other speed settings', diff --git a/lib/Slic3r/Layer.pm b/lib/Slic3r/Layer.pm index 1a5ff7e72..a43b8847c 100644 --- a/lib/Slic3r/Layer.pm +++ b/lib/Slic3r/Layer.pm @@ -291,6 +291,7 @@ sub make_perimeters { foreach my $island (@perimeters) { # do holes starting from innermost one my @holes = (); + my %is_external = (); my @hole_depths = map [ map $_->holes, @$_ ], @$island; # organize the outermost hole loops using a shortest path search @@ -303,6 +304,7 @@ sub make_perimeters { # take first available hole push @holes, shift @{$hole_depths[0]}; + $is_external{$#holes} = 1; my $current_depth = 0; while (1) { @@ -333,9 +335,12 @@ sub make_perimeters { } # do holes, then contours starting from innermost one - $self->add_perimeter($_) for reverse @holes; + $self->add_perimeter($holes[$_], $is_external{$_} ? EXTR_ROLE_EXTERNAL_PERIMETER : undef) + for reverse 0 .. $#holes; for my $depth (reverse 0 .. $#$island) { - my $role = $depth == $#$island ? EXTR_ROLE_CONTOUR_INTERNAL_PERIMETER : EXTR_ROLE_PERIMETER; + my $role = $depth == $#$island ? EXTR_ROLE_CONTOUR_INTERNAL_PERIMETER + : $depth == 0 ? EXTR_ROLE_EXTERNAL_PERIMETER + : EXTR_ROLE_PERIMETER; $self->add_perimeter($_, $role) for map $_->contour, @{$island->[$depth]}; } } diff --git a/slic3r.pl b/slic3r.pl index cb9d16316..979e42bf2 100755 --- a/slic3r.pl +++ b/slic3r.pl @@ -175,6 +175,9 @@ $j --small-perimeter-speed Speed of print moves for small perimeters in mm/s or % over perimeter speed (default: $Slic3r::small_perimeter_speed) + --external-perimeter-speed + Speed of print moves for the external perimeter in mm/s or % over perimeter speed + (default: $Slic3r::external_perimeter_speed) --infill-speed Speed of print moves in mm/s (default: $Slic3r::infill_speed) --solid-infill-speed Speed of print moves for solid surfaces in mm/s or % over infill speed (default: $Slic3r::solid_infill_speed)