mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 12:11:15 -06:00 
			
		
		
		
	New file_info.pl script
This commit is contained in:
		
							parent
							
								
									1c6469fc25
								
							
						
					
					
						commit
						085a818dec
					
				
					 1 changed files with 52 additions and 0 deletions
				
			
		
							
								
								
									
										52
									
								
								utils/file_info.pl
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										52
									
								
								utils/file_info.pl
									
										
									
									
									
										Executable file
									
								
							|  | @ -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__ | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Alessandro Ranellucci
						Alessandro Ranellucci