PATH=$PATH:/home/qi/cae-tools/cameo
PATH=$PATH:/home/moko/svn.openmoko.org/developers/werner/cncmap/gp2rml

cameo <<EOF
mm

gerber 35mil f10-PCB_Edges.gbr
align 1 31.6mm 13.3mm	# align relative to board corner
z 0 -56.8mm		# board surface (tool fully extended)
z -1.6mm		# board thickness
z -0.5mm		# tool extra depth
clear

excellon f10.drl
drill 0.7mm 0.89mm	# 0.8-0.89 mm fill
optimize
write mill.gp

remainder
mill 20mil 0.01mm       # 35 mil endmill; pretend it is a little smaller,
                        # to compensate for tool/board deflections
append mill.gp

remainder
empty
EOF

gp2rml 3 0.2 0.2 mill.gp >mill.rml

cat <<EOF >Makefile.mkmk
SPOOL=/home/moko/svn.openmoko.org/developers/werner/cncmap/spool/spool
CNGT=/home/qi/cae-tools/cngt/cngt

.PHONY:		mill drill cng plot

mill:
		PORT=/dev/ttyUSB0 \$(SPOOL) mill.rml

cng:
		\$(CNGT) -56.8 20 mill.gp

plot:
		echo 'plot "mill.gp" with linespoints' | \
		  gnuplot -persist
EOF
