1
0
mirror of git://projects.qi-hardware.com/ben-blinkenlights.git synced 2024-12-28 20:31:08 +02:00
ben-blinkenlights/cam/pcb.pl
Werner Almesberger ceca128fbf Initial commit.
2010-09-01 04:02:24 -03:00

67 lines
1.1 KiB
Raku
Executable File

#!/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 cut
{
if (defined $x) {
if ($x == $_[0]+$x0 && $y == $_[1]+$y0) {
shift @_;
shift @_;
} else {
print "\n";
}
}
while (@_) {
$x = shift @_;
$y = shift @_;
($x, $y) = (-$y, $x);
$x += $x0;
$y += $y0;
print "$x $y $z\n";
}
}
sub one
{
&cut(
&mil( 0)-$r, &mil( 0)-$r,
&mil( 0)-$r, &mil(580)+$r,
&mil( 130)+$r, &mil(580)+$r,
&mil( 130)+$r, &mil(480)+$r,
&mil( 390)+$r, &mil(480)+$r,
&mil( 420)+$r, &mil(450)+$r,
&mil( 470)-$r, &mil(450)+$r,
&mil( 470)-$r, &mil(480)+$r,
&mil( 520)+$r, &mil(480)+$r,
&mil( 570)+$r, &mil(430)+$r,
&mil( 780)+$r, &mil(430)+$r,
&mil( 780)+$r, &mil( 50)-$r,
&mil( 130)+$r, &mil( 50)-$r,
&mil( 130)+$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+11+19.5*2, 5+26+1)
&one;