From 7412d4a6872d4cec05ef64db2ff13e05ff45ad4e Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Sun, 24 Feb 2013 18:17:08 +0100 Subject: [PATCH] Bugfix: manifoldness error triggered with multi-volume AMF files. #1019 --- lib/Slic3r/GUI/Plater.pm | 2 +- lib/Slic3r/Model.pm | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index caa9dcb3f..f4e1f3219 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -1088,7 +1088,7 @@ sub _trigger_model_object { sub check_manifoldness { my $self = shift; - $self->is_manifold($self->get_model_object->mesh->check_manifoldness); + $self->is_manifold($self->get_model_object->check_manifoldness); return $self->is_manifold; } diff --git a/lib/Slic3r/Model.pm b/lib/Slic3r/Model.pm index c05ee8ee2..67793dd14 100644 --- a/lib/Slic3r/Model.pm +++ b/lib/Slic3r/Model.pm @@ -73,6 +73,7 @@ has 'attributes' => (is => 'rw', default => sub { {} }); package Slic3r::Model::Object; use Moo; +use List::Util qw(first); use Slic3r::Geometry qw(X Y Z); has 'input_file' => (is => 'rw'); @@ -112,6 +113,8 @@ sub add_instance { sub mesh { my $self = shift; + # this mesh won't be suitable for check_manifoldness as multiple + # facets from different volumes may use the same vertices return Slic3r::TriangleMesh->new( vertices => $self->vertices, facets => [ map @{$_->facets}, @{$self->volumes} ], @@ -136,6 +139,11 @@ sub materials_count { return scalar keys %materials; } +sub check_manifoldness { + my $self = shift; + return (first { !$_->mesh->check_manifoldness } @{$self->volumes}) ? 0 : 1; +} + package Slic3r::Model::Volume; use Moo;