pymel has a package to convert from Mel to Pyhon, it works for commands and
all its flags, and even has a method to convert complete Mel files.
So on your example:
import pymel.tools.mel2py as mel2py
print mel2py.mel2pyStr('dgdirty -a;')
#result: dgdirty(a=1)
the only thing that you need to add the cmds import and the namespace to
the command (i.e. from maya import cmds and "cmds." at the beginning)
here you can find more info
https://help.autodesk.com/cloudhelp/2016/ENU/Maya-Tech-Docs/PyMel/generated/pymel.tools.mel2py.html#mel-to-python-translator
El miércoles, 9 de mayo de 2018, 19:57:50 (UTC+2), Ravi escribió:
>
> anyone help me this small mel script to python please
>
>
> dgdirty -a
>
--
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/1a0ead2c-d9b8-4d4c-8591-3e50e4890c42%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.