MitMeshPolygon for selecred mesh

25 views
Skip to first unread message

miarmy

unread,
Apr 23, 2018, 8:54:05 AM4/23/18
to Python Programming for Autodesk Maya
Hi...
Look this code:
import maya.OpenMaya as OpenMaya
...
A=OpenMaya.MItMeshPolygon(obj)

i want obj is equal with the selected obj in the outliner or scenes...(obj=selected☺)
Please help.

Justin Israel

unread,
Apr 23, 2018, 10:01:17 PM4/23/18
to python_in...@googlegroups.com
Try something like this:

import maya.OpenMaya as om

sel = om.MSelectionList()
om.MGlobal.getActiveSelectionList(sel)

obj = om.MObject()
if not sel.isEmpty():
    sel.getDependNode(0, obj)
    # Now use obj

Justin

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, 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/225ba0c5-d3ea-4f9a-a547-ad35df438d38%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages