Member-only story
How to extract smooth mesh preview curves from a mesh in Maya
Tips and tricks for anyone using Maya and Rhino for architecture 3D modeling
Overview
This is a useful script to keep handy when doing a maya-to-rhino workflow. It allows you to extract curves (even from Smooth Mesh Preview!) from the mesh, and bring it as NURBS in Rhino.
The script
import maya.cmds as cmds
objList = cmds.ls(selection=1)
edgeNum = cmds.polyEvaluate(edge=1)
edgeList = []
i=0
while i<edgeNum:
edgeList.append(i)
i+=1
CurveList = []
while edgeList:
usedEdgeList=cmds.polySelect(objList[0],edgeLoop=edgeList[0])
tmpCurveList=cmds.polyToCurve(form=3,degree=1)
cmds.matchTransform(tmpCurveList[0],objList[0],pivots=True)
CurveList.append(tmpCurveList[0])
for j in usedEdgeList:
if j in edgeList:
edgeList.remove(j)
for c in CurveList:
if (c!=CurveList[0]):
curveShapeList=cmds.pickWalk(c,direction="down",type="nodes")
cmds.parent(curveShapeList[0],CurveList[0],relative=True,shape=True)
cmds.delete(c)
Explanation of workflow
Let’s say I want to get the green lines that describe the smooth mesh preview out as NURBS curves. I can do that by running the…