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
path: root/utils
diff options
context:
space:
mode:
authorAlessandro Ranellucci <aar@cpan.org>2012-04-11 21:02:33 +0400
committerAlessandro Ranellucci <aar@cpan.org>2012-04-11 21:02:33 +0400
commit085a818deccba673d057e39100a16f5eeae37b25 (patch)
treec9e352b08c365ba19646199ffa59cf39eb315512 /utils
parent1c6469fc258691acb0de8eccc1f4b33872763e44 (diff)
New file_info.pl script
Diffstat (limited to 'utils')
-rwxr-xr-xutils/file_info.pl52
1 files changed, 52 insertions, 0 deletions
diff --git a/utils/file_info.pl b/utils/file_info.pl
new file mode 100755
index 000000000..36e57e9b0
--- /dev/null
+++ b/utils/file_info.pl
@@ -0,0 +1,52 @@
+#!/usr/bin/perl
+# This script reads a file and outputs information about it
+
+use strict;
+use warnings;
+
+BEGIN {
+ 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);
+ $mesh->check_manifoldness;
+ 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: file_info.pl [ OPTIONS ] file.stl
+
+ --help Output this usage screen and exit
+
+EOF
+ exit ($exit_code || 0);
+}
+
+__END__