remove consecutive duplicate points, loops with < 3 points, and empty top layers

degen-loop-screen
Mike Sheldrake 2012-11-20 04:17:28 -08:00
parent cd892fdce8
commit 3d7757f6e8
2 changed files with 11 additions and 1 deletions

View File

@ -164,6 +164,11 @@ sub slice {
$self->layers->[$i]->id($i);
}
}
# remove empty layers from top
while (@{$self->layers} && !@{$self->layers->[-1]->slices} && !map @{$_->thin_walls}, @{$self->layers->[-1]->regions}) {
pop @{$self->layers};
}
warn "No layers were detected. You might want to repair your STL file and retry.\n"
if !@{$self->layers};

View File

@ -296,11 +296,16 @@ sub make_loops {
next CYCLE;
}
push @points, $next_line->[I_B];
push @points, $next_line->[I_B] if !same_point($line->[I_B], $next_line->[I_B]);
$visited_lines{$next_line} = 1;
$line = $next_line;
} while ($first_facet_index != $line->[I_FACET_INDEX]);
if (@points <= 2) {
Slic3r::debugf " polygon reduced to %d points\n", scalar(@points);
next CYCLE;
}
push @polygons, Slic3r::Polygon->new(@points);
Slic3r::debugf " Discovered %s polygon of %d points\n",
($polygons[-1]->is_counter_clockwise ? 'ccw' : 'cw'), scalar(@points)