4 # ./quacks-ingredients-make-copy-gcodes Tests_L
6 # quacks-ingredients-L$l,Tests_L.auto.stl
8 # quacks-ingredients-L$l,Tests_L.auto.gcode
9 # and then edits them and copies them to the SD card as
17 lhs=quacks-ingredients-L
21 h=/media/sd/PREPARED/Q$l.G
24 for l in 1 2 3 4 5; do
26 cura -i quacks.ini -s $lhs$l,$f.auto.stl -o $g
29 perl -i~ -pe 's/^/;/ if m/^M140 S0\b.*\n/' $g
34 $l =~ s/^/;/ if m/^M400/;
35 $l .= "G91\nG1 Z5\nG90\n" if m/^M84/;
38 END { print $l or die $!; }
45 @l = split m{^(?=;LAYER:\d+\n)}m, $_;
46 foreach my $i (0..$#l) {
49 ^G1 \ Z([0-9.]+) \s*\n
50 ( ^G0 \ F(\d+) \ X\S+ \ Y\S+ \s*\n
52 ^G1 \ Z([0-9.]+) \s*\n )
56 my $z = $i == $#l ? $1 : $4 + 0.5;
60 }gmxe or $l==0 or die $i;
62 print or die $! foreach @l;
66 exec 3>${lhs}234.auto.gcode
69 perl -pe 's/^/;/ if m/^M104 S0\b/ || (m/^M84/..0)' $g >&3
76 umount /media/sd >/dev/null 2>&1 ||:
79 for l in 1 2 3 4 5 234; do
88 for l in 1 2 3 4 5 234; do