Skip to content

Commit

Permalink
Merge pull request prusa3d#1 from lordofhyphens/jaggz--enforce-suppor…
Browse files Browse the repository at this point in the history
…ts-logic

Added test for enforced support generation.
  • Loading branch information
jaggzh authored Apr 16, 2017
2 parents 3164217 + 0952b6d commit 68536a2
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions t/support.t
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use Test::More tests => 27;
use Test::More tests => 28;
use strict;
use warnings;

Expand Down Expand Up @@ -258,5 +258,32 @@ use Slic3r::Test;
@{ $layer_heights_by_tool{$config->support_material_extruder-1} }),
'no support material layer is as thin as object layers';
}

{
my $config = Slic3r::Config->new_from_defaults;
$config->set('support_material_enforce_layers', 100);
$config->set('support_material', 0);
my @contact_z = my @top_z = ();

my $test = sub {
my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
my $flow = $print->print->objects->[0]->support_material_flow;
my $support = Slic3r::Print::SupportMaterial->new(
object_config => $print->print->objects->[0]->config,
print_config => $print->print->config,
flow => $flow,
interface_flow => $flow,
first_layer_flow => $flow,
);
my $support_z = $support->support_layers_z(\@contact_z, \@top_z, $config->layer_height);

is scalar(grep { $support_z->[$_]-$support_z->[$_-1] <= 0 } 1..$#$support_z), 0,
'forced support is generated';

};
$config->set('layer_height', 0.2);
$config->set('first_layer_height', 0.3);
@contact_z = (1.9);
@top_z = (1.1);
$test->();
}
__END__

0 comments on commit 68536a2

Please sign in to comment.