4 # Copyright 2006 DJ Delorie <dj@delorie.com>
5 # Released under the terms of the GNU General Public License, version 2
8 print "Usage: pcb2panel board1.pcb board2.pcb board3.pcb > boards.pcb";
9 print "Then edit boards.pcb, putting each outline where you want it\n";
10 print "and sizing the board. Then:\n";
11 print "panel2pcb [-l regex] boards.pcb\n";
12 print "and edit/print boards.panel.pcb\n";
23 require "$mydir/panel.pl";
28 $panelcopperlayers = shift;
34 if (/PCB\[.* (\S+) (\S+)\]/) {
35 $panel_width = &parseval($1);
36 $panel_height = &parseval($2);
38 if (/Element\[\"[^\"]*\" \"([^\"]*)\" \"([^\"]*)\" \"([^\"]*)\" (\S+) (\S+)/) {
47 if (/Pin\[(\S+) (\S+) \S+ \S+ \S+ \S+ \"(\d)\"/) {
48 $pinx{$3} = &parseval($1);
49 $piny{$3} = &parseval($2);
52 if ($pinx{'1'} < $pinx{'2'}) {
54 } elsif ($pinx{'1'} > $pinx{'2'}) {
56 } elsif ($piny{'1'} < $piny{'2'}) {
58 } elsif ($piny{'1'} > $piny{'2'}) {
61 push (@paste, "$pcb\0$rot\0$mx\0$my");
65 push (@panelvias, $_);
67 if (/^Layer\([^)]*\)$/) {
68 $junk = <P>; # The opening '('
70 last if $junk =~ /^\)/;
71 push (@panelcopper, $junk);
76 $tmp = "/tmp/panel$$.pcb";
82 &baseboard($start, $panel_width, $panel_height, $panel);
85 for $paste (sort @paste) {
86 ($pcb, $rot, $mx, $my) = split(/\0/, $paste);
87 if ($lastboard ne $pcb) {
92 while ($lastrot != $rot) {
93 print PS "PasteBuffer(Rotate,1)\n";
94 $lastrot = ($lastrot+1) % 4;
96 print PS "PasteBuffer(ToLayout,$mx,$my)\n";