#!/bin/bash function ngc_position { ifn="$1" offsetx=10 offsety=10 if [[ "$ifn" == "" ]] ; then echo "provide file" exit 1 fi dos2unix $ifn sed -i 's/;.*//' $ifn #sed -i 's/G0 *F[0-9]*//' $ifn #sed -i 's/G1 F\(.*\)/G1 F\1\nG0 F8000/' $ifn mx=`ngc_bounds $ifn | grep min_x | cut -f2 -d' '` my=`ngc_bounds $ifn | grep min_y | cut -f2 -d' '` shiftx=` echo "-($mx) + $offsetx" | bc -l` shifty=` echo "-($my) + $offsety" | bc -l` tfn=`mktemp` grecode -shift "$shiftx" "$shifty" $ifn | \ grep -v '^(' > $tfn mv $tfn $ifn rm -f $tfn } ./svg2ngc "back-plate.svg" ./svg2ngc "top-plate.svg" ./svg2ngc "aux-plate.svg" ngc_position "back-plate.ngc" ngc_position "top-plate.ngc" ngc_position "aux-plate.ngc"