1
0
mirror of git://projects.qi-hardware.com/wernermisc.git synced 2024-11-15 09:16:14 +02:00

labsw/mech/: added process to mill front plate

This commit is contained in:
Werner Almesberger 2011-09-04 20:36:30 -03:00
parent 2be054814c
commit 596fe88023
3 changed files with 113 additions and 0 deletions

29
labsw/mech/Makefile Normal file
View File

@ -0,0 +1,29 @@
SPOOL=/home/moko/svn.openmoko.org/developers/werner/cncmap/spool/spool
CNGT=/home/qi/cae-tools/cngt/cngt
.PHONY: all mill cng plot clean
all: mill.rml
front.gp: front.fpd
fped -g -1 front-cut $< - | ./filter !logo >$@ || \
{ rm -f $@; exit 1; }
logo.gp: front.fpd
fped -g -1 front-cut $< - | ./filter logo >$@ || \
{ rm -f $@; exit 1; }
mill.rml mill.gp: front.gp logo.gp
./doit BOARD_Z=1.6mm CLEARANCE=3mm || { rm -rf $@; exit 1; }
mill: mill.tmp
PORT=/dev/ttyUSB0 $(SPOOL) mill.rml
cng: mill.gp
$(CNGT) -57.4 20 mill.gp
plot:
echo 'splot "mill.gp" with lines' | gnuplot -persist
clean:
rm -f front.gp mill.gp mill.rml

67
labsw/mech/doit Executable file
View File

@ -0,0 +1,67 @@
#!/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
# 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
# ENGRAVE_Z engraving depth, default: 0.2 mm
# CLEARANCE tool clearance above PCB surface, default: 2mm
#
while [ "$1" ]; do
eval "$1"
shift
done
: ${X0:=0} ${Y0:=0}
: ${X:=0} ${Y:=0}
: ${XN:=1} ${YN:=1}
: ${MILL:=35mil}
: ${BOARD_Z:=0.8mm}
: ${ENGRAVE_Z:=0.2mm}
: ${CLEARANCE:=2mm}
write=write
yi=0
while [ $yi -lt $YN ]; do
xi=0
while [ $xi -lt $XN ]; do
cameo <<EOF || exit
mm
gnuplot $MILL front.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 -57.4mm # board surface (tool fully retracted)
z $ENGRAVE_Z # correct for reference level picked by gp2rml
clear
z -$ENGRAVE_Z # engraving depth
gnuplot $MILL logo.gp
mill any $MILL 0.01mm
$write mill.gp
clear
z $ENGRAVE_Z
z -$BOARD_Z # board thickness
z -0.5mm # tool extra depth
gnuplot $MILL front.gp
offset
append mill.gp
EOF
write=append
xi=`expr $xi + 1`
done
yi=`expr $yi + 1`
done
gp2rml $CLEARANCE 0.5 0.5 mill.gp >mill.rml || exit

17
labsw/mech/filter Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/perl
$on = 1;
while (<STDIN>) {
$line = $_;
if (/^#%id=/) {
chop($id = $');
$on = 1;
for (@ARGV) {
if ($_ =~ /^!/) {
$on = 0 if $id =~ $';
} else {
$on = 0 unless $id =~ $_;
}
}
}
print $line if $on;
}