forked from robertstarr/ulp_user
-
Notifications
You must be signed in to change notification settings - Fork 0
/
merge_renamsig_3.ulp
109 lines (85 loc) · 2.38 KB
/
merge_renamsig_3.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
#usage "<b> rename nets by adding a suffix to the net name</b>\n"
"<p>"
"Useful when merging two or more designs to ensure that "
"no elements overlap, use in conjunction with cmd-renumber_2.ulp"
" for renaming components"
"<p>"
// THIS PROGRAM IS PROVIDED AS IS AND WITHOUT WARRANTY OF ANY KIND,
// EXPRESSED OR IMPLIED.
/*
*
* Netlist (Script) for RENAME of the networks (Signale) in layout
* TEST-VERSION Author: A. Zaffran 13.01.2000 [email protected]
*
* original ULP modified by David Moodie
* quick and dirty mod to add a suffix to net names to ensure names are unique
*/
real Grid = 100; // in 100 Mil
string Version = "RENAMSIG.ULP Version 1.2";
int index[];
int pg = 0;
string n_sub = "_A"; // modify this suffix as required
string cmd;
string c;
numeric string n[]; // Signalname
int ix[];
int iy[];
void setgridmil (void)
{
cmd+= "GRID mil 50;\n";
}
void namescript(void)
{
// Sort by: name
sort(pg, index, n);
for (int i = 0; i < pg; i++) {
sprintf(c, "NAME '%s' (%.2f %.2f);\n", n[i], u2mil(ix[i]), u2mil(iy[i])); cmd +=c;
// sprintf(c, "NAME (%.2f %.2f) '%s';\n", u2mil(ix[i]), u2mil(iy[i]), n[i]); cmd +=c;
}
}
// ** MAIN **
if (board) {
int Result = dlgDialog("Rename Signals") {
dlgHBoxLayout {
dlgLabel("&n_sub");
dlgStringEdit(n_sub);
dlgLabel("mil");
}
dlgHBoxLayout {
dlgStretch(0);
dlgPushButton("+&OK") dlgAccept();
dlgStretch(1);
dlgPushButton("-&Cancel") dlgReject();
dlgStretch(0);
}
};
if (Result ==0) exit(0);
}
else {
dlgMessageBox("\n Start this ULP in a Board \n");
exit (0);
}
board(B) {
output("RENAMSIG.SCR") {
printf("TEXT 'THIS PROGRAM IS PROVIDED AS IS AND WITHOUT WARRANTY\n");
printf("TEXT 'OF ANY KIND EXPRESSED OR IMPLIED.\n");
printf("TEXT 'This file is generated by %s, exported from;\n", Version);
printf("TEXT '%s at %s;\n", B.name, t2string(time()));
printf("TEXT '%s;\n\n", EAGLE_SIGNATURE);
setgridmil();
// collect all Nets (Signals)
B.signals(S) {
S.wires(W) {
n[pg] = S.name + n_sub;
ix[pg] = W.x1;
iy[pg] = W.y1;
pg++;
break;
}
}
namescript();
sprintf(c, "GRID LAST;\n"); cmd +=c;
// output("test.scr" , "wt") {printf (cmd);
}
}
exit(cmd);