[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: autogenerate footprints



> Yeah, great idea... is there any standard Perl Script under svn that
> most people use?

I have some perl scripts on gedasymbols you can copy routines out of.
There isn't a "standard perl script" because that's not why people use
perl - each script is custom.  At best, you might be able to cobble
together a useful set of library functions which you'd call from perl.

Here's an example of a custom perl script to generate footprints.  It
builds a quad flat pack style footprint.  There isn't much in here
that's reusable, but you can see that it's easy to tweak it to change
the generated footprint.

#!/usr/bin/perl
# -*- perl -*-

$e = 0.50;
$vpins = 25;
$hpins = 25;
$b2 = 0.225;
$i2 = 0.9 + 0.4;
$out = 1.2;

$pin = 1;
$vy = ($vpins-1) * $e;
$hx = ($hpins-1) * $e;

print "Element[\"\" \"TQFP-$vpinsx$hpins-$e\" \"\" \"\" 0 0 0 0 0 100 \"\"] (\n";

for ($i=0; $i<$vpins; $i++) {
    &pad(0, $e * $i, -1, 0);
    $pin ++;
}

for ($i=0; $i<$hpins; $i++) {
    &pad($e * $i, $vy, 0, 1);
    $pin ++;
}

for ($i=0; $i<$hpins; $i++) {
    &pad($hx, $vy - $e * $i, 1, 0);
    $pin ++;
}

for ($i=0; $i<$hpins; $i++) {
    &pad($hx - $e * $i, 0, 0, -1);
    $pin ++;
}

sub pad {
    my ($x, $y, $dx, $dy) = @_;
    $x += $dx * ($out + $b2/2);
    $y += $dy * ($out + $b2/2);
    $x2 = $x + $dx * ($i2 - $b2);
    $y2 = $y + $dy * ($i2 - $b2);

    printf("\tPad[%d %d %d %d %d %d %d \"%s\" \"%s\" \"square\"]\n",
	   &m($x), &m($y), &m($x2), &m($y2),
	   &m($b2), &m($e*0.51-$b2), &m(($e+2*$b2)/3),
	   $pin, $pin);
}

sub m {
    my ($mm) = @_;
    return int($mm / 0.000254);
}

print ")\n";



_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user