chiark / gitweb /
quacks-ingredients: gcode manipulation
[reprap-play.git] / quacks-ingredients-make-copy-gcodes
index 4d9c8ea0d9e64bf401ae751d3b95aab559210e47..512d5fe83798cbb8e2bbfe57f95dda06d71a8607 100755 (executable)
@@ -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