chiark / gitweb /
quacks-ingredients: gcode manipulation
[reprap-play.git] / quacks-ingredients-make-copy-gcodes
index af8559cf17d4d711a92a5827ea6658597608310f..512d5fe83798cbb8e2bbfe57f95dda06d71a8607 100755 (executable)
@@ -23,7 +23,7 @@ gh () {
 
 for l in 1 2 3 4 5; do
        gh
-       cura -s $lhs$l,$f.auto.stl -o $g
+       cura -i quacks.ini -s $lhs$l,$f.auto.stl -o $g
        case $l in
        1|2|3|4)
                perl -i~ -pe 's/^/;/ if m/^M140 S0\b.*\n/' $g
@@ -39,6 +39,24 @@ for l in 1 2 3 4 5; do
        ' $g
 done
 
+for l in 2 4 5; do
+       gh
+       perl -i~ -0777 -pe '
+               s{
+                       ^G1 \ Z([0-9.]+) \n
+               (       ^G0 \ F(\d+) \ X\S+ \ Y\S+ \n
+                       (?: ; .* )?
+                       ^G1 \ Z([0-9.]+) \n     )
+               }{
+                       die unless $1 > $4;
+                       die unless $3 > 9000;
+                       "G0 F$2\n".
+                       "G1 Z".($3 + 0.5)."\n" .
+                       $2
+               }mxe
+       ' $g
+done
+
 exec 3>${lhs}234.auto.gcode
 for l in 2 3; do
        gh
@@ -56,6 +74,7 @@ for l in 1 2 3 4 5 234; do
        gh
        cp $g $h
 done
+sleep 0.5
 
 umount /media/sd
 mount /media/sd
@@ -65,5 +84,6 @@ for l in 1 2 3 4 5 234; do
        cmp $g $h
        ls -l $h
 done
+sleep 0.5
 
 umount /media/sd