#usage " "
"run clear-layer-in-lbr.ulp [YES] layer [layer] [layer] ....
"
"YES = clear without confirmation.
"
"Clear only layer in packages
"
"
Usage:
" + usage, "OK");
exit(0);
}
if (argv[1] == "YES") { cnt = 2; clear_outo = 1; }
for (int n = cnt; n <= argc; n++) {
clear_layer[n] = strtol(argv[n]);
cmd += argv[n] + "\n";
}
library(L) {
L.layers(LY) {
layer_visible[LY.number] = LY.visible;
}
scriptfile = filedir(L.name) + clrscript;
output(scriptfile, "wtD") {
printf("GRID MM FINEST;\nDISPLAY NONE ");
for (int n = cnt; n < argc; n++) {
printf(" %d", clear_layer[n]);
if (clear_layer[n] == 21) {
printf(" -23 -25 -27 -51");
}
if (clear_layer[n] == 22) {
printf(" -24 -26 -28 -52");
}
}
printf(";\n");
L.packages(P) {
sprintf(s, "Edit %s;\nCHANGE LAYER %d;\nRECT (%.4f %.4f)(%.4f %.4f);\nGROUP (%.4f %.4f) (%.4f %.4f) (%.4f %.4f) (%.4f %.4f) (%.4f %.4f);\nDELETE (>%.4f %.4f);\n",
P.name,
clear_layer[cnt],
u2mm(P.area.x1)/2, u2mm(P.area.y1)/2,
u2mm(P.area.x2)/2, u2mm(P.area.y2)/2,
u2mm(P.area.x1), u2mm(P.area.y1),
u2mm(P.area.x2), u2mm(P.area.y1),
u2mm(P.area.x2), u2mm(P.area.y2),
u2mm(P.area.x1), u2mm(P.area.y2),
u2mm(P.area.x1), u2mm(P.area.y1),
u2mm(P.area.x1), u2mm(P.area.y1) );
if (clear_outo) {
printf("%s", s);
}
else {
if (dlgMessageBox("clear layer(s) in package:\n" + P.name, "Yes", "+No") == 0) {
printf("%s", s);
}
}
}
printf("grid last;\n");
printf("DISPLAY NONE ");
for (int l = 255; l ; l--) {
if (l == 99) l = 89; // *** no Symbol Layer ***
if (layer_visible[l]) printf(" %d", l);
}
}
}
exit("SCRIPT '" + scriptfile + "';");
}
dlgMessageBox("Start this ULP from a Library", "OK");
exit(0);