Showing posts with label assignments. Show all posts
Showing posts with label assignments. Show all posts

Wednesday, July 22, 2009

04 - Deborah Kaiser - images


04 - Deborah Kaiser

import maya.cmds as cmds
from math import*
from random import*

#create a locator in random position
x = uniform (10,30)
selLoc = cmds.spaceLocator( p=(x,x,2*x) )
#create a curve
def curves (amplitude):

#def initial variables
numPoints= 35

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

#loop and gather information
for i in range (1,numPoints,1):

#function of the spiral curve:
x=cos(i)*i
y=sin(i)*amplitude
z= i
myPoint= (x,y,z)

#store the points in the list
points.append(myPoint)
myCurve=cmds.curve(d=3, p=points)
return myCurve

#create an empty list to store the curves
myCurve=[]

#define number of curves
numCurves=5

#function to call the curves in a loop
for i in range(0,numCurves,1):
crv= curves (i)

#store the curve in the list
myCurve.append (crv)
print crv

#move the curves
cmds.move (10,5,5, crv)

#loft the curves
LoftSrf = cmds.loft(myCurve)

### Move Surface ###

# A) get all the vertices of the Surfaces
allCvs= cmds.ls("loftedSurface1.cv[:][:]", fl=1)
cmds.select (LoftSrf, r = True)

# B) define move cvs in surface randomly
def moveVertiRandomly(allCvs, minimum, maximum):
if minimum>= maximum:
print "hello!"
# B.1) start a loop through all cvs in z axis
else:
for i in allCvs:
x= 0
y= 0
z= uniform (minimum, maximum)
cmds.move (x,y,z,i,r=True)
# C) move cvs randomly
moveVertiRandomly (allCvs, 0, 10)

### Move Cvs of Surface according to Locator direction ###

#define coordinates between locator and CV in order to move CV
def distance1 (posPoint, posLoc, constantMin, constantMax):
#subtract both vectores
x1= posPoint[0]
y1= posPoint[1]
z1= posPoint[2]
x2= posLoc[0]
y2= posLoc[1]
z2= posLoc[2]
constant = uniform (constantMin, constantMax)
x= x1 + ((x2 - x1)/constant)
y= y1 + ((y2 - y1)/constant)
z= z1 + ((z2 - z1)/constant)
m= [x,y,z]
return m

#define moveToLocator function
def moveToLocator(selLoc):
#loop through cvs
for i in allCvs:
# refresh
cmds.refresh ()
posPoint= cmds.pointPosition(i)
posLoc= cmds.pointPosition (selLoc)
# randomly moving CVs towards the locator
d= distance1(posPoint, posLoc, 2,5)
cmds.move (d[0],d[1],d[2],i)

#call the function
moveToLocator(selLoc)


### Move Curves ###

# A) get all the cvsNames of a curve
crvCvs = cmds.ls("curve1.cv[:]", fl=1)

# B) define move cvs randomly
def moveVertRandomly (allCvs, minimum, maximum):
if minimum>= maximum:
print "hello!"
# B.1) start a loop through all cvs
else:
for cv in allCvs:
rx = uniform(minimum, maximum)
ry = uniform(minimum, maximum)
rz = uniform(minimum, maximum)
cmds.move (rx,ry,rz,cv,r=2)
# refresh
cmds.refresh ()
cmds.pause (sec=1)
# C) move cvs randomly
moveVertRandomly (crvCvs, 0, 17)


### Move Curve 5 according to Locator direction ####

def moveCrvFive (selLoc):
fiveCvs = cmds.ls("curve5.cv[:]", fl=1)
for j in fiveCvs:
posPoint= cmds.pointPosition(j)
posLoc= cmds.pointPosition (selLoc)
# randomly moving CVs towards the locator
d= distance1(posPoint, posLoc, 2,2)
cmds.move (d[0],d[1],d[2],j)
# refresh
cmds.refresh ()
cmds.pause (sec=1)

moveCrvFive (selLoc)

03-A Anthony Adelmann Confusion

I have some trouble getting this script to work, a lot of weird spacing errors popped up.


#assignment 3A
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)

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=3)
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:
rz = random.uniform(minimum, maximum)
ry = random.uniform(minimum, maximum)
rz = random.uniform(minimum, maximum)
cmds.move (rx, ry, rz, i, r=2)
allCvs = cmds.ls("curve1.cv[:]", fl=4)
moveVertRandomly (allCvs, 11, 17)
allCvs1 = cmds.ls("nurbsPlane1.cv[:][:]", fl=1)
moveVerticeRandomly (allCvs, 5, 11, 7, 7, 12)
allFaces = cmds.ls ("pPlanel.f[:]", fl = 7)
extrudeFacesRandomly(allFaces, 7, 17)
allVert = cmds.ls("pPlane2.vtx[:]", fl=8)
polygonVertices (allVert, 6, 12)

Sunday, July 12, 2009

Masha - Assignment 03B



import maya.cmds as cmds
import random
import math

def magnitude (v):
x= v[0]
y= v[1]
z= v[2]
m = math.sqrt ((x*x)+(y*y)+(z*z))
return m

def distance (p1, p2):
#substract both vectors
x1 = p1[0]
y1 = p1[1]
z1 = p1[2]
x2 = p2[0]
y2 = p2[1]
z2 = p2[2]
x = x1-x2
y = y1-y2
z = z1-z2
m = magnitude ([x,y,z])
return m

def unit(v):
#returns unit vector of v
#first get magnitude
m = magnitude(v)
x = v[0]
y = v[1]
z = v[2]
#devide each element by magnitude
x = x/m
y = y/m
z = z/m
vu = [x,y,z]
return vu

def move (v, amount):
"Move by certaine amount in directio v"
x = v[0]
y = v[1]
z = v[2]
x = x+amount
y = y+amount
z = z+amount
newP = [x,y,z]
return amount

def vectorBetweenPoints (p1, p2):
"Returns vector between p1 and p2"
#substract both vectors
x1 = p1[0]
y1 = p1[1]
z1 = p1[2]
x2 = p2[0]
y2 = p2[1]
z2 = p2[2]
x = x1-x2
y = y1-y2
z = z1-z2
newV = [x,y,z]
return newV

def moveVert (allCvs):
selLoc = cmds.filterExpand (sm = 22)
xs = 0
ys = 0
zs = 0
for i in allCvs:
pos = cmds.pointPosition(i)

posLoc = cmds.pointPosition (selLoc)
dd = distance ([centerX, centerY, centerZ], posLoc)
print dd
cmds.polyExtrudeVertex( l =dd, w=3, d=4 )


def moveVertice (allCvs):
selLoc = cmds.filterExpand (sm = 22)
allCvs1 = cmds.ls("nurbsPlane2.cv[:][:]", fl=1)
#d=1000
dist =1000
allDist =[]
print selLoc
for i in allCvs1:
pos = cmds.pointPosition(i)
for j in selLoc:
posLoc = cmds.pointPosition (j)
dd = distance (pos, posLoc)
if dd

03B - Deborah Kaiser - Extrudying faces of a polygon according to locator




#################################################
#####
### 03B
#####

import maya.cmds as cmds
import math
import random

#EXTRUDE FACES OF POLYGON ACCORDING TO DISTANCE TO LOCATOR

def magnitude(v):
x=v[0]
y=v[1]
z=v[2]
m=math.sqrt ((x*x)+(y*y)+(z*z))
return m

def distance (p1, p2):
x1=p1[0]
y1=p1[0]
z1=p1[1]
x1=p1[2]
x2=p1[0]
y2=p1[1]
z2=p1[2]
x= x1-x2
y= y1-y2
z= z1-z2
m= magnitude([x, y, z])
return m

def ExtrudeToLocator():
"Extrude based on a distance of a certain Locator"

#GET LOCATOR AND POLYGON
selPoly= cmds.filterExpand(sm=12)
selLoc= cmds.filterExpand(sm=22)
selPoly= selPoly[0]

#GET ALL FACES OF POLYGON
allFaces= cmds.ls(selPoly + ".f[:]", fl=1)

#LOOP THROUGH FACES
for face in allFaces:
vertex= cmds.polyListComponentConversion (face, fromFace=1, toVertex=1)
vertex= cmds.ls (vertex, fl=1)
# find the center of the face
xs= 0
ys= 0
zs= 0

# LOOP THROUGH VERTICES
for v in vertex:
pos= cmds.pointPosition(v)
x= pos[0]
y= pos[1]
z= pos[2]
xs= xs + x
ys= ys + y
zs= zs + z
centerX= xs/len(vertex)
centerY= ys/len(vertex)
centerZ= zs/len(vertex)

#PLACE LOCATOR
cmds.spaceLocator(p=(centerX, centerY, centerZ))

#DISTANCE TO LOCATOR
posLoc= cmds.pointPosition(selLoc)
d= distance([centerX, centerY, centerZ], posLoc)
print d
#extrude based on distance
cmds.polyExtrudeFacet(face, ltz=d/10)

#EXTRUDE TO LOCATOR
ExtrudeToLocator()

Ex03B_PolyPlane_Deborah&Claudia




#######################
## Ex03B_Move Cvs of a Nurbs according to Locator direction
#######################

import maya.cmds as cmds
import math

#define distance between PolFaces and locator
def magnitude (v):
#v is a list of x,y,z values
x= v[0]
y= v[1]
z= v[2]
m= math.sqrt ( (x*x) + (y*y) + (z*z) )
return m

def distance (posVert, posLoc):
#subtract both vectors
x1= posVert[0]
y1= posVert[1]
z1= posVert[2]
x2= posLoc[0]
y2= posLoc[1]
z2= posLoc[2]
x= x1 - x2
y= y1 - y2
z= z1 - z2
m= magnitude ([x,y,z])
return m

#define moveToLocator function
def moveToLocator():
# A) get all the verticesNames of a plane
allVertices= cmds.ls ("pPlane1.vtx[:]", fl=1)

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

#get selected Locator
selLoc= cmds.filterExpand(sm=22)

#loop through vertices
for v in allVertices:
pos= cmds.pointPosition(v)
x= pos[0]
y= pos[1]
z= pos[2]

#find distance to Locator
posVert= cmds.pointPosition(v)
posLoc= cmds.pointPosition(selLoc)
d= distance(posVert, posLoc)
print d
cmds.move (d,3,d,v,r=True)

#store the cvs in a list
MyVerts.append(allVertices)

#call the function
moveToLocator()

Ex03B_NurbsSphere_Deborah&Claudia




#######################
## Ex03B_Move Cvs of a Nurbs according to Locator direction
#######################

import maya.cmds as cmds
import math

#define distance between cvs and locator
def magnitude (v):
#v is a list of x,y,z values
x= v[0]
y= v[1]
z= v[2]
m= math.sqrt ( (x*x) + (y*y) + (z*z) )
return m

def distance (posPoint, posLoc):
#subtract both vectores
x1= posPoint[0]
y1= posPoint[1]
z1= posPoint[2]
x2= posLoc[0]
y2= posLoc[1]
z2= posLoc[2]
x= x1 - x2
y= y1 - y2
z= z1 - z2
m= magnitude ([x,y,z])
return m

#define moveToLocator function
def moveToLocator():
# A) get all the cvsNames of a NurbsPlane
NurbsCvs = cmds.ls("nurbsSphere1.cv[:]", fl=1)

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

#get selected Locator
selLoc= cmds.filterExpand(sm=22)

#loop through cvs
for i in NurbsCvs:
posPoint= cmds.pointPosition(i)
posLoc= cmds.pointPosition (selLoc)
d= distance(posPoint, posLoc)
print d
cmds.move (d,d,d,i,r=True)

#store the cvs in a list
MyCvs.append(NurbsCvs)

#call the function
moveToLocator()

Ex03B_Curve_Claudia&Deborah




#####################
## Ex03B_Move Cvs of a Curve according to Locator direction
#######################

import maya.cmds as cmds
import math

#define distance between cvs and locator
def magnitude (v):
#v is a list of x,y,z values
x= v[0]
y= v[1]
z= v[2]
m= math.sqrt ( (x*x) + (y*y) + (z*z) )
return m

def distance (posPoint, posLoc):
#subtract both vectores
x1= posPoint[0]
y1= posPoint[1]
z1= posPoint[2]
x2= posLoc[0]
y2= posLoc[1]
z2= posLoc[2]
x= x1 - x2
y= y1 - y2
z= z1 - z2
m= magnitude ([x,y,z])
return m

#define moveToLocator function
def moveToLocator():
# A) get all the cvsNames of a curve
allCvs = cmds.ls("curve1.cv[:]", fl=1)

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

#get selected Locator
selLoc= cmds.filterExpand(sm=22)

#loop through cvs
for i in allCvs:
posPoint= cmds.pointPosition(i)
posLoc= cmds.pointPosition (selLoc)
d= distance(posPoint, posLoc)
print d
cmds.move (0,0,d,i,r=True)

#store the cvs in a list
MyCvs.append(cvs)

#call the function
moveToLocator()

02B - Anthony Adelmann


import maya.cmds as cmds
from math import*
from random import*

#from curves to surfaces
#step 1, create a curve
def curves (amplitude):
#def initial variables
numPoints= 70
#create an empty list to store the points
points=[]
#loop and gather information
for i in range (1,numPoints,1):
#function of the spiral curve:
x=sin(i)*amplitude
y=cos(i)*amplitude
z=i
myPoint=(x,y,z)
#store the points in the list
points.append(myPoint)
myCurve=cmds.curve(d=3, p=points)
return myCurve
#create an empty list to store the curves
myCurve=[]
#define the number of curves
numCurves=19
#function to call the curves in a loop
for i in range(0,numCurves,2):
crv=curves(i)
#store the curve in the list
myCurve.append (crv)
print crv
#move the curves
cmds.move(3,11,4, crv)
#loft the curves
cmds.loft(myCurve)

01A - Diana Perez - Make capuccino


function fillBoiler:
with cup
fill with coldMilk
get boiler
place boiler right to cup
with cup
move 20cm up
turn -90°
if cup = „empty“
turn 90°
move 20cm down
execute function boilMilk

function boilMilk:
get boiler
put boiler on heater
turn heater.switch to „on“
desiredTime = 5min
when desiredTime:
turn heater.switch to „off“
execute function putCapuccino

function putCapuccino:
get cup
desiredCapuccino = 2
desiredSugar = 2
execute function fillCup

function fillCup:
get cup
place cup right to boiler
with boiler:
move 20cm up
turn -90°
if cup = „full“
with boiler:
turn 90°
move 20cm down

finish

Clau_Ex03B_Doubts

Daniel, I am trying to move the vertices of a Curve according to the direction of a Locator. I could move the position of the Curve to the direction of a locator -see script below- however, when i try to apply this logic to move the vertices of the curve, i get lost. Don't tell you about moving the cv's of a nurbs surface according the direction of a locator. Could you help me?
This is the scripting with probls
## Ex03B_Move Curve Cvs according to Locator direction
#####

import maya.cmds as cmds
import math

#get names of selected objects on Stage
#first select the objects
selObj= cmds.ls(sl=1)
print selObj

