Copy Wire (Polygon Wire) to any layer"
"This ULP copies copper wire and/or polygon from layer (1 or 16) of selected signals into "
"any layer in order.
"
"Use:
"
"run copy-wire-to-any-layer.ulp [signalname] [signalname]
"
"run copy-wire-to-any-layer.ulp $nameoff$
"
"run copy-wire-to-any-layer.ulp -p [signalname] [signalname]
"
"run copy-wire-to-any-layer.ulp +p [signalname] [signalname]
"
"run copy-wire-to-any-layer.ulp -p -f [signalname] [signalname]
"
"run copy-wire-to-any-layer.ulp +p +f [signalname] [signalname]
"
"$nameoff$ switches off the checking of net names"
"Options are case sensitive.
"
"$nameoff$ copy all signals.
"
"-p copies also polygons.
"
"+p copies only polygons.
"
"-f copies only polygon contour as polygon.
"
"-f copies polygon contour and filling as wire.
"
"
"
"Author: support@cadsoft.de
"
// THIS PROGRAM IS PROVIDED AS IS AND WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED.
string Version = "Version 1.5"; // 2008-04-23 check is a polygon placed
// changed menu to copy to any layer
// 2008-05-05 renamed from "copy-wire-to-solder-mask.ulp" to
// "copy-wire-to-any-layer.ulp"
// 2008-10-24 renamed to copy-layer-to-any-layer.ulp
// copy also rect, circle, text and non copper layer
// 2009-01-28 check polygon filling on orphan
int NameOff = 0; // 0 = copy by signal name
// 1 = copy without signal name (all)
int PolygonOn = 0; // copy also polygon
int onlyPolygon = 0;
int fillPolygon = 0; // copy only polygon contour or copy polygon filling as wire 2006.01.20 alf
int Player[];
string poly[];
int cntp = 0;
string isRatsnest;
string isLayer = "Top/Bottom"; // default layer
int isLayerNb = 0;
string toLayer = "t/bStop"; // default to Stop-Layer
string fromName[], toName[];
fromName[0] = "Top/Bottom";
toName[0] = "t/bStop";
int lNumber[];
int cntLay = 1;
int selisLayer = -1, seltoLayer = -1;
string signals[] = { "" };
string chsignals[] = { "" };
int chngsig = 0;
int lastSigCh = -1;
int decs;
int index[];
int x1[], y1[], x2[], y2[], layer[];
int Wwidth[];
int n = 1;
string cmd;
string c;
// *************************************
int found(string fnam) {
int fnd = 0;
do {
if (chsignals[fnd] == fnam) {
return 1;
break;
}
++fnd;
} while (chsignals[fnd]);
return 0;
}
int getlayernumber(string isL) {
board(B) B.layers(L) if (L.name == isL) return (L.number);
return 0;
}
void changeLayer(int l) {
if (toLayer == "t/bStop") {
if (isLayer == "Top/Bottom") {
if (l == 1) sprintf(c, "CHANGE LAYER 29;\n");
if (l == 16) sprintf(c, "CHANGE LAYER 30;\n");
}
else {
if (l == isLayerNb) sprintf(c, "CHANGE LAYER %d;\n", isLayerNb);
}
}
else {
sprintf(c, "CHANGE LAYER %s;\n", toLayer);
}
cmd+= c;
return;
}
int delfromList(int selct) {
if (lastSigCh >= 0) {
lastSigCh--;
for (int r = selct; r <= lastSigCh; r++) {
chsignals[r] = chsignals[r + 1];
}
chsignals[lastSigCh + 1] = "";
}
return selct;
}
void AddList (string SigName) {
int nofound = 1;
for (int r = 0; r <= lastSigCh; r++) {
if (chsignals[r] == SigName) {
nofound = 0;
break;
}
}
if (nofound) {
lastSigCh++;
if (lastSigCh > 0) {
for (int x = lastSigCh; x > 0; x--) {
chsignals[x] = chsignals[x - 1];
}
}
chsignals[0] = SigName;
}
return;
}
void AddArgument(int n) {
do {
AddList(strupr(argv[n]));
n++;
} while(argv[n]);
return;
}
void copy_any_layer(void) {
dlgMessageBox("jetzt gehts rund!", "OK");
exit(-99);
}
void collectlayer(void) {
board(B) B.layers(L) {
fromName[cntLay] = L.name;
toName[cntLay] = L.name;
lNumber[cntLay] = L.number;
cntLay++;
}
fromName[cntLay] = "";
toName[cntLay] = "";
lNumber[cntLay] = 0;
return;
}
void menue() {
int srt = 0;
if (argc > 1) {
if (argv[1] == "-p" || argv[1] == "+p" || argv[1] == "$nameoff$") {
if (argv[1] == "-p") PolygonOn = 1;
if (argv[1] == "+p") onlyPolygon = 1;
if (argv[2] == "-f") fillPolygon = 0; // 2006.01.20 alf
if (argv[2] == "+f") fillPolygon = 1;
if (argv[1] == "$nameoff$") { NameOff = 1; AddArgument(2); }
else if (argv[2] == "$nameoff$") { NameOff = 1; AddArgument(3); }
else AddArgument(2);
if (argv[2] == "$nameoff$") { NameOff = 1; AddArgument(3); }
else if (argv[3] == "$nameoff$") { NameOff = 1; AddArgument(4); }
else AddArgument(3);
}
else AddArgument(1);
}
else {
string slist[];
int Result = dlgDialog(filename(argv[0])) {
dlgHBoxLayout dlgSpacing(250);
dlgHBoxLayout {
dlgCheckBox("&Copy all ", NameOff);
dlgLabel("