-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathchange-text-in-lbr.ulp
111 lines (93 loc) · 3.36 KB
/
change-text-in-lbr.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#usage "<b>Change lib text sizes</b>\n"
"<p>This script loops through all packages in a library and changes the text size and ratio to new user specified values. "
"<author>Author: rtzaudio@mindspring.com</author>"
string ulp_path = "";
string script_change = "";
int Result = 0;
string grid = "GRID MIL FINEST;\n";
// new text sizes/ratios in mils
real tPlaceSize = 40;
int tPlaceRatio = 14;
real tNamesSize = 32;
int tNamesRatio = 15;
real tValuesSize = 32;
int tValuesRatio = 15;
void DoPackage(UL_PACKAGE P) {
real dx, dy;
P.texts(T) {
dx = u2mil(T.x);
dy = u2mil(T.y);
if (T.layer == 21) {
// Change tPlace layer text
printf("CHANGE SIZE %.3f (%.3f %.3f);\n", tPlaceSize, dx, dy);
printf("CHANGE RATIO %d (%.3f %.3f);\n", tPlaceRatio, dx, dy);
} else if (T.layer == 25) {
// Change tNames layer text
printf("CHANGE SIZE %.3f (%.3f %.3f);\n", tNamesSize, dx, dy);
printf("CHANGE RATIO %d (%.3f %.3f);\n", tNamesRatio, dx, dy);
} else if (T.layer == 27) {
// Change tValues layer text
printf("CHANGE SIZE %.3f (%.3f %.3f);\n", tValuesSize, dx, dy);
printf("CHANGE RATIO %d (%.3f %.3f);\n", tValuesRatio, dx, dy);
}
}
}
void menue(void) {
int err = 0;
int newWidth;
int minLimit = 0;
int maxLimit = 0;
dlgDialog("Change All Text Sizes/Ratios") {
//dlgStretch(1);
dlgGroup("tPlace Text") {
dlgHBoxLayout { dlgLabel("New size (2-100 mils) :\t"); dlgRealEdit(tPlaceSize, 10.0, 100.0); }
dlgHBoxLayout { dlgLabel("New ratio (8-20%) :\t"); dlgIntEdit(tPlaceRatio, 8, 20); }
}
dlgGroup("tNames Text") {
dlgHBoxLayout { dlgLabel("New size (2-100 mils) :\t"); dlgRealEdit(tNamesSize, 10.0, 100.0); }
dlgHBoxLayout { dlgLabel("New ratio (8-20%) :\t"); dlgIntEdit(tNamesRatio, 8, 20); }
}
dlgGroup("tValues Text") {
dlgHBoxLayout { dlgLabel("New size (2-100 mils) :\t"); dlgRealEdit(tValuesSize, 10.0, 100.0); }
dlgHBoxLayout { dlgLabel("New ratio (8-20%) :\t"); dlgIntEdit(tValuesRatio, 8, 20); }
}
//dlgStretch(1);
dlgPushButton("+&OK") { dlgAccept(); return; }
dlgPushButton("-&Cancel") { dlgReject(); exit (0);}
};
}
if (library) {
char bkslash = '/';
int pos = strrchr(argv[0], bkslash);
if (pos >= 0) {
ulp_path = strsub(argv[0], 0, pos + 1);
}
int n = 0;
library(L) {
int posb = strrchr(argv[0], bkslash);
if (posb >= 0) {
ulp_path = strsub(argv[0], 0, posb + 1);
}
menue();
script_change = filesetext(L.name, "~~~.scr");
output(script_change, "wtD") {
printf("DISPLAY NONE 21 51;\n");
int firstf = 1;
L.packages(P) {
printf("EDIT %s.PAC;\n", P.name);
if (firstf) {
printf("%s",grid);
firstf = 0;
}
DoPackage(P);
}
printf("GRID DEFAULT;\n");
printf("DISPLAY NONE 1 16 17 21 51;\n");
}
}
dlgMessageBox("exited normally");
exit ("SCRIPT '" + script_change + "';\n"); // REMOVE " + script_change + ";\n");
} else {
dlgMessageBox("\n*** Start this ULP in a Library ***\n");
exit (0);
}