# Simulate Individual Face Extrusion Via User Input In Python

When you do an alt+e and select individual faces for extrusion in the Blender GUI, you can then either move your mouse around to move the extrusion up or down a path defined by the orientation of the normal of the source face.

Alternatively, I can hit alt+e, select individual faces and then on the number pad proceed to type in the exact value by which I would like the face to be extruded down this path, pressing RETURN to apply the transformation. I can then tap "s" and type a value by which I would like to scale the extruded face by a value I can type in, then again press RETURN to apply the transformation.

Now being a total blender python API/python noob, I'm wondering how I can accomplish this same result purely in python. I've already got a script that will iterate over all objects in my scene, select the face I would like extruded.... but now I need to know how I can extrude that individual face along the path of the normal (just like it would in the GUI) and of course scale it after, just as described above. Any help pointing me in the right direction would be greatly appreciated.

• – gandalf3 Dec 4 '13 at 2:55
• Thanks @gandalf3 I'll read over that again. When I first saw it I just assumed it wouldn't apply since he's using bmesh... which I have no idea what that even is. Perhaps it's my own noobness that made me believe it's not helpful to my cause. I'll review again and post back, happy to delete/close if I'm made a duplicate. :) – user1745 Dec 4 '13 at 2:57
• bmesh is blenders mesh editing api, from python it gives you access to the mesh editing features used by the standard editing tools. TIP: The strip along the top of the blender window (with the logo and vertex count) is an info window, usually only the header is visible but if you expand it you will see a log of actions. When you perform the extrude you will see the python used to perform that step in this window. You can select and copy entries from there. – sambler Dec 5 '13 at 1:41
• @sambler thanks for the nfo! I did notice this window when I was using the scripting layout but didn't realize it would trace things in other layouts as well. Thanks for the explanation about bmesh. :) – user1745 Dec 5 '13 at 5:36

The referenced question and answer(s) didn't actually apply because I didn't want or need bmesh and a massive script just to do this. I found a 1 liner that does exactly what I wanted.

bpy.ops.mesh.extrude_faces_move(
MESH_OT_extrude_faces_indiv={"mirror":True},
TRANSFORM_OT_shrink_fatten={"value":-0.9,
"mirror":False,
"proportional":'DISABLED',
"proportional_edit_falloff":'SMOOTH',
"proportional_size":1,
"snap":False,
"snap_target":'CLOSEST',
"snap_point":(0, 0, 0),
"snap_align":False,
"snap_normal":(0, 0, 0),
"release_confirm":False})

bpy.ops.mesh.extrude_faces_move(MESH_OT_extrude_faces_indiv={"mirror":True}, TRANSFORM_OT_shrink_fatten={"value":-0.9, "mirror":False, "proportional":'DISABLED', "proportional_edit_falloff":'SMOOTH', "proportional_size":1, "snap":False, "snap_target":'CLOSEST', "snap_point":(0, 0, 0), "snap_align":False, "snap_normal":(0, 0, 0), "release_confirm":False})


TRANSFORM_OT_shrink_fatten={"value":-0.9... is where you would set the value of the extrusion (-0.9 in this case).

• As an followup, I would recommend recalculating normals after this operation. – iKlsR Dec 4 '13 at 3:59