Create a MItMeshVertex using a set of vertex

132 views
Skip to first unread message

illunara

unread,
Jan 17, 2016, 2:39:38 AM1/17/16
to Python Programming for Autodesk Maya
Hi everybody 
I want to query the border vertexs of an mesh, then create another MItMeshVertex from it.
Then i looked into maya's doc and found this constructor might does what i need :

MItMeshVertex (const MDagPath &polyObject, MObject &component=MObject::kNullObj, MStatus *ReturnStatus=NULL) 

But i not sure about the 
MObject &component param, can someone give me a hint please? Thanks

Tuan Nguyen

unread,
Jan 17, 2016, 4:01:25 PM1/17/16
to python_in...@googlegroups.com
Some how i figure it out, i will post the code snippet here if anyone got interested
Name of MFnSingleIndexedComponent class confused me


import maya.OpenMaya as om

#Get active list
selList= om.MSelectionList()
om.MGlobal.getActiveSelectionList(selList)

dagpath = om.MDagPath()
sellist.getDagPath(0, dagpath)

#Get mesh vertex list
allVertexIt = om.MItMeshVertex(dagpath)
vtxComponent = om.MFnSingleIndexedComponent()
vtxComponent.create(om.MFn.kMeshVertComponent)


while not allVertexIt.isDone():
    if allVertexIt.onBoundary():
        vtxComponent.addElement(allVertexIt.index())
    allVertexIt.next()

#Get mesh border vertex list
bounderVtxIt = om.MItMeshVertex(dagpath, vtxComponent.object())
while not bounderVtxIt.isDone():
    print bounderVtxIt.index()
    bounderVtxIt.next()

--
You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/xPFtjITNhtk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/1de00628-4ae1-4fc7-a00c-6cb8b6a73979%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages