Global and local coordinates.

I’m getting unexpected results from my script:


objects = Blender.Object.GetSelected()
active=objects.pop(0)
activemesh = active.getData(mesh=1)
for vert in activemesh.verts:
    print( 'active v %f %f %f' % (vert.co.x, vert.co.y, vert.co.z) )

WHich gives me a list of vertices:


active v 0.161264, 4.145985, -0.194141
active v 0.161264, 4.145985, 0.194141
active v -0.161264, 4.145985, 0.119141
active v -0.161264, 4.145985, -0.119141
active v 0.161264, -4.145985, -0.194141
active v 0.161264, -4.145985, 0.194141
active v -0.161264, -4.145985, 0.119141
active v -0.161264, -4.145985, -0.119141

I’ve then tried to duplicate one of the faces:

def addpoints(newverts):
    v=list()
    for vert in newverts:
        v1=NMesh.Vert(vert.co.x, vert.co.y, vert.co.z)
        v.append(v1)
        me.verts.append(v1)
    skinverts(v)
def skinverts(verts):
    f=NMesh.Face()
    for vert in verts:
        f.v.append(vert)
    me.faces.append(f)

me = NMesh.GetRaw()
#Create the leftmost verticies
addpoints(activemesh.verts[:4])
NMesh.PutRaw(me)

The face is drawn, but completely out of position and rotated by 90 degrees.

I’m surmising that there is a difference between local coordinate systems and global coordinate systems, am I right?

Or are there obvious errors in my code?

Thanks to Pananag for pointing out the solution:

http://blenderartists.org/forum/showthread.php?t=169825