number of...


(bowen) #1

How do I access the number of uv coords, or the number of vertices, or number of faces in an object with python? I know how to access the vertices or uvcoords themselves, shouldnt there be an entry for the ammount of vertices as well?

Thanks


(theeth) #2

import Blender

mesh = Blender.NMesh.GetRaw("mesh")
print len(mesh.verts)


the len() function returns the lenght of all the items in any type of subscriptable objects (strings, lists, dictionnaries, tuples, subscrictable user defined objects)

len is a built in function. You can get a list of the builtins with


print dir(__builtins__)

Martin

Martin


(bowen) #3

Thank you. Very quick and very helpfull