File: mount.ulp

package info (click to toggle)
eagle 4.16-5
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 36,508 kB
  • sloc: sh: 82; makefile: 32
file content (50 lines) | stat: -rw-r--r-- 1,413 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#usage "<b>Data generation for mounting machines</b>\n"
       "<p>"
       "Generates a file that can be used with mounting machines. "
       "The x- and y- coordinates (units: mil) are calculated as mean of "
       "maximum and mimimum value of the pads or smds origin points. "
       "The calculated value does not necessarily fit with the origin "
       "point of the part in the layout."
       "<p>"
       "The syntax of the output data looks like this:"
       "<p>"
       "<tt>value;x-coord;y-coord;rotation;name</tt>"
       "<p>"
       "<author>Author: support@cadsoft.de</author>"

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

if (board) board(B) {

  // Get filename
  string fileName = dlgFileSave("Save File", filesetext(B.name, ".mnt"), "*.mnt");
  if (fileName == "") exit(0);

  output(fileName) {

   B.elements(E) {

     int xmax =-2147483648,
         xmin = 2147483647,
         ymax = xmax,
         ymin = xmin;

       E.package.contacts(C) {

         if (C.x > xmax) xmax = C.x;
         if (C.y > ymax) ymax = C.y;
         if (C.x < xmin) xmin = C.x;
         if (C.y < ymin) ymin = C.y;  }


       printf("%s;%5.0f;%5.0f;%3.0f;%s \n",
             E.value, u2mil((xmin + xmax)/2), u2mil((ymin + ymax)/2),
             E.angle, E.name );
   }
  }
}

else {
   dlgMessageBox("\n    Start this ULP in a Board    \n");
   exit (0);
}