Gcode-nachbearbeitung.sh

Aus RF1000 Wiki
Zur Navigation springen Zur Suche springen
#!/bin/bash

for i in bottom top drills board ; do

  FeedG0=500
  FeedG1=30
  if [ $i == drills ]; then
    FeedG0=500
    FeedG1=200
  fi
  
  echo "Eingabe-Datei: ${i}.ncd"
  echo "Ausgabe-Datei: ${i}.gcode"
  echo "Feedrate fuer G0: ${FeedG0}"
  echo "Feedrate fuer G1: ${FeedG1}"

  sleep 1

  cat - ${i}.ncd > ${i}.gcode <<EOF
%
M3005 S6 ; enable debug output
M3060 ; print firmware version
G90 ; absolute coordinates
M3153 ; output matrix
M3141 ; turn z compensation on
EOF
  sed -i ${i}.gcode -e 's/^G00 Z00.*$/G00 Z0.5/' -e 's/^G01.*$/\0 F'${FeedG1}'/' -e 's/^G00.*$/\0 F'${FeedG0}'/'       \
                    -e 's/^M74$/% \0/' -e 's/^M71$/% \0/' -e 's/^M48$/% \0/' -e 's/^M999.*$/% \0/'                     \
                    -e 's/^M30 .*$/% \0/' -e 's/^G36 .*$/% \0/' -e 's/^T.*$/% \0/'

done