I have ply format mesh in edit mode in blender. When I select some vertices , I need the x y z coordinates to be printed as output. Is it possible?

  • $\begingroup$ The mesh being imported from a PLY seems irrelevant to the question being asked. Perhaps the question should be How to print the XYZ coordinates of all selected vertices in edit-mode? Its also not clear if this is a single function you want to run, or if you want the select action to always print vertex locations. $\endgroup$ – ideasman42 May 3 '16 at 6:53

As ideasman42 wrote in his comment, this will work for any mesh in edit mode, regardless of whether it was imported from PLY or any other format, or generated within Blender:

import bpy, bmesh

bm = bmesh.from_edit_mesh( bpy.context.object.data )
mw = bpy.context.object.matrix_world 

selected_verts_coordinates = [ mw * v.co for v in bm.verts if v.select ]

print( selected_verts_coordinates )

This will only work for selected vertices when the mesh is in edit mode.


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