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= '';
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>) {
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 .= ' ';
}