# Extrude face with Python

I want to extrude a face in the direction of the face normal, here is the code so far:

r = bmesh.ops.extrude_face_region(bm, geom=bm.faces[:])
verts = [e for e in r['geom'] if isinstance(e, bmesh.types.BMVert)]
bmesh.ops.translate(bm, vec=dir, verts=verts)


The problem is how to get the direction of the face that I translate? The bm.faces[0].normal is Vector(0,0,0)

Any ideas? Thx!

Update the normals

Either update normals on a whole bmesh

bm.normal_update()


or on a per face basis

for f in bm.faces:
if sometest:
f.normal_update()

• Yeah, thx, I also found it, I use the normal_update on the frist face, cause I am sure that there is at least one. – Jayanam Jan 5 at 18:37