Code:
def getEdgeOrder(borderEdgeList, borderVertrList) : edgeList = {} for v in borderVertList: edgeList[v] = [] print v #for edge in edgeList.items() : # print edge return [] nList = [[] for i in borderEdgeList] for edge in borderEdgeList: info = cmds.polyListComponentConversion(edge, tv = 1) info = cmds.filterExpand(info, sm = 31) if info[1] not in edgeList[info[0]] : edgeList[info[0]].append(info[1]) if info[0] not in edgeList[info[1]] : edgeList[info[1]].append(info[0]) start = borderVertList[0] end = edgeList[start][1] last = edgeList[start][1] counter = 0 e = [] while start != end : counter = counter + 1 #print edgeList[start] if counter >= len(borderEdgeList) : print "error" break elif edgeList[start][0] == last : x = edgeList[start][1] else : x = edgeList[start][0] e.append([start, x]) last = start start = x e.append([end, borderVertList[0]]) edgeOrder = [] for a in e: cmds.select(a, r = 1) cmds.ConvertSelectionToContainedEdges(); edgeOrder.append(cmds.ls(sl = 1)) return edgeOrder