#usage "Generate name layers to panelize board
\n"
"This ULP generates a command sequence which copies the name texts "
"of all elements of your layout into newly generated layers (125 and 126). "
"After running the ULP you can GROUP, CUT and PASTE your layout "
"to get an array of several boards. Make sure all layers are displayed before.
"
"The copied name texts in the new layers will not be changed. "
"Please notice that you have to deactivate layers 25 and 26 if you use "
"the CAM processor e.g. for generating gerber data. Instead, you have to activate "
"the new layers 125 and 126. Thus you get an identical silk screen for all "
"your layouts in this array."
"
"
"Author: support@cadsoft.de"
int offset = 100;
int tf = 0;
int tNames = 25, bNames = 26;
string cmd = "SET UNDO_LOG OFF;\n"; // advisable for speed reasons
string h;
void header(void) {
h = "";sprintf(h, "layer %d _tNames;\n", tNames+offset);cmd += h; // here you can change the new
h = "";sprintf(h, "layer %d _bNames;\n", bNames+offset);cmd += h; // layers names
h = "";sprintf(h, "set color_layer %d yellow;\n", tNames+offset);cmd += h; // and
h = "";sprintf(h, "set color_layer %d magenta;\n", bNames+offset);cmd += h; // colors
h = "";sprintf(h, "set wire_bend 2;\n");cmd += h;
h = "";sprintf(h, "\nGRID mil;\n\n");cmd += h;
}
if (board) board(B) {
header();
B.elements(E) {
E.texts(T) {
if (T.layer == 25) {
if (tf == 0) { // change layer only if necessary
h = "";sprintf(h, "Change Layer %d;\n", tNames+offset);cmd += h;
}
tf = 1;
h = "";sprintf(h, "Change Size %5.3f;\n", u2mil(T.size));cmd += h;
h = "";sprintf(h, "Text '%s' R%1.0f (%5.3f %5.3f);\n",
E.name, T.angle, u2mil(T.x), u2mil(T.y));cmd += h;
}
if (T.layer == 26) {
if (tf != 0) { // change layer only if necessary
h = "";sprintf(h, "Change Layer %d;\n", bNames+offset);cmd += h;
}
tf = 0;
h = "";sprintf(h, "Change Size %5.3f;\n", u2mil(T.size));cmd += h;
h = "";sprintf(h, "Text '%s' MR%1.0f (%5.3f %5.3f);\n",
E.name, T.angle, u2mil(T.x), u2mil(T.y));cmd += h;
}
}
}
}
cmd += "SET UNDO_LOG ON;\n";
// EditBox
int Result = dlgDialog("Descriptions") {
dlgTextEdit(cmd);
dlgHBoxLayout {
dlgPushButton("+Execute") dlgAccept();
dlgPushButton("-Cancel") dlgReject();
}
};
if (Result == 0) exit(0);
exit(cmd);