0
$\begingroup$

I am trying to get a list of faces that has each index of the 3 vertices that go with it. I thought about just doing it from scratch but they are kinda in random order. I am looking for a list that's like this: I also attached an image to make it more clear to what im looking for... thanks for help! 3FacesThatAreShownInCode

Faces = [
(0,1,3),
(0,2,3),
(0,2,40)
#and so on and so forth...
]
$\endgroup$
1

1 Answer 1

1
$\begingroup$

This code should give you the face's verts indices:

import bpy
import bmesh 
obj = bpy.data.objects['Cube'] #Using default cube as example

bm = bmesh.new()
bm.from_mesh(obj.data)
bm.faces.ensure_lookup_table()
vert_idx = []
for f in bm.faces:
    vert_idx.append([v.index for v in f.verts])
print(vert_idx)
$\endgroup$

You must log in to answer this question.

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