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

📄 statistic-brd.ulp

📁 老外的PCB设计软件,是免费的.可以上网更新.
💻 ULP
📖 第 1 页 / 共 4 页
字号:
         dlgCell( 2, 0) dlgRealEdit( checkMinCirc, 0, 10);
         dlgCell( 2, 1) dlgLabel("Check minimum Circle width");
         dlgCell( 3, 0) dlgRealEdit( checkMinPoly, 0, 10);
         dlgCell( 3, 1) dlgLabel("Check minimum Polygon width");
         dlgCell( 4, 0) dlgRealEdit( checkMinRestringP, 0, 10);
         dlgCell( 4, 1) dlgLabel("Check minimum Pad Restring width");
         dlgCell( 5, 0) dlgRealEdit( checkMinRestringV, 0, 10);
         dlgCell( 5, 1) dlgLabel("Check minimum Via Restring width");
         dlgCell( 6, 0) dlgRealEdit( checkMinClearance, 0, 10);
         dlgCell( 6, 1) dlgLabel("Check minimum Clearance");
         dlgCell( 7, 0) dlgRealEdit( checkMinIsol, 0, 10);
         dlgCell( 7, 1) dlgLabel("Check minimum Polygon Isolate");
         dlgCell( 8, 0) dlgRealEdit( checkMinPadDrill, 0, 10);
         dlgCell( 8, 1) dlgLabel("Check minimum Pad drill");
         dlgCell( 9, 0) dlgRealEdit( checkMinViaDrill, 0, 10);
         dlgCell( 9, 1) dlgLabel("Check minimum Via drill");
         dlgCell(10, 0) dlgRealEdit( checkMinHoleDrill, 0, 10);
         dlgCell(10, 1) dlgLabel("Check minimum Hole drill");
    }
    dlgLabel("All Units = " + unit[uval]);

    dlgHBoxLayout {
      dlgPushButton("+OK") {
        dlgAccept();
        showminValWidth = check_min_ValueWidth();
        showminValOther = check_min_ValueOther();
      }
      dlgPushButton("&Save") saveminval();
      dlgPushButton("&Load") loadminval();
      dlgPushButton("-Cancel") dlgReject();
      dlgStretch(1);
    }
  };
  return;
}

string makestrg(string s) {
  string rs;
  return rs;
}

