Date:2010-09-03 04:50:45 (8 years 9 months ago)
Author:Werner Almesberger
Commit:eb6f066bbd7a194a28ad336f32ab59f945f5b906
Message:atusd/cam/: CAM data for cutting the PCB.

Files: atusd/cam/Makefile (1 diff)
atusd/cam/doit (1 diff)
atusd/cam/pcb.pl (1 diff)

Change Details

atusd/cam/Makefile
1.PHONY: pcb
2
3pcb:
4        ./doit >job
atusd/cam/doit
1#!/bin/sh -e
2DIR=/home/moko/svn.openmoko.org/developers/werner/cncmap
3RECT=$DIR/rect/rect
4ALIGN=$DIR/align/align
5ZMAP=$DIR/zmap/zmap
6GP2RML=$DIR/gp2rml/gp2rml
7
8GEN=${1:-./pcb.pl}
9
10rdata="17.8 8.9 -55.7 72.0 9.6 -55.3 17.8 68.5 -55.5"
11rdata="12.4 9.8 -55.6 125.5 9.4 -55.4 12.9 83.6 -55.7"
12# we need quite a large Z adjustment due to the table's vertical flexibility
13Z=-55.80
14
15rect=`$RECT $rdata | awk '{$3 = ""; print}'`
16
17$GEN |
18  awk '{ if ($3 != "") $3 += '$Z'; print $0; }' |
19  $ALIGN 0 1 $rect |
20    # angle, reference (lower left corner), rect
21  $GP2RML 1.5 0.1 0.1
22    # clearance, xy speed, z speed
atusd/cam/pcb.pl
1#!/usr/bin/perl
2
3$d = 2.54/1000*12;
4$r = $d/2+0.25;
5
6
7sub orig
8{
9    $x0 = $_[0];
10    $y0 = $_[1];
11}
12
13
14sub mil
15{
16    return $_[0]/1000*25.4;
17}
18
19
20sub same
21{
22    return @_;
23}
24
25
26sub rot
27{
28    return (-$x, -$y);
29}
30
31
32sub cut
33{
34    local (*fn) = $_[0];
35    shift @_;
36    if (defined $x) {
37    if ($x == $_[0]+$x0 && $y == $_[1]+$y0) {
38        shift @_;
39        shift @_;
40    } else {
41        print "\n";
42    }
43    }
44    while (@_) {
45    $x = shift @_;
46    $y = shift @_;
47    ($x, $y) = &fn($x, $y);
48    $x += $x0;
49    $y += $y0;
50    print "$x $y $z\n";
51    }
52}
53
54
55sub one
56{
57    local ($fn) = @_;
58
59    &cut($fn,
60      &mil( 0)-$r, &mil( 0)-$r,
61      &mil( 0)-$r, &mil(1030)+$r,
62      &mil(1340)+$r, &mil(1030)+$r,
63      &mil(1340)+$r, &mil( 640)-$r,
64      &mil( 440)+$r, &mil( 640)-$r,
65      &mil( 440)+$r, &mil( 390)-$r,
66      &mil( 410)+$r, &mil( 360)-$r,
67      &mil( 410)+$r, &mil( 310)+$r,
68      &mil( 440)+$r, &mil( 310)+$r,
69      &mil( 440)+$r, &mil( 250)-$r,
70      &mil( 380)+$r, &mil( 190)-$r,
71      &mil( 380)+$r, &mil( 0)-$r,
72      &mil( 0)-$r, &mil( 0)-$r);
73}
74
75
76$z = -0.8;
77# x: corner offset, compensation for rotation, array position
78# y: corner offet
79&orig(5+40*0, 5+30*0)
80&one(*same);
81&orig(5+40*0+15+&mil(1340), 5+30*0+&mil(1030));
82&one(*rot);

Archive Download the corresponding diff file



interactive