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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
|
#usage "<b>Export data for SMD solder cream dispenser</b>\n"
"<p>"
"Generates data to control the solder cream dosage for the dispenser "
"unit of 'Martin' on 'Bungard' drill/milling machines."
"<p>"
"The file <i>boardname.plt</i> contains the coordinates of the SMD pads "
"in the Top layer, while <i>boardname.plb</i> contains those in the "
"bottom layer."
"<p>"
"The file <i>boardname.dod</i> contains the information of the SMD pads "
"regarding tool number Txx."
"<p>"
"<author>Author: support@cadsoft.de</author>"
// THIS PROGRAM IS PROVIDED AS IS AND WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED
/*
Mit uval = 0 - 3 kann die Einheit ** der Daten eingestellt werden.
** 0: 1/10 mil
** 1: 1 mil
** 2: 0.025 mm
** 3: 0.01 mm
*06.12.2001 az
*/
int uval = 3;
string Version = "1.0.4";
int smdx[], smdy[]; // size of smd
int x[], y[]; // coordinate of SMD
int tb[]; // top or bottom side
int index[];
int c = 0; // counter
void header(void) {
switch (uval) {
case 0 :
printf("1/10 mil\n%%\n");
break;
case 1 :
printf("1 mil\n%%\n");
break;
case 2 :
printf("0.025 mm\n%%\n");
break;
case 3 :
printf("0.01 mm\n%%\n");
break;
}
}
real value (int v) {
switch (uval) {
case 0 :
return (u2mil(v) * 10);
case 1 :
return (u2mil(v));
case 2 :
return (u2mm(v) * 40);
case 3 :
return (u2mm(v) * 100);
}
}
void genfiles(string file) {
sort(c, index, tb, smdx, smdy, x, y); // sortiere top/bottom, groesse, coord.
int tool = 0;
int ox =0;
int oy =0;
for (int n = 0; n < c; n++) {
if (smdx[index[n]] == ox && smdy[index[n]] ==oy) {
;
}
else { // *** change tool #
ox = smdx[index[n]];
oy = smdy[index[n]];
tool++;
printf("T%02d\n", tool); // print tool change in file #1
output(filesetext(file, ".plb"), "at") {
printf("T%02d\n", tool); // print tool change in file #2
}
output(filesetext(file, ".dod"), "at") { // print in file #3
printf("T%02d X%06.0f Y%06.0f\t| %06.2f\n", tool,
value(smdx[index[n]]), value(smdy[index[n]]),
u2mm(smdx[index[n]]) * u2mm(smdy[index[n]]) );
}
}
if (tb[index[n]]) {
printf("X%06.0fY%06.0f\n",
value(x[index[n]]), value(y[index[n]]) );
}
else {
output(filesetext(file, ".plb"), "at") {
printf("X%06.0fY%06.0f\n",
value(x[index[n]]), value(y[index[n]]) );
}
}
}
}
void trailer(void) { printf("M30\n"); }
void menue(void) {
dlgDialog("Dose pro") {
dlgLabel (usage);
int align = 1;
dlgHBoxLayout {
dlgGroup("Data resolution") {
dlgRadioButton("1/10 mil", uval);
dlgRadioButton("1 mil", uval);
dlgRadioButton("0.025 mm", uval);
dlgRadioButton("0.01 mm", uval);
}
dlgStretch(1);
}
dlgHBoxLayout {
dlgPushButton("+&OK") dlgAccept();
dlgPushButton("-&Cancel") exit (0);
dlgStretch(1);
}
};
return;
}
// main
if (board) {
board(B) {
menue();
output(filesetext(B.name, ".dod"), "wt") {
printf("This file is generated by %s %s, exported from:\n", filename(argv[0]), Version);
printf("%s at %s;\n", B.name, t2string(time()));
printf("%s;\n\n", EAGLE_SIGNATURE);
}
output(filesetext(B.name, ".plb"), "wt") {
header();
}
output(filesetext(B.name, ".plt"), "wt") {
header();
B.elements(E) {
E.package.contacts(C) {
if (C.smd) {
// collect SMD-Pads
smdx[c] = C.smd.dx;
smdy[c] = C.smd.dy;
x[c] = C.smd.x;
y[c] = C.smd.y;
if (E.mirror) {
tb[c] = 0;
}
else {
tb[c] = 1;
}
c++;
}
}
}
output(filesetext(B.name, ".dod"), "at") {
printf("%d SMD-Pads\n\n", c);
header();
printf("Tool Pad-X Pad-Y Square mm^2\n");
}
genfiles(B.name);
trailer();
output(filesetext(B.name, ".plb"), "at") { trailer(); }
}
}
}
else dlgMessageBox("Start this ULP from a Board!", "OK");
|