From ab7697ec1c806873b2076ad67ac4b62c690b98f7 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Fri, 28 Sep 2012 15:46:29 +0200 Subject: [PATCH] New option to force a solid layer every given number of layers. #617 --- README.markdown | 4 +++- lib/Slic3r/Config.pm | 9 +++++++++ lib/Slic3r/GUI/Tab.pm | 2 +- lib/Slic3r/Print/Object.pm | 6 ++++++ slic3r.pl | 2 ++ 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/README.markdown b/README.markdown index 1dfe6552b..5ca1ac240 100644 --- a/README.markdown +++ b/README.markdown @@ -153,7 +153,9 @@ The author of the Silk icon set is Mark James. --first-layer-height Layer height for first layer (mm or %, default: 100%) --infill-every-layers Infill every N layers (default: 1) - + --solid-infill-every-layers + Force a solid layer every N layers (default: 0) + Print options: --perimeters Number of perimeters/horizontal skins (range: 0+, default: 3) --solid-layers Number of solid layers to do for top/bottom surfaces diff --git a/lib/Slic3r/Config.pm b/lib/Slic3r/Config.pm index 557f9cb92..1c78843fd 100644 --- a/lib/Slic3r/Config.pm +++ b/lib/Slic3r/Config.pm @@ -353,6 +353,15 @@ our $Options = { min => 1, default => 1, }, + 'solid_infill_every_layers' => { + label => 'Solid infill every', + tooltip => 'This feature allows to force a solid layer every given number of layers. Zero to disable.', + sidetext => 'layers', + cli => 'solid-infill-every-layers=i', + type => 'i', + min => 0, + default => 0, + }, # flow options 'extrusion_width' => { diff --git a/lib/Slic3r/GUI/Tab.pm b/lib/Slic3r/GUI/Tab.pm index 16107b548..69eab8820 100644 --- a/lib/Slic3r/GUI/Tab.pm +++ b/lib/Slic3r/GUI/Tab.pm @@ -401,7 +401,7 @@ sub build { }, { title => 'Advanced', - options => [qw(infill_every_layers fill_angle solid_infill_below_area only_retract_when_crossing_perimeters)], + options => [qw(infill_every_layers solid_infill_every_layers fill_angle solid_infill_below_area only_retract_when_crossing_perimeters)], }, ]); diff --git a/lib/Slic3r/Print/Object.pm b/lib/Slic3r/Print/Object.pm index b5a8e10da..9443b4cd4 100644 --- a/lib/Slic3r/Print/Object.pm +++ b/lib/Slic3r/Print/Object.pm @@ -329,6 +329,12 @@ sub discover_horizontal_shells { for my $region_id (0 .. ($self->print->regions_count-1)) { for (my $i = 0; $i < $self->layer_count; $i++) { my $layerm = $self->layers->[$i]->regions->[$region_id]; + + if ($Slic3r::Config->solid_infill_every_layers && ($i % $Slic3r::Config->solid_infill_every_layers) == 0) { + $_->surface_type(S_TYPE_INTERNALSOLID) + for grep $_->surface_type == S_TYPE_INTERNAL, @{$layerm->fill_surfaces}; + } + foreach my $type (S_TYPE_TOP, S_TYPE_BOTTOM) { # find surfaces of current type for current layer # and offset them to take perimeters into account diff --git a/slic3r.pl b/slic3r.pl index 7fe0aa0a0..bcda50571 100755 --- a/slic3r.pl +++ b/slic3r.pl @@ -201,6 +201,8 @@ $j --first-layer-height Layer height for first layer (mm or %, default: $config->{first_layer_height}) --infill-every-layers Infill every N layers (default: $config->{infill_every_layers}) + --solid-infill-every-layers + Force a solid layer every N layers (default: $config->{solid_infill_every_layers}) Print options: --perimeters Number of perimeters/horizontal skins (range: 0+, default: $config->{perimeters})