I have found the problem on the scripts, i have tried running the leSearcHierarchy function as before by defining the correct layer e.g. "METAL5" "pin" it returns only the pin ID but the problem is once the particular layer is not found or group together with other layers like
pinLayerList = list (list("M1" "pin") list("METAL5" "pin")
where M1 is not exist in the technology(but i need this to be the universal program which use on different technology). in this scenario the leSearchHierarchy will grep all the metal layer on the top, but it is fine when i define as below,
pinLayerList = list (list("METAL1" "pin") list("METAL5" "pin")
I wonder why is this goes wrong, should leSearchHierarchy only return the value that exist?