Showing posts with label Debbie. Show all posts
Showing posts with label Debbie. 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)

Sunday, July 12, 2009

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()

Friday, July 10, 2009

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)

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)

Tuesday, June 9, 2009

02B - Deborah Kaiser - Lofting curves (exploring the results with different functions)



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

# Surfaces from curves
#Curves
def curves (amplitude):
numPoints= 50
#list to store the points
points=[]
#loop
for i in range (1,numPoints,1):
#function of the spiral curve:
x=i*i/10
y=x*x*.5
z=y*x*sin(i)*.03
myPoint= (x,y,z)
#store the points in the list
points.append(myPoint)
myCurve=cmds.curve(d=3, p=points)
return myCurve
#List to store the curves
myCurve=[]
#Number of curves
numCurves=20
#Call the curve 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 (15,10,30, crv)
#Lofting the curves
cmds.loft(myCurve)

Monday, June 8, 2009

02B - Deborah Kaiser - Lofting curves (exploring the results with different functions)



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

# Surfaces from curves
#Curves
def curves (amplitude):
numPoints= 50
#list to store the points
points=[]
#loop
for i in range (1,numPoints,1):
#function of the spiral curve:
x=tan(i)*amplitude
y=sin(i)*cos(i)*20
z=tan(i)*10
myPoint= (x,y,z)
#store the points in the list
points.append(myPoint)
myCurve=cmds.curve(d=3, p=points)
return myCurve
#List to store the curves
myCurve=[]
#Number of curves
numCurves=20
#Call the curve 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 (10,20,10, crv)
#Lofting the curves
cmds.loft(myCurve)

Lofting curves - Deborah Kaiser



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

# Surfaces from curves
#Curves
def curves (amplitude):
numPoints= 50
#list to store the points
points=[]
#loop
for i in range (1,numPoints,1):
#function of the spiral curve:
x=sin(i)*100
y=cos(i)*amplitude*i/10*tan(i)
z= i*2*sin(i)
myPoint= (x,y,z)
#store the points in the list
points.append(myPoint)
myCurve=cmds.curve(d=3, p=points)
return myCurve
#List to store the curves
myCurve=[]
#Number of curves
numCurves=20
#Call the curve 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 (10,50,1, crv)
#Lofting the curves
cmds.loft(myCurve)

Sunday, May 24, 2009

02A - Deborah Kaiser - from point to curves

Daniel, i took the function from the previous exercise but i can not get it to turn the points into a curve. What am i doing wrong?

Thnx!


def curves (amplitude):
numPoints = 200
amplitude = 1
points = []


for i in range (0,numPoints,1) : # (start, end, increment)ve
x = i + 3*i
y = cos (i)*amplitude*10
z = i*x*.001 + y*0.0001 +1
myPoint = [x,y,z]
points.append (myPoint)


myCurve = cmds.curve (d =3, p= points)
return myCurve

01A - Deborah Kaiser - making rice

Sorry it is so overdo, i was not getting the e mails...

function cook rice:

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

with cup:
get pan
turn 90°
let all content fall into pan


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

with cup:
get pan
turn 90°
let all content fall into pan



execute function makeRice

function makeRice:
desiredSalt = 2
desiredTime = 10 min

get pan
with pan:
place on burner
turn burner on

start counting time
if time = 10min:
turn burner off

finish

01B - Deborah Kaiser - function, succesful attempt

01B - Deborah Kaiser - function, succesful attempt

from math import *

numPoints = 200
amplitude = 1


for i in range (0,numPoints,1) : # (start, end, increment)
x = i + 3*i
y = cos (i)*amplitude*10
z = i*x*.001 + y*0.0001 +1
myPoint = [x,y,z]
cmds.spaceLocator (p=myPoint)

01B - Deborah Kaiser - 3d grid, succesful attempt




# 3d grid

numColumns = 30
numRows = 30
numHeights = 30

for k in range (0, numHeights,1):
z = k
for i in range (0, numColumns,1):
x=i
for j in range(0,numRows, 1):
y = j
myPoint = [x,y,z]
cmds.spaceLocator (p=myPoint)