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

📄 import-ultiboard-ddf.ulp

📁 老外的PCB设计软件,是免费的.可以上网更新.
💻 ULP
📖 第 1 页 / 共 4 页
字号:
}
void PadDefinitionTop(void) {
   n++;
   string nb = read(',', 0);
   int number = strtol(nb);
   pad1topX1[number] = strtol(read(',', 0));
   pad1topX2[number] = strtol(read(',', 0));
   pad1topY[number] = strtol(read(',', 0));
   pad1topRadius[number] = strtol(read(',', 0));
   pad1topClear[number] = strtol(read(',', 0));
   pad1topHorizont[number] = strtol(read(',', 0));
   pad1topVertical[number] = strtol(read(',', 0));
   pad1topThermH[number] = strtol(read(',', 0));
   pad1topThermV[number] = strtol(read(cr, 1));
   return ;
   }
void PadDefiniBottom(void) {
   n++;
   string nb = read(',', 0);
   int number = strtol(nb);
   pad2bottomX1[number] = strtol(read(',', 0));
   pad2bottomX2[number] = strtol(read(',', 0));
   pad2bottomY[number] = strtol(read(',', 0));
   pad2bottomRadius[number] = strtol(read(',', 0));
   pad2bottomClear[number] = strtol(read(',', 0));
   pad2bottomHorizont[number] = strtol(read(',', 0));
   pad2bottomVertical[number] = strtol(read(',', 0));
   pad2bottomThermH[number] = strtol(read(',', 0));
   pad2bottomThermV[number] = strtol(read(cr, 1));
   return ;
   }
void WaveSolderDir(void) {
   n++;
   string WaveSolder = read(' ', 0);
   string WaveSolderDir = read(' ', 0);
   string WaveSolderClear = read(cr, 1);
   return ;
   }
void testxy(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, int ox, int oy) {
   sprintf(st, "s(%s %s)\n2(%s %s)\n3(%s %s)\n4(%s %s)\no(%s %s)" ,
            format(v2mil(x1)), format(v2mil(y1)),
            format(v2mil(x2)), format(v2mil(y2)),
            format(v2mil(x3)), format(v2mil(y3)),
            format(v2mil(x4)), format(v2mil(y4)),
            format(v2mil(ox)), format(v2mil(oy)) );
   dlgDialog("Koordinaten?") {
      dlgTextEdit(st);
      dlgHBoxLayout {
         dlgStretch(0);
         dlgPushButton("+Yes") dlgAccept();
         dlgStretch(1);
         dlgPushButton("-Cancel") dlgReject();
         dlgStretch(0);
         }
      };
   return ;
   }
void outlinedescript(void) {
   int x, y;
   int wcnt = 0;
   string w = "";
   string wire = "";
   string h;
   int n;
   sprintf(h, "CHANGE LAYER 21;\n");
   wire += h;
   do {
      w = read(',', 0);
      if (w == ";") {
         break;
         }
      x = strtod(w);
      y = strtod(read(',', 0));
      if ( (x & 1) == 1) {
         wire += ";wire\n";
         sprintf (h, "(%s %s)\n",  format(v2mil(x - 1)), format(v2mil(y)) );
         }
      else {
         sprintf (h, "(%s %s)\n",  format(v2mil(x)), format(v2mil(y)) );
         }
      wire += h;
      wcnt++;
      } while (c[n]);
   wire += ";\n";
   printf("%s", wire);
   return ;
   }
