forked from cmonr/Eagle-ULPs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathswap.ulp
63 lines (55 loc) · 1.32 KB
/
swap.ulp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
* swap.ulp
* Jan 2013 , By Cruz Monrreal II ([email protected])
*
* Swaps part names.
*
*/
#usage "<b>Swap Part Names</b>\n"
"<p>Usage: run swap A B"
"<p><p><b>Example:</b>"
"<p>run swap R2 R14"
"<p>This will swap parts R2 and R14 with eachother"
"<p><p>"
"<small><table>"
"<tr><td><i>Cruz Monrreal</i></td></tr>"
"<tr><td><i>[email protected]</i></td></tr>"
"<tr><td><i>http://www.innovativemaker.com</i></td></tr>"
"</table></small>"
string cmd = "";
string A = "";
string B = "";
output("swapnames.log", "wt")
{
if (schematic){
schematic(S) {
S.parts(P){
if (P.name == argv[1]){
A = argv[1];
}
if (P.name == argv[2]){
B = argv[2];
}
}
}
}else if (library){
library(L) {
L.packages(P){
P.contacts(C){
if (C.name == argv[1]){
A = argv[1];
}
if (C.name == argv[2]){
B = argv[2];
}
}
}
}
}
if (A != "" && B != ""){
cmd += "name " + A + " _tmp_; ";
cmd += "name " + B + " " + A + "; ";
cmd += "name _tmp_ " + B + "; ";
}
exit(cmd);
}