From e7c475fdff6011db3db8c025fa5b85746afba44d Mon Sep 17 00:00:00 2001 From: PxT Date: Mon, 20 Jul 2015 21:24:50 -0700 Subject: [PATCH] Fix gcodeRetraction initialization for more than 2 extruders Move the initialization loop after the readParams call so that the number of extruders given in the gcode comments is used correctly. Moved perl hash-bang line to beginning of file so that it is recognized correctly when run from CLI. --- wipe_towers_v01.pl | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) 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 +}