Bugfix: enabling raft layers generated support for the whole model. Includes regression test. #1375
This commit is contained in:
parent
e0da81e8bf
commit
a7989e382c
@ -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;
|
||||
}
|
||||
|
@ -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,
|
||||
);
|
||||
|
10
t/support.t
10
t/support.t
@ -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
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user