For the completion of Assignment 01, I prepared some small help functions and procedures to help you out in the process of scripting. They are based on things I observed on most submissions. They are not intended to provide ready solutions, but to offer some hints. Therefore they might seem a bit random and out of context. Any help you need to use them, please post on the comments.
Thursday, May 14, 2009
Subscribe to:
Post Comments (Atom)
import maya.cmds as cmds
ReplyDelete#create initial polygon with sx=1, sy=1
##polygon = cmds.nurbsPlane(w=15, lr=1,u=1,v=1)
polygon = cmds.polyPlane(w=15, h=15, sx=1, sy=1)
cmds.select(polygon)
#get the face
face = cmds.filterExpand(ex=True,sm=12)
def oppositeEdges(polygon, face):
cmds.select(face, r=1)
es = cmds.polyInfo(fe = 1)
es = es[0]
es = es.split()
es = es[2:]
#select first edge
#cmds.select(polygon + ".es[0]", r=1)
cmds.select(polygon[0] , r=True)
#select border loop
sel = cmds.polySelect(eb=1)
pairs = []
for i in range(0, 4, 1):
pair = [ sel[(int(i))], sel[(int(i)+2)%4]]
print pair
pair.sort()
if pair in pairs:
continue
pairs.append(pair)
return pairs
oppositeEdges(polygon,face)
I changed some stuff in order to understand what s going on. As far as i could see, the def is returning values of the pairs list which are like a "culling" pattern. Can you please explain what i should do to get the actual edges?
Thank you in advance and sorry for the messy post.