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

📄 find.ulp

📁 老外的PCB设计软件,是免费的.可以上网更新.
💻 ULP
📖 第 1 页 / 共 2 页
字号:
  string nn[];
  if (b == 2) {
    b = strsplit(nn, bn[1], ',');
  }
  else {
    b = strsplit(nn, name, ',');
  }
  for (int x = 0; x < b; x++) {
    if(nn[x] == sfind) return 1;
  }
  return 0;
}


// ****** Main ******
find = strupr(argv[1]);
vfind = argv[1];
again =  strupr(argv[2]);
if (again == "*")    all = 1000;
else  all = strtol(again) - 1;

if ( strupr(argv[2]) == "PAD" || strupr(argv[3]) == "PAD") fpin = "PAD";
if ( strupr(argv[2]) == "PIN" || strupr(argv[3]) == "PIN") fpin = "PIN";
if ( strupr(argv[2]) == "DEV" || strupr(argv[3]) == "DEV") fpin = "DEV";
if (argv[3] == "CH") {
  ChangeValue = argv[3];
  change_value = 1;
  NewValue = argv[4];
}

if (!find) {
  vfind = getfind();
  find = strupr(vfind);
  }
if (!find && !change_value) exit (0);
cnt = all + 1;

string repeat = "";



// *** Board coord. ***
if (board) {
   board(B) {
      gridunit = (B.grid.unit);

      mx = B.area.x2 + (B.area.x1 * -1);
      my = B.area.y2 + (B.area.y1 * -1);
      B.elements(E) {
         if (E.name == find) {
            repeat += show_B(u2u(E.x), u2u(E.y), 2, 5, find, all);
            sprintf(foundelement, "Element %s on (%.3f %.3f)", E.name ,u2u(E.x), u2u(E.y) );
            check (repeat);
            }
         }
      B.signals(S) {
         if (S.name == find) {
            S.contactrefs(C) {
               repeat += show_B(u2u(C.contact.x), u2u(C.contact.y), 2, 5, find, all);
               if (all <= 0) check(repeat);
               all--;
               }
            }
         }
      B.signals(S) {
         if (S.name == find ) {
            S.wires(W) {
               real z = zfactor(u2u(W.x1), u2u(W.y1), u2u(W.x2), u2u(W.y2) );
               repeat += show_B( u2u((W.x1 + W.x2)/2), u2u((W.y1 + W.y2)/2), z/(z/2) , z/(z/5), find, all);
               if (all <= 0) check(repeat);
               all--;
               }
            }
         }
      B.signals(S) {
         if (S.name == find ) {
            S.polygons(P) {
               P.contours(W) {
                     real z = zfactor(u2u(W.x1), u2u(W.y1), u2u(W.x2), u2u(W.y2) );
                     repeat += show_B( u2u((W.x1 + W.x2)/2), u2u((W.y1 + W.y2)/2), z/(z/2) , z/(z/5), find, all);
                     if (all <= 0) check(repeat);
                     all--;
                     ;break;
                  }
               }
            }
         }
      B.signals(S) {
         if (S.name == find ) {
            S.vias(V) {
               repeat += show_B(u2u(V.x), u2u(V.y), 1, 5, find, all);
               fndpin = "VIA";
               sprintf(foundelement, "Element on (%.3f %.3f) %s<br><b>VIA</b><br><table><tr><td>Layer</td><td>Diameter</td><td>Restring</td></tr><tr><td>Top</td><td>%.3f</td><td>%.3f</td></tr><tr><td>Inner</td><td>%.3f</td><td>%.3f</td></tr><tr><td>Bottom</td><td>%.3f</td><td>%.3f</td></tr><tr><td>Drill</td><td>%.3f</td></tr></table>",
                                                    u2u(V.x), u2u(V.y),
                                                    unit[gridunit],
                                                    u2u(V.diameter[1]),
                                                    u2u( (V.diameter[1] - V.drill) / 2),
                                                    u2u(V.diameter[2]),
                                                    u2u( (V.diameter[2] - V.drill) / 2),
                                                    u2u(V.diameter[16]),
                                                    u2u( (V.diameter[16] - V.drill) / 2),
                                                    u2u(V.drill)
                                                    );
               if (all <= 0) check(repeat);
               all--;
               }
            }
         }
      B.elements(E) {
         if (E.value == vfind || E.value == find) {
            repeat += show_B(u2u(E.x), u2u(E.y), 2, 5, E.name, all);
            sprintf(foundelement, "Element %s on (%.3f %.3f)", E.name ,u2u(E.x), u2u(E.y) );
            if (all <= 0) check(repeat);
            all--;
            }
         }
      B.elements(E) {
         if (fpin == "PAD") {
            E.package.contacts(C) {
               if (C.pad) {
                  if (C.pad.name == find) {
                     fndpin = "PAD";
                     repeat += show_B(u2u(C.pad.x), u2u(C.pad.y), 2, 5, E.name, all);
                     sprintf(foundelement, "<br>PAD <b>%s</b> on (%.3f %.3f) %s [Element %s]<br><table><tr><td>Layer</td><td>Diameter</td><td>Restring</td></tr><tr><td>Top</td><td>%.3f</td><td>%.3f</td></tr><tr><td>Inner</td><td>%.3f</td><td>%.3f</td></tr><tr><td>Bottom</td><td>%.3f</td><td>%.3f</td></tr><tr><td>Drill</td><td>%.3f</td></tr></table>",
                                                    C.pad.name,
                                                    u2u(C.pad.x), u2u(C.pad.y),
                                                    unit[gridunit],
                                                    E.name,
                                                    u2u(C.pad.diameter[1]),
                                                    u2u( (C.pad.diameter[1] - C.pad.drill) / 2),
                                                    u2u(C.pad.diameter[2]),
                                                    u2u( (C.pad.diameter[2] - C.pad.drill) / 2),
                                                    u2u(C.pad.diameter[16]),
                                                    u2u( (C.pad.diameter[16] - C.pad.drill) / 2),
                                                    u2u(C.pad.drill)
                                                    );
                     if (all <= 0) check(repeat);
                     all--;
                     }
                  }
               if (C.smd) {
                  if (C.smd.name == find) {
                     fndpin = "SMD";
                     repeat += show_B(u2u(C.smd.x), u2u(C.smd.y), 2, 5, E.name, all);
                     sprintf(foundelement, "<br>SMD <b>%s</b> on  (%.3f %.3f)  %s [Element %s]",
                                                  C.smd.name,
                                                  u2u(C.smd.x), u2u(C.smd.y),
                                                  unit[gridunit],
                                                  E.name
                                                  );
                     if (all <= 0) check(repeat);
                     all--;
                     }
                  }
               }
            }
         }
      }
   if (repeat) check (repeat);
   dlgMessageBox("<b>" + dpbacksl(find) + "</b> not found!", "OK");
   exit (0);
   }


