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

📄 import-ultiboard-ddf.ulp

📁 老外的PCB设计软件,是免费的.可以上网更新.
💻 ULP
📖 第 1 页 / 共 4 页
字号:
#usage "<b>Import ULTIBOARD PCB Design Data File format (DDF)</b>\n"
       "<p>"
       "Imports ULTIBOARD PCB Design Data File format (DDF) Version 4.80 & 5.50."
       "<p>"
       "Based on : Ultiboard User Manual, Appendix A, FILE FORMATS."
       "<p>"
       "ULTIBOARD is a registered trademark of Electronics Workbench."
       "<p>"
       "<author>Author: support@cadsoft.de</author>"

// THIS PROGRAM IS PROVIDED AS IS AND WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED

string InfoUS =
       "<qt>Confirm the message:<p>\n" +
       "<b>connect Signals</b><p>\n" +
       " S$nn <p>\n" +
       " S$nn<p>\n" +
       " with <b>OK</b>.<p>" +
       "<hr>" +
       "This message will be prompted if a net segment (track) is connected to another " +
       "net segment. " +
       "The reason for this is the way ULTIBOARD exports the tracks, first the " +
       "horizontal ones, then the vertical ones and at least tracks that run diagonal." +
       "If ULTIBOARD has not named a segment of a track, EAGLE generates a name of" +
       "its own and uses the <b>$</b> sign at second position in it." +
       "Please notice that the text height (and length) differs in EAGLE and " +
       "ULTIBOARD. The position of the text will be calculated dependent on " +
       "the the height and length of each character of the EAGLE vector font.<p>" +
       " - ULTIBOARD uses the text center as origin point<p>" +
       " - EAGLE uses the left lower corner of the text as origin point.<p>" +
       "The DDF format does not provide information about the lenght of characters.<p>";

string ULTIBoardinfo =
          "<b>ULTIBOARD Version 4, Revision 80</b><p>" +
          " The x_coord and y_coord are expressed in database units (1/1200th of an inch)<p>" +
          " The rotation is given in degrees, specified as a floating point number between 0.0 and 360.0 degrees.<p>" +
          " Internally, Ultiboard works with a precision of 1/64th degree<p>" +
          "<hr> " +
          "<b>ULTIBOARD Version 5, Revision 50</b><p>" +
          " The x_coord and y_coord are expressed in database units (1 nanometer)<p>" +
          " The rotation is given in degrees, specified as a floating point number between 0.0 and 360.0 degrees.<p>" +
          " Internally, Ultiboard works with a precision of 1/64th degree<p>" +
          "<hr> " +
          "ULTIBOARD is a registered trademark of Electronics Workbench";

string InfoDE =
       "<qt>Best&auml;tigen sie die Meldung:<p>\n" +
       "<b>connect Signals</b><p>\n" +
       " S$nn <p>\n" +
       " S$nn<p>\n" +
       " mit <b>OK</b>.<p>" +
       "Diese Meldung wird dadurch erzeugt, da&szlig; ein Netzsegment (Leiterzug) mit " +
       "einem anderen Netzsegment verbunden wird. " +
       "Die Ursache ist die Reihenfolge der Ausgabe der Leiterbahn-Segmente aus ULTIBOARD, " +
       "da ULTIBOARD zuerst waagrechte dann senkrechte und am Schlu&szlig; diagonale " +
       "Leiterbahnsegmente ausgibt.<p>" +
       "Wird von ULTIBOARD diesen Leitersegmenten kein Netzname zugewiesen, " +
       "so erzeugt EAGLE einen Namen mit dem Zeichen <b>$</b> an zweiter Position.<p>" +
       "<hr> "  +
       "Beachten Sie, da&szlig; die Buchstabengr&ouml;&szlig;en (Zeichenl&auml;nge) " +
       "von ULTIBOARD und EAGLE nicht identisch sind. Die Position der Texte wird " +
       "berechnet durch die Texth&ouml;he und dem Wert der Zeichenl&auml;nge jedes " +
       "Buchstaben des EAGLE-Vector-Font.<p>\n" +
       " - ULTIBOARD plaziert Texte am Mittelpunkt des Textes.<p>" +
       " - EAGLE plaziert Texte mit der linken unteren Ecke des 1. Buchstaben.<p>" +
       "Das ULP berechnet die Position anhand der Stringl&auml;nge und Texth&ouml;he. " +
       "Im DDF-Format gibt es keine Information bez&uuml;glich der Buchstabenl&auml;nge, " +
       "dadurch kann es vorkommen, da&szlig; l&auml;ngere Texte nicht exakt an der gleichen " +
       "Position wie im ULTIBOARD Layout positioniert werden.<p>"  +
       "<hr> "  +
       "Die <b>Warnung</b>: No forward-/backannotation will be performed!<p>" +
       "wird erzeugt, falls ein Schaltplan zur Laufzeit des ULP geladen ist, und mu&szlig; " +
       "mit <b>OK</b> best&auml;tigt werden.<p>";

