mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-07 14:04:11 -06:00
Added failing test case for troubleshooting unexpected filled holes. #858
This commit is contained in:
parent
de5b8b9f4d
commit
6e6bc74636
4 changed files with 79 additions and 15 deletions
|
@ -69,20 +69,8 @@ sub make_surfaces {
|
|||
my $self = shift;
|
||||
my ($loops) = @_;
|
||||
|
||||
return if !@$loops;
|
||||
{
|
||||
my $safety_offset = scale 0.1;
|
||||
# merge everything
|
||||
my $expolygons = [ map $_->offset_ex(-$safety_offset), @{union_ex(safety_offset($loops, $safety_offset))} ];
|
||||
|
||||
Slic3r::debugf " %d surface(s) having %d holes detected from %d polylines\n",
|
||||
scalar(@$expolygons), scalar(map $_->holes, @$expolygons), scalar(@$loops);
|
||||
|
||||
$self->slices([
|
||||
map Slic3r::Surface->new(expolygon => $_, surface_type => S_TYPE_INTERNAL),
|
||||
@$expolygons
|
||||
]);
|
||||
}
|
||||
return if !@$loops;
|
||||
$self->slices([ _merge_loops($loops) ]);
|
||||
|
||||
# the contours must be offsetted by half extrusion width inwards
|
||||
{
|
||||
|
@ -129,6 +117,19 @@ sub make_surfaces {
|
|||
}
|
||||
}
|
||||
|
||||
sub _merge_loops {
|
||||
my ($loops) = @_;
|
||||
|
||||
my $safety_offset = scale 0.1;
|
||||
# merge everything
|
||||
my $expolygons = [ map $_->offset_ex(-$safety_offset), @{union_ex(safety_offset($loops, $safety_offset))} ];
|
||||
|
||||
Slic3r::debugf " %d surface(s) having %d holes detected from %d polylines\n",
|
||||
scalar(@$expolygons), scalar(map $_->holes, @$expolygons), scalar(@$loops);
|
||||
|
||||
return map Slic3r::Surface->new(expolygon => $_, surface_type => S_TYPE_INTERNAL), @$expolygons;
|
||||
}
|
||||
|
||||
sub make_perimeters {
|
||||
my $self = shift;
|
||||
|
||||
|
|
|
@ -7,7 +7,8 @@ our @ISA = qw(Exporter);
|
|||
our @EXPORT_OK = qw(_eq);
|
||||
|
||||
use IO::Scalar;
|
||||
use Slic3r::Geometry qw(epsilon);
|
||||
use List::Util qw(first);
|
||||
use Slic3r::Geometry qw(epsilon X Y Z);
|
||||
|
||||
my %cuboids = (
|
||||
'20mm_cube' => [20,20,20],
|
||||
|
@ -58,6 +59,20 @@ sub _eq {
|
|||
return abs($a - $b) < epsilon;
|
||||
}
|
||||
|
||||
sub add_facet {
|
||||
my ($facet, $vertices, $facets) = @_;
|
||||
|
||||
push @$facets, [];
|
||||
for my $i (0..2) {
|
||||
my $v = first { $vertices->[$_][X] == $facet->[$i][X] && $vertices->[$_][Y] == $facet->[$i][Y] && $vertices->[$_][Z] == $facet->[$i][Z] } 0..$#$vertices;
|
||||
if (!defined $v) {
|
||||
push @$vertices, [ @{$facet->[$i]}[X,Y,Z] ];
|
||||
$v = $#$vertices;
|
||||
}
|
||||
$facets->[-1][$i] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
package Slic3r::Test::GCodeReader;
|
||||
use Moo;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue