Sunday, July 5, 2009

Assignment_03A






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(minimum, maximum)
ry = random.uniform(minimum, maximum)
rz = random.uniform(minimum, maximum)
cmds.move (rx,ry,rz,i,r=1)

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=1)

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=1)


allCvs = cmds.ls("curve1.cv[:]", fl=1)
moveVertRandomly (allCvs, 0, 10)

allCvs1 = cmds.ls("nurbsPlane1.cv[:][:]", fl=1)
moveVerticeRandomly (allCvs, 0, 10, 0,0,5)

extrudeFacesRandomly(allFaces, 0, 5)
allFaces = cmds.ls ("pPlane1.f[:]", fl = 1)

allVert = cmds.ls("pPlane2.vtx[:]", fl=1)
polygonVertices (allVert, 0, 5)

No comments:

Post a Comment