I am pretty new to Blender. I need to get coordinates of each selected vertex somehow. I don't really want to manually copy coordinates of each and single vertex that would just take a lot of time. I need them either printed somewhere or save them into some kind of text file. Again I need only those vertexes I have selected, not the entire model.


Open up a new Text window and copy and past the following.

import bpy
import bmesh

# Get the active mesh
obj = bpy.context.edit_object
me = obj.data

# Get a BMesh representation
bm = bmesh.from_edit_mesh(me)

bm.faces.active = None

# Modify the BMesh, can do anything here...
for v in bm.verts:
    if v.select:
        print(tuple(v.co) )

Make sure you are in Edit mode with the required vertices selected and click "Run Script"

The coordinates of each selected vertices is now printed in the System Console.

If you can not see the System Console select Toggle System Console in the Window menu.

To get this code I used the Bmesh Simple Editmode template from the Templates/Python

  • 1
    $\begingroup$ Would consider using instead an object MODE bmesh bm = bmesh.new() ... load with mesh bm.from_mesh(mesh) and for @JMRMEDEV bm.transform(obj.matrix_world) will convert to global coords. $\endgroup$
    – batFINGER
    Jul 11 at 15:11

Another possible way is to do it with vertex groups (as I do often in order to keep things in tact)

So you select the vertices you want to keep in track (in edit mode) and assign them into the group of your choice, then you change the groupName and filename (optional) variables accordingly if you want to keep track on different groups.

import bpy

groupName = "Group"

filename = "myVerts"

if (filename not in bpy.data.texts):
    myVerts = bpy.data.texts.new(filename)
else :
    myVerts = bpy.data.texts[filename]

myGroupsArr = [];

obj = bpy.context.selected_objects[0]

group = obj.vertex_groups[groupName]

for v in obj.data.vertices:
    for g in v.groups:
        print(g.group, group.index)
        if g.group == group.index:

for grp in myGroupsArr:
    myVerts.write( str(grp[0])+str(grp[1])+str(grp[2])+ "\n")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.