chiark / gitweb /
show cutlines
authorian <ian>
Tue, 7 Sep 2004 23:16:22 +0000 (23:16 +0000)
committerian <ian>
Tue, 7 Sep 2004 23:16:22 +0000 (23:16 +0000)
pcb/pcb-panelise

index 6a3bde375238d7b6fc96d71366409a521e06c9e0..128906364b0e59fb9ee29008425967357bf0958b 100755 (executable)
@@ -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 .= ' ';
 }