I'm trying to create a some code in blender where I can have it print a full list of vertices and faces for a mesh that I have selected. I'm then planning on using this list to draw out the same mesh in a another program i want to use as an add-on. I am am able to get blender to return the list of vertices in the console, but I've had no luck with the faces. I'm just starting to learn the blender API, so any help would be appreciated.
I've already looked at some older forums on a solution to this problem, but they all use a mesh.faces function, which blender says does not exist anymore. I'm getting a feeling that after some updates blender has moved it to a new class function, however, I have no idea where it is.
## This first part works like a charm, and it prints out the vertices perfectly. obj = bpy.context.active_object v = obj.data.vertices coords = [(obj.matrix_world * v.co) for v in obj.data.vertices] plain_coords = [vert.to_tuple() for vert in coords] print(plain_coords) ## This is the part I need help on. No matter what I try it keeps saying there is no attribute f = obj.faces print(f)
In the bottom, I'm trying to set f to be the list of faces in obj, but it keeps saying that obj doesn't have the attribute faces.