diff --git a/README.markdown b/README.markdown index 3f9e28972..f23efc888 100644 --- a/README.markdown +++ b/README.markdown @@ -109,6 +109,8 @@ The author is Alessandro Ranellucci (me). Speed options: --travel-speed Speed of non-print moves in mm/sec (default: 130) --perimeter-speed Speed of print moves for perimeters in mm/sec (default: 30) + --small-perimeter-speed + Speed of print moves for small perimeters in mm/sec (default: 30) --infill-speed Speed of print moves in mm/sec (default: 60) --solid-infill-speed Speed of print moves for solid surfaces in mm/sec (default: 60) --bridge-speed Speed of bridge print moves in mm/sec (default: 60) diff --git a/lib/Slic3r.pm b/lib/Slic3r.pm index 49b1b2dc0..1d065682e 100644 --- a/lib/Slic3r.pm +++ b/lib/Slic3r.pm @@ -50,6 +50,7 @@ our $temperature = 200; # speed options our $travel_speed = 130; # mm/sec our $perimeter_speed = 30; # mm/sec +our $small_perimeter_speed = 30; # mm/sec our $infill_speed = 60; # mm/sec our $solid_infill_speed = 60; # mm/sec our $bridge_speed = 60; # mm/sec @@ -57,6 +58,7 @@ our $bottom_layer_speed_ratio = 0.3; # accuracy options our $resolution = 0.00000001; +our $small_perimeter_area = (5 / $resolution) ** 2; our $layer_height = 0.4; our $first_layer_height_ratio = 1; our $infill_every_layers = 1; diff --git a/lib/Slic3r/Config.pm b/lib/Slic3r/Config.pm index 8ca4c9889..38c531a9f 100644 --- a/lib/Slic3r/Config.pm +++ b/lib/Slic3r/Config.pm @@ -80,6 +80,11 @@ our $Options = { type => 'f', aliases => [qw(perimeter_feed_rate)], }, + 'small_perimeter_speed' => { + label => 'Small perimeters (mm/s)', + cli => 'small-perimeter-speed=i', + type => 'f', + }, 'infill_speed' => { label => 'Infill (mm/s)', cli => 'infill-speed=i', @@ -424,6 +429,7 @@ sub validate { if $Slic3r::skirt_height < 1; # legacy with existing config files + $Slic3r::small_perimeter_speed ||= $Slic3r::perimeter_speed; $Slic3r::bridge_speed ||= $Slic3r::infill_speed; $Slic3r::solid_infill_speed ||= $Slic3r::infill_speed; } diff --git a/lib/Slic3r/Extruder.pm b/lib/Slic3r/Extruder.pm index d4910dd48..e5e4a561b 100644 --- a/lib/Slic3r/Extruder.pm +++ b/lib/Slic3r/Extruder.pm @@ -24,6 +24,10 @@ has 'perimeter_speed' => ( is => 'ro', default => sub { $Slic3r::perimeter_speed * 60 }, # mm/min ); +has 'small_perimeter_speed' => ( + is => 'ro', + default => sub { $Slic3r::small_perimeter_speed * 60 }, # mm/min +); has 'infill_speed' => ( is => 'ro', default => sub { $Slic3r::infill_speed * 60 }, # mm/min @@ -124,6 +128,7 @@ sub extrude { # extrude arc or line $self->print_feed_rate( $path->role =~ /^(perimeter|skirt)$/o ? $self->perimeter_speed + : $path->role eq 'small-perimeter' ? $self->small_perimeter_speed : $path->role eq 'fill' ? $self->infill_speed : $path->role eq 'solid-fill' ? $self->solid_infill_speed : $path->role eq 'bridge' ? $self->bridge_speed diff --git a/lib/Slic3r/GUI/SkeinPanel.pm b/lib/Slic3r/GUI/SkeinPanel.pm index b26e47234..06e746c26 100644 --- a/lib/Slic3r/GUI/SkeinPanel.pm +++ b/lib/Slic3r/GUI/SkeinPanel.pm @@ -25,7 +25,7 @@ sub new { }, print_speed => { title => 'Print speed', - options => [qw(perimeter_speed infill_speed solid_infill_speed bridge_speed)], + options => [qw(perimeter_speed small_perimeter_speed infill_speed solid_infill_speed bridge_speed)], }, speed => { title => 'Other speed settings', diff --git a/lib/Slic3r/Perimeter.pm b/lib/Slic3r/Perimeter.pm index 40402b070..286be4291 100644 --- a/lib/Slic3r/Perimeter.pm +++ b/lib/Slic3r/Perimeter.pm @@ -71,6 +71,11 @@ sub make_perimeter { push @{ $layer->perimeters }, Slic3r::ExtrusionLoop->cast($contour, role => 'perimeter'); } } + + # detect small perimeters by checking their area + for (@{ $layer->perimeters }) { + $_->role('small-perimeter') if $_->polygon->area < $Slic3r::small_perimeter_area; + } } 1; diff --git a/lib/Slic3r/Polyline/Closed.pm b/lib/Slic3r/Polyline/Closed.pm index dd9a742f3..c92287821 100644 --- a/lib/Slic3r/Polyline/Closed.pm +++ b/lib/Slic3r/Polyline/Closed.pm @@ -40,4 +40,9 @@ sub is_valid { return @{$self->points} >= 3; } +sub polygon { + my $self = shift; + return Slic3r::Polygon->new($self->points); +} + 1; diff --git a/slic3r.pl b/slic3r.pl index 90fdcb9fd..1bcddd26c 100755 --- a/slic3r.pl +++ b/slic3r.pl @@ -115,6 +115,8 @@ Usage: slic3r.pl [ OPTIONS ] file.stl Speed options: --travel-speed Speed of non-print moves in mm/sec (default: $Slic3r::travel_speed) --perimeter-speed Speed of print moves for perimeters in mm/sec (default: $Slic3r::perimeter_speed) + --small-perimeter-speed + Speed of print moves for small perimeters in mm/sec (default: $Slic3r::small_perimeter_speed) --infill-speed Speed of print moves in mm/sec (default: $Slic3r::infill_speed) --solid-infill-speed Speed of print moves for solid surfaces in mm/sec (default: $Slic3r::solid_infill_speed) --bridge-speed Speed of bridge print moves in mm/sec (default: $Slic3r::bridge_speed)