void pindescript(void) {
   do {
      string padcode = read(',', 0);
      if (strrchr(padcode, ';') == 0) {
         n++;
         return ;
         }
      int    pcodnumber      = strtol(padcode);
      real   padcodeRotation = strtod(read(',', 0)) / rotatemultiple;
      int    padcodelayerset = strtol(read(',', 0));
      real   padcoderelx     = val2mil(read(',', 0));
      real   padcoderely     = val2mil(read(',', 0));
      string padcodepinname  = read(',', 1);
      refPinNr[cntrefPin] = padcodepinname;
      cntrefPin++;
      real px1  = v2mil(pad2bottomX1[pcodnumber]);
      real px2  = v2mil(pad2bottomX2[pcodnumber]);
      real py   = v2mil(pad2bottomY[pcodnumber]);
      real prad = v2mil(pad2bottomRadius[pcodnumber]);
      real pc   = v2mil(pad2bottomClear[pcodnumber]);
      real ph   = v2mil(pad2bottomHorizont[pcodnumber]);
      real pv   = v2mil(pad2bottomVertical[pcodnumber]);
      real pth  = v2mil(pad2bottomThermH[pcodnumber]);
      real ptv  = v2mil(pad2bottomThermV[pcodnumber]);
      real centeroffset = (px1 - px2);
      real px = px1 + px2;
      int pdril = drillcode[pcodnumber];
      if(pdril != 0) {
         printf("CHANGE DRIll %s;\n", format(v2mil(drillcode[pcodnumber])) );
         }
      printf("CHANGE LAYER 48;\n");
      printf("CHANGE SIZE 32;\n");
      if (py == 0) {
         dlgDialog("Warning") {
            dlgHBoxLayout {
               dlgStretch(1);
               dlgLabel("<img src=" + ulp_path + "warning.bmp>");
               dlgStretch(1);
            }
            dlgLabel( "Package: "+ shapename + ";\nPad : " + padcodepinname + " / PadCode = " + padcode + "\n\nY-Value is zerro = 0; changed to 1 Mil\n", 1);
            dlgPushButton("+&Accept") dlgAccept();
            dlgPushButton("-&Cancel") { dlgReject(); exit(-1); }
            py = 1;
            px = 1;
            };
         }
      printf("CHANGE LAYER 21;\n");
      if(pdril == 0) {
          int roundness = prad / (py / 200) ;
          printf("CHANGE LAYER %s;\n", refLayer[padcodelayerset]);
          if (centeroffset == 0) {
             if (padcodeRotation == 90 || padcodeRotation == 270) {
                printf("SMD %.3f %.3f -%d '%s' (%s %s);\n", py, px, roundness, padcodepinname, format(padcoderelx), format(padcoderely) );
                }
             else {
                printf("SMD %.3f %.3f -%d '%s' (%s %s);\n", px, py, roundness, padcodepinname, format(padcoderelx), format(padcoderely) );
                }
             }
          else {
             printf("SMD %.3f %.3f -%d '%s' (%s %s);\n", px, py, roundness, padcodepinname, format(padcoderelx), format(padcoderely) );
             }
          }
      else {
         if (centeroffset == 0 && px == py) {
            if (prad < px / 2) {
               printf("CHANGE SHAPE SQUARE;\n");
               }
            else {
               printf("CHANGE SHAPE ROUND;\n");
               }
            printf("CHANGE DIAMETER %s;\n", format(px) );
            }
         else {
            if (centeroffset == 0) {
               if (padcodeRotation == 90 || padcodeRotation == 270) {
                  printf("CHANGE SHAPE YLongOct;\n");
                  printf("CHANGE DIAMETER %s;\n", format(py) );
                  }
               else {
                  printf("CHANGE SHAPE XLongOct;\n");
                  printf("CHANGE DIAMETER %s;\n", format(py) );
                  }
               }
            else {
               printf("CHANGE SHAPE OCTAGON;\n");
               if (py > px1 || py > px2) {
                  printf("CHANGE DIAMETER %s;\n", format(py) );
                  }
               else {
                  printf("CHANGE DIAMETER %s;\n", format(px2) );
                  }
               }
            }
         printf("PAD '%s' (%s %s);\n", padcodepinname, format(padcoderelx), format(padcoderely) );
         }
      } while (c[n]);
      return ;
   }
