New --top-solid-infill-speed option. Also, --solid-infill-speed and --small-perimeter-speed can be expressed as ratios too. #174 #151

This commit is contained in:
Alessandro Ranellucci 2012-06-06 19:57:16 +02:00
parent 2ccb443c2f
commit fbfbfac2b6
8 changed files with 59 additions and 33 deletions

View File

@ -127,9 +127,13 @@ The author is Alessandro Ranellucci.
--travel-speed Speed of non-print moves in mm/s (default: 130)
--perimeter-speed Speed of print moves for perimeters in mm/s (default: 30)
--small-perimeter-speed
Speed of print moves for small perimeters in mm/s (default: 30)
Speed of print moves for small perimeters in mm/s or % over perimeter speed
(default: 30)
--infill-speed Speed of print moves in mm/s (default: 60)
--solid-infill-speed Speed of print moves for solid surfaces in mm/s (default: 60)
--solid-infill-speed Speed of print moves for solid surfaces in mm/s or % over infill speed
(default: 60)
--top-solid-infill-speed Speed of print moves for top surfaces in mm/s or % over solid infill speed
(default: 50)
--bridge-speed Speed of bridge print moves in mm/s (default: 60)
--first-layer-speed Speed of print moves for bottom layer, expressed either as an absolute
value or as a percentage over normal speeds (default: 30%)

View File

@ -78,13 +78,14 @@ our $bed_temperature = 0;
our $first_layer_bed_temperature;
# speed options
our $travel_speed = 130; # mm/s
our $perimeter_speed = 30; # mm/s
our $small_perimeter_speed = 30; # mm/s
our $infill_speed = 60; # mm/s
our $solid_infill_speed = 60; # mm/s
our $bridge_speed = 60; # mm/s
our $first_layer_speed = '30%'; # mm/s or %
our $travel_speed = 130; # mm/s
our $perimeter_speed = 30; # mm/s
our $small_perimeter_speed = 30; # 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 %
our $bridge_speed = 60; # mm/s
our $first_layer_speed = '30%'; # mm/s or %
# acceleration options
our $acceleration = 0;

View File

