real Length_x1[]; real Length_x2[]; real Length_y1[]; real Length_y2[]; real text_x[]; real text_y[]; real WLtotal=1; real angle[]; real Length[]; real XYXY[]; real n ; int i = 0; int i2 = 0; string Signal[]; string ulp_path; char bkslash = '/'; int pos = strrchr(argv[0], bkslash); if (pos >= 0) { ulp_path = strsub(argv[0], 0, pos + 1); } real WireLength(real x1 ,real x2 ,real y1 ,real y2) { Length_x1[i]=x1+0.000001; Length_x2[i]=x2; Length_y1[i]=y1+0.000001; Length_y2[i]=y2; // return sqrt((pow(x2 - x1, 2) + pow(y2 - y1, 2)) ); } board(B){ B.texts(T) { if (T.layer == 47) { text_x[i2]=u2mm(T.x); text_y[i2]=u2mm(T.y); ++i2; } } B.wires(W) { if (W.layer == 47) { Length[i] = WireLength(u2mm(W.x1), u2mm(W.x2), u2mm(W.y1), u2mm(W.y2)); n=((Length_y2[i]-Length_y1[i])/(Length_x2[i]-Length_x1[i])); angle[i]= (180*atan(n))/PI; ++i; } } output(ulp_path + "temp.scr", "wt"){ printf("grid mm\n"); printf("Display none;layer 47;\n"); for (int t = 0; t < i2; ++t) { printf("delete (%f %f);\n",text_x[t],text_y[t]); } for (t = 0; t < i; ++t) { printf("text;Change Size 1.016\n"); printf("text %fmm R%f (%f %f)\n;",Length[t],angle[t],Length_x1[t]+((Length_x2[t]-Length_x1[t])/2),Length_y1[t]+((Length_y2[t]-Length_y1[t])/2)); } printf("Display last\n"); printf("grid last;layer 47;Change width 0.15;\n"); } exit("; SCR '" + ulp_path + "temp.scr';wire\n\n"); }