I followed this and ended up with a closed mesh.

import bpy,bmesh
import mathutils
from mathutils import Vector
bm  = bmesh.from_edit_mesh( bpy.context.object.data )
operate_faces=[a for a in bm.select_history]
n = Vector((0,0,0))
for i in operat_faces:
    n += i.normal

verts = [e for e in r['geom'] if isinstance(e, bmesh.types.BMVert)]

z = mathutils.Vector((0,0,1))
axis = n.cross(z)
angle = n.angle(z)
R = mathutils.Matrix.Rotation(angle,4,axis)

bmesh.ops.translate(bm, vec = Vector((0,0,.3)),space=R,verts = verts )
#bmesh.ops.delete(bm, geom=operat_faces, context=5)

bmesh.update_edit_mesh( bpy.context.object.data )

enter image description here enter image description here

but I want the original faces to disappear, so I used

bmesh.ops.delete(bm, geom=operate_faces, context=5)

to delete the faces. Is there a better way?

PS: I tried to use extrude_discrete_faces(), but the faces that extruded were not connected.

enter image description here

  • $\begingroup$ wow,thank you for correcting,i am new here,and not very good at English. $\endgroup$ – Joe Davidson Nov 19 '17 at 14:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.