Now we will start digging into Maya and PyMEL. Let's begin by initializing Maya in the mayapy interpreter so we can use more than just standard Python functionality. We do this by calling
maya.standalone.initialize, as shown in the following code:
>>> import maya.standalone >>> maya.standalone.initialize() >>> import pymel.core as pmc >>> xform, shape = pmc.polySphere()
The import of
pymel.core will implicitly call
maya.standalone.initialize automatically, but I do it explicitly here so it's clear what's going on. In the future, you can generally skip the call to
maya.standalone.initialize and just import
There is a lot we can discover about these PyMEL objects, which represent Maya nodes, using basic Python. ...