#!/bin/bash
# Needs the tool pcb2gcode
# Was documented at: http://marcuswolschon.blogspot.de/2013/02/milling-pcbs-using-gerber2gcode.html

MILLSPEED=600
MILLFEED=200
PROJECT=tuer
pcb2gcode --metric --back $PROJECT-B_Cu.gbr --cutter-diameter 0.2 --zsafe 5 --zchange 10 --zwork -0.01 --offset 0.02 --mill-feed $MILLFEED --mill-speed $MILLSPEED --drill $PROJECT.drl --zdrill -2.5 --drill-feed $MILLFEED --drill-speed $MILLSPEED --basename $PROJECT
# one-drill parameter workaround
sed ${PROJECT}_drill.ngc -e "s/^T[0-9]$/T1/g" > ${PROJECT}_drillOne.ngc
mv ${PROJECT}_drillOne.ngc ${PROJECT}_drill.ngc
