diff --git a/wipe_towers_v01.pl b/wipe_towers_v01.pl index ea17b23..04fbf95 100755 --- a/wipe_towers_v01.pl +++ b/wipe_towers_v01.pl @@ -1,9 +1,9 @@ +#!/usr/bin/perl -i # WIPE TOWERS v01 # PERL POSTPROCESSOR FOR ADDING WIPE TOWERS TO SLIC3R # YUNOMAKE.COM # (c) Moritz Walter 2015 -#!/usr/bin/perl -i use strict; use warnings; use Math::Round; @@ -93,13 +93,6 @@ my $bypass=0; -for(my $i=0;$i<$extruders;$i++){ - $linesByExtruder[$i]=(); - $gcodeX[$i]=0; - $gcodeY[$i]=0; - $gcodeE[$i]=0; - $gcodeRetraction[$i]=0; -} ########## # MAIN LOOP @@ -107,9 +100,16 @@ while (<>) { if($start==0){ - readParams($_); - evaluateLine($_); - print; + readParams($_); + for(my $i=0;$i<$extruders;$i++){ + $linesByExtruder[$i]=(); + $gcodeX[$i]=0; + $gcodeY[$i]=0; + $gcodeE[$i]=0; + $gcodeRetraction[$i]=0; + } + evaluateLine($_); + print; }elsif($end==1){ print; # just print out everything after the end code marker }elsif (/^T(\d)/){ @@ -779,4 +779,4 @@ sub readParams{ # collecting params if($_[0]=~/extrusionFeedrate=(\d*\.?\d*)/){ $extrusionFeedrate=$1*60.0; } -} \ No newline at end of file +}