From 97e864699eb6121f1358ca6ba3d5589059ac9f2e Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Thu, 7 Mar 2013 16:00:58 +0100 Subject: [PATCH] New top-infill-extrusion-width option --- README.markdown | 2 ++ lib/Slic3r/Config.pm | 8 ++++++++ lib/Slic3r/Fill.pm | 4 +++- lib/Slic3r/GUI/Tab.pm | 2 +- lib/Slic3r/Layer/Region.pm | 4 ++++ lib/Slic3r/Print.pm | 5 +++-- slic3r.pl | 2 ++ 7 files changed, 23 insertions(+), 4 deletions(-) diff --git a/README.markdown b/README.markdown index e6ec81eba..4b54f8b39 100644 --- a/README.markdown +++ b/README.markdown @@ -289,6 +289,8 @@ The author of the Silk icon set is Mark James. Set a different extrusion width for perimeters --infill-extrusion-width Set a different extrusion width for infill + --top-infill-extrusion-width + Set a different extrusion width for top infill --support-material-extrusion-width Set a different extrusion width for support material --bridge-flow-ratio Multiplier for extrusion when bridging (> 0, default: 1) diff --git a/lib/Slic3r/Config.pm b/lib/Slic3r/Config.pm index 4ea040401..01891fd70 100644 --- a/lib/Slic3r/Config.pm +++ b/lib/Slic3r/Config.pm @@ -422,6 +422,14 @@ our $Options = { type => 'f', default => 0, }, + 'top_infill_extrusion_width' => { + label => 'Top infill', + tooltip => 'Set this to a non-zero value to set a manual extrusion width for infill for top surfaces. You may want to use thinner extrudates to fill all narrow regions and get a smoother finish. If expressed as percentage (for example 90%) if will be computed over layer height.', + sidetext => 'mm or % (leave 0 for default)', + cli => 'top-infill-extrusion-width=s', + type => 'f', + default => 0, + }, 'support_material_extrusion_width' => { label => 'Support material', tooltip => 'Set this to a non-zero value to set a manual extrusion width for support material. If expressed as percentage (for example 90%) if will be computed over layer height.', diff --git a/lib/Slic3r/Fill.pm b/lib/Slic3r/Fill.pm index 6e9dcaf45..15806e213 100644 --- a/lib/Slic3r/Fill.pm +++ b/lib/Slic3r/Fill.pm @@ -102,7 +102,9 @@ sub make_fill { SURFACE: foreach my $surface (@surfaces) { my $filler = $Slic3r::Config->fill_pattern; my $density = $Slic3r::Config->fill_density; - my $flow_spacing = $layerm->infill_flow->spacing; + my $flow_spacing = ($surface->surface_type == S_TYPE_TOP) + ? $layerm->top_infill_flow->spacing + : $layerm->infill_flow->spacing; my $is_bridge = $layerm->id > 0 && $surface->is_bridge; my $is_solid = $surface->is_solid; diff --git a/lib/Slic3r/GUI/Tab.pm b/lib/Slic3r/GUI/Tab.pm index d970da1bd..e78b1a02c 100644 --- a/lib/Slic3r/GUI/Tab.pm +++ b/lib/Slic3r/GUI/Tab.pm @@ -510,7 +510,7 @@ sub build { { title => 'Extrusion width', label_width => 180, - options => [qw(extrusion_width first_layer_extrusion_width perimeter_extrusion_width infill_extrusion_width support_material_extrusion_width)], + options => [qw(extrusion_width first_layer_extrusion_width perimeter_extrusion_width infill_extrusion_width top_infill_extrusion_width support_material_extrusion_width)], }, { title => 'Flow', diff --git a/lib/Slic3r/Layer/Region.pm b/lib/Slic3r/Layer/Region.pm index f98bfc9a7..77f778434 100644 --- a/lib/Slic3r/Layer/Region.pm +++ b/lib/Slic3r/Layer/Region.pm @@ -16,6 +16,7 @@ has 'layer' => ( has 'region' => (is => 'ro', required => 1, handles => [qw(extruders)]); has 'perimeter_flow' => (is => 'rw'); has 'infill_flow' => (is => 'rw'); +has 'top_infill_flow' => (is => 'rw'); has 'infill_area_threshold' => (is => 'lazy'); has 'overhang_width' => (is => 'lazy'); @@ -62,9 +63,12 @@ sub _update_flows { ($self->region->first_layer_flows->{perimeter} || $self->region->flows->{perimeter}); $self->infill_flow ($self->region->first_layer_flows->{infill} || $self->region->flows->{infill}); + $self->top_infill_flow + ($self->region->first_layer_flows->{top_infill} || $self->region->flows->{top_infill}); } else { $self->perimeter_flow($self->region->flows->{perimeter}); $self->infill_flow($self->region->flows->{infill}); + $self->top_infill_flow($self->region->flows->{top_infill}); } } diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index 56b868335..c32c97aa2 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -200,10 +200,11 @@ sub init_extruders { my $region = $self->regions->[$region_id]; # per-role extruders and flows - for (qw(perimeter infill)) { + for (qw(perimeter infill top_infill)) { + my $extruder_name = $_ eq 'top_infill' ? 'infill' : $_; $region->extruders->{$_} = ($self->regions_count > 1) ? $self->extruders->[$extruder_mapping{$region_id}] - : $self->extruders->[$self->config->get("${_}_extruder")-1]; + : $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, ); diff --git a/slic3r.pl b/slic3r.pl index 741da1de8..cd7f714fd 100755 --- a/slic3r.pl +++ b/slic3r.pl @@ -337,6 +337,8 @@ $j Set a different extrusion width for perimeters --infill-extrusion-width Set a different extrusion width for infill + --top-infill-extrusion-width + Set a different extrusion width for top infill --support-material-extrusion-width Set a different extrusion width for support material --bridge-flow-ratio Multiplier for extrusion when bridging (> 0, default: $config->{bridge_flow_ratio})