diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index bc002af37..56d90fa91 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -568,7 +568,8 @@ sub split_object { my $mesh = $model_object->mesh; $mesh->align_to_origin; - my @new_meshes = $mesh->split_mesh; + $mesh->repair; + my @new_meshes = @{$mesh->split}; if (@new_meshes == 1) { Slic3r::GUI::warning_catcher($self)->("The selected object couldn't be split because it already contains a single part."); return; @@ -583,9 +584,10 @@ sub split_object { my $new_model = Slic3r::Model->new; foreach my $mesh (@new_meshes) { + $mesh->repair; my $bb = $mesh->bounding_box; - my $model_object = $new_model->add_object(vertices => $mesh->vertices); - $model_object->add_volume(facets => $mesh->facets); + my $model_object = $new_model->add_object; + $model_object->add_volume(mesh => $mesh); my $object = Slic3r::GUI::Plater::Object->new( name => basename($current_object->input_file), input_file => $current_object->input_file, diff --git a/lib/Slic3r/Model.pm b/lib/Slic3r/Model.pm index b017d21a0..3bddb6824 100644 --- a/lib/Slic3r/Model.pm +++ b/lib/Slic3r/Model.pm @@ -216,10 +216,10 @@ sub mesh { foreach my $instance (@instances) { my $mesh = $object->mesh->clone; if ($instance) { - $mesh->rotate($instance->rotation); + $mesh->rotate($instance->rotation, Slic3r::Point->new(0,0)); $mesh->scale($instance->scaling_factor); $mesh->align_to_origin; - $mesh->move(@{$instance->offset}); + $mesh->translate(@{$instance->offset}, 0); } push @meshes, $mesh; } @@ -246,15 +246,14 @@ sub split_meshes { } my $volume = $object->volumes->[0]; - foreach my $mesh ($volume->mesh->split_mesh) { + foreach my $mesh (@{$volume->mesh->split}) { my $new_object = $self->add_object( input_file => $object->input_file, config => $object->config, layer_height_ranges => $object->layer_height_ranges, ); $new_object->add_volume( - vertices => $mesh->vertices, - facets => $mesh->facets, + mesh => $mesh, material_id => $volume->material_id, );