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

gEDA-user: simple panelizing script



Given an input board and the number horizontally and vertically you
want, this produces a panelized board.  For a board "foo.pcb" it
produces "foo.pcb.panel".  Not a lot of smarts here, but it
demonstrates the procedure, including fixing up the paste-point.
Note: make sure you have "unique refdes" OFF before panelizing!

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

$source = shift;
$xn = shift;
$yn = shift;

open(PS, ">$source.pscript");

open(S, $source);
open(O, ">$source.panel");
while (<S>) {
    if (/PCB\[.* (\d+) (\d+)\]/) {
	$width = $1;
	$height = $2;
	$w = $width * $xn;
	$h = $height * $yn;
	s/ (\d+) (\d+)\]/ $w $h\]/;
    }
    s/Cursor\[.*\]/Cursor[0 0 0.0]/;
    print O;
}
close O;
close S;

print PS "LoadFrom(Layout,$source.panel)\n";

print PS "LoadFrom(LayoutToBuffer,$source.panel)\n";

for ($x=0; $x<$xn; $x++) {
    $xp = $x * $width;
    for ($y=0; $y<$yn; $y++) {
	$yp = $y * $height;
	if ($x || $y) {
	    print PS "PasteBuffer(ToLayout,$xp,$yp)\n";
	}
    }
}

print PS "SaveTo(LayoutAs,$source.panel)\n";
print PS "Quit()\n";

close PS;

system "pcb --action-script $source.pscript";


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