06 June 2012, 01:02 PM
The first thing to do is find out exactly what ToggleLocalRotationAxes actually is.
If you do a: whatIs on ToggleLocalRotationAxes you will find out that it isn't actually a real (internal) command, but a Run Time Command. A Run Time Command is simply an "alias" where a complex line or two of MEL code is reduced down into a single, handy-to-remember named "label". You then use the runTimeCommand command to find out what the "hidden" code is. In the case of ToggleLocalRotationAxes this simply works out as:
and, as toggle is a real (internal) command that means there will (most likely) be a python equivalent. However, this is not ideal as toggle is a toggle and ideally you really need an explicit on/off command. Also, it doesn't seem to specify any explicit object names so this may be an issue if you want it to work on anything other than the active selection.
Fortunately for us, toggle does accept object names and also has a query mode, so you can query the current state of any given item:
mc.toggle('pCube1', query=1, localAxis=1)
# Result: 1
Finally, you should soon learn that most stuff in Maya is done with attributes on nodes. Anything that is a per-object setting is almost guarenteed to be handled by an attribute on the node. If you view the object transform in the Attribute Editor and open the "display" frame you should see an attribute labelled: Display Local Axis. If you toggle the local axis on/off using the above methods and watch this attribute you should see it check on and off. If you then manually flick this attribute on/off you should see in the Script Editor:
setAttr "pCube1.displayLocalAxis" 1;
This then tells you the attribute name in question. This means you can simply ignore all MEL commands and Run Time Commands and set this attribute on any given nodes to explicitly turn the local Axis display on or off.
import pymel.core as pm
for obj in pm.selected():
Hope this is some help...
06 June 2012, 04:00 AM
Thank you for your response. I am very grateful for your time. This will be big help.
06 June 2012, 04:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.