Calls to ->repair where needed
This commit is contained in:
parent
566d38a472
commit
78ee6e5d6d
2 changed files with 3 additions and 0 deletions
lib/Slic3r/GUI
|
@ -1269,6 +1269,7 @@ sub _trigger_model_object {
|
||||||
$self->bounding_box($model_object->bounding_box);
|
$self->bounding_box($model_object->bounding_box);
|
||||||
|
|
||||||
my $mesh = $model_object->mesh;
|
my $mesh = $model_object->mesh;
|
||||||
|
$mesh->repair;
|
||||||
$self->convex_hull(Slic3r::Polygon->new(@{Math::ConvexHull::MonotoneChain::convex_hull($mesh->used_vertices)}));
|
$self->convex_hull(Slic3r::Polygon->new(@{Math::ConvexHull::MonotoneChain::convex_hull($mesh->used_vertices)}));
|
||||||
$self->facets(scalar @{$mesh->facets});
|
$self->facets(scalar @{$mesh->facets});
|
||||||
$self->vertices(scalar @{$mesh->vertices});
|
$self->vertices(scalar @{$mesh->vertices});
|
||||||
|
@ -1335,6 +1336,7 @@ sub make_thumbnail {
|
||||||
|
|
||||||
my $mesh = $self->get_model_object->mesh; # $self->model_object is already aligned to origin
|
my $mesh = $self->get_model_object->mesh; # $self->model_object is already aligned to origin
|
||||||
my $thumbnail = Slic3r::ExPolygon::Collection->new;
|
my $thumbnail = Slic3r::ExPolygon::Collection->new;
|
||||||
|
$mesh->repair;
|
||||||
if (@{$mesh->facets} <= 5000) {
|
if (@{$mesh->facets} <= 5000) {
|
||||||
# remove polygons with area <= 1mm
|
# remove polygons with area <= 1mm
|
||||||
my $area_threshold = Slic3r::Geometry::scale 1;
|
my $area_threshold = Slic3r::Geometry::scale 1;
|
||||||
|
|
|
@ -37,6 +37,7 @@ sub new {
|
||||||
$self->volumes([]);
|
$self->volumes([]);
|
||||||
foreach my $volume (@{$object->volumes}) {
|
foreach my $volume (@{$object->volumes}) {
|
||||||
my $mesh = $volume->mesh;
|
my $mesh = $volume->mesh;
|
||||||
|
$mesh->repair;
|
||||||
|
|
||||||
my $material_id = $volume->material_id // '_';
|
my $material_id = $volume->material_id // '_';
|
||||||
my $color_idx = first { $materials[$_] eq $material_id } 0..$#materials;
|
my $color_idx = first { $materials[$_] eq $material_id } 0..$#materials;
|
||||||
|
|
Loading…
Add table
Reference in a new issue