string saveReport(void) {
  int t = time();
  int n;
  string report = "Data Expoted from: ";
  report +=  brdfile + "\n";
  report += "with: " + argv[0] + "\n";
  report += "at: " + t2string(t) + "\n";
  report += EAGLE_SIGNATURE + "\n\n";
  report += "all Values in " + unit[uval] + "\n";
  report += brdmaximum + "\n";
  report += brdoutline + "\n\n";
  report += usedLayer + "_________________________\n\n";
  report += layerError;
  report += "\n";
  report += sum + "\n";
  report += "\n============================\n";   n=0;
  if (Unrouted) report += Unrouted + " Unroutet airwires ***\n";

  report += "\n----------------------------\nLAYER\n";   n=0;
  sort(cntalllay, allLayers);
  report += "Nb.\tName\tUsed\n";
  for (n = 0; n < cntalllay; n++) {
    report+= allLayers[n] + "\n";
  }
  report += "\n----------------------------\nCLASS\n";   n=0;
  while (statisticCLASS[n]) {
     report += statisticCLASS[n] + "\n";      n++;
  }
  report += "\n----------------------------\nWIDTH\n";   n=0;
  while (statisticWirew[n]) {
    report += statisticWirew[n] + "\n";      n++;
  }
  report += "\n";   n=0;
  while (statisticARCw[n]) {
    report += statisticARCw[n] + "\n";      n++;
  }
  report += wireWidthInternal;

  report += "\n";   n=0;
  while (statisticPolyw[n]) {
    report += statisticPolyw[n] + "\n";      n++;
  }
  report += "\n";   n=0;
  while (statisticPoliso[n]) {
    report += statisticPoliso[n] + "\n";      n++;
  }
  report += "\n";   n=0;
  report += "Signal\tLayer\tRank\tWidth\n";
  while (PolygonLayer[n]) {
    report += PolygonLayer[n] + "\n";      n++;
  }
  report += wireWidthInternal;

  report += "\n----------------------------\n";   n=0;
  while (statisticCIRw[n]) {
    report += statisticCIRw[n] + "\n";      n++;
  }
  report += "\n----------------------------\n";   n=0;
  while (statisticTEXTw[n]) {
    report += statisticTEXTw[n] + "\n";      n++;
  }
  report += "\n";   n=0;
  while (statisticTEXTsize[n]) {
    report += statisticTEXTsize[n] + "\n";      n++;
  }
  report += "\n----------------------------\n";   n=0;
  while (statisticSMD[n]) {
    report += statisticSMD[n] + "\n";      n++;
  }
  report += "\n";   n=0;
  while (statisticPADdiaTOP[n]) {
    report += statisticPADdiaTOP[n] + "\n";      n++;
  }
  report += "\n";   n=0;
  while (statisticPADdiaBOT[n]) {
    report += statisticPADdiaBOT[n] + "\n";      n++;
  }
  report += "\n";   n=0;
  while (statisticPADrestTOP[n]) {
    report += statisticPADrestTOP[n] + "\n";      n++;
  }
  report += "\n";   n=0;
  while (statisticPADrestBOT[n]) {
    report += statisticPADrestBOT[n] + "\n";      n++;
  }
  report += "\n";   n=0;
  while (statisticPADdiaI[n]) {
    report += statisticPADdiaI[n] + "\n";      n++;
  }
  report += "\n";   n=0;
  while (statisticPADrestI[n]) {
    report += statisticPADrestI[n] + "\n";      n++;
  }
  report += "\n";   n=0;
  while (statisticVIAdia[n]) {
    report += statisticVIAdia[n] + "\n";      n++;
  }
  report += "\n";   n=0;
  while (statisticVIArest[n]) {
    report += statisticVIArest[n] + "\n";      n++;
  }
  report += "\n";   n=0;
  while (statisticVIAdiaI[n]) {
    report += statisticVIAdiaI[n] + "\n";      n++;
  }
  report += "\n";   n=0;
  while (statisticVIArestI[n]) {
    report += statisticVIArestI[n] + "\n";      n++;
  }
  report += "\n";   n=0;
  while (statisticVIAdril[n]) {
    report += statisticVIAdril[n] + "\n";      n++;
  }
  report += "\n";   n=0;
  while (statisticVIAstack[n]) {
    report += statisticVIAstack[n] + "\n";      n++;
  }
  report += "\n";   n=0;
  while (statisticPADdril[n]) {
    report += statisticPADdril[n] + "\n";      n++;
  }
  report += "\n----------------------------\n";   n=0;
  while (statisticHOLE[n]) {
    report += statisticHOLE[n] + "\n";      n++;
  }
  report += "\n";   n=0;
  while (drillRack[n]) {
    report += drillRack[n] + "\n";      n++;
  }
  report += "\n----------------------------\n";   n=0;
  while (statisticLBR[n]) {
    report += statisticLBR[n] + "\n";      n++;
  }
  report += "\n";   n=0;
  while (statisticPAC[n]) {
    report += statisticPAC[n] + "\n";      n++;
  }
  report += "\n";   n=0;
  while (statisticVALUE[n]) {
    report += statisticVALUE[n] + "\n";      n++;
  }
  report += "\n----------------------------\n";   n=0;
  while (statisticRECT[n]) {
    report += statisticRECT[n] + "\n";      n++;
  }
  report += "\n";
  report += "End report";
  return report;
}


void  viaStack(int start, int end) {
  string sstack = "";
  sprintf(sstack, "%02d-%02d", start, end);
  int notfound = 1;
  int stc = 0;
  for (stc = 0; stc < cntStack; stc ++) {
    if (sstack == ViaStack[stc]) {
      ViaStackCnt[stc]++;
      notfound = 0;
      break;
    }
  }
  if (notfound) {
    ViaStack[cntStack] = sstack;
    ViaStackCnt[cntStack]++;
    cntStack++;
  }
  return;
}


real WireLength(int x1, int x2, int y1, int y2) {
  return sqrt( pow(u2u(x2) - u2u(x1), 2) + pow( u2u(y2) - u2u(y1), 2));
}


real WireLengthCircle(real r) {
  return u2u(r * 2 * PI) ;
}


real WireLengthArc(real startangle, real endangle, int r) {
  return u2u(r * 2 * PI) / 360 * (endangle - startangle);
}


