diff --git a/lib/Slic3r/TriangleMesh.pm b/lib/Slic3r/TriangleMesh.pm index 39bfef4c2..99af25526 100644 --- a/lib/Slic3r/TriangleMesh.pm +++ b/lib/Slic3r/TriangleMesh.pm @@ -29,8 +29,8 @@ use constant I_FACET_EDGE => 6; use constant FE_TOP => 0; use constant FE_BOTTOM => 1; -# always make sure BUILD is idempotent -sub BUILD { +# always make sure this method is idempotent +sub analyze { my $self = shift; @{$self->edges} = (); @@ -145,6 +145,8 @@ sub clean { sub check_manifoldness { my $self = shift; + $self->analyze; + # look for any edges not connected to exactly two facets my ($first_bad_edge_id) = grep { @{ $self->edges_facets->[$_] } != 2 } 0..$#{$self->edges_facets}; @@ -154,6 +156,10 @@ sub check_manifoldness { map @{$self->vertices->[$_]}, @{$self->edges->[$first_bad_edge_id]}; return 0; } + + # empty the edges array as we don't really need it anymore + @{$self->edges} = (); + return 1; }