meshlabpymeshlab

How to find vertex and face number via pymeshlab


I'm a newbie of pymeshlab and trying to use this tool to do some batch processing. My question is that how to use pymeshlab to find the total vertex and face number of a mesh?


Solution

  • Just use the vertex_number() and face_number() methods. You have the documentation here :

    https://pymeshlab.readthedocs.io/en/latest/classes/mesh.html

    import pymeshlab as ml
    ms = ml.MeshSet()
    ms.load_new_mesh('input.ply')
    m = ms.current_mesh()
    
    print(m.vertex_number(), 'vertex' )
    print(m.face_number(), 'faces' )