Thanks Jooja, seems much more simple...
I tried something out, and you can see why i think it looks very ugly... too many loops and checkings.
I have to do it all very fast, no time for good thinking, but it works......
I'll try your suggestion though, should make it much more simple....
Python code:
CODE
def oppositeEdges(f):
#returns 2 pairs of opposite edges for a 4-sided face
es = cmds.ls(cmds.polyListComponentConversion(f, ff=1, te=1), fl=1) #get edges
pairs = [] #to store pairs of edges
for e1 in es:
vs1 = cmds.polyListComponentConversion(e1, fe=1, tv=1) #get vertices for edge 1
for e2 in es:
if e2 == e1: #if looking at the same edge, skip
continue
vs2 = cmds.polyListComponentConversion(e2, fe=1, tv=1) #get vertices for edge 2
#check if the vertices from the first do not appear between the ones of the second
if (vs2[0] in vs1) == 0 and (vs2[1] in vs1) == 0 and (e1 in pairs) == 0:
pairs.append(e1)
pairs.append(e2)
#reassemble the list so it has 2 elements containing the
return [[pairs[0], pairs[1]], [pairs[2], pairs[3]]] pairs