Bugfix: when using low layer heights and support material, the contact regions were generated with a negative height. #1013
This commit is contained in:
parent
3eedd4bbed
commit
504962712b
@ -64,7 +64,16 @@ sub support_material_contact_height {
|
|||||||
|
|
||||||
# TODO: check what upper region applies instead of considering the first one
|
# TODO: check what upper region applies instead of considering the first one
|
||||||
my $upper_layer = $self->object->layers->[ $self->id + 1 ] // $self;
|
my $upper_layer = $self->object->layers->[ $self->id + 1 ] // $self;
|
||||||
return 2*$self->height - $upper_layer->regions->[0]->infill_flow->bridge_width;
|
my $h = ($self->height + $upper_layer->height) - $upper_layer->regions->[0]->infill_flow->bridge_width;
|
||||||
|
|
||||||
|
# If layer height is less than half the bridge width then we'll get a negative height for contact area.
|
||||||
|
# The optimal solution would be to skip some layers during support material generation, but for now
|
||||||
|
# we'll apply a (dirty) workaround that should still work.
|
||||||
|
if ($h <= 0) {
|
||||||
|
$h = $self->height;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $h;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Z used for printing support material contact in scaled coordinates
|
# Z used for printing support material contact in scaled coordinates
|
||||||
|
@ -15,11 +15,9 @@ my %cuboids = (
|
|||||||
'2x20x10' => [2, 20,10],
|
'2x20x10' => [2, 20,10],
|
||||||
);
|
);
|
||||||
|
|
||||||
sub init_print {
|
sub model {
|
||||||
my ($model_name, %params) = @_;
|
my ($model_name) = @_;
|
||||||
|
|
||||||
my $model = Slic3r::Model->new;
|
|
||||||
{
|
|
||||||
my ($vertices, $facets);
|
my ($vertices, $facets);
|
||||||
if ($cuboids{$model_name}) {
|
if ($cuboids{$model_name}) {
|
||||||
my ($x, $y, $z) = @{ $cuboids{$model_name} };
|
my ($x, $y, $z) = @{ $cuboids{$model_name} };
|
||||||
@ -30,15 +28,21 @@ sub init_print {
|
|||||||
[0,1,2], [0,2,3], [4,5,6], [4,6,7], [0,4,7], [0,7,1], [1,7,6], [1,6,2], [2,6,5], [2,5,3], [4,0,3], [4,3,5],
|
[0,1,2], [0,2,3], [4,5,6], [4,6,7], [0,4,7], [0,7,1], [1,7,6], [1,6,2], [2,6,5], [2,5,3], [4,0,3], [4,3,5],
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $model = Slic3r::Model->new;
|
||||||
$model->add_object(vertices => $vertices)->add_volume(facets => $facets);
|
$model->add_object(vertices => $vertices)->add_volume(facets => $facets);
|
||||||
|
return $model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub init_print {
|
||||||
|
my ($model_name, %params) = @_;
|
||||||
|
|
||||||
my $config = Slic3r::Config->new_from_defaults;
|
my $config = Slic3r::Config->new_from_defaults;
|
||||||
$config->apply($params{config}) if $params{config};
|
$config->apply($params{config}) if $params{config};
|
||||||
$config->set('gcode_comments', 1) if $ENV{SLIC3R_TESTS_GCODE};
|
$config->set('gcode_comments', 1) if $ENV{SLIC3R_TESTS_GCODE};
|
||||||
|
|
||||||
my $print = Slic3r::Print->new(config => $config);
|
my $print = Slic3r::Print->new(config => $config);
|
||||||
$print->add_model($model);
|
$print->add_model(model($model_name));
|
||||||
$print->validate;
|
$print->validate;
|
||||||
|
|
||||||
return $print;
|
return $print;
|
||||||
|
13
t/layers.t
13
t/layers.t
@ -1,4 +1,4 @@
|
|||||||
use Test::More tests => 4;
|
use Test::More tests => 5;
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
@ -55,4 +55,15 @@ ok $test->(), "positive Z offset";
|
|||||||
$config->set('z_offset', -0.8);
|
$config->set('z_offset', -0.8);
|
||||||
ok $test->(), "negative Z offset";
|
ok $test->(), "negative Z offset";
|
||||||
|
|
||||||
|
{
|
||||||
|
my $config = Slic3r::Config->new_from_defaults;
|
||||||
|
$config->set('nozzle_diameter', [0.35]);
|
||||||
|
$config->set('layer_height', 0.1333);
|
||||||
|
|
||||||
|
my $print = Slic3r::Test::init_print('2x20x10', config => $config);
|
||||||
|
$print->init_extruders;
|
||||||
|
$_->region(0) for @{$print->objects->[0]->layers}; # init layer regions
|
||||||
|
ok $print->objects->[0]->layers->[1]->support_material_contact_height > 0, 'support_material_contact_height is positive';
|
||||||
|
}
|
||||||
|
|
||||||
__END__
|
__END__
|
||||||
|
Loading…
Reference in New Issue
Block a user