support_material_synchronize_layers implementation
This commit is contained in:
parent
556204fddc
commit
38cb2842ac
@ -45,6 +45,7 @@ sub generate {
|
|||||||
# We now know the upper and lower boundaries for our support material object
|
# We now know the upper and lower boundaries for our support material object
|
||||||
# (@$contact_z and @$top_z), so we can generate intermediate layers.
|
# (@$contact_z and @$top_z), so we can generate intermediate layers.
|
||||||
my $support_z = $self->support_layers_z(
|
my $support_z = $self->support_layers_z(
|
||||||
|
$object,
|
||||||
[ sort keys %$contact ],
|
[ sort keys %$contact ],
|
||||||
[ sort keys %$top ],
|
[ sort keys %$top ],
|
||||||
max(map $_->height, @{$object->layers})
|
max(map $_->height, @{$object->layers})
|
||||||
@ -384,7 +385,7 @@ sub object_top {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub support_layers_z {
|
sub support_layers_z {
|
||||||
my ($self, $contact_z, $top_z, $max_object_layer_height) = @_;
|
my ($self, $object, $contact_z, $top_z, $max_object_layer_height) = @_;
|
||||||
|
|
||||||
# quick table to check whether a given Z is a top surface
|
# quick table to check whether a given Z is a top surface
|
||||||
my %top = map { $_ => 1 } @$top_z;
|
my %top = map { $_ => 1 } @$top_z;
|
||||||
@ -397,13 +398,18 @@ sub support_layers_z {
|
|||||||
my $contact_distance = $self->contact_distance($support_material_height, $nozzle_diameter);
|
my $contact_distance = $self->contact_distance($support_material_height, $nozzle_diameter);
|
||||||
|
|
||||||
# initialize known, fixed, support layers
|
# initialize known, fixed, support layers
|
||||||
my @z = sort { $a <=> $b }
|
my @z = @$contact_z;
|
||||||
@$contact_z,
|
my $synchronize = $self->object_config->support_material_synchronize_layers;
|
||||||
# TODO: why we have this?
|
if (! $synchronize) {
|
||||||
# Vojtech: To detect the bottom interface layers by finding a Z value in the $top_z.
|
push @z,
|
||||||
@$top_z,
|
# TODO: why we have this?
|
||||||
# Top surfaces of the bottom interface layers.
|
# Vojtech: To detect the bottom interface layers by finding a Z value in the $top_z.
|
||||||
(map $_ + $contact_distance, @$top_z);
|
@$top_z;
|
||||||
|
push @z,
|
||||||
|
# Top surfaces of the bottom interface layers.
|
||||||
|
(map $_ + $contact_distance, @$top_z);
|
||||||
|
}
|
||||||
|
@z = sort { $a <=> $b } @z;
|
||||||
|
|
||||||
# enforce first layer height
|
# enforce first layer height
|
||||||
my $first_layer_height = $self->object_config->get_value('first_layer_height');
|
my $first_layer_height = $self->object_config->get_value('first_layer_height');
|
||||||
@ -423,23 +429,29 @@ sub support_layers_z {
|
|||||||
1..($self->object_config->raft_layers - 2);
|
1..($self->object_config->raft_layers - 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
# create other layers (skip raft layers as they're already done and use thicker layers)
|
if ($synchronize) {
|
||||||
for (my $i = $#z; $i >= $self->object_config->raft_layers; $i--) {
|
@z = splice @z, $self->object_config->raft_layers;
|
||||||
my $target_height = $support_material_height;
|
# if ($self->object_config->raft_layers > scalar(@z));
|
||||||
if ($i > 0 && $top{ $z[$i-1] }) {
|
push @z, map $_->print_z, @{$object->layers};
|
||||||
# Bridge flow?
|
} else {
|
||||||
#FIXME We want to enforce not only the bridge flow height, but also the interface gap!
|
# create other layers (skip raft layers as they're already done and use thicker layers)
|
||||||
# This will introduce an additional layer if the gap is set to an extreme value!
|
for (my $i = $#z; $i >= $self->object_config->raft_layers; $i--) {
|
||||||
$target_height = $nozzle_diameter;
|
my $target_height = $support_material_height;
|
||||||
}
|
if ($i > 0 && $top{ $z[$i-1] }) {
|
||||||
|
# Bridge flow?
|
||||||
|
#FIXME We want to enforce not only the bridge flow height, but also the interface gap!
|
||||||
|
# This will introduce an additional layer if the gap is set to an extreme value!
|
||||||
|
$target_height = $nozzle_diameter;
|
||||||
|
}
|
||||||
|
|
||||||
# enforce first layer height
|
# enforce first layer height
|
||||||
#FIXME better to split the layers regularly, than to bite a constant height one at a time,
|
#FIXME better to split the layers regularly, than to bite a constant height one at a time,
|
||||||
# and then be left with a very thin layer at the end.
|
# and then be left with a very thin layer at the end.
|
||||||
if (($i == 0 && $z[$i] > $target_height + $first_layer_height)
|
if (($i == 0 && $z[$i] > $target_height + $first_layer_height)
|
||||||
|| ($z[$i] - $z[$i-1] > $target_height + Slic3r::Geometry::epsilon)) {
|
|| ($z[$i] - $z[$i-1] > $target_height + Slic3r::Geometry::epsilon)) {
|
||||||
splice @z, $i, 0, ($z[$i] - $target_height);
|
splice @z, $i, 0, ($z[$i] - $target_height);
|
||||||
$i++;
|
$i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ use Slic3r::Test;
|
|||||||
interface_flow => $flow,
|
interface_flow => $flow,
|
||||||
first_layer_flow => $flow,
|
first_layer_flow => $flow,
|
||||||
);
|
);
|
||||||
my $support_z = $support->support_layers_z(\@contact_z, \@top_z, $config->layer_height);
|
my $support_z = $support->support_layers_z($print->print->objects->[0], \@contact_z, \@top_z, $config->layer_height);
|
||||||
my $expected_top_spacing = $support->contact_distance($config->layer_height, $config->nozzle_diameter->[0]);
|
my $expected_top_spacing = $support->contact_distance($config->layer_height, $config->nozzle_diameter->[0]);
|
||||||
|
|
||||||
is $support_z->[0], $config->first_layer_height,
|
is $support_z->[0], $config->first_layer_height,
|
||||||
|
Loading…
Reference in New Issue
Block a user