Test that stacked cubes with distinct extruders don't generate any internal interface shells. #1847

This commit is contained in:
Alessandro Ranellucci 2014-03-24 23:44:47 +01:00
parent 91799a9e58
commit 6feff7fe53
2 changed files with 75 additions and 18 deletions

File diff suppressed because one or more lines are too long

View file

@ -1,4 +1,4 @@
use Test::More tests => 2;
use Test::More tests => 4;
use strict;
use warnings;
@ -66,4 +66,55 @@ use Slic3r::Test;
ok Slic3r::Test::gcode($print), 'no errors when using non-consecutive extruders';
}
{
my $model = Slic3r::Model->new;
my $object = $model->add_object;
my $lower_config = $model->set_material('lower')->config;
my $upper_config = $model->set_material('upper')->config;
$object->add_volume(mesh => Slic3r::Test::mesh('20mm_cube'), material_id => 'lower');
$object->add_volume(mesh => Slic3r::Test::mesh('20mm_cube', translate => [0,0,20]), material_id => 'upper');
$object->add_instance(offset => [0,0]);
$lower_config->set('extruder', 1);
$lower_config->set('bottom_solid_layers', 0);
$lower_config->set('top_solid_layers', 1);
$upper_config->set('extruder', 2);
$upper_config->set('bottom_solid_layers', 1);
$upper_config->set('top_solid_layers', 0);
my $config = Slic3r::Config->new_from_defaults;
$config->set('fill_density', 0);
$config->set('solid_infill_speed', 99);
$config->set('top_solid_infill_speed', 99);
$config->set('cooling', 0); # for preventing speeds from being altered
$config->set('first_layer_speed', '100%'); # for preventing speeds from being altered
my $test = sub {
my $print = Slic3r::Test::init_print($model, config => $config);
my $tool = undef;
my %T0_shells = my %T1_shells = (); # Z => 1
Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub {
my ($self, $cmd, $args, $info) = @_;
if ($cmd =~ /^T(\d+)/) {
$tool = $1;
} elsif ($cmd eq 'G1' && $info->{extruding} && $info->{dist_XY} > 0) {
if (($args->{F} // $self->F) == $config->solid_infill_speed*60) {
if ($tool == 0) {
$T0_shells{$self->Z} = 1;
} elsif ($tool == 1) {
$T1_shells{$self->Z} = 1;
}
}
}
});
return [ sort keys %T0_shells ], [ sort keys %T1_shells ];
};
{
my ($t0, $t1) = $test->();
is scalar(@$t0), 0, 'no interface shells';
is scalar(@$t1), 0, 'no interface shells';
}
}
__END__