string Version = "1.1.0";
string costomer;
string versionnumb;
string revisionnum;
string tmpchtxtfile = ".ch$";
string tmpextfile = "$.scr";
string changetextfile;
string scriptfile;
string ULTIversion[] = { "480", "550" };
real   ULTIscale[]   = {  1.20,  25400.0 };
real   rotatemult[]  = {  64  ,  64 };
int VersionCnt = 2;
real xScale;
real rotatemultiple;
string Grid = "MIL";
real CharacterLength;
real eagle_caracter_length[] = {
     00.000, 00.000, 00.000, 00.000,
     00.000, 00.000, 00.000, 00.000,
     00.000, 00.000, 00.000, 00.000,
     00.000, 00.000, 00.000, 00.000,
     00.000, 00.000, 00.000, 00.000,
     00.000, 00.000, 00.000, 00.000,
     00.000, 00.000, 00.000, 00.000,
     00.000, 00.000, 00.000, 00.000,
     00.917, 00.303, 00.764, 00.917,
     00.917, 01.071, 00.917, 00.610,
     00.764, 00.764, 00.917, 00.917,
     00.764, 00.917, 00.764, 00.917,
     00.917, 00.764, 00.917, 00.917,
     00.917, 00.917, 00.917, 00.917,
     00.917, 00.917, 00.764, 00.764,
     00.917, 00.917, 00.917, 00.917,
     00.917, 00.917, 00.917, 00.917,
     00.917, 00.917, 00.917, 00.917,
     00.917, 00.764, 00.917, 00.917,
     00.917, 00.917, 00.917, 00.917,
     00.917, 00.917, 00.917, 00.917,
     00.917, 00.917, 00.917, 00.917,
     00.917, 00.917, 00.917, 00.764,
     00.917, 00.764, 00.917, 00.917,
     00.610, 00.917, 00.917, 00.917,
     00.917, 00.917, 00.764, 00.917,
     00.917, 00.764, 00.917, 00.917,
     00.764, 00.917, 00.917, 00.917,
     00.917, 00.917, 00.917, 00.917,
     00.764, 00.917, 00.917, 00.917,
     00.917, 00.917, 00.917, 00.917,
     00.457, 00.917, 00.917, 00.917,
     01.390, 01.236, 01.390, 00.150,
     -6.000, 00.000, 00.307, 00.618,
     00.618, 00.307, 00.925, 00.618,
     00.610, 00.307, 00.307, 00.917,
     00.618, 00.618, 00.618, 00.917,
     00.917, 00.917, 00.618, 00.925,
     00.925, 00.618, 00.925, 00.925,
     00.917, 00.618, 00.610, 01.071,
     00.000, 00.303, 00.917, 01.224,
     00.618, 00.610, 00.307, 00.764,
     00.457, 00.610, 00.917, 00.917,
     00.917, 00.917, 00.917, 00.764,
     00.764, 00.917, 00.610, 00.917,
     00.917, 00.917, 00.764, 00.457,
     00.764, 00.917, 00.917, 00.917,
     01.071, 01.071, 00.917, 00.917,
     00.917, 00.610, 00.917, 00.618,
     00.917, 00.917, 01.531, 00.917,
     00.307, 00.917, 00.618, 00.618,
     00.618, 00.618, 00.925, 00.618,
     00.618, 00.917, 01.071, 01.071,
     00.764, 01.071, 00.917, 01.224,
     01.071, 00.764, 00.917, 00.917,
     00.917, 00.917, 00.917, 00.764,
     00.917, 00.917, 00.917, 00.307,
     00.917, 00.917, 01.378, 00.917,
     00.917, 00.917, 00.917, 00.917,
     00.764, 00.610, 00.764, 00.764,
     00.618, 00.917, 00.917, 00.917,
     00.917, 00.917, 00.917, 00.764,
     00.917, 00.917, 00.917, 00.917,
     00.917, 01.224, 01.071, 00.917
     };
real   def_grid;
real   refpointx;
real   refpointy;
string ulp_path = "";
int    lastLayer = 0;
string filter;
string ddffile;
int    Result = 0;
string st     = "";
char lf    = 10;
char cr    = 13;
char nl    = 12;
char polysepar = ':';
char semikolon = ';';
string cmd  = "";
string brd  = "";
string cmdroute = "";
string script = "";
string polygon = "";
string arcscript = "";
string cmdchname = "";
string cmdvalue = "";
real   TextRatio = 8;
char c[];
int  nBytes = 0;
int  n = 0;
string fileName = "";
string shapename = "";
string refLayer[] = { "49",
                      "1",
                      "16",
                      "2",
                      "3",
                      "4",
                      "5",
                      "6",
                      "7",
                      "8",
                      "9",
                      "10",
                      "11",
                      "12",
                      "13",
                      "14",
                      "15",
                      "116",
                      "117",
                      "118",
                      "119",
                      "120",
                      "121",
                      "122",
                      "123",
                      "124",
                      "125",
                      "126",
                      "127",
                      "128",
                      "129",
                      "130",
                      "131"
                      };
