New --extrusion-width-ratio option. #8

This commit is contained in:
Alessandro Ranellucci 2011-11-25 10:58:13 +01:00
parent 465bef1748
commit 3c0ea0b57f
6 changed files with 38 additions and 15 deletions

View File

@ -57,7 +57,8 @@ our $resolution = 0.00000001;
our $layer_height = 0.4;
our $first_layer_height_ratio = 1;
our $infill_every_layers = 1;
our $thickness_ratio = 1;
our $extrusion_width_ratio = undef;
our $flow_speed_ratio = 1.2;
our $flow_width;
# print options

View File

@ -68,6 +68,10 @@ our $Options = {
label => 'Layer height (mm)',
type => 'f',
},
'extrusion_width_ratio' => {
label => 'Extrusion width (ratio over layer height; leave empty to calculate automatically)',
type => 'f',
},
'first_layer_height_ratio' => {
label => 'First layer height ratio',
type => 'f',
@ -276,15 +280,21 @@ sub validate {
die "First layer height can't be greater than --nozzle-diameter\n"
if ($Slic3r::layer_height * $Slic3r::first_layer_height_ratio) > $Slic3r::nozzle_diameter;
$Slic3r::flow_width = ($Slic3r::nozzle_diameter**2)
* $Slic3r::thickness_ratio * PI / (4 * $Slic3r::layer_height);
* $Slic3r::flow_speed_ratio * PI / (4 * $Slic3r::layer_height);
my $max_flow_width = $Slic3r::layer_height + $Slic3r::nozzle_diameter;
if ($Slic3r::flow_width > $max_flow_width) {
$Slic3r::thickness_ratio = $max_flow_width / $Slic3r::flow_width;
$Slic3r::flow_speed_ratio = $max_flow_width / $Slic3r::flow_width;
$Slic3r::flow_width = $max_flow_width;
}
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;
}
Slic3r::debugf "Flow width = $Slic3r::flow_width\n";
Slic3r::debugf "Flow speed ratio = $Slic3r::flow_speed_ratio\n";
# --perimeters
die "Invalid value for --perimeters\n"

View File

@ -101,7 +101,7 @@ sub extrude {
# calculate extrusion length per distance unit
my $e = $Slic3r::resolution
* (($Slic3r::nozzle_diameter**2) / ($Slic3r::filament_diameter ** 2))
* $Slic3r::thickness_ratio
* $Slic3r::flow_speed_ratio
* $self->flow_ratio
* $Slic3r::filament_packing_density
* $path->depth_layers;

View File

@ -32,7 +32,7 @@ sub new {
$size = Wx::Size->new($opt->{width} || -1, $opt->{height} || -1);
}
$field = Wx::TextCtrl->new($parent, -1, Slic3r::Config->get($opt_key),
$field = Wx::TextCtrl->new($parent, -1, Slic3r::Config->get($opt_key) || '',
Wx::wxDefaultPosition, $size, $style);
EVT_TEXT($parent, $field, sub { Slic3r::Config->set($opt_key, $field->GetValue) });
push @reload_callbacks, sub { $field->SetValue(Slic3r::Config->get($opt_key)) };

View File

@ -51,6 +51,10 @@ sub new {
title => 'Custom GCODE',
options => [qw(start_gcode end_gcode)],
},
extrusion => {
title => 'Extrusion',
options => [qw(extrusion_width_ratio)],
},
);
$self->{panels} = \%panels;
@ -73,13 +77,17 @@ sub new {
return $tab;
};
my $tab1 = $make_tab->([qw(transform accuracy skirt)], [qw(print retract)]);
my $tab2 = $make_tab->([qw(printer filament)], [qw(speed)]);
my $tab3 = $make_tab->([qw(gcode)]);
my @tabs = (
$make_tab->([qw(transform accuracy skirt)], [qw(print retract)]),
$make_tab->([qw(printer filament)], [qw(speed)]),
$make_tab->([qw(gcode)]),
$make_tab->([qw(extrusion)]),
);
$tabpanel->AddPage($tab1, "Print Settings");
$tabpanel->AddPage($tab2, "Printer and Filament");
$tabpanel->AddPage($tab3, "Start/End GCODE");
$tabpanel->AddPage($tabs[0], "Print Settings");
$tabpanel->AddPage($tabs[1], "Printer and Filament");
$tabpanel->AddPage($tabs[2], "Start/End GCODE");
$tabpanel->AddPage($tabs[3], "Advanced");
my $buttons_sizer;
{

View File

@ -35,7 +35,7 @@ GetOptions(
# filament options
'filament-diameter=f' => \$Slic3r::filament_diameter,
'filament-packing-density=f' => \$Slic3r::filament_packing_density,
'temperature=i' => \$Slic3r::temperature,
'temperature=i' => \$Slic3r::temperature,
# speed options
'print-feed-rate=i' => \$Slic3r::print_feed_rate,
@ -44,9 +44,10 @@ GetOptions(
'bottom-layer-speed-ratio=f' => \$Slic3r::bottom_layer_speed_ratio,
# accuracy options
'layer-height=f' => \$Slic3r::layer_height,
'first-layer-height-ratio=f' => \$Slic3r::first_layer_height_ratio,
'infill-every-layers=i' => \$Slic3r::infill_every_layers,
'layer-height=f' => \$Slic3r::layer_height,
'extrusion-width-ratio=f' => \$Slic3r::extrusion_width_ratio,
'first-layer-height-ratio=f' => \$Slic3r::first_layer_height_ratio,
'infill-every-layers=i' => \$Slic3r::infill_every_layers,
# print options
'perimeters=i' => \$Slic3r::perimeters,
@ -165,6 +166,9 @@ Usage: slic3r.pl [ OPTIONS ] file.stl
layer with (> 0, default: $Slic3r::first_layer_height_ratio)
--infill-every-layers
Infill every N layers (default: $Slic3r::infill_every_layers)
--extrusion-width-ratio
Calculate the extrusion width as the layer height multiplied by
this value (> 0, default: calculated automatically)
Print options:
--perimeters Number of perimeters/horizontal skins (range: 1+,