/usr/bin/dump-stl is in slic3r 1.1.7+dfsg-2+b1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | #!/usr/bin/perl
# This script dumps a STL file into Perl syntax for writing tests
# or dumps a test model into a STL file
use strict;
use warnings;
BEGIN {
use FindBin;
use lib "$FindBin::Bin/../lib";
}
use Slic3r;
use Slic3r::Test;
$|++;
$ARGV[0] or usage(1);
if (-e $ARGV[0]) {
my $model = Slic3r::Format::STL->read_file($ARGV[0]);
$model->objects->[0]->add_instance(offset => Slic3r::Pointf->new(0,0));
my $mesh = $model->mesh;
$mesh->repair;
printf "VERTICES = %s\n", join ',', map "[$_->[0],$_->[1],$_->[2]]", @{$mesh->vertices};
printf "FACETS = %s\n", join ',', map "[$_->[0],$_->[1],$_->[2]]", @{$mesh->facets};
exit 0;
} elsif ((my $model = Slic3r::Test::model($ARGV[0]))) {
$ARGV[1] or die "Missing writeable destination as second argument\n";
Slic3r::Format::STL->write_file($ARGV[1], $model);
printf "Model $ARGV[0] written to $ARGV[1]\n";
exit 0;
} else {
die "No such model exists\n";
}
sub usage {
my ($exit_code) = @_;
print <<"EOF";
Usage: dump-stl.pl file.stl
dump-stl.pl modelname file.stl
EOF
exit ($exit_code || 0);
}
__END__
|