From: Ian Jackson Date: Wed, 19 Feb 2020 23:15:56 +0000 (+0000) Subject: quacks-ingredients: gcode manipulation wip X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=2487c5f3238584ac720e9dd4aa956054635638da;p=reprap-play.git quacks-ingredients: gcode manipulation wip Signed-off-by: Ian Jackson --- diff --git a/quacks-ingredients-make-copy-gcodes b/quacks-ingredients-make-copy-gcodes new file mode 100755 index 0000000..c2c0849 --- /dev/null +++ b/quacks-ingredients-make-copy-gcodes @@ -0,0 +1,57 @@ +#!/bin/sh +# +# usage: +# ./quacks-ingredients-make-copy-gcodes Tests_L +# Uses +# quacks-ingredients-L$l,Tests_L.auto.stl +# to make +# quacks-ingredients-L$l,Tests_L.auto.gcode +# and then edits them and copies them to the SD card as +# PREPARED/Q$l.G + +set -e + +f=$1 +shift + +umount /media/sd >/dev/null 2>&1 ||: +mount /media/sd + +lhs=quacks-ingredients-L + +gh () { + g=$lhs$l.auto.gcode + h=/media/sd/PREPARED/Q$l.G +} + +for l in 1 2 3 4 5; do + gh + cura -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 + ;; + 5) ;; + *) echo >&2 "??? $l"; exit 1 ;; + esac + + perl -i~ -ne ' + $l =~ s/^/;/ if m/^M400/; + print $l or die $!; + $l = $_; + END { print $l or die $!; } + ' $g + + cp $g $h +done + +umount /media/sd +mount /media/sd + +for l in 1 2 3 4 5; do + gh + cmp $g $h + ls -l $h +done + +umount /media/sd