Root/atusd/cam/pcb.pl

Source at commit 93f0f403a78b9f3451bbbb8707dbbb36007a1612 created 9 years 9 months ago.
By Werner Almesberger, New atusd errata and a few small CAM updates.
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(1030)+$r,
63      &mil(1340)+$r, &mil(1030)+$r,
64      &mil(1340)+$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 = 0;
79$row = 1;
80# x: corner offset, compensation for rotation, array position
81# y: corner offet
82&orig(5+54*$col, 5+33*$row)
83&one(*same);
84&orig(5+54*$col+15+&mil(1340), 5+33*$row+&mil(1030));
85&one(*rot);
86

Archive Download this file



interactive