#usage "Delete empty devices
\n"
"To delete devices without a symbol from a library, "
"run this ULP and click EXECUTE.
"
"Before executing the DELETE commands you can edit them"
"in the appearing editor window.
"
"Author: support@cadsoft.de"
int empty;
string cmd = "", h;
cmd += "set undo_log off;\n";
library(L) {
L.devicesets(D) {
h = "";
empty = 1;
D.gates(G) {
empty = 0;
}
if (empty) { // device w/o gates found!
sprintf(h,"REMOVE %s.dev;\n",D.name);
cmd += h;
}
}
}
cmd += "set undo_log on;\n";
// EditBox
int Result = dlgDialog("edit and execute") {
dlgTextEdit(cmd);
dlgHBoxLayout {
dlgPushButton("+Execute") dlgAccept();
dlgPushButton("-Cancel") dlgReject();
}
};
if (!Result)
exit(0);
exit(cmd);