chiark / gitweb /
quacks-ingredients: gcode manipulation wip
[reprap-play.git] / quacks-ingredients-make-copy-gcodes
1 #!/bin/sh
2 #
3 # usage:
4 #    ./quacks-ingredients-make-copy-gcodes Tests_L
5 # Uses
6 #    quacks-ingredients-L$l,Tests_L.auto.stl
7 # to make
8 #    quacks-ingredients-L$l,Tests_L.auto.gcode
9 # and then edits them and copies them to the SD card as
10 #    PREPARED/Q$l.G
11
12 set -e
13
14 f=$1
15 shift
16
17 lhs=quacks-ingredients-L
18
19 gh () {
20         g=$lhs$l.auto.gcode
21         h=/media/sd/PREPARED/Q$l.G
22 }
23
24 for l in 1 2 3 4 5; do
25         gh
26         cura -s $lhs$l,$f.auto.stl -o $g
27         case $l in
28         1|2|3|4)
29                 perl -i~ -pe 's/^/;/ if m/^M140 S0\b.*\n/' $g
30                 ;;
31         5)      ;;
32         *)      echo >&2 "??? $l"; exit 1 ;;
33         esac
34
35         perl -i~ -ne '
36                 $l =~ s/^/;/ if m/^M400/;
37                 print $l or die $!;
38                 $l = $_;
39                 END { print $l or die $!; }
40         ' $g
41 done
42
43 umount /media/sd >/dev/null 2>&1 ||:
44 mount /media/sd
45
46 for l in 1 2 3 4 5; do
47         cp $g $h
48 done
49
50 umount /media/sd
51 mount /media/sd
52
53 for l in 1 2 3 4 5; do
54         gh
55         cmp $g $h
56         ls -l $h
57 done
58
59 umount /media/sd