1

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?

ideasman42
  • 47,387
  • 10
  • 141
  • 223
kpdkps
  • 79
  • 2
  • 4
  • 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.

    – ideasman42 May 03 '16 at 06:53

1 Answers1

2

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.

TLousky
  • 16,043
  • 1
  • 40
  • 72