-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathtoglays.ulp
49 lines (39 loc) · 1003 Bytes
/
toglays.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
#usage "<qt><b>togmlays.ulp layernum layernum ... "
"<p>Toggle visibility of the specified layers"
"<p>"
"<author>Author: Paul Badger modded for multiple args by Bill Westfield westfw@assorted</author></qt>"
int mylayer;
string foo="";
string buff="";
string nfoo="";
string buf;
void display (string s) {
dlgMessageBox(s);
return;
}
if (argc < 2) { /* Should be ulp + arg */
sprintf(foo, "no layer %d found", argc);
display(foo);
exit("");
}
for (int i = 1; i <= (argc); i++){
mylayer = strtod(argv[i]);
if (board) board(B) {
B.layers(L) {
if (L.number == mylayer) {
if (L.visible) {
// I'm using layer numbers here instead of names because of bizzare eagle bug
// "Display Top;" on my machine stopped working, but layer numbers still work fine.
sprintf(buff, "%d", mylayer);
foo = foo + "display -" + buff + "; ";
}
else
{
sprintf(buff, "%d", mylayer);
nfoo = nfoo + "display " + buff + "; ";
}
}
}
}
}
exit(foo + nfoo);