How to get the number of triangles in a mesh

To get the number of vertices, edges, and polygons in a mesh, we can simply take their amount from the desired data block: “vertices”, “edges”, and “polygons”. However, there is no special data block for triangles in the mesh structure.

To get the number of triangles in the mesh, we need to execute the following code:

For the active object:

Or we can use counting mesh triangles through its loop structure:

 

5 2 votes
Article Rating
Subscribe
Notify of
guest

2 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Rombout Versluijs
Rombout Versluijs
3 years ago

The image shows the triangle already in that list, yet it has one less than you code?
Why run this action when it shows the triangles?

I guess you want it for selection only right

Nikita
Editor
3 years ago

The title image is only for beauty. The formula is right.