Thursday, July 23, 2009

03-A Zhulei








import maya.cmds as cmds
import random
import math

def moveVertRandomly (allCvs, minimum, maximum):
if minimum>= maximum:
print "Find new variables!"
else:
for i in allCvs:
rx = random.uniform(1, 19)
ry = random.uniform(minimum, maximum)
rz = random.uniform(minimum, maximum)
cmds.move (rx,ry,rz,i,r=8)

def moveVerticeRandomly (allCvs, minimum, maximum, x,y,z):
if minimum>= maximum:
print "Find new variables!"
else:
for i in allCvs:

z = random.uniform(minimum, maximum)
cmds.move (x,y,z,i,r=12)

def extrudeFacesRandomly(allFaces, minimum, maximum):
if minimum>= maximum:
print "Find new variables!"
else:
for i in allFaces:
rz = random.uniform(minimum, maximum)
cmds.polyExtrudeFacet(i, ltz = rz)

def polygonVertices (allVert, minimum, maximum):
if minimum>= maximum:
print "Find new variables!"
else:
for i in allVert:
rx = random.uniform(minimum, maximum)
ry = random.uniform(minimum, maximum)
rz = random.uniform(minimum, maximum)
cmds.move (rx,ry,rz,i,r=7)


allCvs = cmds.ls("curve1.cv[:]", fl=5)
moveVertRandomly (allCvs, -1, 20)

allCvs1 = cmds.ls("nurbsPlane1.cv[:][:]", fl=5)
moveVerticeRandomly (allCvs, 1, 2,3,4,5)
allFaces = cmds.ls ("pPlane1.f[:]", fl = 5)

extrudeFacesRandomly(allFaces, 0, 6)
allVert = cmds.ls("pPlane2.vtx[:]", fl=5)
polygonVertices (allVert, 0, 20)

No comments:

Post a Comment