From 78a4ae483582a591117a4df9cb3c73246c63264b Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Sun, 17 Mar 2013 00:21:17 +0100 Subject: [PATCH] Use full flow for sparse infill by default --- lib/Slic3r/Flow.pm | 15 ++++++++------- lib/Slic3r/Print.pm | 6 ++++++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/lib/Slic3r/Flow.pm b/lib/Slic3r/Flow.pm index e2e780921..b17b1991a 100644 --- a/lib/Slic3r/Flow.pm +++ b/lib/Slic3r/Flow.pm @@ -1,11 +1,11 @@ package Slic3r::Flow; use Moo; -use List::Util qw(max); use Slic3r::Geometry qw(PI scale); has 'nozzle_diameter' => (is => 'ro', required => 1); has 'layer_height' => (is => 'ro', default => sub { $Slic3r::Config->layer_height }); +has 'role' => (is => 'ro', default => sub { '' }); has 'width' => (is => 'rwp', builder => 1); has 'spacing' => (is => 'lazy'); @@ -36,12 +36,13 @@ sub _build_width { $width = $self->nozzle_diameter * ($self->nozzle_diameter/$self->layer_height - 4/PI + 1); } - my $min = max( - ($volume / $self->layer_height), - ($self->nozzle_diameter * 1.05), - ); - my $max = $self->nozzle_diameter * 2; - $width = $max if $width > $max; + my $min = $self->nozzle_diameter * 1.05; + my $max; + if ($self->role ne 'infill') { + # do not limit width for sparse infill so that we use full native flow for it + $max = $self->nozzle_diameter * 1.7; + } + $width = $max if defined($max) && $width > $max; $width = $min if $width < $min; return $width; diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index 0ee365074..e374a6cfa 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -209,10 +209,12 @@ sub init_extruders { : $self->extruders->[$self->config->get("${extruder_name}_extruder")-1]; $region->flows->{$_} = $region->extruders->{$_}->make_flow( width => $self->config->get("${_}_extrusion_width") || $self->config->extrusion_width, + role => $_, ); $region->first_layer_flows->{$_} = $region->extruders->{$_}->make_flow( layer_height => $self->config->get_value('first_layer_height'), width => $self->config->first_layer_extrusion_width, + role => $_, ) if $self->config->first_layer_extrusion_width; } } @@ -222,10 +224,12 @@ sub init_extruders { my $extruder = $self->extruders->[$self->config->support_material_extruder-1]; $self->support_material_flow($extruder->make_flow( width => $self->config->support_material_extrusion_width || $self->config->extrusion_width, + role => 'support_material', )); $self->first_layer_support_material_flow($extruder->make_flow( layer_height => $self->config->get_value('first_layer_height'), width => $self->config->first_layer_extrusion_width, + role => 'support_material', )); } } @@ -697,6 +701,8 @@ sub write_gcode { } printf $fh "; perimeters extrusion width = %.2fmm\n", $self->regions->[0]->flows->{perimeter}->width; printf $fh "; infill extrusion width = %.2fmm\n", $self->regions->[0]->flows->{infill}->width; + printf $fh "; solid infill extrusion width = %.2fmm\n", $self->regions->[0]->flows->{solid_infill}->width; + printf $fh "; top infill extrusion width = %.2fmm\n", $self->regions->[0]->flows->{top_infill}->width; printf $fh "; support material extrusion width = %.2fmm\n", $self->support_material_flow->width if $self->support_material_flow; printf $fh "; first layer extrusion width = %.2fmm\n", $self->regions->[0]->first_layer_flows->{perimeter}->width