1
0
mirror of git://projects.qi-hardware.com/ben-blinkenlights.git synced 2024-09-28 22:30:43 +03:00

ubb/cam: CAM process for cutting the PCB, now with parametrized "mkmk"

This commit is contained in:
Werner Almesberger 2011-02-02 21:42:37 -03:00
parent 8172464c05
commit 5b7cc3edb6
2 changed files with 114 additions and 0 deletions

22
ubb/cam/Makefile Normal file
View File

@ -0,0 +1,22 @@
NAME=ubb
BOARD = X0=8.0mm Y0=8.1mm
FAB = X=0 Y=0 XN=1 YN=5
.PHONY: all clean
all: Makefile.mkmk
Makefile.mkmk: mkmk ../$(NAME).drl ../$(NAME)-PCB_Edges.gbr
./mkmk NAME=$(NAME) $(BOARD) $(FAB)
../$(NAME).drl: ../$(NAME).brd
pcbnew --drill `pwd`/../$(NAME).brd
../$(NAME)-PCB_Edges.gbr: ../$(NAME).brd
pcbnew --plot=gerber -l PCB_Edges `pwd`/../$(NAME).brd
-include Makefile.mkmk
clean::
rm -f Makefile.mkmk

92
ubb/cam/mkmk Executable file
View File

@ -0,0 +1,92 @@
#!/bin/sh
PATH=$PATH:/home/qi/cae-tools/cameo
PATH=$PATH:/home/moko/svn.openmoko.org/developers/werner/cncmap/gp2rml
while [ "$1" ]; do
eval "$1"
shift
done
if ! [ "$NAME" ]; then
echo "NAME is required" 1>&2
exit 1
fi
: ${X0:=0} ${Y0:=0}
: ${X:=0} ${Y:=0}
: ${XN:=1} ${YN:=1}
write=write
yi=0
while [ $yi -lt $YN ]; do
xi=0
while [ $xi -lt $XN ]; do
cameo <<EOF
mm
gerber 35mil ../$NAME-PCB_Edges.gbr
align 1 $X0 $Y0 # align relative to board corner
translate 4mm 4mm # move to PCB zone assigned to project
array +3mm +3mm `expr $X + $xi` `expr $Y + $yi`
z 0 -58.9mm # board surface (tool fully retracted)
z 1.5mm # slack for extending the tool
z -0.8mm # board thickness
z -0.5mm # tool extra depth
clear
excellon ../$NAME.drl
drill 7mil 15mil # 12.5-13.5 mil drill
optimize
$write drill.gp
remainder
mill 25mil 0.01mm # 35 mil endmill; pretend it is a little smaller,
# to compensate for tool/board deflections
$write mill.gp
remainder
empty
gerber 45mil ../$NAME-PCB_Edges.gbr # 35 mil endmill, -10 mil deflection
offset
append mill.gp
EOF
write=append
xi=`expr $xi + 1`
done
yi=`expr $yi + 1`
done
gp2rml 2 0.5 0.5 mill.gp >mill.rml
gp2rml 2 0.1 0.5 drill.gp >drill.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 dplot
mill:
PORT=/dev/ttyUSB0 \$(SPOOL) mill.rml
drill:
PORT=/dev/ttyUSB0 \$(SPOOL) drill.rml
cng:
\$(CNGT) -57.4 20 mill.gp
plot:
echo 'plot "drill.gp" with points, "mill.gp" with lines' | \\
gnuplot -persist
dplot:
echo 'plot "< sed /^\$\$/d drill.gp" with linespoints' | \\
gnuplot -persist
clean::
rm -f mill.gp mill.rml drill.gp drill.rml
EOF