#find position of this two objetcs
obj1= selObj[0] #this is for locator1
obj2= selObj[1] #this is for curve1
print obj1
print obj2

pos1= cmds.pointPosition(obj1)
pos2 = cmds.pointOnCurve(obj2)
print pos1
print pos2

#find distance between two objects
d= distance (pos1,pos2)
print d

#move all vertices of obj2 10 times in direction to obj1
# select all vertices of obj2
allCvs = cmds.ls("curve1.cv[:]", fl=1)

# I dont know how to continue....


Here is the script to move the curve position according to loc1 direction
## Ex03B_Move Curve according to Locator direction
#####

import maya.cmds as cmds
import math

#get names of selected objects on Stage
#first select the objects
selObj= cmds.ls(sl=1)
print selObj

#find position of this two objetcs
obj1= selObj[0] #this is for locator1
obj2= selObj[1] #this is for curve1
print obj1
print obj2

pos1= cmds.pointPosition(obj1)
pos2= cmds.pointOnCurve(obj2)
print pos1
print pos2

#find distance between two objects
d= distance (pos1,pos2)
print d

#move obj2 4 times in direction to obj1
# first get vectors between obj2 and obj1
v= vectorBetweenPoints(pos1,pos2)
# get the unit of vector v
dir= unit(v)

#move 4 units in dir obj1
newPos= move (dir,4)

#move obj2 to that position
cmds.move (newPos[0], newPos[1], newPos[2], obj2)

This is the exercise of extruding faces of a polygon according to the distance of a Locator.



### Ex03B ######
## Vector Functions
import maya.cmds as cmds
import math
import random

########### extrude the faces of a polygonal object
# according to its distance to a certain
# locator

def ExtrudeToLocator():
"Extrude based on a distance of a certain Locator"
#get selected Poly and selected Locator
selPoly= cmds.filterExpand(sm=12)
selLoc= cmds.filterExpand(sm=22)
selPoly= selPoly[0]

#get all faces of the Poly
allFaces= cmds.ls(selPoly + ".f[:]", fl=1)

#start a loop through all faces
for face in allFaces:
vertex= cmds.polyListComponentConversion (face, fromFace=1, toVertex=1)
vertex= cmds.ls (vertex, fl=1)
# find the center of the face
xs= 0
ys= 0
zs= 0

#loop through vertices
for v in vertex:
pos= cmds.pointPosition(v)
x= pos[0]
y= pos[1]
z= pos[2]
xs= xs + x
ys= ys + y
zs= zs + z
centerX= xs/len(vertex)
centerY= ys/len(vertex)
centerZ= zs/len(vertex)

#check by placing a Locator
cmds.spaceLocator(p=(centerX, centerY, centerZ))

#find distance to Locator
posLoc= cmds.pointPosition(selLoc)
d= distance([centerX, centerY, centerZ], posLoc)

#extrude based on distance
cmds.polyExtrudeFacet(face, ltz=d)

#extrude to locator
ExtrudeToLocator()

Saturday, July 11, 2009

02A - Anthony Adelmann


import maya.cmds as cmds
from math import*
from random import*

numRow = 20
numColumns = 13
numHeights = 12
points = []

for i in range(0, numRow, 1):
x = (i)
for j in range (0, numColumns, 1):
y = j
for k in range (-1, numHeights, 1):
z = sin (k*i*j)
myPoint = (x,y,z)
points.append(myPoint)
cmds.curve(d=3, p=points)

Claudia_Ex03A










######### Excercise 03A
import maya.cmds as cmds
import random
import math

###### CURVE ######
# A) get all the cvsNames of a curve
allCvs = cmds.ls("curve1.cv[:]", fl=1)

# B) define move cvs randomly
def moveVertRandomly (allCvs, minimum, maximum):
if minimum>= maximum:
print "hello!"
# B.1) start a loop through all cvs
else:
for cv in allCvs:
rx = random.uniform(minimum, maximum)
ry = random.uniform(minimum, maximum)
rz = random.uniform(minimum, maximum)
cmds.move (rx,ry,rz,cv,r=2)

