Commit dd45a357 authored by f3nix's avatar f3nix

Set svn:eol-style native on new files.

parent bca7b5f4
This diff is collapsed.
Dr:: 0,400,400; Dr:: 0,400,400;
ShC:: 0,700,600,0,900,900 ShC:: 0,700,600,0,900,900
ShR:: 0,0,0,0,0,0 ShR:: 0,0,0,0,0,0
ShO:: 0,0,0,0,0,0 ShO:: 0,0,0,0,0,0
Vias:: 0,700,600,0,400,400 Vias:: 0,700,600,0,400,400
infile: example.brd infile: example.brd
outfile: processed.brd outfile: processed.brd
1. edit a copy of configuration file 'pcb-dr-adjust.cfg' in project folder 1. edit a copy of configuration file 'pcb-dr-adjust.cfg' in project folder
a. Dr:: from,to,result:from_2,to_2,result_2 a. Dr:: from,to,result:from_2,to_2,result_2
Replaces all drills (from...to] with 'result' value Replaces all drills (from...to] with 'result' value
b. Sh[C,R,O]:[|locked]: fromX,toX,resultX,fromY,toY,resultY; e.t.c. b. Sh[C,R,O]:[|locked]: fromX,toX,resultX,fromY,toY,resultY; e.t.c.
C,R,O - different types of pads C,R,O - different types of pads
locked/unlocked - process X and Y only if both checks match/independently locked/unlocked - process X and Y only if both checks match/independently
c. Vias:: the same as Shapes c. Vias:: the same as Shapes
d. infile: your_board_filename d. infile: your_board_filename
e. outfile: your_out_filename e. outfile: your_out_filename
Should be not the same as infile now. Should be not the same as infile now.
2. run pcb-dr-adjust.pl. Under Windows - download ActivePerl from http://activestate.com 2. run pcb-dr-adjust.pl. Under Windows - download ActivePerl from http://activestate.com
Undex *nix - chmod 755 pcb-dr-adjust.cfg, execute "./pcb-dr-adjust.pl" or "path-to-svn/scripts/pcb-dr-adjust/pcb-dr-adjust.pl" Undex *nix - chmod 755 pcb-dr-adjust.cfg, execute "./pcb-dr-adjust.pl" or "path-to-svn/scripts/pcb-dr-adjust/pcb-dr-adjust.pl"
3. take a look at outfile and rename it manually if correct. 3. take a look at outfile and rename it manually if correct.
P.S. Next release I will add "make install" to *nix,*win32 makefiles to install it to bin folder. P.S. Next release I will add "make install" to *nix,*win32 makefiles to install it to bin folder.
I will try to make this tool as good as time permit. Any contributions welcome! I will try to make this tool as good as time permit. Any contributions welcome!
Enjoy! Enjoy!
\ No newline at end of file
Dr:: 0,400,400; Dr:: 0,400,400;
ShC:: 0,700,600,0,900,900 ShC:: 0,700,600,0,900,900
ShR:: 0,0,0,0,0,0 ShR:: 0,0,0,0,0,0
ShO:: 0,0,0,0,0,0 ShO:: 0,0,0,0,0,0
Vias:: 0,700,600,0,400,400 Vias:: 0,700,600,0,400,400
infile: example.brd infile: example.brd
outfile: processed.brd outfile: processed.brd
\ No newline at end of file
#!/usr/bin/perl -w #!/usr/bin/perl -w
# version:0.01 # version:0.01
# Script is written by Vladimir Kalyaev. You can copy and modify it, but # Script is written by Vladimir Kalyaev. You can copy and modify it, but
# this header should remain unchanged if any part of code is taken. Use # this header should remain unchanged if any part of code is taken. Use
# it gently AS-IS without any warranties. # it gently AS-IS without any warranties.
# Dedicated to my daughter Jacy. # Dedicated to my daughter Jacy.
open FH, "<pcb-dr-adjust.cfg" || die "can't load configuration file pcb-dr-adjust.cfg\n"; open FH, "<pcb-dr-adjust.cfg" || die "can't load configuration file pcb-dr-adjust.cfg\n";
$totalBins=0; $totalBins=0;
print "Type\tLocked\tBin\tXmin\tXmax\tXnew\tYmin\tYmax\tYnew\n"; print "Type\tLocked\tBin\tXmin\tXmax\tXnew\tYmin\tYmax\tYnew\n";
#$prev=0; #$prev=0;
#@bins=(); #@bins=();
$inp{"Dr"}[0] = qr!^(Dr\s+)(\d+)(\s+)(\d+)(\s+.*)$!; $inp{"Dr"}[0] = qr!^(Dr\s+)(\d+)(\s+)(\d+)(\s+.*)$!;
$inp{"ShC"}[0] = qr!^(Sh\s+\"\d+\"\s+C\s+)(\d+)(\s+)(\d+)(\s+.*)$!; $inp{"ShC"}[0] = qr!^(Sh\s+\"\d+\"\s+C\s+)(\d+)(\s+)(\d+)(\s+.*)$!;
$inp{"ShR"}[0] = qr!^(Sh\s+\"\d+\"\s+R\s+)(\d+)(\s+)(\d+)(\s+.*)$!; $inp{"ShR"}[0] = qr!^(Sh\s+\"\d+\"\s+R\s+)(\d+)(\s+)(\d+)(\s+.*)$!;
$inp{"ShO"}[0] = qr!^(Sh\s+\"\d+\"\s+O\s+)(\d+)(\s+)(\d+)(\s+.*)$!; $inp{"ShO"}[0] = qr!^(Sh\s+\"\d+\"\s+O\s+)(\d+)(\s+)(\d+)(\s+.*)$!;
$inp{"Vias"}[0] = qr!^(Po\s+\d+\s+\d+\s+\d+\s+\d+\s+\d+\s+)(\d+)(\s+)(\d+)(.*)$!; $inp{"Vias"}[0] = qr!^(Po\s+\d+\s+\d+\s+\d+\s+\d+\s+\d+\s+)(\d+)(\s+)(\d+)(.*)$!;
#my ($pref,$curX,$space,$curY,$rest)=($1,$2,$3,$4,$5); #my ($pref,$curX,$space,$curY,$rest)=($1,$2,$3,$4,$5);
#< Po 3 72000 42500 72000 42500 450 450 #< Po 3 72000 42500 72000 42500 450 450
#--- #---
#> Po 3 72000 42500 72000 42500 620 450 #> Po 3 72000 42500 72000 42500 620 450
while (<FH>) while (<FH>)
{ {
s!\s+$!!; s!\s+$!!;
$line=$_; $line=$_;
if ($line=~s!.*(Dr)::\s*!!) if ($line=~s!.*(Dr)::\s*!!)
{ {
$totalBins=3; $type=$1; $locked="u"; # Dr cant be "locked"! $totalBins=3; $type=$1; $locked="u"; # Dr cant be "locked"!
while ($line=~m!(\d+),(\d+),(\d+)!g) while ($line=~m!(\d+),(\d+),(\d+)!g)
{ {
$inp{$type}[$totalBins]=[$1, $2, $3, 0, 0, 0]; $inp{$type}[$totalBins]=[$1, $2, $3, 0, 0, 0];
$inp{$type}[1]=$locked; $inp{$type}[1]=$locked;
print "$type\t$inp{$type}[1]\t$totalBins\t$inp{$type}[$totalBins]->[0]\t$inp{$type}[$totalBins]->[1]\t$inp{$type}[$totalBins]->[2]\n"; print "$type\t$inp{$type}[1]\t$totalBins\t$inp{$type}[$totalBins]->[0]\t$inp{$type}[$totalBins]->[1]\t$inp{$type}[$totalBins]->[2]\n";
$totalBins++; $totalBins++;
} }
$inp{$type}[2]=$totalBins-1; $inp{$type}[1]=$locked; $inp{$type}[2]=$totalBins-1; $inp{$type}[1]=$locked;
} }
if ($line =~s!.*(Sh.|Vias):(.?):\s*!!) if ($line =~s!.*(Sh.|Vias):(.?):\s*!!)
{ {
$totalBins=3; $type=$1; $totalBins=3; $type=$1;
if (defined $2) {$locked = $2;}; if (defined $2) {$locked = $2;};
if ($locked =~ m!^\s*$!) {$locked="u";}; if ($locked =~ m!^\s*$!) {$locked="u";};
while ($line=~m!(\d+),(\d+),(\d+),(\d+),(\d+),(\d+)!g) while ($line=~m!(\d+),(\d+),(\d+),(\d+),(\d+),(\d+)!g)
{ {
$inp{$type}[1]=$locked; $inp{$type}[1]=$locked;
$inp{$type}[$totalBins]=[$1, $2, $3, $4, $5, $6]; $inp{$type}[$totalBins]=[$1, $2, $3, $4, $5, $6];
print "$type\t$inp{$type}[1]\t$totalBins\t$inp{$type}[$totalBins]->[0]\t$inp{$type}[$totalBins]->[1]\t$inp{$type}[$totalBins]->[2]\t$inp{$type}[$totalBins]->[3]\t$inp{$type}[$totalBins]->[4]\t$inp{$type}[$totalBins]->[5]\n"; print "$type\t$inp{$type}[1]\t$totalBins\t$inp{$type}[$totalBins]->[0]\t$inp{$type}[$totalBins]->[1]\t$inp{$type}[$totalBins]->[2]\t$inp{$type}[$totalBins]->[3]\t$inp{$type}[$totalBins]->[4]\t$inp{$type}[$totalBins]->[5]\n";
$totalBins++; $totalBins++;
} }
$inp{$type}[2]=$totalBins-1; $inp{$type}[1]=$locked; $inp{$type}[2]=$totalBins-1; $inp{$type}[1]=$locked;
} }
if ($line =~ s!infile:\s*(.+?)\s*$!!) if ($line =~ s!infile:\s*(.+?)\s*$!!)
{ {
$infile=$1; $infile=$1;
} }
if ($line =~ s!outfile:\s*(.+?)\s*$!!) if ($line =~ s!outfile:\s*(.+?)\s*$!!)
{ {
$outfile=$1; $outfile=$1;
} }
} }
#Sh "1" C 1600 1600 0 0 0 #Sh "1" C 1600 1600 0 0 0
#Sh "1" R 550 550 0 0 900 #Sh "1" R 550 550 0 0 900
#R/C/O #R/C/O
#Dr 1200 0 0 #Dr 1200 0 0
if (!defined $infile) { $infile = "<example.brd";} else {$infile="<$infile";}; if (!defined $infile) { $infile = "<example.brd";} else {$infile="<$infile";};
if (!defined $outfile) { $outfile = ">processed.brd";} else {$outfile=">$outfile";}; if (!defined $outfile) { $outfile = ">processed.brd";} else {$outfile=">$outfile";};
open FH, $infile || die "can't read inputfile ==$infile==\n"; open FH, $infile || die "can't read inputfile ==$infile==\n";
open FHout, $outfile || die "can't open outfile ==$outfile==\n"; open FHout, $outfile || die "can't open outfile ==$outfile==\n";
while (<FH>) while (<FH>)
{ {
#print "before:$_|\n"; #print "before:$_|\n";
s!\s+$!!; s!\s+$!!;
#chomp();# chop(); #chomp();# chop();
$curline=$_; $curline=$_;
#print "after :$_|\n"; #print "after :$_|\n";
foreach $key (sort keys %inp) foreach $key (sort keys %inp)
{ {
# print "proc key:$key\n"; # print "proc key:$key\n";
if ($_ =~ $inp{$key}[0]) if ($_ =~ $inp{$key}[0])
{ {
# print "proc key:$key\n"; # print "proc key:$key\n";
#Sh "6" C 550 550 0 0 900 #Sh "6" C 550 550 0 0 900
#Sh "6" C ,550, ,550, 0 0 900 #Sh "6" C ,550, ,550, 0 0 900
#Dr 320 0 0 #Dr 320 0 0
#Dr ,320, ,0, 0 #Dr ,320, ,0, 0
#$inp{"ShC"}[0] = qr!^(Sh\s+\"\d+\"\s+C\s+)(\d+)(\s+)(\d+)(\s+.*)$!; #$inp{"ShC"}[0] = qr!^(Sh\s+\"\d+\"\s+C\s+)(\d+)(\s+)(\d+)(\s+.*)$!;
my ($pref,$curX,$space,$curY,$rest)=($1,$2,$3,$4,$5); my ($pref,$curX,$space,$curY,$rest)=($1,$2,$3,$4,$5);
# print "inp{$key}=$inp{$key}[0]\n"; # print "inp{$key}=$inp{$key}[0]\n";
# print "$curline\n"; # print "$curline\n";
# print "$1,$2,$3,$4,$5\n"; # print "$1,$2,$3,$4,$5\n";
#-------------------------------- #--------------------------------
#0 - regexp #0 - regexp
#1 - locked #1 - locked
#2 - totalBins #2 - totalBins
#3=>[1,2,3,4,5,6] - bins #3=>[1,2,3,4,5,6] - bins
#4=>.... #4=>....
#5=>.... #5=>....
$index=3; $index=3;
$flagX=0; $flagY=0; $flagX=0; $flagY=0;
$newX =0; $newY =0; $newX =0; $newY =0;
# $curline = "bef:$pref,$curX,$space,$curY,$rest. locked=$inp{$key}[1], totalBins=$inp{$key}[2]\n"; # $curline = "bef:$pref,$curX,$space,$curY,$rest. locked=$inp{$key}[1], totalBins=$inp{$key}[2]\n";
# print $curline; # print $curline;
while ( ($index < $inp{$key}[2]+1) ) while ( ($index < $inp{$key}[2]+1) )
{ {
if (($flagX == 0) && ($curX > $inp{$key}[$index]->[0]) && ($curX <= $inp{$key}[$index]->[1]) ) if (($flagX == 0) && ($curX > $inp{$key}[$index]->[0]) && ($curX <= $inp{$key}[$index]->[1]) )
{ {
$flagX=1; $newX=$inp{$key}[$index]->[2]; $flagX=1; $newX=$inp{$key}[$index]->[2];
if ($inp{$key}[1] =~ m!l!i) { } else {$curX=$newX;}; if ($inp{$key}[1] =~ m!l!i) { } else {$curX=$newX;};
} }
if (($flagY == 0) && ($curY > $inp{$key}[$index]->[3]) && ($curY <= $inp{$key}[$index]->[4]) ) if (($flagY == 0) && ($curY > $inp{$key}[$index]->[3]) && ($curY <= $inp{$key}[$index]->[4]) )
{ {
$flagY=1; $newY=$inp{$key}[$index]->[5]; $flagY=1; $newY=$inp{$key}[$index]->[5];
if ($inp{$key}[1] =~ m!l!i) { } else {$curY=$newY;}; if ($inp{$key}[1] =~ m!l!i) { } else {$curY=$newY;};
} }
if (($inp{$key}[1] =~ m!l!i) && ($flagX =~ m!1!) && ($flagY =~ m!1!)) if (($inp{$key}[1] =~ m!l!i) && ($flagX =~ m!1!) && ($flagY =~ m!1!))
{ {
# This section means LOCKED = change together only # This section means LOCKED = change together only
$curX=$newX; $curX=$newX;
$curY=$newY; $curY=$newY;
} }
$index ++; $index ++;
} }
#-------------------------------- #--------------------------------
# $curline = "aft:$pref,$curX,$space,$curY,$rest.\n"; # $curline = "aft:$pref,$curX,$space,$curY,$rest.\n";
# print $curline; # print $curline;
$curline = "$pref$curX$space$curY$rest"; $curline = "$pref$curX$space$curY$rest";
} }
} }
print FHout "$curline\n"; print FHout "$curline\n";
} }
#$local = "TR|PL|EX|TQ|TA|SN|BA|BS|DT|BH|GL"; #$local = "TR|PL|EX|TQ|TA|SN|BA|BS|DT|BH|GL";
#$pcode = qr/^\s*($local)\d\w?\s+\d[A-Z]{2}\s*$/; #$pcode = qr/^\s*($local)\d\w?\s+\d[A-Z]{2}\s*$/;
#@vcheck = ("SN12 6QL","G3 7XR","GLZ 7PX"," OX11 0EY","NW1 1AD"); #@vcheck = ("SN12 6QL","G3 7XR","GLZ 7PX"," OX11 0EY","NW1 1AD");
#foreach $tp (@vcheck) { #foreach $tp (@vcheck) {
# $tp =~ $pcode and print "$1\n"; # $tp =~ $pcode and print "$1\n";
# } # }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment