diff --git a/m1/case/Makefile b/m1/case/Makefile new file mode 100644 index 0000000..b66739e --- /dev/null +++ b/m1/case/Makefile @@ -0,0 +1,19 @@ +SPOOL=/home/moko/svn.openmoko.org/developers/werner/cncmap/spool/spool + +BOARD=X0=5.0mm Y0=0.0mm Z0=-56.0mm BOARD_Z=4mm + +.PHONY: all mill clean + +all: mill.rml + +case.gp: case.fpd + fped -g $< + +mill.rml: case.gp + ./doit $(BOARD) CLEARANCE=5mm || { rm -f $@; exit 1; } + +mill: mill.rml + PORT=/dev/ttyUSB0 $(SPOOL) mill.rml + +clean: + rm -f case.gp mill.gp mill.rml diff --git a/m1/case/case.fpd b/m1/case/case.fpd new file mode 100644 index 0000000..217296c --- /dev/null +++ b/m1/case/case.fpd @@ -0,0 +1,113 @@ +/* MACHINE-GENERATED ! */ + +frame short { + __0: vec @(Iox, 0mm) + line @ . w + __1: vec .(Lox, 0mm) + __2: vec .(Iix, 0mm) + line __1 . w + __3: vec __0(0mm, -Ly) + line __0 . w + __4: vec __1(0mm, -Ly) + line __3 . w + line . __1 w + __5: vec __2(Lix, 0mm) + __6: vec __2(0mm, -Ly) + line __2 . w + __7: vec __5(0mm, -Ly) + line __6 . w + line . __5 w + __8: vec __5(Iix, 0mm) + line __5 . w + __9: vec .(Lox, 0mm) + __10: vec .(Iox, 0mm) + line __9 . w + __11: vec __8(0mm, -Ly) + line __8 . w + __12: vec __9(0mm, -Ly) + line . __11 w + line __9 . w + __13: vec @(0mm, H) + line . @ w + __14: vec .(Iox, 0mm) + line __13 . w + __15: vec .(Lox, 0mm) + __16: vec .(Iix, 0mm) + line __15 . w + __17: vec .(Lix, 0mm) + __18: vec .(Iix, 0mm) + line __17 . w + __19: vec .(Lox, 0mm) + __20: vec .(Iox, 0mm) + line __19 . w + line . __10 w + __21: vec __14(0mm, Ly) + line . __14 w + __22: vec __15(0mm, Ly) + line __21 . w + line . __15 w + __23: vec __16(0mm, Ly) + line . __16 w + __24: vec __17(0mm, Ly) + line __23 . w + line . __17 w + __25: vec __18(0mm, Ly) + line . __18 w + __26: vec __19(0mm, Ly) + line . __25 w + line . __19 w +} + +frame usb { + set Wusb = 8.5mm + + set Husb = 15.5mm + + __0: vec @(-Wusb, Husb) + rect . @ w +} + +frame but { + set Rbut = 4mm+0.1mm + + __0: vec @(0mm, Rbut) + circ @ . w +} + +frame front { + table + { Ibutx, Ibuty, Dbut } + { 54.5mm, 10.5mm, 14mm } + + table + { Iusbx, Iusby, Dusb } + { 18.5mm, 6.5mm+1.3mm, 12.5mm } + + __0: vec @(Ibutx, Ibuty) + frame but . + __1: vec .(Dbut, 0mm) + frame but . + __2: vec .(Dbut, 0mm) + frame but . + __3: vec @(Ws, 0mm) + __4: vec .(-Iusbx, Iusby) + frame usb . + __5: vec .(-Dusb, 0mm) + frame usb . + frame short @ +} + +package "M1" +unit mm + +table + { Iox, Lox, Ly, Iix, Lix } + { 10mm, 12mm, 3mm, 33mm, 21mm } + +set w = 0.1mm + +table + { H, Ws } + { 36.5mm, 2*(Iox+Lox+Iix)+Lix } + +frame front @ diff --git a/m1/case/doit b/m1/case/doit new file mode 100755 index 0000000..e3b5ff9 --- /dev/null +++ b/m1/case/doit @@ -0,0 +1,59 @@ +#!/bin/sh +PATH=$PATH:/home/qi/cae-tools/cameo +PATH=$PATH:/home/qi/cae-tools/gp2rml + +# +# Parameters: +# +# X0, Y0 lower left corner of raw board, default: 0mm 0mm +# Z0 position at which tool tip touches the piece's surface +# X, Y position in array, default: 0 0 +# XN, YN number of boards in X/Y direction, default: 1 1 +# MILL diameter of mill, default: 35mil +# BOARD_Z board tickness, default: 0.8 mm +# CLEARANCE tool clearance above PCB surface, default: 2mm +# + +while [ "$1" ]; do + eval "$1" + shift +done + +: ${X0:=0} ${Y0:=0} ${Z0:=0} +: ${X:=0} ${Y:=0} +: ${XN:=1} ${YN:=1} +: ${MILL:=35mil} +: ${BOARD_Z:=0.8mm} +: ${CLEARANCE:=2mm} + +write=write +yi=0 +while [ $yi -lt $YN ]; do + xi=0 + while [ $xi -lt $XN ]; do + + cat <_job +mm +gnuplot $MILL case.gp + +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 $Z0 # board surface (tool fully retracted) +z -$BOARD_Z # board thickness + +write merged.gp +offset +write mill.gp +EOF + + cameo _job || exit + rm -f _job + + write=append + xi=`expr $xi + 1` + done + yi=`expr $yi + 1` +done + +gp2rml $CLEARANCE 10 10 mill.gp >mill.rml || exit