string TMrefLayer[] = { "",
                        "",
                        "M",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        "",
                        ""
                        };
real boardoutline[];
string layerDirection[];
real tracewidth[];
real traceclearance[];
real drilltolerance;
real drilltolerancevalue;
int  drillcode[];
real pad0innerX1[];
real pad0innerX2[];
real pad0innerY[];
real pad0innerRadius[];
real pad0innerClear[];
real pad0innerHorizont[];
real pad0innerVertical[];
real pad0innerThermH[];
real pad0innerThermV[];
real pad1topX1[];
real pad1topX2[];
real pad1topY[];
real pad1topRadius[];
real pad1topClear[];
real pad1topHorizont[];
real pad1topVertical[];
real pad1topThermH[];
real pad1topThermV[];
real pad2bottomX1[];
real pad2bottomX2[];
real pad2bottomY[];
real pad2bottomRadius[];
real pad2bottomClear[];
real pad2bottomHorizont[];
real pad2bottomVertical[];
real pad2bottomThermH[];
real pad2bottomThermV[];
int net = -1;
string netname[];
int  nettracecode[];
real netxlo[];
real netxhi[];
real netylo[];
real netyhi[];
real netxsum[];
real netysum[];
int  netpincount[];
netname[65535] = "";
int    cntrefPin = 0;
string refPinNr[];
string refPackname[];
int    pointPackPin[];
int    cntShape = 0;
string signal[];
string brdvia;
int comp = 0;
real stringLength(string s, real hight) {
   real len = 0;
   for (int l = 0; l < strlen(s); l++) {
      len += (eagle_caracter_length[s[l]] * hight);
      }
   return len;
   }
void importpass2(void) {
   string changetextfile = argv[2];
   string scriptfile = filesetext(changetextfile, "$" + tmpextfile);
   string s[];
   int nString = fileread(s, changetextfile);
   if (board) board(B) {
      output(scriptfile, "wt") {
         printf("DISPLAY NONE 25;\n");
         printf("GRID %s FINEST;\n", Grid);
         B.elements(E) {
            for (int n = 0; n < nString; n+= 7) {
               if (E.name == s[n]) {
                  E.texts(T) {
                     if (T.layer == 25 && T.value == s[n]) {
                       real size   = strtod(s[n+5]);
                       if (size != 0) {
                          printf("# %s\n", s[n]);
                          real r = T.angle;
                          int pacnametextrotate  = abs(r);
                          real slen   = strtod(s[n+1]);
                          int trotate = strtod(s[n+2]);
                          real relx   = strtod(s[n+3]);
                          real rely   = strtod(s[n+4]);
                          real ratio  = strtod(s[n+6]);
                          if(ratio <= 1) ratio = 1;
                          printf("CHANGE SIZE %.2f (%.2f %.2f);\n", size, u2mil(T.x), u2mil(T.y) );
                          printf("CHANGE RATIO %.0f (%.2f %.2f);\n", ratio, u2mil(T.x), u2mil(T.y) );
                          int pacrotate = E.angle;
                          if (pacrotate == pacnametextrotate) {
                             switch (pacrotate) {
                                case   0 :
                                   switch(trotate) {
                                      case   0 :
                                           printf("MOVE (%.2f %.2f) (%.2f %.2f);\n",
                                              u2mil(T.x), u2mil(T.y),
                                              u2mil(E.x) + (relx) - slen,
                                              u2mil(E.y) + (rely) - (size/2) );
                                           break;
                                      case  90 :
                                           printf("ROTATE (%.2f %.2f);\n", u2mil(T.x), u2mil(T.y) );
                                           printf("MOVE (%.2f %.2f) (%.2f %.2f);\n",
                                              u2mil(T.x), u2mil(T.y),
                                              u2mil(E.x) + (relx) + (size/2),
                                              u2mil(E.y) + (rely) - slen );
                                           break;
                                      case 180 :
                                           printf("ROTATE (%.2f %.2f);\n", u2mil(T.x), u2mil(T.y) );
                                           printf("ROTATE (%.2f %.2f);\n", u2mil(T.x), u2mil(T.y) );
                                           printf("MOVE (%.2f %.2f) (%.2f %.2f);\n",
                                              u2mil(T.x), u2mil(T.y),
                                              u2mil(E.x) + (relx) + slen,
                                              u2mil(E.y) + (rely) + (size/2));
                                           break;
                                      case 270 :
                                           printf("ROTATE (%.2f %.2f);\n", u2mil(T.x), u2mil(T.y) );
                                           printf("MOVE (%.2f %.2f) (%.2f %.2f);\n",
                                              u2mil(T.x), u2mil(T.y),
                                              u2mil(E.x) + (relx) + (size/2),
                                              u2mil(E.y) + (rely) - slen );
                                           break;
                                      }
                                   break;
                                case  90 :
                                   switch(trotate) {

⌨️ 快捷键说明

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