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

📄 hyperlynx-4_11.ulp

📁 老外的PCB设计软件,是免费的.可以上网更新.
💻 ULP
📖 第 1 页 / 共 5 页
字号:
            printf("(PIN X=%5.*f Y=%5.*f R=%s.%s P=THR%03d",
                precision_of_nets,u2inch(Xpad), precision_of_nets,u2inch(Ypad),
                C.element.name, C.contact.pad.name, Pad_ID);
            SayUPinFunction( C.element.name, C.contact.pad.name );
            printf(") %s, Pad Diameter: %5.*f  Drill: %5.*f\n",
                S.name, precision_of_nets, u2inch(C.contact.pad.diameter[16]),
                precision_of_nets, u2inch(C.contact.pad.drill) );
          }
          else {
            printf("Unregistered Pin Size!\n");
          }
        }
        if (C.contact.smd) {
          Pad_ID = Find_A_Pad( ISASMD, C.contact.smd.layer,
                               SmdRoundness(C.contact.smd.roundness), 0, 0,
                               C.contact.smd.angle,
                               C.contact.smd.dx, 0, 0,
                               C.contact.smd.dy,
                               0 );
          if ( Pad_ID >= 0 ) {
            Xpad = C.contact.smd.x;
            EpadX = Xpad;
            Ypad = C.contact.smd.y;
            EpadY = Ypad;
            TLaylimit = C.contact.smd.layer;
            Blaylimit = C.contact.smd.layer;
            printf("(PIN X=%5.*f Y=%5.*f R=%s.%s P=SMD%03d",
                     precision_of_nets,u2inch(Xpad), precision_of_nets,u2inch(Ypad),
                     C.element.name, C.contact.smd.name, Pad_ID);
            SayUPinFunction( C.element.name, C.contact.smd.name );
            printf(") %s, Smd Dx: %5.*f  Dy: %5.*f\n",
                    S.name, precision_of_nets, u2inch(C.contact.smd.dx),
                    precision_of_nets, u2inch(C.contact.smd.dy) );
          }
          else {
            printf("Unregistered Smd Size!\n");
          }
        }
        // if a pad/smd was located for this contact
        // and a copper segment starts at this contact's x,y location,
        // then the copper segment is included on this net.
        if ( Pad_ID >= 0) {
          // Package element copper information
          // circles
          C.element.package.circles(A) {
            if ( ( A.layer >= 1 ) && ( A.layer <= 16 ) ) {
                printf("* %s has metal circles or isolation circles\n",C.element.name);
            }
          }
          // polygons
          C.element.package.polygons(P) {
            if ( ( P.layer >= 1 ) && ( P.layer <= 16 ) ) {
               printf("* %s has metal polygons\n",C.element.name);
            }
          }
          // rectangles
          C.element.package.rectangles(R) {
            if ( ( R.layer >= 1 ) && ( R.layer <= 16 ) ) {
              printf("* %s has metal rectangles\n",C.element.name);
            }
          }
          // Find any wires that connect to this pin/pad that are internal to the package
          // 1. build a table of all wires on the accepted layer
          int AnyPackageWiresCount = 0;
          int Wx1[], Wy1[], Wx2[], Wy2[], Wwid[], Wusedflag[],
              Wcurve[], Warcx1[], Warcx2[], Warcxc[], Warcy1[], Warcy2[], Warcyc[], Warcradius[],
              Wlayer ;
          C.element.package.wires(W) {
            // find all wires on the correct layer.
            if ( ( W.layer >= TLaylimit ) && ( W.layer <= Blaylimit ) ) {
              Wx1[AnyPackageWiresCount] = W.x1;
              Wy1[AnyPackageWiresCount] = W.y1;
              Wx2[AnyPackageWiresCount] = W.x2;
              Wy2[AnyPackageWiresCount] = W.y2;
              Wwid[AnyPackageWiresCount] = W.width;
              Wcurve[AnyPackageWiresCount] = W.curve;
              if (W.curve) {                               // 21.04.2005 alf@cadsoft.de
                Warcx1[AnyPackageWiresCount] = W.arc.x1;
                Warcx2[AnyPackageWiresCount] = W.arc.x2;
                Warcxc[AnyPackageWiresCount] = W.arc.xc;
                Warcy1[AnyPackageWiresCount] = W.arc.y1;
                Warcy2[AnyPackageWiresCount] = W.arc.y2;
                Warcyc[AnyPackageWiresCount] = W.arc.yc;
                Warcradius[AnyPackageWiresCount] = W.arc.radius;
              }
              Wusedflag[AnyPackageWiresCount] = no;
              TLaylimit = W.layer;    // fix layer to first found layer on an accepted first layer
              Blaylimit = W.layer;    // fix layer to first found layer on an accepted first layer
              Wlayer = W.layer;       // fix the layer
              AnyPackageWiresCount++; // count one segment
            }
          }
          // 2. search for physically connected copper segments, even if out of order
          if ( AnyPackageWiresCount != 0 ) {
            for ( int woi = 0; woi < AnyPackageWiresCount; woi++ ) {
              if ( Wusedflag[woi] == no ) {
                // check either end of the segment
                if ( ( Wx1[woi] == Xpad ) && ( Wy1[woi] == Ypad ) ) {
                  Xpad = Wx2[woi]; // remember the end of this segment
                  Ypad = Wy2[woi]; // which must be the start of the next segment
                  Wusedflag[woi] = yes;
                  woi = 0; // start searching list from the beginning again
                }
                else if ( ( Wx2[woi] == Xpad ) && ( Wy2[woi] == Ypad ) ) {
                  Xpad = Wx1[woi]; // remember the end of this segment
                  Ypad = Wy1[woi]; // which must be the start of the next segment
                  Wusedflag[woi] = yes;
                  woi = 0; // start searching list from the beginning again
                }
              }
            }
          }
          // 3. write out all segments attached to the contact
          if ( AnyPackageWiresCount != 0 ) {
            for ( int woi = 0; woi < AnyPackageWiresCount; woi++ ) {
              if ( Wusedflag[woi] == yes ) {
                // write the segment
                if ( Wlayer >= 1 && Wlayer <= 16 ) {
                  if (Wcurve[woi]) {
                    printf("(PERIMETER_ARC X1=%5.*f Y1=%5.*f X2=%5.*f Y2=%5.*f XC=%5.*f YC=%5.*f R=%5.*f  W=%5.*f L=%s) Arcs: Board Outline Arc is CCW\n",
                             precision_of_nets,u2inch(Warcx1[woi]), precision_of_nets,u2inch(Warcy1[woi]),
                             precision_of_nets,u2inch(Warcx2[woi]), precision_of_nets,u2inch(Warcy2[woi]),
                             precision_of_nets,u2inch(Warcxc[woi]), precision_of_nets,u2inch(Warcyc[woi]),
                             precision_of_nets,u2inch(Warcradius[woi]),
                             precision_of_nets,u2inch(Wwid[woi]),
                             LayerNames[Wlayer]  );
                  }
                  else {
                    printf("(SEG X1=%5.*f Y1=%5.*f X2=%5.*f Y2=%5.*f W=%5.*f L=%s) %s Internal Package Wire\n",
                          precision_of_nets,u2inch(Wx1[woi]),
                          precision_of_nets,u2inch(Wy1[woi]),
                          precision_of_nets,u2inch(Wx2[woi]),
                          precision_of_nets,u2inch(Wy2[woi]),
                          precision_of_nets,u2inch(Wwid[woi]),
                          LayerNames[Wlayer],
                          S.name);
                  }
                }
                // write any contact pins or smds
                int OtherPad_ID;
                C.element.package.contacts(Q) {
                  // don't write out contacts at the original element contact location
                  if ( ( Q.x != EpadX ) || ( Q.y != EpadY ) ) {
                    // check if this element contact is at either end of the wire segment
                    if ( ( ( Q.x == Wx1[woi] ) && ( Q.y == Wy1[woi] ) ) ||
                         ( ( Q.x == Wx2[woi] ) && ( Q.y == Wy2[woi] ) ) ) {
                      // if a through hole pad
                      if (Q.pad) {
                        // find a pad on any layer
                        OtherPad_ID = Find_A_Pad( ISAPAD, 0,
                                                  Q.pad.shape[1], Q.pad.shape[2], Q.pad.shape[16],
                                                  Q.pad.angle,
                                                  Q.pad.diameter[1], Q.pad.diameter[2], Q.pad.diameter[16],
                                                  Q.pad.elongation,
                                                  Q.pad.drill );
                        if ( OtherPad_ID >= 0) {
                          printf("(PIN X=%5.*f Y=%5.*f R=%s.%s P=THR%03d",
                                   precision_of_nets, u2inch(Q.pad.x), precision_of_nets, u2inch(Q.pad.y),
                                   C.element.name, Q.pad.name, OtherPad_ID);
                          SayUPinFunction( C.element.name, Q.pad.name );
                          printf(") %s, Internal Package Pad Diameter: %5.*f  Drill: %5.*f\n",
                                   S.name, precision_of_nets,u2inch(Q.pad.diameter[16]),
                                   precision_of_nets, u2inch(Q.pad.drill) );
                          InsertAssocatedPin( C.element.name, Q.pad.name );
                        }
                        else {
                          printf("Unregistered Internal Package Pin Size!\n");
                        }
                      }
                      // if a smd pad
                      if (Q.smd) {
                        // smd pad must be on this layer
                        if ( Q.smd.layer == Wlayer ) {
                          // find a smd that matches
                          OtherPad_ID = Find_A_Pad( ISASMD, Q.smd.layer,
                                                    SmdRoundness(Q.smd.roundness), 0, 0,
                                                    Q.smd.angle,
                                                    Q.smd.dx, 0, 0,
                                                    Q.smd.dy,
                                                    0 );
                          if ( OtherPad_ID >= 0) {
                            printf("(PIN X=%5.*f Y=%5.*f R=%s.%s P=SMD%03d",
                                     precision_of_nets,u2inch(Q.smd.x), precision_of_nets,u2inch(Q.smd.y),
                                     C.element.name, Q.smd.name, OtherPad_ID);
                            SayUPinFunction( C.element.name, Q.smd.name );
                            printf(") %s, Smd Dx: %5.*f  Dy: %5.*f\n",
                                     S.name,precision_of_nets,u2inch(Q.smd.dx),
                                     precision_of_nets,u2inch(Q.smd.dy) );
                            InsertAssocatedPin( C.element.name, Q.smd.name );
                          }
                          else {
                            printf("Unregistered Smd Size!\n");
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
      S.vias(V) {
        Pad_ID = Find_A_Pad( ISAPAD, 18,
                             V.shape[1], V.shape[2], V.shape[16],
                             V.end,
                             V.diameter[1], V.diameter[2], V.diameter[16],
                             V.start,
                             V.drill );

        if ( Pad_ID >= 0) {
          printf("(VIA X=%5.*f Y=%5.*f P=THR%03d) %s\n",
                  precision_of_nets,u2inch(V.x), precision_of_nets, u2inch(V.y),
                  Pad_ID, S.name);
        }
        else {
          printf("Unregistered Via Size!\n");
        }
      }
      S.wires(W) {
        if (W.layer >= 1 && W.layer <= 16 ) {
          if (W.curve) {
            printf("(ARC X1=%5.*f Y1=%5.*f X2=%5.*f Y2=%5.*f XC=%5.*f YC=%5.*f R=%5.*f W=%5.*f L=%s)\n",
                    precision_of_nets,u2inch(W.arc.x1), precision_of_nets,u2inch(W.arc.y1),
                    precision_of_nets,u2inch(W.arc.x2), precision_of_nets,u2inch(W.arc.y2),
                    precision_of_nets,u2inch(W.arc.xc), precision_of_nets,u2inch(W.arc.yc),
                    precision_of_nets,u2inch(W.arc.radius),
                    precision_of_nets,u2inch(W.width),
                    LayerNames[W.layer]  );
          }
          else {
            printf("(SEG X1=%5.*f Y1=%5.*f X2=%5.*f Y2=%5.*f W=%5.*f L=%s) %s\n",
                    precision_of_nets,u2inch(W.x1), precision_of_nets,u2inch(W.y1),
                    precision_of_nets,u2inch(W.x2), precision_of_nets,u2inch(W.y2),
                    precision_of_nets,u2inch(W.width), LayerNames[W.layer], S.name);
          }
        }
      }
      S.polygons(P) {
        printf("* POLYGONS   NOT Allowed in HYP as of BoardSimm 2.2 Build 70.  ");
        printf("Hopefully someday they will!\n");
        printf("* I=Isolate S=Spacing W=Width O=Orphins_On/Off P=Pour_SOLID/HATCH T=Thermals_On/Off L=Layer) Polygon Format\n");
        printf("*(PLG I=%5.*f S=%5.*f W=%5.*f O=%s P=%s T=%s L=%s) Polygon %s Data\n",
                precision_of_nets,u2inch(P.isolate),precision_of_nets,u2inch(P.spacing),
                precision_of_nets,u2inch(P.width),P.orphans ? "On" : "Off",
                P.pour == POLYGON_POUR_SOLID ? "SOLID" : "HATCH",
                P.thermals ? "On" : "Off",LayerNames[P.layer],S.name);
        P.wires(W) {
          printf("(SEG X1=%5.*f Y1=%5.*f X2=%5.*f Y2=%5.*f W=%5.*f L=%s) Polygon %s\n",
                precision_of_nets,u2inch(W.x1),precision_of_nets,u2inch(W.y1),
                precision_of_nets,u2inch(W.x2),precision_of_nets,u2inch(W.y2),
                precision_of_nets,u2inch(W.width),LayerNames[W.layer],S.name);
        }
      }
      printf("}\n\n");
    }

    // Unconnected Component Pins are on their own special net "HYP$xPy"
    // where x=element name and y=pin name

    // handle all unconnected package pins
    B.elements(E) {
      E.package.contacts(C) {
        if ( strlen(C.signal) == 0 ) {
          if (C.pad) {
            Pad_ID = Find_A_Pad( ISAPAD, 0,
                                 C.pad.shape[1], C.pad.shape[2], C.pad.shape[16],
                                 C.pad.angle,
                                 C.pad.diameter[1], C.pad.diameter[2], C.pad.diameter[16],
                                 C.pad.elongation,
                                 C.pad.drill );
            if ( Pad_ID >= 0) {
              if ( FindAssocatedPin( E.name, C.pad.name ) == 0 ) {
                Xpad = C.pad.x;
                Ypad = C.pad.y;
                printf("{NET=HYP$%s.%s\n",E.name,C.pad.name);
                printf("(PIN X=%5.*f Y=%5.*f R=%s.%s P=THR%03d",
                       precision_of_nets,u2inch(Xpad), precision_of_nets,u2inch(Ypad),
                       E.name, C.pad.name, Pad_ID);
                printf(") Pad Diameter: %5.*f  Drill: %5.*f\n",
                       precision_of_nets, u2inch(C.pad.diameter[16]),
                       precision_of_nets, u2inch(C.pad.drill) );
                printf("}\n\n");
              }
              else {
                printf("* PIN %s.%s is part of an internal package net.\n",E.name,C.pad.name);
              }
            }
            else {
              printf("* Unregistered Pin Size

⌨️ 快捷键说明

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