4 # Copyright 2006 DJ Delorie <dj@delorie.com>
5 # Released under the terms of the GNU General Public License, version 2
14 require "$mydir/panel.pl";
17 print "Usage: pcb2panel board1.pcb board2.pcb board3.pcb > boards.pcb\n";
18 print "Then edit boards.pcb, putting each outline where you want it\n";
19 print "and sizing the board. Then:\n";
20 print "panel2pcb boards.pcb\n";
21 print "and edit/print boards.panel.pcb\n";
33 if (/^PCB\[".*" (\S+) (\S+)\]/) {
34 $width{$pcb} = &parseval($1);
35 $height{$pcb} = &parseval($2);
36 printf STDERR "%s : %d x %d\n", $pcb, $width{$pcb}, $height{$pcb};
42 if (/Layer\(.*"outline"\)/) {
43 $junk = <PCB>; # open paren
45 last if /^\)/; # close paren
46 ($args) = m@\[(.*)\]@;
47 ($x1, $y1, $x2, $y2, $width) = split(' ', $args);
48 $outline .= " ElementLine[$x1 $y1 $x2 $y2 $width]\n";
52 push (@outlines, $outline);
61 $ph = $height{$pcb} if $ph < $height{$pcb};
65 print "PCB[\"\" $pw $ph]\n";
66 print "Grid[10000.0 0 0 1]\n";
67 print "DRC[799 799 800 100 1500 800]\n";
68 print "Groups(\"1,c:2,s\")\n"; #"
72 for ($i=0; $i<@pcbs; $i++) {
74 $outline = $outlines[$i];
77 $value = "$width{$pcb} x $height{$pcb}";
81 print "Element[\"\" \"$desc\" \"$name\" \"$value\" $x $y 2000 2000 0 50 \"\"] (\n";
82 print " Pin[0 0 1000 0 0 400 \"1\" \"1\" \"\"]\n";
83 print " Pin[$w 0 1000 0 0 400 \"2\" \"2\" \"\"]\n";
84 if ($outline =~ /\S/) {
87 print " ElementLine[0 0 $w 0 100]\n";
88 print " ElementLine[0 0 0 $h 100]\n";
89 print " ElementLine[$w 0 $w $h 100]\n";
90 print " ElementLine[0 $h $w $h 100]\n";
96 print "Layer(1 \"component\")()\n";
97 print "Layer(2 \"solder\")()\n";
98 print "Layer(3 \"silk\")()\n";
99 print "Layer(4 \"silk\")()\n";