Sunday, May 24, 2009

02A_Clau_from points to curves

In the first part of this exercise I took the code of the previous assingment, but instead of plotting points I generated curves (see image). Then I tried to convert the code into a function and return the value but didn't get a result. I have a Syntax Error. I don't know where is the mistake.


import maya.cmds as cmds
from math import*
from random import*
######################################################
#from points to curves
#defining initial variables
numRows= 40
numColumns=4
numLevels=12
amplitude = 12

#create an empty list to store the points
points= []

#defining the loop and gather information
for i in range (-1,numRows,1):
x= sin(6*i)*amplitude
for j in range (-1,numColumns,2):
y= cos(i)*8
for k in range (0,numLevels,1.5):
z= k+1
myPoint=(x,y,z)
#store the point in the list
points.append(myPoint)

#create the curve
cmds.curve (d= 3, p= points) #curve degree 3

######################################################
######################################################
#2ND PART
#####################################################
#defining initial variables
numRows= 40
numColumns=4
numLevels=12
amplitude = 12

#defining the curve
def Curves (numPoints, amplitude)

#create an empty list to store the points
points= []

#loop and gather point information
for i in range (-1,numRows,1):
x= sin(6*i)*amplitude
for j in range (-1,numColumns,2):
y= cos(i)*8
for k in range (0,numLevels,1.5):
z= k+1
myPoint=(x,y,z)
#store the point in the list
points.append(myPoint)

#creating the curve
myCurve= cmds.curve (d=3, p=points) #curve degree 3

#returning the name of the curve created
return myCurve

No comments:

Post a Comment