void checkmaxmin(int x1, int x2, int y1, int y2, int width) {
  int w = 0;
  if (width) w = width/2;  // 2005.07.05 alf
  if (x1 > maxX) maxX = x1+w;
  if (x2 > maxX) maxX = x2+w;
  if (y1 > maxY) maxY = y1+w;
  if (y2 > maxY) maxY = y2+w;
  if (x1 < minX) minX = x1-w;
  if (x2 < minX) minX = x2-w;
  if (y1 < minY) minY = y1-w;
  if (y2 < minY) minY = y2-w;
  return;
}

void checkHole( int x, int y, int drill ) {
  checkmaxmin( x - drill/2, x + drill/2, y - drill/2, y + drill/2 , 0);
  return;
}


void checkarc( int x1, int x2, int y1, int y2, int xc, int yc, real angle1, real angle2, real radius, int width) {
  checkmaxmin( x1, x2, y1, y2, width );
  if     ( angle2 > angle1 + 270.0) {
    if     ( angle1 < 90  ) checkmaxmin( x1         , xc - radius, yc + radius, yc - radius, width );
    else if( angle1 < 180 ) checkmaxmin( xc - radius, xc + radius, y1         , yc - radius, width );
    else if( angle1 < 270 ) checkmaxmin( x1         , xc + radius, yc - radius, yc + radius, width );
    else if( angle1 < 360 ) checkmaxmin( xc + radius, xc - radius, y1         , yc + radius, width );
  }
  else if( angle2 > angle1 + 180.0) {
    if     ( angle1 < 90  ) checkmaxmin( x1         , xc - radius, yc + radius, y2         , width );
    else if( angle1 < 180 ) checkmaxmin( x1         , xc - radius, yc - radius, y2         , width );
    else if( angle1 < 270 ) checkmaxmin( x1         , xc + radius, yc - radius, y2         , width );
    else if( angle1 < 360 ) checkmaxmin( x1         , xc + radius, yc + radius, y2         , width );
  }
  else if( angle2 > angle1 + 90.0 ) {
    if     ( angle1 < 90  ) checkmaxmin( x1         , x2         , yc + radius, y2         , width );
    else if( angle1 < 180 ) checkmaxmin( x1         , xc - radius, y1         , y2         , width );
    else if( angle1 < 270 ) checkmaxmin( x1         , x2         , yc - radius, y2         , width );
    else if( angle1 < 360 ) checkmaxmin( x1         , xc + radius, y1         , y2         , width );
  }
  return;
}


void checkpad( int x, int y, int diameter1, int diameter16, int shape1, int shape16, int P_elongation) {
  int d = diameter1;
  int d2 = diameter1 / 2;
  if (shape16 == PAD_SHAPE_LONG)   d = diameter1 * (diameter1 * P_elongation / 100);
  if (shape16 == PAD_SHAPE_OFFSET) d = diameter1 * (diameter1 * P_elongation / 100) * 1.5;
  checkmaxmin( x + d2, x - d2, y + d2, y - d2, 0 );
  return;
}


void checksmd( int x, int y, int smddx, int smddy, int Layer) {
  int dx2 = smddx / 2;
  int dy2 = smddx / 2;
  checkmaxmin( x + dx2, x - dx2, y + dy2, y - dy2, 0 );
  return;
}


real ArcLength(real ang1, real ang2, real radius) {
  return radius  * 2 * PI / 360 * (ang2 - ang1);
}


string NetClassLabel(string ClassName , int cnt) {
  string s;
  sprintf(s, "CLASS %s : %d Netze", ClassName , cnt);
  return s;
}


string isempty(string s) {
  if (!s) s = empty;
  return s;
}


void list_pac_drills(int drill) {
  int n;
  for ( n = 0; n <= cnt_d; n++) {
    if (pac_drill[n] == drill) {
      cntpac_drill[n]++;
      break;
    }
  }
  if (n > cnt_d) {           // a new drill
    cnt_d++;
    pac_drill[cnt_d] = drill;
    cntpac_drill[cnt_d]++;
    pac_drill[cnt_d+1] = 0;
  }
  return;
}


void list_pac_holes(int drill) {
  int n;
  for ( n = 0; n <= cnt_h; n++) {
    if (pac_hole[n] == drill) {
      cntpac_hole[n]++;
      break;
    }
  }
  if (n > cnt_h) {           // a new drill
    cnt_h++;
    pac_hole[cnt_h] = drill;
    cntpac_hole[cnt_h]++;
    pac_hole[cnt_h+1] = 0;
  }
  return;
}


