Showing posts with label 03A. Show all posts
Showing posts with label 03A. Show all posts

Wednesday, July 22, 2009

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

Saturday, July 11, 2009

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)

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)