[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: Silkscreen Logo



> Looks like that program just reads in a PBM, inverts all the pixels,
> and writes it back out as a PBM.  I'm not seeing anything that
> translates to PCB file format.  Did you post the right program?

You're right, wrong program.  This one uses square vias with
zero-sized holes, probably could be converted to spit out an Element
with pads instead.

#!/usr/bin/perl
# -*- perl -*-

open(PGM, $ARGV[0]);
$sig = <PGM>;

if ($sig !~ /P5/) {
    print "not P5\n";
    exit (1);
}
$sig = <PGM>;
$l = <PGM>;
($w,$h) = split(' ', $l);
$l = <PGM>;
($max) = split(' ', $l);

print STDERR "w $w h $h max $max\n";

printf "PCB[\"\" %d %d]\n", $w * 2500, $h * 2500;

print '
Grid[10.00000000 0 0 0]
Cursor[118793 106348 3.000000]
Thermal[0.500000]
DRC[699 400 800 800]
Flags(0x0000000000000040)
Groups("1,s:2,c:3:4:5:6:7:8")
Styles["Signal,1000,3600,2000,1000:Power,2500,6000,3500,1000:Fat,4000,6000,3500,1000:Skinny,600,2402,1181,600"]
';

for ($y=0; $y<$h; $y++) {
    for ($x=0; $x<$w; $x++) {
	$r = read(PGM, $byte, 1);
	$byte = ord($byte);
	if ($byte) {
	    $diam = 2500 * (255-$byte) / $max;
	    printf("Via[%d %d %d 0 0 1 \"\" 0x00000102]\n",
		   $x * 2500, $y * 2500, $diam);
	}
    }
}

print while <DATA>;

__END__;
Layer(1 "component")
(
)
Layer(2 "solder")
(
)
Layer(3 "GND")
(
)
Layer(4 "power")
(
)
Layer(5 "signal1")
(
)
Layer(6 "signal2")
(
)
Layer(7 "unused")
(
)
Layer(8 "unused")
(
)
Layer(9 "silk")
(
)
Layer(10 "silk")
(
)



_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user