2
$\begingroup$

I have created a cuboid room in blender using python and it has 289 faces as shown in the stats (in the image). How can I find which polygon number a particular face is ?

For example, If I print the output of the number of polygons by

Code snippet: 
mesh = ob.data
face_list = [face for face in mesh.polygons]
print('Face list: ', face_list)

Output: 
bpy.data.meshes['new_mesh.001'].polygons[0], 
bpy.data.meshes['new_mesh.001'].polygons[1] ... bpy.data.meshes['new_mesh.001'].polygons[288]

I want to know which face belong to which polygon number. Is there a way to find this ?

enter image description here

$\endgroup$
0

2 Answers 2

6
$\begingroup$

To use indices (small blue number) you have to enable the Interface > Display > [X] Developer Extras in the User Preferences dialog to see this option. enter image description here

Or use MeasureIt Tools (build-in) enter image description here

$\endgroup$
2
  • 4
    $\begingroup$ You should mention in your answer that you have to enable the Interface > Display > [X] Developer Extras in the User Preferences dialog to see this option. $\endgroup$
    – Blunder
    Commented Oct 31, 2021 at 11:33
  • $\begingroup$ Thanks for the advice. I edited the answer $\endgroup$
    – relaxed
    Commented Dec 14, 2021 at 9:48
1
$\begingroup$

For Python: The index is stored in face.index.

Related question: How can I check face selection in edit mode

To print the indexes of all selected faces in Edit mode:

import bpy
import bmesh

context = bpy.context
ob = context.edit_object
me = ob.data

bm = bmesh.from_edit_mesh(me)
# check the selected faces
for f in bm.faces:
    if f.select:
        print(f.index)
$\endgroup$

Not the answer you're looking for? Browse other questions tagged .