Page 1 of 1

How to obtain the number of selected vertices in a mesh...

Posted: Sat Jun 01, 2013 9:20 pm
by dvochin
Is there a way to quickly do that without being forced to iterate through the verts and checking their 'select' flag?

Posted: Sat Jun 01, 2013 11:41 pm
by CoDEmanX
no there isn't, see ... esign_TODO
convenience function to get selected verts/edges/faces to prevent expensive iteration over meshes. Something like: me.verts.selected
for a quick check without leaving editmode you could do:

Code: Select all

ob = bpy.context.object
ob.update_from_editmode() # not available in older versions!
verts_sel = len([v for v in if])
Note: this requires blender 2.67+

Posted: Sun Jun 02, 2013 2:15 am
by dvochin
Many thanks CodeManX, that will do the job! Didn't know about updating from edit mode either... useful!