X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=pcb2panel;fp=pcb2panel;h=e517c013b68e9bbf5b17f8acb8738fd49c9af2f1;hb=5e63d78e2a095843e5c4784e792c9d15406e3ad7;hp=0000000000000000000000000000000000000000;hpb=6dd0294894b59603f743d6167461d16b114aeae7;p=hw%2Ftelemetrum diff --git a/pcb2panel b/pcb2panel new file mode 100644 index 0000000..e517c01 --- /dev/null +++ b/pcb2panel @@ -0,0 +1,70 @@ +#!/usr/bin/perl +# -*- perl -*- + +# Copyright 2006 DJ Delorie +# Released under the terms of the GNU General Public License, version 2 + +if (! @ARGV) { + print "Usage: pcb2panel board1.pcb board2.pcb board3.pcb > boards.pcb"; + print "Then edit boards.pcb, putting each outline where you want it\n"; + print "and sizing the board. Then:\n"; + print "panel2pcb boards.pcb\n"; + print "and edit/print boards.panel.pcb\n"; + exit 0; +} + +for $pcb (@ARGV) { + $base = $pcb; + $base =~ s@.*/@@; + $base =~ s@\.pcb$@@; + $base{$pcb} = $base; + push (@pcbs, $pcb); + open(PCB, $pcb); + while () { + if (/^PCB\["" (\d+) (\d+)\]/) { + $width{$pcb} = $1; + $height{$pcb} = $2; + break; + } + } + close PCB; +} + +$pw = 10000; +$ph = 0; +for $pcb (@pcbs) { + $pw += 10000; + $pw += $width{$pcb}; + $ph = $height{$pcb} if $ph < $height{$pcb}; +} +$ph += 20000; + +print "PCB[\"\" $pw $ph]\n"; +print "Grid[10000.0 0 0 1]\n"; +print "Groups(\"1,c:2,s\")\n"; + +$x = 10000; +$y = 10000; +for $pcb (@pcbs) { + $desc = $pcb; + $name = $base{$pcb}; + $value = "$width{$pcb} x $height{$pcb}"; + $w = $width{$pcb}; + $h = $height{$pcb}; + print "Element[\"\" \"$desc\" \"$name\" \"$value\" $x $y 2000 2000 0 50 \"\"] (\n"; + print " Pin[0 0 300 0 0 100 \"1\" \"1\" \"\"]\n"; + print " Pin[$w 0 300 0 0 100 \"2\" \"2\" \"\"]\n"; + print " ElementLine[0 0 $w 0 100]\n"; + print " ElementLine[0 0 0 $h 100]\n"; + print " ElementLine[$w 0 $w $h 100]\n"; + print " ElementLine[0 $h $w $h 100]\n"; + print ")\n"; + $x += $w + 10000; +} + +print "Layer(1 \"component\")()\n"; +print "Layer(2 \"solder\")()\n"; +print "Layer(3 \"silk\")()\n"; +print "Layer(4 \"silk\")()\n"; + +exit 0;