// *** Schematic coord. ***
if (schematic) {
   lastSheet = 0;
   schematic(S) {
      gridunit = (S.grid.unit);
      S.sheets(SH) {
         mx = SH.area.x2 + (SH.area.x1 * -1);
         my = SH.area.y2 + (SH.area.y1 * -1);
         if (fpin == "PIN" || fpin == "DEV") {
            SH.parts(PA) {
               if (fpin == "DEV") {
                  if (PA.device.name == find) {  // 2005.11.14 alf@cadsoft.de
                     PA.instances(IN) {
                        IN.gate.symbol.pins(P) {  // Pin
                           fndpin = "Dev";
                           real sym = zfactor( u2u(IN.gate.symbol.area.x1), u2u(IN.gate.symbol.area.y1),  u2u(IN.gate.symbol.area.x2), u2u(IN.gate.symbol.area.y2) );
                           real z = zfactor( u2u(mx), u2u(my), 1.0, 1.0 );
                           sprintf(foundelement, "DEVices %s in sheet %d on (%.3f %.3f)", IN.name , IN.sheet, u2u(IN.x), u2u(IN.y) );
                           repeat += show_S(IN.sheet, u2u(IN.x), u2u(IN.y),  sym , z, PA.name);
                           if (all <= 0) check(repeat);
                           all--;
                        }
                     }
                  }
               }
               else {
                  PA.instances(IN) {
                     IN.gate.symbol.pins(P) {  // Pin
                        if (P.name == find) {
                           fndpin = "Pin";
                           real sym = zfactor( u2u(IN.gate.symbol.area.x1), u2u(IN.gate.symbol.area.y1), u2u(IN.gate.symbol.area.x2), u2u(IN.gate.symbol.area.y2) );
                           real z = zfactor( u2u(mx), u2u(my), 1.0, 1.0 );
                           sprintf(foundelement, "PIN %s in sheet %d on (%.3f %.3f)", P.name , IN.sheet, u2u(P.x), u2u(P.y) );
                           repeat += show_S(IN.sheet, u2u(P.x), u2u(P.y),  sym , z, PA.name);
                           if (all <= 0) check(repeat);
                           all--;
                        }
                     }
                  }
               }
            }
         }
         if (fpin == "PAD") {
            SH.parts(PA) {
               PA.instances(IN) {
                  IN.gate.symbol.pins(P) {
                     if (P.contact) {
                        if (P.contact.name == find) {
                           fndpin = "Pad";
                           real sym = zfactor( u2u(IN.gate.symbol.area.x1), u2u(IN.gate.symbol.area.y1), u2u(IN.gate.symbol.area.x2), u2u(IN.gate.symbol.area.y2) );
                           real z = zfactor( u2u(mx), u2u(my), 1.0, 1.0 );
                           sprintf(foundelement, "PAD %s (PIN %s) in sheet %d on (%.3f %.3f)", PA.name, P.name , IN.sheet, u2u(IN.x), u2u(IN.y) );
                           repeat += show_S(IN.sheet, u2u(P.x), u2u(P.y), sym, z, PA.name);
                           if (all <= 0) check(repeat);
                           all--;
                        }
                     }
                  }
               }
            }
         }
         SH.parts(PA) {
            if (PA.name == find) {
               PA.instances(IN) {  // Gate
                  if (IN.sheet) {
                     real sym = zfactor( u2u(IN.gate.symbol.area.x1), u2u(IN.gate.symbol.area.y1), u2u(IN.gate.symbol.area.x2), u2u(IN.gate.symbol.area.y2) );
                     real z = zfactor( u2u(mx), u2u(my), 1.0, 1.0 );
                     sprintf(foundelement, "Device %s in sheet %d on (%.3f %.3f)", PA.name , IN.sheet, u2u(IN.x), u2u(IN.y) );
                     repeat += show_S(IN.sheet, u2u(IN.x), u2u(IN.y),  sym , z, PA.name);
                     if (all <= 0) check(repeat);
                     all--;
                  }
               }
            }
         }
         SH.nets(N) {
            if (N.name == find) {
               N.segments(SEG) {
                  SEG.wires(W) {
                     fndpin = "NET";
                     real z = zfactor(u2u(W.x1), u2u(W.y1), u2u(W.x2), u2u(W.y2) );
                     repeat += show_S(SH.number, u2u((W.x1 + W.x2) /2), u2u((W.y1 + W.y2) / 2), z, u2u(mx), find);
                     if (all <= 0) check(repeat);
                     all--;
                  }
               }
            }
         }
         SH.busses(B) {
            if (findBus(B.name, find)) {
               B.segments(SEG) {
                  SEG.wires(W) {
                     fndpin = "BUS";
                     real z = zfactor(u2u(W.x1), u2u(W.y1), u2u(W.x2), u2u(W.y2) );
                     repeat += show_S(SH.number, u2u((W.x1 + W.x2) /2), u2u((W.y1 + W.y2) / 2), z, u2u(mx), B.name);
                     if (all <= 0) check(repeat);
                     all--;
                  }
               }
            }
         }
         SH.parts(PA) {
            PA.instances(IN) {             // Gate
               if (PA.value == vfind) { // *** || PA.value == find) {
                  real sym = zfactor( u2u(IN.gate.symbol.area.x1), u2u(IN.gate.symbol.area.y1), u2u(IN.gate.symbol.area.x2), u2u(IN.gate.symbol.area.y2) );
                  real z = zfactor( u2u(mx), u2u(my), 1.0, 1.0 );
                  sprintf(foundelement, "Device %s in sheet %d on (%.3f %.3f)", PA.name , IN.sheet, u2u(IN.x), u2u(IN.y) );
                  repeat += show_S(IN.sheet, u2u(IN.x), u2u(IN.y), sym, z, PA.name);
                  if (all <= 0) check(repeat);
                  all--;
               }
            }
         }
      }
   }
   check(repeat);
}
else {
   dlgMessageBox("Start this ULP from schematic or board!", "OK");
   exit (0);
}

⌨️ 快捷键说明

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