-
Notifications
You must be signed in to change notification settings - Fork 0
/
smash_all.ulp
71 lines (56 loc) · 1.5 KB
/
smash_all.ulp
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
#usage "<b>SMASH ALL</b><p>\n"
"<hr>"
"This Program will Execute 'SMASH' Command "
"for all parts on Board or Schematic<p>\n"
// Based on sm_all.ulp by Reinhard Daemon < yum@fexphds01.tu-graz.ac.at >
// Extended by Sergey Molchanov < serge@lineo.ca > 29 May 2001
if (dlgMessageBox("<b>SMASH ALL ?</b>", "+Yes", "No") != 0) exit (0);
int cnt=0, i = 0, coordx[], coordy[];
if (board) board(B)
{
B.elements(E)
{
coordx[cnt] = u2mil(E.x);
coordy[cnt] = u2mil(E.y);
cnt++;
}
}
if (schematic) schematic(S)
{
S.parts(P)
{
P.instances(E)
{
coordx[cnt] = u2mil(E.x);
coordy[cnt] = u2mil(E.y);
cnt++;
}
}
}
string ulp_path;
char bkslash = '/';
int pos = strrchr(argv[0], bkslash);
if (pos >= 0)
{
ulp_path = strsub(argv[0], 0, pos + 1);
}
output(ulp_path + "smash_all.scr","wt")
{
printf("grid mil;\n");
if (board)
{
printf("dis 23;\n");
printf("dis -24;\n");
}
for (i = 0; i < cnt; i++)
printf("smash (%d %d);\n",coordx[i], coordy[i]);
if (board)
{
printf("dis 24;\n");
printf("dis -23;\n");
for (i = 0; i < cnt; i++)
printf("smash (%d %d);\n",coordx[i], coordy[i]);
}
printf("grid last;\n");
}
exit("; SCR '" + ulp_path + "smash_all.scr';\n");