Perform additional checks before merging solid surfaces (i.e. take flow and fill pattern into account)

This commit is contained in:
Alessandro Ranellucci 2014-02-10 01:27:36 +01:00
parent 7be042567d
commit 7ce49fc2b2
2 changed files with 26 additions and 2 deletions

View file

@ -62,7 +62,12 @@ sub make_fill {
my @surfaces_with_bridge_angle = grep defined $_->bridge_angle, @fill_surfaces;
# give priority to bridges
my @groups = Slic3r::Surface->group({merge_solid => 1}, @fill_surfaces);
my @groups = Slic3r::Surface->group({
bridged_bottom => ($layerm->id > 0),
solid_infill_flow => $layerm->solid_infill_flow,
top_infill_flow => $layerm->top_infill_flow,
solid_fill_pattern => $layerm->config->solid_fill_pattern,
}, @fill_surfaces);
@groups = sort { defined $a->[0]->bridge_angle ? -1 : 0 } @groups;
foreach my $group (@groups) {

View file

@ -21,8 +21,20 @@ sub group {
my %unique_types = ();
foreach my $surface (@surfaces) {
my $stype = $surface->surface_type;
if ($surface->is_bridge && ($params->{bridged_bottom} || $surface->surface_type != S_TYPE_BOTTOM)) {
$stype = 'bridge';
} elsif ($surface->is_solid) {
my $fw = $params->{solid_infill_flow};
if ($surface->surface_type == S_TYPE_TOP && $params->{top_infill_flow}) {
$fw = $params->{top_infill_flow}->width;
}
my $pattern = $surface->is_external ? $params->{solid_fill_pattern} : 'rectilinear';
$stype = join '_', $fw // '', $pattern // '';
}
my $type = join '_',
($params->{merge_solid} && $surface->is_solid) ? 'solid' : $surface->surface_type,
$stype,
$surface->bridge_angle // '',
$surface->thickness // '',
$surface->thickness_layers;
@ -57,6 +69,13 @@ sub is_solid {
|| $type == S_TYPE_INTERNALSOLID;
}
sub is_external {
my $self = shift;
my $type = $self->surface_type;
return $type == S_TYPE_TOP
|| $type == S_TYPE_BOTTOM;
}
sub is_bridge {
my $self = shift;
my $type = $self->surface_type;