############################################################################# ## nurbface.py v1.0 by Andrew Osiow (c) 2009 ## ## Builds a Nurb Patch for every selected face ## ## To be used freely with the author's permission. Please contact the author ## if you wish upload or post this script to another site. ## ## usage: import nurbface.py ## nurbface.nurbface() ## ## ver 1.0 create 3rd Nurb faces from selected polyfaces ## ver 1.1 uses the boundary tool instead of Lofting ## ############################################################################# import maya.cmds as cmds def nurbface(): selectedFaces = cmds.ls( sl=True, fl=True ) faceString = selectedFaces[0] print faceString shapeName = faceString[0:faceString.find('.')] print shapeName for face in selectedFaces: resultString = cmds.polyInfo( face, fe=True )[0] edgeArray = [str(s) for s in resultString.split()][2:] print edgeArray for edge in edgeArray: if edge == edgeArray[0]: cmds.select( shapeName + '.e[' + edge + ']', r=True ) else: cmds.select( shapeName + '.e[' + edge + ']', add=True ) cmds.Boundary() nurbSurface = cmds.ls( sl=True, fl=True )[0] cmds.rebuildSurface( nurbSurface, ch=1, rpo=1, su=1, du=3, sv=1, dv=3, tol=0.01 ) cmds.delete( ch=1 ) #end