Bugfix: enabling raft layers generated support for the whole model. Includes regression test. #1375

This commit is contained in:
Alessandro Ranellucci 2013-09-17 23:51:30 +02:00
parent e0da81e8bf
commit a7989e382c
3 changed files with 17 additions and 8 deletions

View File

@ -787,7 +787,8 @@ sub combine_infill {
sub generate_support_material {
my $self = shift;
return unless $self->config->support_material && $self->layer_count >= 2;
return unless ($self->config->support_material || $self->config->raft_layers > 0)
&& $self->layer_count >= 2;
Slic3r::Print::SupportMaterial->new(object => $self)->generate;
}

View File

@ -16,7 +16,6 @@ sub flow {
sub generate {
my $self = shift;
return unless $self->object->config->support_material && $self->object->layer_count >= 2;
my $flow = $self->flow;
@ -44,6 +43,7 @@ sub generate {
my %contact = (); # contact_z => [ polygons ]
my %overhang = (); # contact_z => [ expolygons ] - this stores the actual overhang supported by each contact layer
for my $layer_id (1 .. $#{$self->object->layers}) {
last if $layer_id > $self->object->config->raft_layers && !$self->object->config->support_material;
my $layer = $self->object->layers->[$layer_id];
my $lower_layer = $self->object->layers->[$layer_id-1];
@ -54,7 +54,9 @@ sub generate {
my $diff;
# If a threshold angle was specified, use a different logic for detecting overhangs.
if (defined $threshold_rad || $layer_id <= $self->object->config->support_material_enforce_layers) {
if (defined $threshold_rad
|| $layer_id <= $self->object->config->support_material_enforce_layers
|| $layer_id <= $self->object->config->raft_layers) {
my $d = defined $threshold_rad
? scale $lower_layer->height * ((cos $threshold_rad) / (sin $threshold_rad))
: 0;
@ -326,7 +328,7 @@ sub generate {
[ @$interface, @$support, @$contact_infill ],
1,
);
$support{$layer_id} = diff(
$support = diff(
$support,
$interface,
);

View File

@ -66,7 +66,7 @@ use Slic3r::Test;
$config->set('support_material_interface_extruder', 2);
$config->set('layer_height', 0.4);
$config->set('first_layer_height', '100%');
my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
my $print = Slic3r::Test::init_print('overhang', config => $config);
ok my $gcode = Slic3r::Test::gcode($print), 'no conflict between raft/support and brim';
my $tool = 0;
@ -75,9 +75,15 @@ use Slic3r::Test;
if ($cmd =~ /^T(\d+)/) {
$tool = $1;
} elsif ($info->{extruding} && $self->Z <= ($config->raft_layers * $config->layer_height)) {
} elsif ($info->{extruding}) {
if ($self->Z <= ($config->raft_layers * $config->layer_height)) {
fail 'not extruding raft/brim with support material extruder'
if $tool != ($config->support_material_extruder-1);
} else {
fail 'support material exceeds raft layers'
if $tool == $config->support_material_extruder-1;
# TODO: we should test that full support is generated when we use raft too
}
}
});
}