Index: trunk/pcblib/parametric/bga =================================================================== --- trunk/pcblib/parametric/bga (revision 703) +++ trunk/pcblib/parametric/bga (revision 704) @@ -43,7 +43,19 @@ #@@default:height two columns higher than the array +#@@param:automap assume a regular nx*ny array, automap (autonumber) the pins; multiple values separated by colons accepted (e.g. automap=alnum:pivot:reversx) +#@@optional:automap +#@@enum:automap:none do not autonumber pins +#@@enum:automap:alnum number y rows from A..Z (then AA..AZ) from top to bottom, number x rows from 0..nx left to right +#@@enum:automap:pivot swap x and y +#@@enum:automap:reversex number x from right to left +#@@enum:automap:reversey number y from bottom up +#@@default:none +#@@preview_args:silkmark 3,3 +#@@thumbsize:sequence 3 + + #@@include common.awk awk -f `dirname $0`/common.awk -f `dirname $0`/bga.awk -v "args=$*" -v gen=`basename $0` Index: trunk/pcblib/parametric/bga.awk =================================================================== --- trunk/pcblib/parametric/bga.awk (revision 703) +++ trunk/pcblib/parametric/bga.awk (revision 704) @@ -1,9 +1,38 @@ +function pinalpha(p, s) +{ + if (p >= 26) + s = pinalpha(int(p/26)-1) + return s sprintf("%c", 65 + (p % 26)) +} + +function automap(algo, pivot, revx, revy ,xx,yy) +{ + if (algo == 1) { + for(y = 0; y < ny; y++) { + if (revy) + yy = ny - y - 1 + else + yy = y + for(x = 0; x < nx; x++) { + if (revx) + xx = nx - x - 1 + else + xx = x + if (pivot) + MAP[x,y] = pinalpha(xx) yy+1 + else + MAP[x,y] = pinalpha(yy) xx+1 + } + } + } +} + BEGIN { set_arg(P, "?spacing", "0.5mm") set_arg(P, "?balldia", "0.35mm") set_arg(P, "?silkmark", "arc") - proc_args(P, "nx,ny,spacing,balldia,silkmark,map,width,height", "") + proc_args(P, "nx,ny,spacing,balldia,silkmark,map,width,height,automap", "") step = parse_dim(P["spacing"]) @@ -32,9 +61,16 @@ } ny++; } - else + else { if ((nx == "") || (ny == "")) error("missing argument: need nx,ny or a map") + if (P["automap"] ~ "alnum") + automap(1, (P["automap"] ~ "pivot"), (P["automap"] ~ "reversex"), (P["automap"] ~ "reversey")) + else if ((P["automap"] ~ "none") || (P["automap"] == "")) { + } + else + error("automap should have a directive alnum or none") + } balldia = parse_dim(P["balldia"]) bw = parse_dim(P["width"])