void arcdescript(void) {
   do {
      string arcxs = read(',', 0);
      if (strrchr(arcxs, ';') == 0) {
         n++;
         return ;
         }
      real arcx = val2mil(arcxs);
      real arcy = val2mil(read(',', 0));
      real arcradius = val2mil(read(',', 0));
      real ang1 = strtod(read(',', 0)) / rotatemultiple ;
      real ang2 = strtod(read(',', 1)) / rotatemultiple ;
      printf("CHANGE LAYER 21;\n");
      if(ang1 == 0 && ang2 == 360) {
         printf("CIRCLE (%s %s) (%s %s);\n", format(arcx), format(arcy), format(arcx - arcradius), format(arcy) );
         }
      else {
         real endangle = ang1 + ang2;
         if (endangle >= 360) {
            endangle -= 360;
            }
         real startXarc = arcradius * cos(PI / 180 * ang1);
         real startYarc = arcradius * sin(PI / 180 * ang1);
         real endXarc = arcradius * cos(PI / 180 * endangle);
         real endYarc = arcradius * sin(PI / 180 * endangle);
         printf("ARC CCW (%s %s) (%s %s) (%s %s);\n",
              format(arcx + startXarc), format(arcy + startYarc),
              format(arcx - startXarc), format(arcy - startYarc),
              format(arcx + endXarc),   format(arcy + endYarc) );
         }
      } while (c[n]);
   return ;
   }
void ShapeDef(void) {
   n++;
   shapename = read(cr, 1);
   printf("EDIT '" + shapename + ".PAC';\n");
   printf("CHANGE FONT VECTOR;\n");
   real ShapeNameRelx   = val2mil(read(' ', 0));
   real ShapeNameRely   = val2mil(read(' ', 0));
   real ShapeNameHeight = val2mil(read(' ', 0));
   real ShapeNameRotate = strtod(read(' ', 0));
   real ShapeNameWidth  = val2mil(read(' ', 0));
   real ShapeNameThickness = strtod(read(' ', 1));
   real AliasNameRelx   = val2mil(read(' ', 0));
   real AliasNameRely   = val2mil(read(' ', 0));
   real AliasNameHeight = val2mil(read(' ', 0));
   real AliasNameRotate = strtod(read(' ', 0));
   real AliasNameWidth  = val2mil(read(' ', 0));
   real AliasNameThickness = strtod(read(' ', 1));
   if (ShapeNameHeight == 0) {
      ShapeNameHeight = 1;
      }
   real strglen2 = stringLength(shapename, ShapeNameHeight) / 2;
   printf ("CHANGE SIZE %s;\n", format(ShapeNameHeight ) );
   printf ("CHANGE LAYER 25;\n");
   printf ("TEXT '>NAME' (%s %s);\n", format(ShapeNameRelx - strglen2), format(ShapeNameRely - (ShapeNameHeight / 2)) );
   if (AliasNameHeight == 0) {
      AliasNameHeight = 1;
      }
   strglen2 = stringLength(shapename, AliasNameHeight) / 2;
   printf ("CHANGE SIZE %s;\n", format(AliasNameHeight) );
   printf ("CHANGE LAYER 27;\n");
   printf ("TEXT '>VALUE' (%s %s);\n", format(AliasNameRelx), format(AliasNameRely- (AliasNameHeight / 2)) );
   n++;
   string RthJuncBoard = read(cr, 1);
   outlinedescript();
   n++;
   cntShape++;
   pointPackPin[cntShape] = cntrefPin;
   refPackname[cntShape] = shapename;
   pindescript();
   arcdescript();
   return ;
   }
string nnameCheck(string name, int nb) {
   name = strsub(name, 1);
   if (name == "") {
      sprintf(name, "SB$%d", nb);
      }
   int ch;
   do {
      ch = strchr( name, '\'');
      if (ch == -1) break;
      else name[ch] = '/';
      } while (ch != -1);
   return name;
   }
void NetDef(void) {
   n+= 2;
   net++;
   netname[net] = read(' ' ,0);
   if(netname[net] == "65535") {
     netname[net] = "";
     dlgMessageBox("NEt 65535","OK");
     }
   nettracecode[net] = strtod(read(' ' ,0));
   netxlo[net] = strtol(read(' ' ,0));
   netxhi[net] = strtol(read(' ' ,0));
   netylo[net] = strtol(read(' ' ,0));
   netyhi[net] = strtol(read(' ' ,0));
   netxsum[net] = strtol(read(' ' ,0));
   netysum[net] = strtol(read(' ' ,0));
   netpincount[net] = strtod(read(';' ,1));
   netname[net] = nnameCheck(netname[net], net);
   return ;
   }
