UV 2d cursor and vertex coordinates from python script in Edit_Mode I want to access to this data:



I tried:

Exporting UV coordinates

http://blenderartists.org/forum/showthread.php?254004-Accessing-UV-data-in-Python-script

http://blenderartists.org/forum/showthread.php?334400-I-want-to-select-a-vertex-on-UV-layer

but all that return the 3dview vertices coordinates....

some ideas?

thanks
This will print the uv coordinates of each vertex and (x, y) position in the UVmap editor then the cursor location

import bpy

ob = bpy.context.active_object

for area in bpy.context.screen.areas:
    if area.type == 'IMAGE_EDITOR':   #find the UVeditor
        cursor = area.spaces.active.cursor_location   # get cursor location
        if  area.spaces.active.image :                #get image dimension
            x = area.spaces.active.image.size[0]
            y = area.spaces.active.image.size[1]
        else:
            x = y = 256

        for v in ob.data.loops :
             uv = ob.data.uv_layers.active.data[v.index].uv   #get uv coo

            #calculate and print the position in the uv editor
             print("vertex %d at with UV coo (%d , %d) at  (%d ,%d)"%(v.index, uv[0], uv[1], uv[0]*x, uv[1]*y) )  
             print( "is selected ? " , ob.data.uv_layers.active.data[v.index].select )

        print (cursor,x,y)