From: ian Date: Tue, 7 Sep 2004 23:16:22 +0000 (+0000) Subject: show cutlines X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=60152efda507e9655b7e8eeb559f27d8bd4ace13;p=trains.git show cutlines --- diff --git a/pcb/pcb-panelise b/pcb/pcb-panelise index 6a3bde3..1289063 100755 --- a/pcb/pcb-panelise +++ b/pcb/pcb-panelise @@ -8,12 +8,15 @@ our ($line,$indent,$command,$lbrack,$argstring,$rbrack); our (@a, $output_file, $accumulate); our ($xpos,$ypos,$spaces,@titles); -our ($xmax,$ymax,$gap); +our ($xmax,$ymax,$gap,$cutlinewidth); sub init () { $xpos=$ypos=0; $xmax=0,$ymax=0; - $gap=500; + + # 100s of thou like in PCB + $gap=20000; + $cutlinewidth=800; $spaces= ''; $output_file= ''; @@ -25,6 +28,12 @@ sub process () { my ($q,$z); @stack= (); foreach $filename (@ARGV) { + if ($filename =~ m/^\-g(\d+)$/) { + $gap= $1 * 100; + next; + } elsif ($filename =~ m/^\-/) { + die "$filename ?"; + } $f = new IO::File $filename, 'r' or die $filename; &beginfile__; while (<$f>) { @@ -135,24 +144,33 @@ sub define_identical_end () { undef $accumulate; } -our (@thiscoords); +our (@thisextent); our ($netlist_aside,$netlist_data); our ($layer,$layer_aside,%layer_name,%layer_data); +sub horizline ($) { + my ($y) = @_; + $layer_data{10} .= "\tLine[". + "$xpos $y $thisextent[0] $y $cutlinewidth 0 0x00000020". + "]\n"; +} + sub beginfile__ { - @thiscoords= (); + @thisextent= (); } sub op__PCB { $a[0] =~ m/^"(.+)"$/ or die; push @titles, $1; - die if @thiscoords; - @thiscoords= @a[1..2]; - transform(0,@thiscoords); - $xmax= $xpos + $thiscoords[0] if $xpos + $thiscoords[0] > $xmax; - $ymax= $thiscoords[1] if $thiscoords[1] > $ymax; + die if @thisextent; + @thisextent= @a[1..2]; + transform(0,@thisextent); + $xmax= $xpos + $thisextent[0] if $xpos + $thisextent[0] > $xmax; + $ymax= $thisextent[1] if $thisextent[1] > $ymax; + if (length $spaces) { horizline($ypos); } } sub endfile__ { - $ypos= $thiscoords[1] + $gap; + if (@ARGV) { horizline($thisextent[1]); } + $ypos= $thisextent[1] + $gap; $spaces .= ' '; }