# C) move cvs randomly
moveVertRandomly (allCvs, 0, 17)

####### Nurbs Surface #######
# A) get all the vertices of the Nurbs
allCvs= cmds.ls("nurbsPlane1.cv[:][:]", fl=1)

# B) define move cvs in nurbsPlane randomly
def moveVertiRandomly(allCvs, minimum, maximum,x,y,z):
if minimum>= maximum:
print "hello!"
# B.1) start a loop through all cvs in z axis
else:
for i in allCvs:
x= 0
y= 0
z= random.uniform(minimum, maximum)
cmds.move (x,y,z,i,r=True)
# C) move dvs randomly
moveVertiRandomly (allCvs, 2, 18, 0,0,7)

####### Faces of a Polygon #######
# A) get all faces of a Polygon
allFaces= cmds.ls ("pCone1.f[:]", fl=1)

# B) define extrude faces of a polygon
def ExtrudeFacesRandom (allFaces, minimum, maximum):
if minimum>= maximum:
print "polygon"
# B.1 start a loop through all faces in y axix
else:
for face in allFaces:
ry= random.uniform(minimum, maximum)
cmds.polyExtrudeFacet(face, ltz=ry)

# C) extrude faces
ExtrudeFacesRandom(allFaces, 0,10)

####### Polygon Vertices #######
# A) get all vertices of a Polygon
allVertices= cmds.ls ("pPlane1.vtx[:]", fl=1)

# B) define movePolVertices
def movePolVert (allVertices, minimum, maximum):
if minimum>= maximum:
print "polygon"
# B.1 start a loop through vertices in z axis
else:
for e in allVertices:
rx= random.uniform (minimum, maximum)
ry= random.uniform (minimum, maximum)
rz= random.uniform (minimum, maximum)
cmds.move (rx,ry,rz,e,r=True)

# C) move Polygon Vertices
movePolVert(allVertices,1,7)

Friday, July 10, 2009

03A - Valentina de Leon







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, 10, 20)

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

extrudeFacesRandomly(allFaces, 0, 15)

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

02A - Valentina de Leon


import maya.cmds as cmds

#CURVES THROUGH POINTS

from math import*

numRows = 15
numColumns = 30
num3rdDimension = 50
points=[]
for i in range(0,numRows,1):
x = (i)
for j in range(-15,numColumns,30):
y = j
for k in range(5,num3rdDimension,30):
z = sin(k*i*j)*5

# ONDULATING GRID
myPoint=(x,y,z)
points.append(myPoint)
cmds.curve(d=30, p=points)

03A - Deborah Kaiser


03A - Deborah Kaiser

########################################################
##
###03A
##
import maya.cmds as cmds
import random
import math
#MOVE CURVES
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)
#EXTRUDE FACES
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)
#POLYGON VERTICES
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, 5, 25)
allCvs1 = cmds.ls("nurbsPlane1.cv[:][:]", fl=1)
moveVerticeRandomly (allCvs, 10, 1, 2,20,5)
allFaces = cmds.ls("pPlane1.f[:]", fl=1)
extrudeFacesRandomly(allFaces, 5, 10)
allVert = cmds.ls("pPlane2.vtx[:]", fl=1)
polygonVertices (allVert, 0, 5)

Thursday, July 9, 2009

Wednesday, July 8, 2009

03A - Deborah Kaiser - doubt

Hey daniel, i dont know why i can only make the curve part work, i get a syntax error with the extrude and the last one and i can not figure out why.
Could u help me?

Thnx!

########################################################
##
###03A
##

import maya.cmds as cmds
import random
import math


#MOVE CURVES

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)


#EXTRUDE FACES

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)


#POLYGON VERTICES

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, 5, 25)

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


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

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)