Customizable speed for small perimeters. #60

This commit is contained in:
Alessandro Ranellucci 2011-12-04 20:50:03 +01:00
parent ea254588f7
commit 53bc9c7421
8 changed files with 28 additions and 1 deletions

View File

@ -109,6 +109,8 @@ The author is Alessandro Ranellucci (me).
Speed options: Speed options:
--travel-speed Speed of non-print moves in mm/sec (default: 130) --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) --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) --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) --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) --bridge-speed Speed of bridge print moves in mm/sec (default: 60)

View File

@ -50,6 +50,7 @@ our $temperature = 200;
# speed options # speed options
our $travel_speed = 130; # mm/sec our $travel_speed = 130; # mm/sec
our $perimeter_speed = 30; # mm/sec our $perimeter_speed = 30; # mm/sec
our $small_perimeter_speed = 30; # mm/sec
our $infill_speed = 60; # mm/sec our $infill_speed = 60; # mm/sec
our $solid_infill_speed = 60; # mm/sec our $solid_infill_speed = 60; # mm/sec
our $bridge_speed = 60; # mm/sec our $bridge_speed = 60; # mm/sec
@ -57,6 +58,7 @@ our $bottom_layer_speed_ratio = 0.3;
# accuracy options # accuracy options
our $resolution = 0.00000001; our $resolution = 0.00000001;
our $small_perimeter_area = (5 / $resolution) ** 2;
our $layer_height = 0.4; our $layer_height = 0.4;
our $first_layer_height_ratio = 1; our $first_layer_height_ratio = 1;
our $infill_every_layers = 1; our $infill_every_layers = 1;

View File

@ -80,6 +80,11 @@ our $Options = {
type => 'f', type => 'f',
aliases => [qw(perimeter_feed_rate)], aliases => [qw(perimeter_feed_rate)],
}, },
'small_perimeter_speed' => {
label => 'Small perimeters (mm/s)',
cli => 'small-perimeter-speed=i',
type => 'f',
},
'infill_speed' => { 'infill_speed' => {
label => 'Infill (mm/s)', label => 'Infill (mm/s)',
cli => 'infill-speed=i', cli => 'infill-speed=i',
@ -424,6 +429,7 @@ sub validate {
if $Slic3r::skirt_height < 1; if $Slic3r::skirt_height < 1;
# legacy with existing config files # legacy with existing config files
$Slic3r::small_perimeter_speed ||= $Slic3r::perimeter_speed;
$Slic3r::bridge_speed ||= $Slic3r::infill_speed; $Slic3r::bridge_speed ||= $Slic3r::infill_speed;
$Slic3r::solid_infill_speed ||= $Slic3r::infill_speed; $Slic3r::solid_infill_speed ||= $Slic3r::infill_speed;
} }

View File

@ -24,6 +24,10 @@ has 'perimeter_speed' => (
is => 'ro', is => 'ro',
default => sub { $Slic3r::perimeter_speed * 60 }, # mm/min 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' => ( has 'infill_speed' => (
is => 'ro', is => 'ro',
default => sub { $Slic3r::infill_speed * 60 }, # mm/min default => sub { $Slic3r::infill_speed * 60 }, # mm/min
@ -124,6 +128,7 @@ sub extrude {
# extrude arc or line # extrude arc or line
$self->print_feed_rate( $self->print_feed_rate(
$path->role =~ /^(perimeter|skirt)$/o ? $self->perimeter_speed $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 'fill' ? $self->infill_speed
: $path->role eq 'solid-fill' ? $self->solid_infill_speed : $path->role eq 'solid-fill' ? $self->solid_infill_speed
: $path->role eq 'bridge' ? $self->bridge_speed : $path->role eq 'bridge' ? $self->bridge_speed

View File

@ -25,7 +25,7 @@ sub new {
}, },
print_speed => { print_speed => {
title => '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 => { speed => {
title => 'Other speed settings', title => 'Other speed settings',

View File

@ -71,6 +71,11 @@ sub make_perimeter {
push @{ $layer->perimeters }, Slic3r::ExtrusionLoop->cast($contour, role => '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; 1;

View File

@ -40,4 +40,9 @@ sub is_valid {
return @{$self->points} >= 3; return @{$self->points} >= 3;
} }
sub polygon {
my $self = shift;
return Slic3r::Polygon->new($self->points);
}
1; 1;

View File

@ -115,6 +115,8 @@ Usage: slic3r.pl [ OPTIONS ] file.stl
Speed options: Speed options:
--travel-speed Speed of non-print moves in mm/sec (default: $Slic3r::travel_speed) --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) --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) --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) --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) --bridge-speed Speed of bridge print moves in mm/sec (default: $Slic3r::bridge_speed)