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
On Tue, Apr 24, 2018 at 12:54 AM miarmy <[email protected]> wrote:
> 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.
>
> --
> 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 [email protected].
> 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.
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA00YAw6VKM4XSPORhz_w4cq4VXep1O%2BGQmwkEeS-tvZ%3DQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.