Date:2011-01-06 03:12:35 (13 years 2 months ago)
Author:Werner Almesberger
Commit:6ccb252729d297e149f36e159134c12ceb2bd219
Message:atusd/cam: updated to use cameo

- cam/pcb.pl, cam/doit: deleted
- cam/mkmk: CAM translation and conversion process
Files: atusd/cam/doit (1 diff)
atusd/cam/mkmk (1 diff)
atusd/cam/pcb.pl (1 diff)

Change Details

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 2 0.2 0.2
22    # clearance, xy speed, z speed
atusd/cam/mkmk
1#!/bin/sh -e
2PATH=$PATH:/home/qi/cae-tools/cameo
3PATH=$PATH:/home/moko/svn.openmoko.org/developers/werner/cncmap/gp2rml
4
5cameo <<EOF
6mm
7
8gerber 35mil ../atusd-PCB_Edges.gbr
9align 1 4.6mm 9.0mm # align relative to board corner
10translate 3mm 3mm # move to PCB zone assigned to project
11array +2.5mm +2.5mm 0 0
12z 0 -58.9mm # board surface (tool fully retracted)
13z 1.5mm # slack for extending the tool
14z -0.8mm # board thickness
15z -0.5mm # tool extra depth
16clear
17
18excellon ../atusd.drl
19drill 7mil 15mil # 12.5-13.5 mil drill
20optimize
21write drill.gp
22
23remainder
24mill 20mil 0.01mm # 35 mil endmill; pretend it is a little smaller,
25            # to compensate for tool/board deflections
26write mill.gp
27
28remainder
29empty
30
31gerber 20mil ../atusd-PCB_Edges.gbr # 35 mil endmill, 15 mil deflection
32offset
33append mill.gp
34EOF
35
36
37gp2rml 2 0.5 0.5 mill.gp >mill.rml
38gp2rml 2 0.1 0.5 drill.gp >drill.rml
39
40
41cat <<EOF >Makefile.mkmk
42SPOOL=/home/moko/svn.openmoko.org/developers/werner/cncmap/spool/spool
43CNGT=/home/qi/cae-tools/cngt/cngt
44
45.PHONY: mill drill cng plot dplot
46
47mill:
48        PORT=/dev/ttyUSB0 \$(SPOOL) mill.rml
49
50drill:
51        PORT=/dev/ttyUSB0 \$(SPOOL) drill.rml
52
53cng:
54        \$(CNGT) -57.4 20 mill.gp
55
56plot:
57        echo 'plot "drill.gp" with points, "mill.gp" with lines' | \\
58          gnuplot -persist
59
60dplot:
61        echo 'plot "< sed /^\$\$/d drill.gp" with linespoints' | \\
62          gnuplot -persist
63
64clean::
65        rm -f mill.gp mill.rml drill.gp drill.rml
66EOF
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
36    shift @_;
37    if (defined $x) {
38    if ($x == $_[0]+$x0 && $y == $_[1]+$y0) {
39        shift @_;
40        shift @_;
41    } else {
42        print "\n";
43    }
44    }
45    while (@_) {
46    $x = shift @_;
47    $y = shift @_;
48    ($x, $y) = &fn($x, $y);
49    $x += $x0;
50    $y += $y0;
51    print "$x $y $z\n";
52    }
53}
54
55
56sub one
57{
58    local ($fn) = @_;
59
60    &cut($fn,
61      &mil( 0)-$r, &mil( 0)-$r,
62      &mil( 0)-$r, &mil(1010)+$r,
63      &mil(1400)+$r, &mil(1010)+$r,
64      &mil(1400)+$r, &mil( 640)-$r,
65      &mil( 440)+$r, &mil( 640)-$r,
66      &mil( 440)+$r, &mil( 390)-$r,
67      &mil( 410)+$r, &mil( 360)-$r,
68      &mil( 410)+$r, &mil( 310)+$r,
69      &mil( 440)+$r, &mil( 310)+$r,
70      &mil( 440)+$r, &mil( 250)-$r,
71      &mil( 380)+$r, &mil( 190)-$r,
72      &mil( 380)+$r, &mil( 0)-$r,
73      &mil( 0)-$r, &mil( 0)-$r);
74}
75
76
77$z = -0.8;
78$col = 1;
79$row = 1;
80# x: corner offset, compensation for rotation, array position
81# y: corner offet
82&orig(5+53.5*$col, 5+33*$row)
83&one(*same);
84&orig(5+53.5*$col+15+&mil(1400), 5+33*$row+&mil(1010));
85&one(*rot);

Archive Download the corresponding diff file



interactive