Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'utils/split_stl.pl')
-rwxr-xr-xutils/split_stl.pl11
1 files changed, 8 insertions, 3 deletions
diff --git a/utils/split_stl.pl b/utils/split_stl.pl
index af9890116..42d2926bd 100755
--- a/utils/split_stl.pl
+++ b/utils/split_stl.pl
@@ -25,15 +25,20 @@ my %opt = ();
}
{
- my $mesh = Slic3r::Format::STL->read_file($ARGV[0]);
+ my $model = Slic3r::Format::STL->read_file($ARGV[0]);
my $basename = $ARGV[0];
$basename =~ s/\.stl$//i;
my $part_count = 0;
- foreach my $new_mesh ($mesh->split_mesh) {
+ foreach my $new_mesh ($model->mesh->split_mesh) {
+ my $new_model = Slic3r::Model->new;
+ $new_model
+ ->add_object(vertices => $new_mesh->vertices)
+ ->add_volume(facets => $new_mesh->facets);
+
my $output_file = sprintf '%s_%02d.stl', $basename, ++$part_count;
printf "Writing to %s\n", basename($output_file);
- Slic3r::Format::STL->write_file($output_file, $new_mesh, !$opt{ascii});
+ Slic3r::Format::STL->write_file($output_file, $new_model, binary => !$opt{ascii});
}
}