Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
executable file 53 lines (40 sloc) 1.07 KB
# This script reads a file and outputs information about it
use strict;
use warnings;
use FindBin;
use lib "$FindBin::Bin/../lib";
use File::Basename qw(basename);
use Getopt::Long qw(:config no_auto_abbrev);
use Slic3r;
my %opt = ();
my %options = (
'help' => sub { usage() },
GetOptions(%options) or usage(1);
$ARGV[0] or usage(1);
my $input_file = $ARGV[0];
my $mesh;
$mesh = Slic3r::Format::STL->read_file($input_file) if $input_file =~ /\.stl$/i;
die "This script doesn't support AMF yet\n" if $input_file =~ /\.amf$/i;
die "Unable to read file\n" if !$mesh;
printf "Info about %s:\n", basename($input_file);
printf " number of facets: %d\n", scalar @{$mesh->facets};
printf " size: x=%s y=%s z=%s\n", $mesh->size;
sub usage {
my ($exit_code) = @_;
print <<"EOF";
Usage: [ OPTIONS ] file.stl
--help Output this usage screen and exit
exit ($exit_code || 0);
Something went wrong with that request. Please try again.