import bpy
import bmesh
def mission1(scn):
obj = scn.objects.active
if bpy.context.mode == 'EDIT_MESH':
bm = bmesh.from_edit_mesh(obj.data)
else:
bm = bmesh.new()
bm.from_object(obj, scn)
v2 = bm.verts.new( [0,7,0] )
bm.verts.ensure_lookup_table()
v1 = bm.verts[3]
e1 = bm.edges.new( [v1, v2] )
f1 = bm.faces.new( [v1, v2, bm.verts[7]])
if bpy.context.mode == 'EDIT_MESH':
bmesh.update_edit_mesh(obj.data)
else:
bm.to_mesh(obj.data)
obj.data.update()
mission1(bpy.context.scene)
|
Blender python API quick-start
Syntax highlighting by Pygments.