i’m new to python, nut not to programming.
i have many difficulties looknig at the documentation.
i’m trying to make a simple script that prints vertices, face index, and normals of the
faces.mesh=bpy.data.meshes["Cube"]
face=mesh.faces
for f in face
print(f.verts)
assuming you are running this code in some recent version of blender (2.58…)
(but the error message looks like it’s being run in a 2.49 version or something, so the following code will be of no use to you)
your for loop misses a colon. i’ve written at length about this kind of stuff:
with one face selected, in editmode… go to object mode and run this in the console
import bpy
current_object = bpy.context.active_object
selected_faces = [face for face in current_object.data.faces if face.select]
# shows you what you can do with 'selected_faces'
print(dir(selected_faces[0]))
# print the normal of the first item in selected faces
print(selected_faces[0].normal)
there is no pre written function that i know of in bpy that does that, but i would use something like :
import bpy
current_obj = bpy.context.active_object
print("="*40) # printing marker
for face in current_obj.data.faces:
verts_in_face = face.vertices[:]
print("face index", face.index)
print("normal", face.normal)
for vert in verts_in_face:
print("vert", vert, " vert co", current_obj.data.vertices[vert].co)