Using average to find center point for group of vertice

    #move entire group of vertices into one central location
    def closeGroup(self,thelist,themesh):

        if(thelist[0]==-1):
            return

        #find mid point of first face
        poly=themesh.data.polygons[thelist[0]]
        newod=(themesh.data.vertices[poly.vertices[0]].co + themesh.data.vertices[poly.vertices[1]].co + themesh.data.vertices[poly.vertices[2]].co )/3

        scan=1
        while(thelist[scan]!= -1):
            poly=themesh.data.polygons[thelist[scan]]

            #first find mid point of face
            newod2=(themesh.data.vertices[poly.vertices[0]].co+themesh.data.vertices[poly.vertices[1]].co+themesh.data.vertices[poly.vertices[2]].co)/3
   
            #find mid point of faces
            newod=(newod+newod2)/2

            scan+=1

        scan=0
        while(thelist[scan]!= -1):
            poly=themesh.data.polygons[thelist[scan]]
            themesh.data.vertices[poly.vertices[0]].co=newod
            themesh.data.vertices[poly.vertices[1]].co=newod
            themesh.data.vertices[poly.vertices[2]].co=newod
            scan+=1

        

        return

The result is off center position. I cannot find out what is wrong with it.

What value are you expecting, and what value are you getting? Nailing that down will probably help you find the error in your math

Use the vertex locations to calculate the central point.