Extrude a mesh by Region using Python script I've got a flat mesh resulting from a previous script (How to draw a PostGIS Polygon with holes into Blender using Python) :



I'd like to extrude this mesh by Region using Python (This can be done from Blender, in Edit mode, selecting the entire mesh, then from the mesh menu: Extrude --> Region)



Typically, i don't want to extrude individual faces showing the internal edges of the polygon like this :



Below is a script extruding the active mesh, but unfortunately it's using individual faces, and i couldn't adapt it to extrude Region :

import bmesh

o = bpy.context.active_object
me = o.data
bm = bmesh.new()
bm.from_mesh(me)
faces = bm.faces[:]
for face in faces:
    r = bmesh.ops.extrude_discrete_faces(bm, faces=[face])
    bmesh.ops.translate(bm, vec=Vector((0,0,-3)), verts=r['faces'][0].verts)
bm.to_mesh(me)
me.update()
bpy.context.scene.update()


Is there a way to adapt this script to extrude Region instead of individual faces ?
This should do the trick, and no need to create a bmesh object to extrude all your mesh's faces:

import bpy

# Go to edit mode, face selection mode and select all faces
bpy.ops.object.mode_set( mode   = 'EDIT'   )
bpy.ops.mesh.select_mode( type  = 'FACE'   )
bpy.ops.mesh.select_all( action = 'SELECT' )

bpy.ops.mesh.extrude_region_move(
    TRANSFORM_OT_translate={"value":(0, 0, 3)}
)

bpy.ops.object.mode_set( mode = 'OBJECT' )


Often you can find hints about how to call operators from the info panel, and of course the tooltip. In this case they give contradictory hints but both can get be beneficial: