I ran your code thru the checking utility sklint & corrected the issues it found, corrected a couple of logic issues and added a couple of debug printing statements, please try using the updated code shown below: procedure(refdes_on_pad() let((text_pad layer cnt tmp allpads) (text_pad = t) (layer = "TOP") turn_on_layer(layer) unselect_object() (axlSetFindFilter ?enabled '(noall pins vias) ?onButtons '(noall pins vias)) (allpads = (axlGetSelSet (axlAddSelectAll))) axlMsgPut(";; total pin cnt %d" length(allpads)) if(text_pad then (cnt = 0) foreach(pad allpads (tmp = text_overlap(pad layer)) (cnt = (cnt + tmp)) ) (axlMsgPut "Total of text on %s pad : %d" layer cnt) ) ) ) procedure(getpadarea(pads) prog((l0 t0 r0 b0 x0 y0 padsold padetch ls ts rs bs le te re be xs ys xe ye xfinal yfinal l2 t2 r2 b2) (l0 = car(nth(0 (pads->bBox)))) (t0 = cadr(nth(1 (pads->bBox)))) (r0 = car(nth(1 (pads->bBox)))) (b0 = cadr(nth(0 (pads->bBox)))) (x0 = ((r0 + l0) / 2)) (y0 = ((t0 + b0) / 2)) (padsold = ((axlDBGetPad pads "PIN/SOLDERMASK_TOP" "REGULAR")->bBox)) (padetch = ((axlDBGetPad pads "ETCH/TOP" "REGULAR")->bBox)) (ls = car(nth(0 padsold))) (ts = cadr(nth(1 padsold))) (rs = car(nth(1 padsold))) (bs = cadr(nth(0 padsold))) (le = car(nth(0 padetch))) (te = cadr(nth(1 padetch))) (re = car(nth(1 padetch))) (be = cadr(nth(0 padetch))) (xs = ((rs - ls) / 2)) (ys = ((ts - bs) / 2)) (xe = ((re - le) / 2)) (ye = ((te - be) / 2)) if((xe > xs) then (xfinal = xe) (yfinal = ye) else (xfinal = xs) (yfinal = ys) ) (l2 = (x0 - xfinal)) (t2 = (y0 + yfinal)) (r2 = (x0 + xfinal)) (b2 = (y0 - yfinal)) return(list((l2:t2) (r2:b2))) ) ) procedure(text_overlap(pad layer) prog((allbox cnt) (cnt = 0) (axlSetFindFilter ?enabled '(noall text) ?onButtons '(noall text)) when((axlSingleSelectBox getpadarea(pad)) axlMsgPut(";; %d text found near pad @ (%f %f)" length(axlGetSelSet()) xCoord(pad->xy) yCoord(pad->xy)) (allbox = (axlGetSelSet)) foreach(item allbox if(((item->objType) == "text") then when((((item->layer) == strcat("REF DES/SILKSCREEN_" layer)) || ((item->layer) == strcat("PACKAGE GEOMETRY/SILKSCREEN_" layer))) (axlHighlightObject list(item)) (cnt++) ) ) ) ) return(cnt) ) ) procedure(unselect_object() let((allsel) (axlSetFindFilter ?enabled '(noall shapes pins vias text) ?onButtons '(noall shapes pins vias text)) (allsel = (axlGetSelSet (axlAddSelectAll))) (axlClearSelSet) (axlSetFindFilter ?enabled '(noall symbols) ?onButtons '(noall symbols)) (allsel = (axlGetSelSet (axlAddSelectAll))) (axlClearSelSet) ) ) procedure(turn_on_layer(layer) let((Going_On) (axlVisibleDesign nil) (Going_On = (axlGetParam "paramLayerGroup:BOARD GEOMETRY/paramLayer:OUTLINE")) (Going_On->visible = t) (axlSetParam Going_On) (Going_On = (axlGetParam sprintf(nil "paramLayerGroup:VIA CLASS/paramLayer:%s" layer))) if((layer == "BOTTOM") then (Going_On->visible = t) else (Going_On->visible = nil) ) (axlSetParam Going_On) (Going_On = (axlGetParam sprintf(nil "paramLayerGroup:PIN/paramLayer:%s" layer))) (Going_On->visible = t) (axlSetParam Going_On) (Going_On = (axlGetParam sprintf(nil "paramLayerGroup:PACKAGE GEOMETRY/paramLayer:SILKSCREEN_%s" layer))) (Going_On->visible = t) (axlSetParam Going_On) (Going_On = (axlGetParam sprintf(nil "paramLayerGroup:REF DES/paramLayer:SILKSCREEN_%s" layer))) (Going_On->visible = t) (axlSetParam Going_On) (Going_On = (axlGetParam sprintf(nil "paramLayerGroup:PACKAGE GEOMETRY/paramLayer:PLACE_BOUND_%s" layer))) (Going_On->visible = t) (axlSetParam Going_On) (axlUIWRedraw nil) (axlClearSelSet) ) )
↧