Root/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 cut
21{
22    if (defined $x) {
23    if ($x == $_[0]+$x0 && $y == $_[1]+$y0) {
24        shift @_;
25        shift @_;
26    } else {
27        print "\n";
28    }
29    }
30    while (@_) {
31    $x = shift @_;
32    $y = shift @_;
33    ($x, $y) = (-$y, $x);
34    $x += $x0;
35    $y += $y0;
36    print "$x $y $z\n";
37    }
38}
39
40
41sub one
42{
43    &cut(
44      &mil( 0)-$r, &mil( 0)-$r,
45      &mil( 0)-$r, &mil(580)+$r,
46      &mil( 130)+$r, &mil(580)+$r,
47      &mil( 130)+$r, &mil(480)+$r,
48      &mil( 390)+$r, &mil(480)+$r,
49      &mil( 420)+$r, &mil(450)+$r,
50      &mil( 470)-$r, &mil(450)+$r,
51      &mil( 470)-$r, &mil(480)+$r,
52      &mil( 520)+$r, &mil(480)+$r,
53      &mil( 570)+$r, &mil(430)+$r,
54      &mil( 780)+$r, &mil(430)+$r,
55      &mil( 780)+$r, &mil( 50)-$r,
56      &mil( 130)+$r, &mil( 50)-$r,
57      &mil( 130)+$r, &mil( 0)-$r,
58      &mil( 0)-$r, &mil( 0)-$r);
59}
60
61
62$z = -0.8;
63# x: corner offset, compensation for rotation, array position
64# y: corner offet
65&orig(5+11+19.5*2, 5+26+1)
66&one;
67

Archive Download this file

Branches:
master



interactive