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

📄 unidat.ulp

📁 老外的PCB设计软件,是免费的.可以上网更新.
💻 ULP
字号:
#usage "<b>Export UNIDAT format</b>\n"
       "<p>"
       "<author>Author: support@cadsoft.de</author>"

#require 4.1106

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

///////////////////////////////////////////////////////////////////////////////////////////
// Rudi Hofer, CadSoft, rudi.hofer@cadsoft.de, 9/1999
//
// Revision 1.1: shape names derived from element names instead of package names (unique!)
// Revision 1.2: output limited to elements with package in routine "component"
// Revision 1.3: output of round pads corrected
// Revision 2.0: shape names again derived from package names (seems to be the only
//               solution which makes sense)
//
// Revision 3.0: include Crossref.ULP with Pin_Name from Sheet     -- alf@cadsoft.de
// Revision 4.0: for EAGLE Version 4.0 with Dialog                 -- alf@cadsoft.de
// Revision 5.0: exports Polygon of signals                        -- alf@cadsoft.de
// Revision 6.0: exports Fiducial if placed from MAKRS.lbr         -- alf@cadsoft.de 30.03.2004
//               Source: unidat.format.91010.doc from <Claus.Kessel@tecnomatix.com>
//
// Revision 7.0: correct rotation in rot() function 16.02.2005 alf@cadsoft.de
// Revision 8.0: Display status of ULP in any function             -- alf@cadsoft.de 31.03.2005
//               Function rot() : correct rotation for any angle
//                                Pad/Smd-Rotation consider in Eagle 4.1
//                                resolution in 1/1000
//
///////////////////////////////////////////////////////////////////////////////////////////
// Since version 2.0 all packages with the same name must be identical (avoid REPLACE!)
///////////////////////////////////////////////////////////////////////////////////////////
// This ULP generates output for UNICAM software which is able to convert the
// data for automatic mounting and test equipment. The resolution is fixed to 1/100 mm.
//
// To generate the output, load the board and run this ULP.
//
// You can provide properties like "partnumber", "tolerance" etc. in the
// component library:
//
// - define a user layer named UNIDAT
// - add texts in the form "propertyname=value" to this layer, e.g.
//   partnumber=12345
//   pos_tolerance=0.05
// - see array property[] below for predefined property names
// - by changing the array contents you can change the property names
//   (do not change the number of array entries!)
//
// OUTPUT OF PROPERTIES IS ONLY POSSIBLE IF FORWARD & BACK ANNOTATION IS USED AND
// IF THE SCHEMATIC AND THE BOARD ARE LOADED!
// THE PROGRAM HAS TO BE EXECUTED FROM THE BOARD WINDOW!
//
//
// Pads of the shape type OCTAGON are changed to round, if the following variable
// is set to 1 (otherwise set to 0)

   int disp_oct_as_round = 1;

//
///////////////////////////////////////////////////////////////////////////////////////////

/* Dieses ULP erzeugt eine Cross-Referenzliste zwischen Pad und Pin ***
 * Dabei wird eine Liste generiert, in der die Koordinaten
 * der Pads/Netze im Board, in Bezug zu den Pins/Netze im
 * Schaltplan(Sheet Nr.) stehen.
 * A. Zaffran CadSoft 07.09.1999
 */

/*

%COMPONENT
C1|N$5|sheet2|15.240,8.890|mm|
C1|1|N$5|sheet2|15.240,8.890|mm|
|  | |     |       |    |
|  | |     |       X    Y
|  | |    Seite
|  | Netzname
|  Pad-Name
Bauteil

%PINS
IC1|IC1A|FILTER|1|I0|sheet1|25.40,22.86|mm|
|    |     |    |  |   |      |     |
|    |     |    |  |   |      X     Y
|    |     |    |  |   Seite
|    |     |    |  Symbolischer Pin-Name
|    |     |    Numerischer Pin-Name
|    |     Netzname
|    Gate-Name
Bauteil

*/

string _MARKER_ = "marks";  // the library name for fiducials

int   px[], py[], ps[], PinPoints = 0;  // Pin: x, y, sheet, counter
string  pa[],      pg[],      pc[],         pn[],    pnn[];
     // Part-name, gate-name, contact-name, pinname, pin-netname

int   padx[], pady[], pads[], PadPoints = 0;  // Pad: x, y, sheet, counter
string  padd[], padn[], padnn[];              // devicename, padname, pad-netname

int   sheetload = 0;
string proz = "%";
string Pad_Pin = "";

enum { bottom = 16 };

string reffile;
string unifile;

string ULPversion = filename(argv[0]);

//-----------------------------------------------------

string user_layer_name = "unidat", // layer name for property definitions (lower case!)
       jobname,
