From eb6f066bbd7a194a28ad336f32ab59f945f5b906 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Thu, 2 Sep 2010 23:50:45 -0300 Subject: [PATCH] atusd/cam/: CAM data for cutting the PCB. --- atusd/cam/Makefile | 4 +++ atusd/cam/doit | 22 +++++++++++++ atusd/cam/pcb.pl | 82 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 atusd/cam/Makefile create mode 100755 atusd/cam/doit create mode 100755 atusd/cam/pcb.pl diff --git a/atusd/cam/Makefile b/atusd/cam/Makefile new file mode 100644 index 0000000..00c827b --- /dev/null +++ b/atusd/cam/Makefile @@ -0,0 +1,4 @@ +.PHONY: pcb + +pcb: + ./doit >job diff --git a/atusd/cam/doit b/atusd/cam/doit new file mode 100755 index 0000000..5aaf07e --- /dev/null +++ b/atusd/cam/doit @@ -0,0 +1,22 @@ +#!/bin/sh -e +DIR=/home/moko/svn.openmoko.org/developers/werner/cncmap +RECT=$DIR/rect/rect +ALIGN=$DIR/align/align +ZMAP=$DIR/zmap/zmap +GP2RML=$DIR/gp2rml/gp2rml + +GEN=${1:-./pcb.pl} + +rdata="17.8 8.9 -55.7 72.0 9.6 -55.3 17.8 68.5 -55.5" +rdata="12.4 9.8 -55.6 125.5 9.4 -55.4 12.9 83.6 -55.7" +# we need quite a large Z adjustment due to the table's vertical flexibility +Z=-55.80 + +rect=`$RECT $rdata | awk '{$3 = ""; print}'` + +$GEN | + awk '{ if ($3 != "") $3 += '$Z'; print $0; }' | + $ALIGN 0 1 $rect | + # angle, reference (lower left corner), rect + $GP2RML 1.5 0.1 0.1 + # clearance, xy speed, z speed diff --git a/atusd/cam/pcb.pl b/atusd/cam/pcb.pl new file mode 100755 index 0000000..fa41c8e --- /dev/null +++ b/atusd/cam/pcb.pl @@ -0,0 +1,82 @@ +#!/usr/bin/perl + +$d = 2.54/1000*12; +$r = $d/2+0.25; + + +sub orig +{ + $x0 = $_[0]; + $y0 = $_[1]; +} + + +sub mil +{ + return $_[0]/1000*25.4; +} + + +sub same +{ + return @_; +} + + +sub rot +{ + return (-$x, -$y); +} + + +sub cut +{ + local (*fn) = $_[0]; + shift @_; + if (defined $x) { + if ($x == $_[0]+$x0 && $y == $_[1]+$y0) { + shift @_; + shift @_; + } else { + print "\n"; + } + } + while (@_) { + $x = shift @_; + $y = shift @_; + ($x, $y) = &fn($x, $y); + $x += $x0; + $y += $y0; + print "$x $y $z\n"; + } +} + + +sub one +{ + local ($fn) = @_; + + &cut($fn, + &mil( 0)-$r, &mil( 0)-$r, + &mil( 0)-$r, &mil(1030)+$r, + &mil(1340)+$r, &mil(1030)+$r, + &mil(1340)+$r, &mil( 640)-$r, + &mil( 440)+$r, &mil( 640)-$r, + &mil( 440)+$r, &mil( 390)-$r, + &mil( 410)+$r, &mil( 360)-$r, + &mil( 410)+$r, &mil( 310)+$r, + &mil( 440)+$r, &mil( 310)+$r, + &mil( 440)+$r, &mil( 250)-$r, + &mil( 380)+$r, &mil( 190)-$r, + &mil( 380)+$r, &mil( 0)-$r, + &mil( 0)-$r, &mil( 0)-$r); +} + + +$z = -0.8; +# x: corner offset, compensation for rotation, array position +# y: corner offet +&orig(5+40*0, 5+30*0) +&one(*same); +&orig(5+40*0+15+&mil(1340), 5+30*0+&mil(1030)); +&one(*rot);