1
0
Fork 0
This repository has been archived on 2019-12-23. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
arduinisten/eagle-5.7.0/ulp/mountsmd.ulp

93 lines
2.4 KiB
Text
Raw Normal View History

2010-03-30 20:14:34 +02:00
#usage "<b>Data generation for mounting machines</b>\n"
"<p>"
"Generates files for smds on the top and bottom layers "
"wich can be used with mounting machines. "
"The x and y coordinates (units: mm) of the SMD elements are calculated "
"as mean of maximum and mimimum value of the 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>name x-coord y-coord rotation value package</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 wasSmd,
xmax =-2147483648,
xmin = 2147483647,
ymax = xmax,
ymin = xmin;
wasSmd = 0;
E.package.contacts(C) {
if (C.smd && C.smd.layer == 1) {
wasSmd = 1;
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;
}
}
if (wasSmd)
printf("%s %5.2f %5.2f %3.0f %s %s\n",
E.name, u2mm((xmin + xmax)/2), u2mm((ymin + ymax)/2),
E.angle, E.value, E.package.name);
}
}
// Get filename
fileName = dlgFileSave("Save File", filesetext(B.name, ".mnb"), "*.mnb");
if (fileName == "") exit(0);
output(fileName) {
B.elements(E) {
int wasSmd,
xmax =-2147483648,
xmin = 2147483647,
ymax = xmax,
ymin = xmin;
wasSmd = 0;
E.package.contacts(C) {
if (C.smd && C.smd.layer == 16) {
wasSmd = 1;
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;
}
}
if (wasSmd)
printf("%s %5.2f %5.2f %3.0f %s %s\n",
E.name, u2mm((xmin + xmax)/2), u2mm((ymin + ymax)/2),
E.angle, E.value, E.package.name);
}
}
}
else {
dlgMessageBox("\n Start this ULP in a Board \n");
exit (0);
}