Thursday, May 14, 2009

Assignment 01B – Help Functions

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.

1 comment:

  1. import maya.cmds as cmds

    #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)
    #get the face
    face = cmds.filterExpand(ex=True,sm=12)

    def oppositeEdges(polygon, face):, r=1)
    es = cmds.polyInfo(fe = 1)
    es = es[0]
    es = es.split()
    es = es[2:]
    #select first edge + ".es[0]", r=1)[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
    if pair in pairs:

    return pairs


    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.