If you’re interested in taking the first step into Python for 3D software, Or simply would like to browse some script examples, your welcome to visit my Gist page, It contains a useful library of Python code example for Blender, Maya, 3ds max and Unreal engine: https://gist.github.com/CGLion
The following Python script iterates though Maya’s timeline frames, and for each frame creates a new cube, and aligns it’s position to the selected animated locator.
* There is probably a nicer way to set one object’s position according to anothers but haven’t found it yet (not finding enough examples of the cmds.xform command…) so sorry for that..
How to get an object transformation matrix relative to another object’s coordinates:
* The following script requires selecting 2 objects, the function will return the transform matrix of the first object relative to the transform matrix of the second.