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:

 

Nikita

Author: Nikita

Blender add-ons developer and articles writer.

5 1 vote
Article Rating
Subscribe
Notify of
guest
2 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Rombout Versluijs
Rombout Versluijs
8 days 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
8 days ago

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