
import maya.cmds as cmds
import random
import math
#revolve a curve to form a surface
def revolve(numPoints,myAxis,myEndSweep):
  "revolve 12a curve"
  myPoints=[]
  for i in range(numPoints):
      x=uniform(0,20)
      y=10
      z=i*5
      myPoints.append([x,y,z])
  crv=cmds.curve(ep=myPoints,d=3)
  cmds.revolve(crv,axis=myAxis,endSweep=myEndSweep)
revolve(10,[0,0,1],180)
#get all the Cvs of the revolved surface
allCvs= cmds.ls("revolvedSurface8.cv[:][:]", fl=1)
#define move cvs in nurbsPlane randomly
def moveVertiRandomly(allCvs, minimum, maximum,x,y,z):
  if minimum>= maximum:
      print "hello!"
  #start a loop through all cvs in x axis
  else:
      for i in allCvs:
          x= random.uniform(minimum, maximum)
          y=0
          z=0
          cmds.move (x,y,z,i,r=True)
#move Cvs randomly
moveVertiRandomly (allCvs, 2, 18, 0,0,7)
 
No comments:
Post a Comment