We will go in details over the script pasted here:
import bpy # Get first selected object ob = bpy.context.active_object # Get the faces of the selected object faces = ob.data.polygons bpy.ops.object.mode_set(mode = 'EDIT') bpy.ops.mesh.select_all(action = 'DESELECT') bpy.ops.object.mode_set(mode = 'OBJECT') print(len(faces)) for i in range(len(faces)): face = faces[i] face.select = True bpy.ops.object.mode_set(mode = 'EDIT') bpy.ops.mesh.extrude_region_move(TRANSFORM_OT_translate={"value": face.normal, "constraint_orientation" : 'NORMAL' }) bpy.ops.transform.resize( value=( 0.5, 0.5, 0.5 ), constraint_orientation='LOCAL' ) bpy.ops.transform.rotate(value=-.5, axis= face.normal) bpy.ops.mesh.select_all(action = 'DESELECT') bpy.ops.object.mode_set(mode = 'OBJECT') face.select = False