del-empty-devices.ulp

来自「老外的PCB设计软件,是免费的.可以上网更新.」· ULP 代码 · 共 51 行

ULP
51
字号
#usage "<b>Delete empty devices</b>\n"
       "<p>"
       "To delete devices without a symbol from a library, "
       "run this ULP and click EXECUTE."
       "<p>"
       "Before executing the DELETE commands you can edit them "
       "in the appearing editor window."
       "<p>"
       "<author>Author: support@cadsoft.de</author>"

// THIS PROGRAM IS PROVIDED AS IS AND WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED

if (library) {
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);
}

else {
   dlgMessageBox("\n    Start this ULP in a Library    \n");
   exit (0);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?