from Blender import * import math import sys xres = 10 yres = 10 xscale = 1 yscale = 1 mesh = NMesh.New() for y in range(yres): for x in range(xres): vert = NMesh.Vert(x,y,0) mesh.verts.append(vert) print len(mesh.verts) for y in range(yres - 1): for x in range(xres - 1): print x,y topleft = mesh.verts[y * xres + xres] bottomleft = mesh.verts[(y + 1) * xres + xres] topright = mesh.verts[y * xres + xres + 1] bottomright = mesh.verts[(y + 1) * xres + xres + 1] face1 = NMesh.Face([topleft, bottomleft, bottomright]) face2 = NMesh.Face([topleft, topright, bottomright]) mesh.faces.append(face1) mesh.faces.append(face2) NMesh.PutRaw(mesh)