Fixed split_stl.pl

This commit is contained in:
Alessandro Ranellucci 2014-08-03 16:00:37 +02:00
parent 30fa055995
commit 5902c65014

View File

@ -30,11 +30,16 @@ my %opt = ();
$basename =~ s/\.stl$//i; $basename =~ s/\.stl$//i;
my $part_count = 0; my $part_count = 0;
foreach my $new_mesh ($model->mesh->split_mesh) { my $mesh = $model->objects->[0]->volumes->[0]->mesh;
foreach my $new_mesh (@{$mesh->split}) {
$new_mesh->repair;
my $new_model = Slic3r::Model->new; my $new_model = Slic3r::Model->new;
$new_model $new_model
->add_object(vertices => $new_mesh->vertices) ->add_object()
->add_volume(facets => $new_mesh->facets); ->add_volume(mesh => $new_mesh);
$new_model->add_default_instances;
my $output_file = sprintf '%s_%02d.stl', $basename, ++$part_count; my $output_file = sprintf '%s_%02d.stl', $basename, ++$part_count;
printf "Writing to %s\n", basename($output_file); printf "Writing to %s\n", basename($output_file);