4 # Copyright 2006 DJ Delorie <dj@delorie.com>
5 # Released under the terms of the GNU General Public License, version 2
8 my ($file, $width, $height, $nbase) = @_;
16 $panelcopperlayers = ".*" unless $panelcopperlayers;
18 $pscript = "$base.pscript";
19 open(PS, ">$pscript");
20 push(@files_to_remove, "$base.pscript");
22 open(S, $file) || die("$file: $!");
23 $outname = "$base.panel.pcb";
24 $outname =~ s/pnl\.panel\.pcb/pcb/;
27 if (/PCB\[.* (\S+) (\S+)\]/) {
28 s/ (\S+) (\S+)\]/ $width $height\]/;
30 s/Cursor\[.*\]/Cursor[0 0 0.0]/;
36 next if /\b(Via|Pin|Pad|ElementLine|Line|Arc|ElementArc|Text)/;
37 if (/Polygon|Element/) {
41 last if /^\s*\)\s*$/ && $hole <= 0;
53 if (/Layer\((\d+) \"(.*)\"\)/) {
57 print STDERR "layer $lnum $lname vs '$panelcopperlayers'\n";
58 if ($lnum =~ /$panelcopperlayers/ || $lname =~ /$panelcopperlayers/) {
66 print PS "LoadFrom(Layout,$outname)\n";
76 open(O, ">temp-panel.$seq");
78 if (/PCB\[.* (\S+) (\S+)\]/) {
79 $width = &parseval($1);
80 $height = &parseval($2);
82 s/Cursor\[.*\]/Cursor[0 0 0.0]/;
87 print PS "LoadFrom(LayoutToBuffer,temp-panel.$seq)\n";
88 push(@files_to_remove, "temp-panel.$seq");
94 print PS "PasteBuffer(ToLayout,$ox,$oy)\n";
100 print PS "PasteBuffer(ToLayout,$vx,$vy)\n";
105 print PS "SaveTo(LayoutAs,$outname)\n";
110 system "set -x; pcb --action-script $pscript";
111 #system "pcb -x ps $base.panel.pcb";
112 #unlink @files_to_remove;
121 $v *= 3937.007874015748;