⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 copy-wire-to-solder-mask.ulp

📁 老外的PCB设计软件,是免费的.可以上网更新.
💻 ULP
字号:
#usage "<qt>This ULP copies copper wire from layer 1 or 16 of selected signals into the"
       "solderstop layers in order to keep it free from solder stop layer.<p>"
       "Use:<br>"
       "run copy-wire-to-solder-mask.ulp [signalname]<br>"
       "run copy-wire-to-solder-mask.ulp $nameoff$<p>"
       "$nameoff$ switches off the checking of net names<p>"
       "<hr> "
       "THIS PROGRAM IS PROVIDED AS IS AND WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED.\n"
       "<author>Author: support@cadsoft.de</author></qt>"


int NameOff = 0;       // 0 = copy by signal name
                       // 1 = copy without signal name (all)

string signals[]   = { "" };
string chsignals[] = { "" };
int    chngsig     = 0;
int    lastSigCh   = -1;
int decs;

int index[];
int x1[], y1[], x2[], y2[], layer[];
int Wwidth[];
int n = 1;

string cmd;
string c;

// *************************************
int found(string fnam) {
  int fnd = 0;
  do {
    if (chsignals[fnd] == fnam) {
      return 1;
      break;
    }
    ++fnd;
  } while (chsignals[fnd]);
  return 0;
}


void changeLayer(int l) {
  if (l == 1) sprintf(c, "CHANGE LAYER 29;\n");
  if (l == 16) sprintf(c, "CHANGE LAYER 30;\n");
  cmd+= c;
  return;
}


int delfromList(int selct) {
  if (lastSigCh >= 0) {
    lastSigCh--;
    for (int r = selct; r <= lastSigCh; r++) {
      chsignals[r] = chsignals[r + 1];
    }
    chsignals[lastSigCh + 1] = "";
  }
  return selct;
}

void  AddList (string SigName) {
  int nofound = 1;
  for (int r = 0; r <= lastSigCh; r++) {
    if (chsignals[r] == SigName) {
      nofound = 0;
      break;
    }
  }
  if (nofound) {
    lastSigCh++;
    if (lastSigCh > 0) {
      for (int x = lastSigCh; x > 0; x--) {
        chsignals[x] = chsignals[x - 1];
      }
    }
    chsignals[0] = SigName;
  }
  return;
}


void menue() {
  int cs;
  int l;
  if (argv[1]) {
    if (argv[1] == "$nameoff$") NameOff = 1;
    else AddList(strupr(argv[1]));
  }
  else {
    int Result = dlgDialog("Copy wire to mask layer") {
      string slist[];
      dlgCheckBox("Copy &all (without signal name)", NameOff);
      dlgSpacing(10);
      dlgStretch(0);
      dlgLabel("add &Signal");
      dlgComboBox(signals, chngsig) { AddList(signals[chngsig]); dlgRedisplay();}
      dlgSpacing(30);
      dlgLabel("&delete signal from list");
      dlgComboBox(chsignals, decs) { decs = delfromList(decs); }
      dlgHBoxLayout {
        dlgStretch(0);
        dlgPushButton("+OK") dlgAccept();
        dlgStretch(1);
        dlgPushButton("-Cancel") dlgReject();
        dlgStretch(0);
      }
      dlgStretch(0);
    };
    if (Result == 0) exit (0);
  }
  return;
}


// main
if (board) board(B) {
  int s = 0;
  B.signals(S) {
    signals[s] = S.name;
    s++;
  }
  menue();

  sprintf(c, "GRID MM;\nSET WIRE_BEND 2;\n");
  cmd+= c;
  B.signals(S) {
    if (found(S.name) || NameOff) {
      S.wires(W) {
        if (W.layer == 1 || W.layer == 16) {
          x1[n] = W.x1;
          y1[n] = W.y1;
          x2[n] = W.x2;
          y2[n] = W.y2;
          Wwidth[n] = W.width;
          layer[n] = W.layer;
          ++n;
        }
      }
    }
  }
  sort(n, index, layer);
  int dl = 0;
  for (int i = 1; i < n; ++i) {
    if(dl != layer[index[i]]) {
      dl = layer[index[i]];
      changeLayer(dl);
    }
    sprintf(c, "WIRE %.4f (%.4f %.4f) (%.4f %.4f);\n", u2mm(Wwidth[index[i]]),
                u2mm(x1[index[i]]), u2mm(y1[index[i]]), u2mm(x2[index[i]]), u2mm(y2[index[i]])  );
    cmd+= c;
  }
  sprintf(c, "GRID LAST;\n");
  cmd+= c;
  exit (cmd);
}

else dlgMessageBox("start this ULP in a Board", "OK");

⌨️ 快捷键说明

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