Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
bca7b5f4
Commit
bca7b5f4
authored
Apr 25, 2008
by
klui_
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding pcb-dr-adjust: pcbnew Design Rules Adjustment tool for .brd files
parent
c6bc0d14
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6362 additions
and
0 deletions
+6362
-0
example.brd
scripts/pcb-dr-adjust/example.brd
+6181
-0
howto.txt
scripts/pcb-dr-adjust/howto.txt
+27
-0
pcb-dr-adjust.cfg
scripts/pcb-dr-adjust/pcb-dr-adjust.cfg
+7
-0
pcb-dr-adjust.pl
scripts/pcb-dr-adjust/pcb-dr-adjust.pl
+147
-0
No files found.
scripts/pcb-dr-adjust/example.brd
0 → 100644
View file @
bca7b5f4
This diff is collapsed.
Click to expand it.
scripts/pcb-dr-adjust/howto.txt
0 → 100644
View file @
bca7b5f4
Dr:: 0,400,400;
ShC:: 0,700,600,0,900,900
ShR:: 0,0,0,0,0,0
ShO:: 0,0,0,0,0,0
Vias:: 0,700,600,0,400,400
infile: example.brd
outfile: processed.brd
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
Replaces all drills (from...to] with 'result' value
b. Sh[C,R,O]:[|locked]: fromX,toX,resultX,fromY,toY,resultY; e.t.c.
C,R,O - different types of pads
locked/unlocked - process X and Y only if both checks match/independently
c. Vias:: the same as Shapes
d. infile: your_board_filename
e. outfile: your_out_filename
Should be not the same as infile now.
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"
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.
I will try to make this tool as good as time permit. Any contributions welcome!
Enjoy!
\ No newline at end of file
scripts/pcb-dr-adjust/pcb-dr-adjust.cfg
0 → 100644
View file @
bca7b5f4
Dr:: 0,400,400;
ShC:: 0,700,600,0,900,900
ShR:: 0,0,0,0,0,0
ShO:: 0,0,0,0,0,0
Vias:: 0,700,600,0,400,400
infile: example.brd
outfile: processed.brd
\ No newline at end of file
scripts/pcb-dr-adjust/pcb-dr-adjust.pl
0 → 100644
View file @
bca7b5f4
#!/usr/bin/perl -w
# version:0.01
# 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
# it gently AS-IS without any warranties.
# Dedicated to my daughter Jacy.
open
FH
,
"<pcb-dr-adjust.cfg"
||
die
"can't load configuration file pcb-dr-adjust.cfg\n"
;
$totalBins
=
0
;
print
"Type\tLocked\tBin\tXmin\tXmax\tXnew\tYmin\tYmax\tYnew\n"
;
#$prev=0;
#@bins=();
$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
{
"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
{
"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);
#< Po 3 72000 42500 72000 42500 450 450
#---
#> Po 3 72000 42500 72000 42500 620 450
while
(
<
FH
>
)
{
s!\s+$!!
;
$line
=
$_
;
if
(
$line
=~
s!.*(Dr)::\s*!!
)
{
$totalBins
=
3
;
$type
=
$1
;
$locked
=
"u"
;
# Dr cant be "locked"!
while
(
$line
=~
m!(\d+),(\d+),(\d+)!g
)
{
$inp
{
$type
}[
$totalBins
]
=
[
$1
,
$2
,
$3
,
0
,
0
,
0
];
$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"
;
$totalBins
++
;
}
$inp
{
$type
}[
2
]
=
$totalBins
-
1
;
$inp
{
$type
}[
1
]
=
$locked
;
}
if
(
$line
=~
s!.*(Sh.|Vias):(.?):\s*!!
)
{
$totalBins
=
3
;
$type
=
$1
;
if
(
defined
$2
)
{
$locked
=
$2
;};
if
(
$locked
=~
m!^\s*$!
)
{
$locked
=
"u"
;};
while
(
$line
=~
m!(\d+),(\d+),(\d+),(\d+),(\d+),(\d+)!g
)
{
$inp
{
$type
}[
1
]
=
$locked
;
$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"
;
$totalBins
++
;
}
$inp
{
$type
}[
2
]
=
$totalBins
-
1
;
$inp
{
$type
}[
1
]
=
$locked
;
}
if
(
$line
=~
s!infile:\s*(.+?)\s*$!!
)
{
$infile
=
$1
;
}
if
(
$line
=~
s!outfile:\s*(.+?)\s*$!!
)
{
$outfile
=
$1
;
}
}
#Sh "1" C 1600 1600 0 0 0
#Sh "1" R 550 550 0 0 900
#R/C/O
#Dr 1200 0 0
if
(
!
defined
$infile
)
{
$infile
=
"<example.brd"
;}
else
{
$infile
=
"<$infile"
;};
if
(
!
defined
$outfile
)
{
$outfile
=
">processed.brd"
;}
else
{
$outfile
=
">$outfile"
;};
open
FH
,
$infile
||
die
"can't read inputfile ==$infile==\n"
;
open
FHout
,
$outfile
||
die
"can't open outfile ==$outfile==\n"
;
while
(
<
FH
>
)
{
#print "before:$_|\n";
s!\s+$!!
;
#chomp();# chop();
$curline
=
$_
;
#print "after :$_|\n";
foreach
$key
(
sort
keys
%
inp
)
{
# print "proc key:$key\n";
if
(
$_
=~
$inp
{
$key
}[
0
])
{
# print "proc key:$key\n";
#Sh "6" C 550 550 0 0 900
#Sh "6" C ,550, ,550, 0 0 900
#Dr 320 0 0
#Dr ,320, ,0, 0
#$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
);
# print "inp{$key}=$inp{$key}[0]\n";
# print "$curline\n";
# print "$1,$2,$3,$4,$5\n";
#--------------------------------
#0 - regexp
#1 - locked
#2 - totalBins
#3=>[1,2,3,4,5,6] - bins
#4=>....
#5=>....
$index
=
3
;
$flagX
=
0
;
$flagY
=
0
;
$newX
=
0
;
$newY
=
0
;
# $curline = "bef:$pref,$curX,$space,$curY,$rest. locked=$inp{$key}[1], totalBins=$inp{$key}[2]\n";
# print $curline;
while
(
(
$index
<
$inp
{
$key
}[
2
]
+
1
)
)
{
if
((
$flagX
==
0
)
&&
(
$curX
>
$inp
{
$key
}[
$index
]
->
[
0
])
&&
(
$curX
<=
$inp
{
$key
}[
$index
]
->
[
1
])
)
{
$flagX
=
1
;
$newX
=
$inp
{
$key
}[
$index
]
->
[
2
];
if
(
$inp
{
$key
}[
1
]
=~
m!l!i
)
{
}
else
{
$curX
=
$newX
;};
}
if
((
$flagY
==
0
)
&&
(
$curY
>
$inp
{
$key
}[
$index
]
->
[
3
])
&&
(
$curY
<=
$inp
{
$key
}[
$index
]
->
[
4
])
)
{
$flagY
=
1
;
$newY
=
$inp
{
$key
}[
$index
]
->
[
5
];
if
(
$inp
{
$key
}[
1
]
=~
m!l!i
)
{
}
else
{
$curY
=
$newY
;};
}
if
((
$inp
{
$key
}[
1
]
=~
m!l!i
)
&&
(
$flagX
=~
m!1!
)
&&
(
$flagY
=~
m!1!
))
{
# This section means LOCKED = change together only
$curX
=
$newX
;
$curY
=
$newY
;
}
$index
++
;
}
#--------------------------------
# $curline = "aft:$pref,$curX,$space,$curY,$rest.\n";
# print $curline;
$curline
=
"$pref$curX$space$curY$rest"
;
}
}
print
FHout
"$curline\n"
;
}
#$local = "TR|PL|EX|TQ|TA|SN|BA|BS|DT|BH|GL";
#$pcode = qr/^\s*($local)\d\w?\s+\d[A-Z]{2}\s*$/;
#@vcheck = ("SN12 6QL","G3 7XR","GLZ 7PX"," OX11 0EY","NW1 1AD");
#foreach $tp (@vcheck) {
# $tp =~ $pcode and print "$1\n";
# }
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment