User:Pluke/blender/basic mexh

From Wikibooks, open books for an open world
Jump to navigation Jump to search
verts= [(-1,2,-0),(1,2,0),(-1,-2,0),(1,-2,0)]
faces =[(0,1,3,2)]
mesh = bpy.data.meshes.new("square") 
object = bpy.data.objects.new("square", mesh)

object.location = bpy.context.scene.cursor_location

bpy.context.scene.objects.link(object)

mesh.from_pydata(verts, [], faces)
mesh.update(calc_edges=True)