Don't validate the number of layers for infill combination, just limit it automatically. #993

This commit is contained in:
Alessandro Ranellucci 2013-02-22 16:24:24 +01:00
parent 91bcfc8a74
commit 5eade0f9e1
2 changed files with 8 additions and 5 deletions

View file

@ -1213,9 +1213,6 @@ sub validate {
# --infill-every-layers
die "Invalid value for --infill-every-layers\n"
if $self->infill_every_layers !~ /^\d+$/ || $self->infill_every_layers < 1;
# TODO: this check should be limited to the extruder used for infill
die "Maximum infill thickness can't exceed nozzle diameter\n"
if grep $self->infill_every_layers * $self->layer_height > $_, @{$self->nozzle_diameter};
# --scale
die "Invalid value for --scale\n"

View file

@ -1,6 +1,7 @@
package Slic3r::Print::Object;
use Moo;
use List::Util qw(min);
use Slic3r::ExtrusionPath ':roles';
use Slic3r::Geometry qw(Z PI scale unscale deg2rad rad2deg scaled_epsilon);
use Slic3r::Geometry::Clipper qw(diff_ex intersection_ex union_ex);
@ -532,10 +533,15 @@ sub combine_infill {
my $self = shift;
return unless $Slic3r::Config->infill_every_layers > 1 && $Slic3r::Config->fill_density > 0;
my $every = $Slic3r::Config->infill_every_layers;
my $layer_count = $self->layer_count;
for my $region_id (0 .. ($self->print->regions_count-1)) {
# limit the number of combined layers to the maximum height allowed by this regions' nozzle
my $every = min(
$Slic3r::Config->infill_every_layers,
int($self->print->regions->[$region_id]->extruders->{infill}->nozzle_diameter/$Slic3r::Config->layer_height),
);
Slic3r::debugf "Infilling every %d layers\n", $every;
# skip bottom layer
for (my $layer_id = $every; $layer_id <= $layer_count-1; $layer_id += $every) {
# get the layers whose infill we want to combine (bottom-up)