2011-10-03 09:55:32 +00:00
|
|
|
package Slic3r::Config;
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
2011-10-09 20:29:13 +00:00
|
|
|
use utf8;
|
2011-10-03 09:55:32 +00:00
|
|
|
|
|
|
|
use constant PI => 4 * atan2(1, 1);
|
|
|
|
|
2011-10-05 16:13:47 +00:00
|
|
|
our $Options = {
|
|
|
|
|
|
|
|
# printer options
|
|
|
|
'nozzle_diameter' => {
|
|
|
|
label => 'Nozzle diameter',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'nozzle-diameter=f',
|
2011-10-05 16:13:47 +00:00
|
|
|
type => 'f',
|
2011-12-02 16:02:36 +00:00
|
|
|
important => 1,
|
2011-10-05 16:13:47 +00:00
|
|
|
},
|
|
|
|
'print_center' => {
|
|
|
|
label => 'Print center',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'print-center=s',
|
2011-10-05 16:13:47 +00:00
|
|
|
type => 'point',
|
|
|
|
serialize => sub { join ',', @{$_[0]} },
|
|
|
|
deserialize => sub { [ split /,/, $_[0] ] },
|
|
|
|
},
|
|
|
|
'use_relative_e_distances' => {
|
|
|
|
label => 'Use relative E distances',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'use-relative-e-distances',
|
2011-11-13 17:26:31 +00:00
|
|
|
type => 'bool',
|
|
|
|
},
|
2011-12-01 21:34:21 +00:00
|
|
|
'extrusion_axis' => {
|
|
|
|
label => 'Extrusion axis',
|
2011-12-02 16:02:36 +00:00
|
|
|
cli => 'extrusion-axis',
|
2011-12-01 21:34:21 +00:00
|
|
|
type => 's',
|
2011-10-05 16:13:47 +00:00
|
|
|
},
|
|
|
|
'z_offset' => {
|
|
|
|
label => 'Z offset',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'z-offset=f',
|
2011-10-05 16:13:47 +00:00
|
|
|
type => 'f',
|
|
|
|
},
|
2011-12-01 21:03:13 +00:00
|
|
|
'gcode_arcs' => {
|
|
|
|
label => 'Use native GCODE arcs',
|
|
|
|
cli => 'gcode-arcs',
|
|
|
|
type => 'bool',
|
|
|
|
},
|
|
|
|
'g0' => {
|
|
|
|
label => 'Use g0 for travel moves',
|
|
|
|
cli => 'g0',
|
|
|
|
type => 'bool',
|
|
|
|
},
|
2011-10-05 16:13:47 +00:00
|
|
|
|
|
|
|
# filament options
|
|
|
|
'filament_diameter' => {
|
|
|
|
label => 'Diameter (mm)',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'filament-diameter=f',
|
2011-10-05 16:13:47 +00:00
|
|
|
type => 'f',
|
2011-12-02 16:02:36 +00:00
|
|
|
important => 1,
|
2011-10-05 16:13:47 +00:00
|
|
|
},
|
2011-11-25 10:15:20 +00:00
|
|
|
'extrusion_multiplier' => {
|
|
|
|
label => 'Extrusion multiplier',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'extrusion-multiplier=f',
|
2011-10-05 16:13:47 +00:00
|
|
|
type => 'f',
|
2011-11-25 10:15:20 +00:00
|
|
|
aliases => [qw(filament_packing_density)],
|
2011-10-05 16:13:47 +00:00
|
|
|
},
|
2011-10-09 20:29:13 +00:00
|
|
|
'temperature' => {
|
|
|
|
label => 'Temperature (°C)',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'temperature=i',
|
2011-10-09 20:29:13 +00:00
|
|
|
type => 'i',
|
2011-12-02 16:02:36 +00:00
|
|
|
important => 1,
|
2011-10-09 20:29:13 +00:00
|
|
|
},
|
2011-10-05 16:13:47 +00:00
|
|
|
|
|
|
|
# speed options
|
2011-12-01 21:03:13 +00:00
|
|
|
'travel_speed' => {
|
2011-11-28 18:11:26 +00:00
|
|
|
label => 'Travel (mm/s)',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'travel-speed=i',
|
2011-10-05 16:13:47 +00:00
|
|
|
type => 'f',
|
2011-12-01 21:03:13 +00:00
|
|
|
aliases => [qw(travel_feed_rate)],
|
2011-10-05 16:13:47 +00:00
|
|
|
},
|
2011-12-01 21:03:13 +00:00
|
|
|
'perimeter_speed' => {
|
2011-11-28 18:11:26 +00:00
|
|
|
label => 'Perimeters (mm/s)',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'perimeter-speed=i',
|
2011-11-28 18:11:26 +00:00
|
|
|
type => 'f',
|
2011-12-01 21:03:13 +00:00
|
|
|
aliases => [qw(perimeter_feed_rate)],
|
2011-11-28 18:11:26 +00:00
|
|
|
},
|
2011-12-04 19:50:03 +00:00
|
|
|
'small_perimeter_speed' => {
|
|
|
|
label => 'Small perimeters (mm/s)',
|
|
|
|
cli => 'small-perimeter-speed=i',
|
|
|
|
type => 'f',
|
|
|
|
},
|
2011-12-01 21:03:13 +00:00
|
|
|
'infill_speed' => {
|
2011-11-28 18:11:26 +00:00
|
|
|
label => 'Infill (mm/s)',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'infill-speed=i',
|
2011-11-28 18:11:26 +00:00
|
|
|
type => 'f',
|
2011-12-01 21:03:13 +00:00
|
|
|
aliases => [qw(print_feed_rate infill_feed_rate)],
|
2011-11-28 18:11:26 +00:00
|
|
|
},
|
2011-12-01 21:03:13 +00:00
|
|
|
'solid_infill_speed' => {
|
2011-11-28 18:11:26 +00:00
|
|
|
label => 'Solid infill (mm/s)',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'solid-infill-speed=i',
|
2011-10-05 16:13:47 +00:00
|
|
|
type => 'f',
|
2011-12-01 21:03:13 +00:00
|
|
|
aliases => [qw(solid_infill_feed_rate)],
|
2011-10-05 16:13:47 +00:00
|
|
|
},
|
2011-12-01 21:03:13 +00:00
|
|
|
'bridge_speed' => {
|
2011-11-28 18:11:26 +00:00
|
|
|
label => 'Bridges (mm/s)',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'bridge-speed=i',
|
2011-11-28 17:37:53 +00:00
|
|
|
type => 'f',
|
2011-12-01 21:03:13 +00:00
|
|
|
aliases => [qw(bridge_feed_rate)],
|
2011-11-28 17:37:53 +00:00
|
|
|
},
|
2011-10-05 16:13:47 +00:00
|
|
|
'bottom_layer_speed_ratio' => {
|
2011-11-28 18:11:26 +00:00
|
|
|
label => 'Bottom layer speed ratio',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'bottom-layer-speed-ratio=f',
|
2011-10-05 16:13:47 +00:00
|
|
|
type => 'f',
|
|
|
|
},
|
|
|
|
|
|
|
|
# accuracy options
|
|
|
|
'layer_height' => {
|
|
|
|
label => 'Layer height (mm)',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'layer-height=f',
|
2011-10-05 16:13:47 +00:00
|
|
|
type => 'f',
|
|
|
|
},
|
2011-12-07 18:33:59 +00:00
|
|
|
'first_layer_height_ratio' => {
|
|
|
|
label => 'First layer height ratio',
|
|
|
|
cli => 'first-layer-height-ratio=f',
|
|
|
|
type => 'f',
|
|
|
|
},
|
|
|
|
'infill_every_layers' => {
|
|
|
|
label => 'Infill every N layers',
|
|
|
|
cli => 'infill-every-layers=i',
|
|
|
|
type => 'i',
|
|
|
|
},
|
|
|
|
|
|
|
|
# flow options
|
2011-11-25 09:58:13 +00:00
|
|
|
'extrusion_width_ratio' => {
|
2011-11-26 19:51:04 +00:00
|
|
|
label => 'Extrusion width (ratio over layer height; leave zero to calculate automatically)',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'extrusion-width-ratio=f',
|
2011-11-25 09:58:13 +00:00
|
|
|
type => 'f',
|
|
|
|
},
|
2011-12-04 19:29:21 +00:00
|
|
|
'bridge_flow_ratio' => {
|
|
|
|
label => 'Bridge flow ratio',
|
|
|
|
cli => 'bridge-flow-ratio=f',
|
|
|
|
type => 'f',
|
|
|
|
},
|
2011-12-07 18:33:59 +00:00
|
|
|
'overlap_ratio' => {
|
|
|
|
label => 'Extrusion overlap (ratio over extrusion width)',
|
|
|
|
cli => 'overlap-ratio=f',
|
2011-11-13 18:08:19 +00:00
|
|
|
type => 'f',
|
|
|
|
},
|
2011-10-05 16:13:47 +00:00
|
|
|
|
|
|
|
# print options
|
2011-11-17 09:38:23 +00:00
|
|
|
'perimeters' => {
|
2011-10-05 16:13:47 +00:00
|
|
|
label => 'Perimeters',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'perimeters=i',
|
2011-10-05 16:13:47 +00:00
|
|
|
type => 'i',
|
2011-11-17 09:38:23 +00:00
|
|
|
aliases => [qw(perimeter_offsets)],
|
2011-10-05 16:13:47 +00:00
|
|
|
},
|
|
|
|
'solid_layers' => {
|
|
|
|
label => 'Solid layers',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'solid-layers=i',
|
2011-10-05 16:13:47 +00:00
|
|
|
type => 'i',
|
|
|
|
},
|
2011-11-13 17:14:02 +00:00
|
|
|
'fill_pattern' => {
|
|
|
|
label => 'Fill pattern',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'fill-pattern=s',
|
2011-11-13 17:14:02 +00:00
|
|
|
type => 'select',
|
2011-11-26 09:38:05 +00:00
|
|
|
values => [qw(rectilinear line concentric hilbertcurve archimedeanchords octagramspiral)],
|
2011-11-26 21:41:23 +00:00
|
|
|
labels => [qw(rectilinear line concentric), 'hilbertcurve (slow)', 'archimedeanchords (slow)', 'octagramspiral (slow)'],
|
2011-11-13 17:14:02 +00:00
|
|
|
},
|
|
|
|
'solid_fill_pattern' => {
|
|
|
|
label => 'Solid fill pattern',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'solid-fill-pattern=s',
|
2011-11-13 17:14:02 +00:00
|
|
|
type => 'select',
|
2011-11-26 09:38:05 +00:00
|
|
|
values => [qw(rectilinear concentric hilbertcurve archimedeanchords octagramspiral)],
|
2011-11-26 21:41:23 +00:00
|
|
|
labels => [qw(rectilinear concentric), 'hilbertcurve (slow)', 'archimedeanchords (slow)', 'octagramspiral (slow)'],
|
2011-11-13 17:14:02 +00:00
|
|
|
},
|
2011-10-05 16:13:47 +00:00
|
|
|
'fill_density' => {
|
|
|
|
label => 'Fill density',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'fill-density=f',
|
2011-10-05 16:13:47 +00:00
|
|
|
type => 'f',
|
|
|
|
},
|
|
|
|
'fill_angle' => {
|
|
|
|
label => 'Fill angle (°)',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'fill-angle=i',
|
2011-10-05 16:13:47 +00:00
|
|
|
type => 'i',
|
|
|
|
},
|
2011-10-14 14:24:55 +00:00
|
|
|
'start_gcode' => {
|
|
|
|
label => 'Start GCODE',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'start-gcode=s',
|
2011-10-14 14:24:55 +00:00
|
|
|
type => 's',
|
2011-11-13 21:48:21 +00:00
|
|
|
multiline => 1,
|
|
|
|
width => 350,
|
|
|
|
height => 150,
|
2011-10-14 14:24:55 +00:00
|
|
|
serialize => sub { join '\n', split /\R+/, $_[0] },
|
|
|
|
deserialize => sub { join "\n", split /\\n/, $_[0] },
|
|
|
|
},
|
|
|
|
'end_gcode' => {
|
|
|
|
label => 'End GCODE',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'end-gcode=s',
|
2011-10-14 14:24:55 +00:00
|
|
|
type => 's',
|
2011-11-13 21:48:21 +00:00
|
|
|
multiline => 1,
|
|
|
|
width => 350,
|
|
|
|
height => 150,
|
2011-10-14 14:24:55 +00:00
|
|
|
serialize => sub { join '\n', split /\R+/, $_[0] },
|
|
|
|
deserialize => sub { join "\n", split /\\n/, $_[0] },
|
|
|
|
},
|
2011-10-05 16:13:47 +00:00
|
|
|
|
|
|
|
# retraction options
|
|
|
|
'retract_length' => {
|
|
|
|
label => 'Length (mm)',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'retract-length=f',
|
2011-10-05 16:13:47 +00:00
|
|
|
type => 'f',
|
|
|
|
},
|
|
|
|
'retract_speed' => {
|
|
|
|
label => 'Speed (mm/s)',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'retract-speed=i',
|
2011-10-05 16:13:47 +00:00
|
|
|
type => 'i',
|
|
|
|
},
|
|
|
|
'retract_restart_extra' => {
|
|
|
|
label => 'Extra length on restart (mm)',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'retract-restart-extra=f',
|
2011-10-05 16:13:47 +00:00
|
|
|
type => 'f',
|
|
|
|
},
|
|
|
|
'retract_before_travel' => {
|
|
|
|
label => 'Minimum travel after retraction (mm)',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'retract-before-travel=f',
|
2011-10-05 16:13:47 +00:00
|
|
|
type => 'f',
|
|
|
|
},
|
2011-11-07 14:58:47 +00:00
|
|
|
'retract_lift' => {
|
|
|
|
label => 'Lift Z (mm)',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'retract-lift=f',
|
2011-11-07 14:58:47 +00:00
|
|
|
type => 'f',
|
|
|
|
},
|
2011-10-05 16:13:47 +00:00
|
|
|
|
|
|
|
# skirt options
|
|
|
|
'skirts' => {
|
|
|
|
label => 'Loops',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'skirts=i',
|
2011-10-05 16:13:47 +00:00
|
|
|
type => 'i',
|
|
|
|
},
|
|
|
|
'skirt_distance' => {
|
|
|
|
label => 'Distance from object (mm)',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'skirt-distance=i',
|
2011-10-05 16:13:47 +00:00
|
|
|
type => 'i',
|
|
|
|
},
|
2011-11-13 17:41:12 +00:00
|
|
|
'skirt_height' => {
|
|
|
|
label => 'Skirt height (layers)',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'skirt-height=i',
|
2011-11-13 17:41:12 +00:00
|
|
|
type => 'i',
|
|
|
|
},
|
2011-10-05 16:13:47 +00:00
|
|
|
|
|
|
|
# transform options
|
|
|
|
'scale' => {
|
|
|
|
label => 'Scale',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'scale=f',
|
2011-10-05 16:13:47 +00:00
|
|
|
type => 'f',
|
|
|
|
},
|
|
|
|
'rotate' => {
|
|
|
|
label => 'Rotate (°)',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'rotate=i',
|
2011-10-05 16:13:47 +00:00
|
|
|
type => 'i',
|
|
|
|
},
|
2011-11-07 14:49:07 +00:00
|
|
|
'duplicate_x' => {
|
|
|
|
label => 'Copies along X',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'duplicate-x=i',
|
2011-10-05 16:13:47 +00:00
|
|
|
type => 'i',
|
2011-11-07 16:16:34 +00:00
|
|
|
aliases => [qw(multiply_x)],
|
2011-10-05 16:13:47 +00:00
|
|
|
},
|
2011-11-07 14:49:07 +00:00
|
|
|
'duplicate_y' => {
|
|
|
|
label => 'Copies along Y',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'duplicate-y=i',
|
2011-10-05 16:13:47 +00:00
|
|
|
type => 'i',
|
2011-11-07 16:16:34 +00:00
|
|
|
aliases => [qw(multiply_y)],
|
2011-10-05 16:13:47 +00:00
|
|
|
},
|
2011-11-07 14:49:07 +00:00
|
|
|
'duplicate_distance' => {
|
|
|
|
label => 'Distance between copies',
|
2011-12-01 21:03:13 +00:00
|
|
|
cli => 'duplicate-distance=i',
|
2011-10-05 16:13:47 +00:00
|
|
|
type => 'i',
|
2011-11-07 16:16:34 +00:00
|
|
|
aliases => [qw(multiply_distance)],
|
2011-10-05 16:13:47 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
sub get {
|
|
|
|
my $class = @_ == 2 ? shift : undef;
|
|
|
|
my ($opt_key) = @_;
|
|
|
|
no strict 'refs';
|
|
|
|
return ${"Slic3r::$opt_key"};
|
|
|
|
}
|
|
|
|
|
|
|
|
sub set {
|
|
|
|
my $class = @_ == 3 ? shift : undef;
|
|
|
|
my ($opt_key, $value) = @_;
|
|
|
|
no strict 'refs';
|
|
|
|
${"Slic3r::$opt_key"} = $value;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub save {
|
|
|
|
my $class = shift;
|
|
|
|
my ($file) = @_;
|
|
|
|
|
|
|
|
open my $fh, '>', $file;
|
|
|
|
foreach my $opt (sort keys %$Options) {
|
|
|
|
my $value = get($opt);
|
|
|
|
$value = $Options->{$opt}{serialize}->($value) if $Options->{$opt}{serialize};
|
|
|
|
printf $fh "%s = %s\n", $opt, $value;
|
|
|
|
}
|
|
|
|
close $fh;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub load {
|
|
|
|
my $class = shift;
|
|
|
|
my ($file) = @_;
|
|
|
|
|
|
|
|
open my $fh, '<', $file;
|
|
|
|
while (<$fh>) {
|
2011-12-04 19:41:17 +00:00
|
|
|
next if /^\s+/;
|
|
|
|
next if /^$/;
|
2011-10-05 16:13:47 +00:00
|
|
|
next if /^\s*#/;
|
2011-12-01 21:06:07 +00:00
|
|
|
/^(\w+) = (.*)/ or die "Unreadable configuration file (invalid data at line $.)\n";
|
2011-11-07 16:16:34 +00:00
|
|
|
my $key = $1;
|
|
|
|
if (!exists $Options->{$key}) {
|
|
|
|
$key = +(grep { $Options->{$_}{aliases} && grep $_ eq $key, @{$Options->{$_}{aliases}} }
|
|
|
|
keys %$Options)[0] or die "Unknown option $1 at line $.\n";
|
|
|
|
}
|
|
|
|
my $opt = $Options->{$key};
|
|
|
|
set($key, $opt->{deserialize} ? $opt->{deserialize}->($2) : $2);
|
2011-10-05 16:13:47 +00:00
|
|
|
}
|
|
|
|
close $fh;
|
|
|
|
}
|
|
|
|
|
2011-10-14 14:24:55 +00:00
|
|
|
sub validate_cli {
|
|
|
|
my $class = shift;
|
|
|
|
my ($opt) = @_;
|
|
|
|
|
|
|
|
for (qw(start end)) {
|
|
|
|
if (defined $opt->{$_."_gcode"}) {
|
|
|
|
if ($opt->{$_."_gcode"} eq "") {
|
|
|
|
set($_."_gcode", "");
|
|
|
|
} else {
|
|
|
|
die "Invalid value for --${_}-gcode: file does not exist"
|
|
|
|
if !-e $opt->{$_."_gcode"};
|
|
|
|
open my $fh, "<", $opt->{$_."_gcode"};
|
2011-12-01 21:03:13 +00:00
|
|
|
$opt->{$_."_gcode"} = do { local $/; <$fh> };
|
2011-10-14 14:24:55 +00:00
|
|
|
close $fh;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-03 09:55:32 +00:00
|
|
|
sub validate {
|
|
|
|
my $class = shift;
|
|
|
|
|
|
|
|
# --layer-height
|
|
|
|
die "Invalid value for --layer-height\n"
|
|
|
|
if $Slic3r::layer_height <= 0;
|
|
|
|
die "--layer-height must be a multiple of print resolution\n"
|
|
|
|
if $Slic3r::layer_height / $Slic3r::resolution % 1 != 0;
|
|
|
|
|
2011-11-13 18:08:19 +00:00
|
|
|
# --first-layer-height-ratio
|
|
|
|
die "Invalid value for --first-layer-height-ratio\n"
|
|
|
|
if $Slic3r::first_layer_height_ratio < 0;
|
|
|
|
|
2011-10-03 09:55:32 +00:00
|
|
|
# --filament-diameter
|
|
|
|
die "Invalid value for --filament-diameter\n"
|
|
|
|
if $Slic3r::filament_diameter < 1;
|
|
|
|
|
|
|
|
# --nozzle-diameter
|
|
|
|
die "Invalid value for --nozzle-diameter\n"
|
|
|
|
if $Slic3r::nozzle_diameter < 0;
|
|
|
|
die "--layer-height can't be greater than --nozzle-diameter\n"
|
|
|
|
if $Slic3r::layer_height > $Slic3r::nozzle_diameter;
|
2011-11-13 18:08:19 +00:00
|
|
|
die "First layer height can't be greater than --nozzle-diameter\n"
|
|
|
|
if ($Slic3r::layer_height * $Slic3r::first_layer_height_ratio) > $Slic3r::nozzle_diameter;
|
2011-10-03 09:55:32 +00:00
|
|
|
$Slic3r::flow_width = ($Slic3r::nozzle_diameter**2)
|
2011-11-25 09:58:13 +00:00
|
|
|
* $Slic3r::flow_speed_ratio * PI / (4 * $Slic3r::layer_height);
|
2011-10-03 09:55:32 +00:00
|
|
|
|
|
|
|
my $max_flow_width = $Slic3r::layer_height + $Slic3r::nozzle_diameter;
|
2011-11-25 09:58:13 +00:00
|
|
|
if ($Slic3r::extrusion_width_ratio) {
|
|
|
|
my $flow_width = $Slic3r::layer_height * $Slic3r::extrusion_width_ratio;
|
|
|
|
$Slic3r::flow_speed_ratio = $flow_width / $Slic3r::flow_width;
|
|
|
|
$Slic3r::flow_width = $flow_width;
|
2011-11-30 17:18:17 +00:00
|
|
|
} elsif ($Slic3r::flow_width > $max_flow_width) {
|
|
|
|
$Slic3r::flow_speed_ratio = $max_flow_width / $Slic3r::flow_width;
|
|
|
|
$Slic3r::flow_width = $max_flow_width;
|
2011-11-25 09:58:13 +00:00
|
|
|
}
|
2011-12-07 18:33:59 +00:00
|
|
|
$Slic3r::flow_spacing = $Slic3r::flow_width * (1-$Slic3r::overlap_ratio);
|
2011-10-03 09:55:32 +00:00
|
|
|
|
|
|
|
Slic3r::debugf "Flow width = $Slic3r::flow_width\n";
|
2011-11-25 09:58:13 +00:00
|
|
|
Slic3r::debugf "Flow speed ratio = $Slic3r::flow_speed_ratio\n";
|
2011-12-07 18:33:59 +00:00
|
|
|
Slic3r::debugf "Flow spacing = $Slic3r::flow_spacing\n";
|
2011-10-03 09:55:32 +00:00
|
|
|
|
|
|
|
# --perimeters
|
|
|
|
die "Invalid value for --perimeters\n"
|
2011-11-17 09:38:23 +00:00
|
|
|
if $Slic3r::perimeters < 1;
|
2011-10-03 09:55:32 +00:00
|
|
|
|
|
|
|
# --solid-layers
|
|
|
|
die "Invalid value for --solid-layers\n"
|
2011-11-30 01:51:34 +00:00
|
|
|
if $Slic3r::solid_layers < 0;
|
2011-10-03 09:55:32 +00:00
|
|
|
|
|
|
|
# --print-center
|
|
|
|
die "Invalid value for --print-center\n"
|
|
|
|
if !ref $Slic3r::print_center
|
|
|
|
&& (!$Slic3r::print_center || $Slic3r::print_center !~ /^\d+,\d+$/);
|
|
|
|
$Slic3r::print_center = [ split /,/, $Slic3r::print_center ]
|
|
|
|
if !ref $Slic3r::print_center;
|
|
|
|
|
2011-11-13 17:14:02 +00:00
|
|
|
# --fill-pattern
|
|
|
|
die "Invalid value for --fill-pattern\n"
|
|
|
|
if !exists $Slic3r::Fill::FillTypes{$Slic3r::fill_pattern};
|
|
|
|
|
|
|
|
# --solid-fill-pattern
|
|
|
|
die "Invalid value for --solid-fill-pattern\n"
|
|
|
|
if !exists $Slic3r::Fill::FillTypes{$Slic3r::solid_fill_pattern};
|
2011-10-06 13:24:21 +00:00
|
|
|
|
2011-10-03 09:55:32 +00:00
|
|
|
# --fill-density
|
|
|
|
die "Invalid value for --fill-density\n"
|
|
|
|
if $Slic3r::fill_density < 0 || $Slic3r::fill_density > 1;
|
|
|
|
|
2011-10-18 13:57:53 +00:00
|
|
|
# --infill-every-layers
|
|
|
|
die "Invalid value for --infill-every-layers\n"
|
|
|
|
if $Slic3r::infill_every_layers !~ /^\d+$/ || $Slic3r::infill_every_layers < 1;
|
|
|
|
die "Maximum infill thickness can't exceed nozzle diameter\n"
|
|
|
|
if $Slic3r::infill_every_layers * $Slic3r::layer_height > $Slic3r::nozzle_diameter;
|
|
|
|
|
2011-10-03 09:55:32 +00:00
|
|
|
# --scale
|
|
|
|
die "Invalid value for --scale\n"
|
|
|
|
if $Slic3r::scale <= 0;
|
|
|
|
|
2011-11-07 14:49:07 +00:00
|
|
|
# --duplicate-x
|
|
|
|
die "Invalid value for --duplicate-x\n"
|
|
|
|
if $Slic3r::duplicate_x < 1;
|
2011-10-03 09:55:32 +00:00
|
|
|
|
2011-11-07 14:49:07 +00:00
|
|
|
# --duplicate-y
|
|
|
|
die "Invalid value for --duplicate-y\n"
|
|
|
|
if $Slic3r::duplicate_y < 1;
|
2011-10-03 09:55:32 +00:00
|
|
|
|
2011-11-07 14:49:07 +00:00
|
|
|
# --duplicate-distance
|
|
|
|
die "Invalid value for --duplicate-distance\n"
|
|
|
|
if $Slic3r::duplicate_distance < 1;
|
2011-11-13 17:41:12 +00:00
|
|
|
|
|
|
|
# --skirt-height
|
|
|
|
die "Invalid value for --skirt-height\n"
|
|
|
|
if $Slic3r::skirt_height < 1;
|
2011-11-28 17:37:53 +00:00
|
|
|
|
|
|
|
# legacy with existing config files
|
2011-12-04 19:50:03 +00:00
|
|
|
$Slic3r::small_perimeter_speed ||= $Slic3r::perimeter_speed;
|
2011-12-01 21:03:13 +00:00
|
|
|
$Slic3r::bridge_speed ||= $Slic3r::infill_speed;
|
|
|
|
$Slic3r::solid_infill_speed ||= $Slic3r::infill_speed;
|
2011-10-03 09:55:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
1;
|