From c539a8d9e0e9c30eb31b7371e482a614a4fcfd23 Mon Sep 17 00:00:00 2001 From: Owen Stenseth Date: Tue, 21 Feb 2012 09:26:54 -0700 Subject: [PATCH] Support skeining multiple files from the command line. Update the status output to include input and export filenames. --- lib/Slic3r/Skein.pm | 3 ++- slic3r.pl | 27 ++++++++++++--------------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/lib/Slic3r/Skein.pm b/lib/Slic3r/Skein.pm index 1c19ad4a..c066e5dc 100644 --- a/lib/Slic3r/Skein.pm +++ b/lib/Slic3r/Skein.pm @@ -23,6 +23,7 @@ sub go { # skein the STL into layers # each layer has surfaces with holes + $self->status_cb->(5, "Processing input file " . $self->input_file); $self->status_cb->(10, "Processing triangulated mesh"); my $print; if ($self->input_file =~ /\.stl$/i) { @@ -127,8 +128,8 @@ sub go { $print->extrude_skirt; # output everything to a GCODE file - $self->status_cb->(90, "Exporting GCODE"); my $output_file = $self->expanded_output_filepath; + $self->status_cb->(90, "Exporting GCODE to $output_file"); $print->export_gcode($output_file); # run post-processing scripts diff --git a/slic3r.pl b/slic3r.pl index b4e6fed4..3bbd8e8f 100755 --- a/slic3r.pl +++ b/slic3r.pl @@ -71,21 +71,18 @@ if (!@ARGV && !$opt{save} && eval "require Slic3r::GUI; 1") { exit; } -if ($ARGV[0]) { - - # skein - my $input_file = $ARGV[0]; - - my $skein = Slic3r::Skein->new( - input_file => $input_file, - output_file => $opt{output}, - status_cb => sub { - my ($percent, $message) = @_; - printf "=> $message\n"; - }, - ); - $skein->go; - +if (@ARGV) { + foreach my $input_file ( @ARGV ) { + my $skein = Slic3r::Skein->new( + input_file => $input_file, + output_file => $opt{output}, + status_cb => sub { + my ($percent, $message) = @_; + printf "=> $message\n"; + }, + ); + $skein->go; + } } else { usage(1) unless $opt{save}; }