1
0
mirror of git://projects.qi-hardware.com/f32xbase.git synced 2024-11-16 22:27:12 +02:00
f32xbase/c2ben/cam/pcb.pl

76 lines
1.2 KiB
Raku
Executable File

#!/usr/bin/perl
$d = 25.4/1000*35;
$r = $d/2-0.1; # compensate deflection of board
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 card
{
&cut(
&mil( 0)-$r, &mil( 0)-$r,
&mil( 0)-$r, &mil( 570)+$r,
&mil( 30)-$r, &mil( 600)+$r,
&mil( 30)-$r, &mil( 650)-$r,
&mil( 0)-$r, &mil( 650)-$r,
&mil( 0)-$r, &mil( 705)+$r,
&mil( 55)-$r, &mil( 760)+$r,
&mil( 55)-$r, &mil( 960)+$r,
&mil( 435)+$r, &mil( 960)+$r,
&mil( 435)+$r, &mil( 0)-$r,
&mil( 0)-$r, &mil( 0)-$r);
}
sub conn
{
&cut(
&mil( 0)-$r, &mil( 0)-$r,
&mil( 0)-$r, &mil( 505)+$r,
&mil( 450)+$r, &mil( 505)+$r,
&mil( 450)+$r, &mil( 0)-$r,
&mil( 0)-$r, &mil( 0)-$r);
}
$z = -0.8; # full thickness of board
# x: corner offset, compensation for rotation, array position
# y: corner offet
&orig(13*4, 0)
&card;
&orig($x0, $y0+26)
&conn;