//     jobrevision = "1.0",
       layer_name[],
       property_assign_char = "=",
       property[] = {"partnumber"        // propterty[0] is partnumber and so on
                    ,"parttype"
                    ,"description"
                    ,"pos_tolerance"
                    ,"neg_tolerance"
                    ,"user1"
                    ,"user2"
                    ,"user3"
                    },
       property_value[],
       /*
       PAD_SHAPE_SQUARE   square
       PAD_SHAPE_ROUND    round
       PAD_SHAPE_OCTAGON  octagon
       PAD_SHAPE_LONG     long
       PAD_SHAPE_OFFSET   offset
       PAD_SHAPE_ANNULUS  annulus (only in Supply-Layer)
       PAD_SHAPE_THERMAL  thermal (only in Supply-Layer)
       */
       padshape[] = {"S","R","O","L","T"},  // shapes - square, round, oct, long, offset
       padname,
       shapename[];

real   ang2, cx, cy, rx, ry, x, y, x1, x2, y1, y2, r, a1, a2;;

int    i,
       padcount,
       pad_is_numeric,
       max_property = 7,
       new,
       sx = 0;

// --------------------------------------------------------------------

void test(void) {
  string ref;
  int nr = fileread(ref, reffile);
  string uni;
  int nu = fileread(uni, unifile);
  dlgDialog("UNIDAT File export") {
    dlgLabel("UNIDAT File: " + unifile);
    dlgTextView(uni);
    dlgLabel("Cross reference file: " + reffile);
    dlgTextView(ref);
    dlgHBoxLayout { dlgSpacing(400); }
    dlgLabel("Fiducial library = '" + _MARKER_ + "'");
    dlgHBoxLayout {
      dlgStretch(1);
      dlgPushButton("+OK") dlgAccept();
      dlgStretch(1);
    }
  };
  return;
}

void Header(string name) {
  printf(";This file is generated by %s from:\n", ULPversion);
  printf(";%s';\n", name);
}

int search_Pad_Pin(string name, string pad) {
  for (int pin = 0; pin < PinPoints; pin++) {
    if (pa[pin] == name && pc[pin] == pad){
      break;
    }
  }
  if (pin == PinPoints) pin = -2;
  return pin;
}

// --------------------------------------------------------------------

real u2u(int x) { // resolution 1/100 mm
   x = round(x * 100)/100;
   return u2mm(x);  // if mm
}

real u2ang(real x) {
  if (x > 360)
     x = x -360;
  x = round(x * 10)/10;
  return x;
}

//-----------------------------------------------------
real Xneu(real Xalt, real Yalt, real Xorigin, real Yorigin, real UserWinkel) {
  real RADIUS = sqrt(((Xalt - Xorigin) * (Xalt - Xorigin)) + ((Yalt - Yorigin) * (Yalt - Yorigin)));
  real WinkelNeu;                     /* alter Cosinus Winkel = (Xalt - Xorigin) / RADIUS; */

  if ((Xalt > Xorigin) && (Yalt >= Yorigin)) {                 /* Quadrant 1 */
    WinkelNeu = acos((Xalt - Xorigin) / RADIUS) * 57.29578 + UserWinkel;
    real rad = PI / 180 * WinkelNeu;
    return (RADIUS * cos(rad));
  }
  if ((Xalt < Xorigin) && (Yalt >= Yorigin)) {                 /* Quadrant 2 */
    WinkelNeu = acos((Xalt - Xorigin) / RADIUS) * 57.29578 + UserWinkel;
    real rad = PI / 180 * WinkelNeu;
    return (RADIUS * cos(rad));
  }
  if ((Xalt < Xorigin) && (Yalt < Yorigin)) {                  /* Quadrant 3 */
    WinkelNeu = 360 - acos((Xalt - Xorigin) / RADIUS) * 57.29578 + UserWinkel;
    real rad = PI / 180 * WinkelNeu;
    return (RADIUS * cos(rad));
  }
  if ((Xalt > Xorigin) && (Yalt < Yorigin)) {                  /* Quadrant 4 */
    WinkelNeu = 360 - acos((Xalt - Xorigin) / RADIUS) * 57.29578 + UserWinkel;
    real rad = PI / 180 * WinkelNeu;
    return (RADIUS * cos(rad));
  }
  if ((Xalt == Xorigin) && (Yalt == Yorigin)) {                /* Ursprung   */
    WinkelNeu = (Xalt - Xorigin) + UserWinkel;
    real rad = PI / 180 * WinkelNeu;
    return (RADIUS * cos(rad));
  }
  if ((Xalt == Xorigin) && (Yalt > Yorigin)) {                 /* 90

⌨️ 快捷键说明

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