# (mise a jour le 24/11/2007)
import Blender
from Blender import NMesh
#Number of steps
n = 10
#Distance entre les marches
d = 0.5
# distance du centre de l'objet
xc = 0.0
yc = 10.0
zc = 0.0
# dimensions des cotes de la marche
lar_x = 5.0
lar_y = 6.0
lar_z = 0.5
ME=NMesh.GetRaw()
verts=ME.verts
for s in range(n):
x=xc+s*lar_x
y=yc
z=zc+s*(lar_z+d)
verts.append(NMesh.Vert(x,y,z))
z+=lar_z
verts.append(NMesh.Vert(x,y,z))
x=xc+(s+1)*lar_x
y=yc
z=zc+s*(lar_z+d)
verts.append(NMesh.Vert(x,y,z))
z+=lar_z
verts.append(NMesh.Vert(x,y,z))
x=xc+(s+1)*lar_x
y=yc+lar_y
z=zc+s*(lar_z+d)
verts.append(NMesh.Vert(x,y,z))
z+=lar_z
verts.append(NMesh.Vert(x,y,z))
x=xc+s*lar_x
y=yc+lar_y
z=zc+s*(lar_z+d)
verts.append(NMesh.Vert(x,y,z))
z+=lar_z
verts.append(NMesh.Vert(x,y,z))
FL=[(0,1,3,2),
(4,5,7,6),
(0,2,4,6),
(1,3,5,7),
(0,1,7,6),
(2,3,5,4)]
for i in range(0,len(verts)+1,8)[:-1]:
for a,b,c,d in FL :
f=NMesh.Face()
f.v=[ME.verts[v] for v in i+a,i+b,i+c,i+d]
ME.faces.append(f)
NMesh.PutRaw(ME,'test') |