#===============================================================================
# author: yangjie
# mobilePhone:15850792203
# QQ:691633493
# E-mail:691633493@
# version:2.0
#===============================================================================
from maya.cmds import*

def YJRigZeroGrp(TargetObjList):
    if TargetObjList == 'select':
        TargetObjList = ls(sl=1)
    else:
        TargetObjList = TargetObjList            
    for TargetObj in TargetObjList:
        ParentObj=listRelatives(TargetObj,p=1)
        TargetXYZ = xform(TargetObj,ws=1,q=1,t=1)
        TargetXYZRo = xform(TargetObj,ws=1,q=1,ro=1)
        ZeroGrpName=TargetObj+'_ZeroGrp1'
        while objExists(ZeroGrpName):
            ZeroNub=int(ZeroGrpName[-1])+1
            ZeroGrpName=ZeroGrpName.replace(ZeroGrpName[-1],str(ZeroNub))
        group( em=True, name=ZeroGrpName )
        move (TargetXYZ [0],TargetXYZ [1],TargetXYZ [2],ZeroGrpName,r=1, os=1,wd=1)
        setAttr(ZeroGrpName+'.r', TargetXYZRo[0], TargetXYZRo[1], TargetXYZRo[2])
        parent( TargetObj, ZeroGrpName )
        if not ParentObj == None:
            parent( ZeroGrpName, ParentObj )
    return ZeroGrpName