forked from robertstarr/ulp_user
-
Notifications
You must be signed in to change notification settings - Fork 0
/
del-empty-sch-brd-layers.ulp
55 lines (53 loc) · 1.33 KB
/
del-empty-sch-brd-layers.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
#usage "<b>Deletes 'User Defined' layers (100-255) that are empty.</b>\n"
"<p>"
"Run this ULP in either a board or schematic."
"If both files of a Schematic/Board pair are open, both will be processed.<br>"
"and will delete the empty layers in both editors<br>"
"<p>"
"<author>Author: Warren Brayshaw</author>"
// THIS PROGRAM IS PROVIDED AS IS AND WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED
string cmdB,cmdS,DelLayB,DelLayS;
if(!board && !schematic) dlgMessageBox("Run this ULP in a Board or Schematic");
if(board){
board(B){
B.layers(L){
if(L.number>99){
sprintf(DelLayB,"layer ?? -%u;\n",L.number);
cmdB += DelLayB;
}
}
}
if(!project.schematic) exit(cmdB);
project.schematic(S){
S.layers(L){
if(L.number>99){
sprintf(DelLayS,"layer ?? -%u;\n",L.number);
cmdS += DelLayS;
}
}
if(cmdS!="") exit(cmdB + "edit .sch;\n" + cmdS + "edit .brd;\n");
else exit(cmdB);
}
}
if(schematic){
schematic(S){
S.layers(L){
if(L.number>99){
sprintf(DelLayS,"layer ?? -%u;\n",L.number);
cmdS += DelLayS;
}
}
}
if(!project.board) exit(cmdS);
project.board(B){
B.layers(L){
if(L.number>99){
sprintf(DelLayB,"layer ?? -%u;\n",L.number);
cmdB += DelLayB;
}
}
if(cmdB!="") exit(cmdS + "edit .brd;\n" + cmdB + "edit .sch;\n");
else exit(cmdS);
}
}
exit(0);