@ -135,9 +135,10 @@ our $Options = {
aliases => [qw(perimeter_feed_rate)],
},
'small_perimeter_speed' => {
label => 'Small perimeters (mm/s)',
label => 'Small perimeters (mm/s or %)',
cli => 'small-perimeter-speed=f',
type => 'f',
ratio_over => 'perimeter_speed',
},
'infill_speed' => {
label => 'Infill (mm/s)',
@ -146,11 +147,18 @@ our $Options = {
aliases => [qw(print_feed_rate infill_feed_rate)],
},
'solid_infill_speed' => {
label => 'Solid infill (mm/s)',
label => 'Solid infill (mm/s or %)',
cli => 'solid-infill-speed=f',
type => 'f',
ratio_over => 'infill_speed',
aliases => [qw(solid_infill_feed_rate)],
},
'top_solid_infill_speed' => {
label => 'Solid infill (mm/s or %)',
cli => 'solid-infill-speed=f',
type => 'f',
ratio_over => 'solid_infill_speed',
},
'bridge_speed' => {
label => 'Bridges (mm/s)',
cli => 'bridge-speed=f',
@ -190,6 +198,7 @@ our $Options = {
label => 'First layer height (mm or %)',
cli => 'first-layer-height=s',
type => 'f',
ratio_over => 'layer_height',
},
'infill_every_layers' => {
label => 'Infill every N layers',
@ -475,7 +484,10 @@ sub get {
my $class = @_ == 2 ? shift : undef;
my ($opt_key) = @_;
no strict 'refs';
return ${"Slic3r::$opt_key"};
my $value = ${"Slic3r::$opt_key"};
$value = get($Options->{$opt_key}{ratio_over}) * $1/100
if $Options->{$opt_key}{ratio_over} && $value =~ /^(\d+(?:\.\d+)?)%$/;
return $value;
}
sub set {
@ -589,9 +601,7 @@ sub validate {
# --first-layer-height
die "Invalid value for --first-layer-height\n"
if $Slic3r::first_layer_height !~ /^(?:\d+(?:\.\d+)?)%?$/;
$Slic3r::_first_layer_height = $Slic3r::first_layer_height =~ /^(\d+(?:\.\d+)?)%$/
? ($Slic3r::layer_height * $1/100)
: $Slic3r::first_layer_height;
$Slic3r::_first_layer_height = Slic3r::Config->get('first_layer_height');
# --filament-diameter
die "Invalid value for --filament-diameter\n"
@ -699,6 +709,7 @@ sub validate {
$Slic3r::small_perimeter_speed ||= $Slic3r::perimeter_speed;
$Slic3r::bridge_speed ||= $Slic3r::infill_speed;
$Slic3r::solid_infill_speed ||= $Slic3r::infill_speed;
$Slic3r::top_solid_infill_speed ||= $Slic3r::solid_infill_speed;
}
sub replace_options {

View File

@ -24,13 +24,14 @@ has 'dec' => (is => 'ro', default => sub { 3 } );
has 'speeds' => (
is => 'ro',
default => sub {{
travel => 60 * $Slic3r::travel_speed,
perimeter => 60 * $Slic3r::perimeter_speed,
small_perimeter => 60 * $Slic3r::small_perimeter_speed,
infill => 60 * $Slic3r::infill_speed,
solid_infill => 60 * $Slic3r::solid_infill_speed,
bridge => 60 * $Slic3r::bridge_speed,
retract => 60 * $Slic3r::retract_speed,
travel => 60 * Slic3r::Config->get('travel_speed'),
perimeter => 60 * Slic3r::Config->get('perimeter_speed'),
small_perimeter => 60 * Slic3r::Config->get('small_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'),
bridge => 60 * Slic3r::Config->get('bridge_speed'),
retract => 60 * Slic3r::Config->get('retract_speed'),
}},
);
@ -40,6 +41,7 @@ my %role_speeds = (
&EXTR_ROLE_CONTOUR_INTERNAL_PERIMETER => 'perimeter',
&EXTR_ROLE_FILL => 'infill',
&EXTR_ROLE_SOLIDFILL => 'solid_infill',
&EXTR_ROLE_TOPSOLIDFILL => 'top_solid_infill',
&EXTR_ROLE_BRIDGE => 'bridge',
&EXTR_ROLE_SKIRT => 'perimeter',
&EXTR_ROLE_SUPPORTMATERIAL => 'perimeter',
@ -183,7 +185,7 @@ sub extrude_path {
if ($Slic3r::cooling) {
my $path_time = unscale($path_length) / $self->speeds->{$self->last_speed} * 60;
if ($self->layer->id == 0) {
$path_time = $Slic3r::first_layer_speed =~ /^(\d+(?:\.\d+)?)%$/
$path_time = $Slic3r:: =~ /^(\d+(?:\.\d+)?)%$/
? $path_time / ($1/100)
: unscale($path_length) / $Slic3r::first_layer_speed * 60;
}

View File

@ -4,7 +4,8 @@ use Moo;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(EXTR_ROLE_PERIMETER EXTR_ROLE_SMALLPERIMETER EXTR_ROLE_CONTOUR_INTERNAL_PERIMETER
EXTR_ROLE_FILL EXTR_ROLE_SOLIDFILL EXTR_ROLE_BRIDGE EXTR_ROLE_SKIRT EXTR_ROLE_SUPPORTMATERIAL);
EXTR_ROLE_FILL EXTR_ROLE_SOLIDFILL EXTR_ROLE_TOPSOLIDFILL EXTR_ROLE_BRIDGE EXTR_ROLE_SKIRT
EXTR_ROLE_SUPPORTMATERIAL);
our %EXPORT_TAGS = (roles => \@EXPORT_OK);
use Slic3r::Geometry qw(PI X Y epsilon deg2rad rotate_points);
@ -28,9 +29,10 @@ 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_BRIDGE => 5;
use constant EXTR_ROLE_SKIRT => 6;
use constant EXTR_ROLE_SUPPORTMATERIAL => 7;
use constant EXTR_ROLE_TOPSOLIDFILL => 5;
use constant EXTR_ROLE_BRIDGE => 6;
use constant EXTR_ROLE_SKIRT => 7;
use constant EXTR_ROLE_SUPPORTMATERIAL => 8;
sub BUILD {
my $self = shift;

View File

@ -167,9 +167,11 @@ sub make_fill {
paths => [
map Slic3r::ExtrusionPath->new(
polyline => Slic3r::Polyline->new(@$_),
role => ($is_bridge ? EXTR_ROLE_BRIDGE
: $is_solid ? EXTR_ROLE_SOLIDFILL
: EXTR_ROLE_FILL),
role => ($is_bridge
? EXTR_ROLE_BRIDGE
: $is_solid
? ($surface->surface_type == S_TYPE_TOP ? EXTR_ROLE_TOPSOLIDFILL : EXTR_ROLE_SOLIDFILL)
: EXTR_ROLE_FILL),
depth_layers => $surface->depth_layers,
flow_spacing => $params->{flow_spacing},
), @paths,

View File

@ -32,7 +32,7 @@ sub new {
},
print_speed => {
title => 'Print speed',
options => [qw(perimeter_speed small_perimeter_speed infill_speed solid_infill_speed bridge_speed)],
options => [qw(perimeter_speed small_perimeter_speed infill_speed solid_infill_speed top_solid_infill_speed bridge_speed)],
},
speed => {
title => 'Other speed settings',

View File

@ -171,9 +171,13 @@ $j
--travel-speed Speed of non-print moves in mm/s (default: $Slic3r::travel_speed)
--perimeter-speed Speed of print moves for perimeters in mm/s (default: $Slic3r::perimeter_speed)
--small-perimeter-speed
Speed of print moves for small perimeters in mm/s (default: $Slic3r::small_perimeter_speed)
Speed of print moves for small perimeters in mm/s or % over perimeter speed
(default: $Slic3r::small_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 (default: $Slic3r::solid_infill_speed)
--solid-infill-speed Speed of print moves for solid surfaces in mm/s or % over infill speed
(default: $Slic3r::solid_infill_speed)
--top-solid-infill-speed Speed of print moves for top surfaces in mm/s or % over solid infill speed
(default: $Slic3r::top_solid_infill_speed)
--bridge-speed Speed of bridge print moves in mm/s (default: $Slic3r::bridge_speed)
--first-layer-speed Speed of print moves for bottom layer, expressed either as an absolute
value or as a percentage over normal speeds (default: $Slic3r::first_layer_speed)