string infoDril(UL_ELEMENT E) {
  string s, h;
  cnt_d = -1;
  cnt_h = -1;
  cntpac_drill[0] = 0;
  cntpac_hole[0] = 0;

  E.package.contacts(C) {
    if (C.pad)       list_pac_drills(C.pad.drill);
  }
  E.package.holes(H) list_pac_holes(H.drill);

  if (cnt_d > -1) {
    s += "Drills:\n";
    for (int n = 0; n <= cnt_d; n++) {
      sprintf(h, "%d\t%.4f mm\n", cntpac_drill[n], u2mm(pac_drill[n]) );
      s += h;
    }
  }
  if (cnt_h > -1) {
    s += "Holes:\n";
    for (int n = 0; n <= cnt_h; n++) {
      sprintf(h, "%d\t%.4f mm\n", cntpac_hole[n], u2mm(pac_hole[n]) );
      s += h;
    }
  }
  if (cnt_d > -1 || cnt_h > -1) s += "------\n";
  return s;
}

void infoLBR( string val) {
  linfo = "Element : Value : Package";
  string s, M;
  board(B) {
    B.elements(E) {
      if (E.package.library == val) {
        sprintf(s, "%s %s(%.3f %.3f)\t: %s\t: %s\n", E.name, M, u2u(E.x), u2u(E.y), isempty(E.value), E.package.name);
        Element_info += s;
      }
    }
  }
  return;
}

void infoPAC( string val) {
  linfo = "Element : Value : Library";
  string s, M;
  int getdrill = 0;
  board(B) B.elements(E) if (E.package.name == val) {
    if (E.mirror) M = "Bot ";
    else M = "Top ";
    if (!getdrill) {
      Element_info += infoDril(E);
      getdrill++;
    }
    sprintf(s, "%s %s(%.3f %.3f)\t: %s\t: %s\n", E.name, M, u2u(E.x), u2u(E.y), isempty(E.value), E.package.library);
    Element_info += s;
  }
  return;
}


void infoVAL( string val) {
  string s, M;
  int pos = strstr(val, empty);
  if (pos == 0) {
    linfo = "Package : Library";
    val = strsub(val, strlen(empty));
    board(B) B.elements(E) if (E.name == val) {
      sprintf(Element_info, "Value empty/leer\n");
      if (E.mirror) M = "Bot ";
      else M = "Top ";
      sprintf(s, "%s %s(%.3f %.3f) %s\t: %s\n", E.name, M, u2u(E.x), u2u(E.y), E.package.name, E.package.library);
      Element_info += s;
    }

  }
  else {
    linfo = "Element : Package : Library";
    board(B) B.elements(E) if (E.value == val) {
      if (E.mirror) M = "Bot ";
      else M = "Top ";
      sprintf(s, "%s %s(%.3f %.3f)\t: %s\t: %s\n\n", E.name, M, u2u(E.x), u2u(E.y), E.package.name, E.package.library);
      Element_info += s;
    }
  }
  return;
}


void get_Info(int art, string val) {
  Element_info = "";
  int pos = strchr(val, '\t', 0);
  val = strsub(val, 0, pos);
  switch(art) {
    case 1  : infoLBR(val);
              break;

    case 2  : infoPAC(val);
              break;

    case 3  : infoVAL(val);
              break;

    default : break;
  }
  return;
}


void resetMaxMin(void) {
  maxX = INT_MIN;
  minX = INT_MAX;
  maxY = INT_MIN;
  minY = INT_MAX;
  return;
}


// *** used area in board to calculate if board area enuff ***

real used_area(UL_ELEMENT E) {
  resetMaxMin();
  E.package.circles(C) {
    if (C.layer == 1 || C.layer == 16 || C.layer == 21 ||  C.layer == 22 ||  C.layer == 51 ||  C.layer == 52 )
        checkmaxmin( C.x - C.radius, C.x + C.radius, C.y - C.radius, C.y + C.radius, C.width );
  }
  E.package.wires(W) {
    if (W.layer == 1 || W.layer == 16 || W.layer == 21 ||  W.layer == 22 ||  W.layer == 51 ||  W.layer == 52 ) {
      if (W.arc) {
        checkarc(W.arc.x1, W.arc.x2, W.arc.y1, W.arc.y2, W.arc.xc, W.arc.yc, W.arc.angle1, W.arc.angle2, W.arc.radius, W.width);
      }

⌨️ 快捷键说明

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