string GenNet(void) {
     string sign = "";
      for (int s = 0; s <= net; s++) {
         string sig;
         sprintf(sig, "SIGNAL '%s'\n%s\n", netname[s], signal[s] );
         sign += sig;
         }
   return sign;
   }
void ComponentDef(void) {
   n += 1;
   comp++;
   string componentName      = read(' ', 0);
   string componentAlias     = read(' ', 0);
   string componentShapename = read(cr, 1);
   real componentX           = val2mil(read(',', 0));
   real componentY           = val2mil(read(',', 0));
   real componentRotate      = strtod(read(',', 0)) / rotatemultiple;
   real componentNameX       = val2mil(read(',', 0));
   real componentNameY       = val2mil(read(',', 0));
   real componentNameRotate  = strtod(read(',', 0)) / rotatemultiple;
   real componentNameHeight  = val2mil(read(',', 0));
   real componentNameWidth   = val2mil(read(',', 0));
   real componentNameThick   = strtod(read(',', 0));
   real componentAliasX      = val2mil(read(',', 0));
   real componentAliasY      = val2mil(read(',', 0));
   real componentAliasRotate = strtod(read(',', 0)) / rotatemultiple;
   real componentAliasHight  = val2mil(read(',', 0));
   real componentAliasWidth  = val2mil(read(',', 0));
   real componentAliasThick  = val2mil(read(cr, 1));
   string ca;
   sprintf(ca, "CHANGE LAYER 27;\n");
   cmdvalue += ca;
   if (componentAliasHight == 0) componentAliasHight = 1;
   sprintf (ca, "change size %s;\n", format(componentAliasHight) );
   cmdvalue += ca;
   if (componentAliasThick <= 0) componentAliasThick = 50;
   sprintf (ca, "change ratio %.0f;\n", componentAliasThick / 100 * TextRatio );
   cmdvalue += ca;
   sprintf(ca, "TEXT '%s' R%.0f (%s %s);\n", componentAlias, componentAliasRotate, format(componentAliasX), format(componentAliasY) );
   cmdvalue += ca;
   real stringlengh_2 = stringLength(componentName, componentNameHeight ) / 2;
   sprintf(ca, "%s\n%.2f\n%.0f\n%s\n%s\n", componentName, stringlengh_2, componentNameRotate, format(componentNameX), format(componentNameY) );
   cmdchname += ca;
   sprintf (ca, "%s\n", format(componentNameHeight) );
   cmdchname += ca;
   sprintf (ca, "%.0f\n", componentNameThick / 100 * TextRatio );
   cmdchname += ca;
   real componentXforceVect = val2mil(read(',', 0));
   real componentYforceVect = val2mil(read(',', 0));
   real componentTempcase = val2mil(read(',', 0));
   real componentTempjunc = val2mil(read(',', 0));
   real componentPower = val2mil(read(',', 0));
   real componentRTHjuncboard = val2mil(read(',', 0));
   real nul                   = val2mil(read(cr, 0));
   sprintf(st, "ADD %s '%s' R%.0f (%s %s);\n", componentShapename, componentName, componentRotate, format(componentX), format(componentY) );
   brd += st;
   sprintf(st, "SMASH (%s %s);\n", format(componentX), format(componentY) );
   brd += st;
   int pin = 0;
   int z = 0;
   for ( int p = 0 ; p <= cntShape ; p++ ) {
      if ( componentShapename == refPackname[p]) {
         z = pointPackPin[p];
         break ;
         }
      }
   do {
      string componentNetNr = read(' ', 0);
      string componentPadSetting = read(' ', 1);
      if (componentNetNr == ";") break;
      int NetNr = strtod(componentNetNr);
      if (NetNr <= net) {
         string sig;
         sprintf(sig, "%s %s\n", componentName, refPinNr[z + pin]);
         signal[NetNr] += sig;
         pin++;
         }
      } while (c[n]);
   n--;
   return ;
   }
void LTrace(void) {
  n++;

⌨️ 快捷键说明

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