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
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] myVerts.clear() myGroupsArr = ; obj = bpy.context.selected_objects 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: myGroupsArr.append() for grp in myGroupsArr: myVerts.write( str(grp)+str(grp)+str(grp)+ "\n")