-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathCentroid_ScreamingCircuits_smd.ulp
More file actions
executable file
·55 lines (50 loc) · 1.36 KB
/
Copy pathCentroid_ScreamingCircuits_smd.ulp
File metadata and controls
executable file
·55 lines (50 loc) · 1.36 KB
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
/*
* This EAGLE User Language Program creates the proper format
* Centroid file for assembly at Screaming Circuits including
* the reference designator, position, layer and orientation
* of each part
*
*
* Version 1.0, May 16, 2006
*
* www.screamingcircuits.com
*
*/
string rotation(real Angle)
{
string s;
sprintf(s, "%.1f", Angle);
for (int i = 0; s[i]; i++)
if (s[i] == '.') {
if (s[i + 1] == '0')
s[i] = 0;
break;
}
return s;
}
string side(int Mirror)
{
string s;
if (Mirror){
s = "Bottom";
}
else {
s = "Top";
}
return s;
}
if (board) board(B) {
output(filesetext(B.name, " centroid.csv")) {
printf("Screaming Circuits SMD component position file.\n\n");
printf("Centroid Data for pc board: \"%s\" as of: %s\n", filename(B.name), t2string(time()));
printf("Measurements are in inches. Comma delimited\n");
printf("Only surface mount components included\n\n");
printf("%s,%s,%s,%s,%s\n", "RefDes", "Layer", "LocationX", "LocationY", "Rotation");
B.elements(E) {
int isSmd;
isSmd = 0;
E.package.contacts(C) { if (C.smd) isSmd = 1; }
if (isSmd) printf("%s,%s,%5.3f,%5.3f,%s\n", E.name, side(E.mirror), u2inch(E.x), u2inch(E.y), rotation(E.angle));
}
}
}