############################################################################# ## easyas.py v by Andrew Osiow (c) 2009 ## ## ver 1.0 This is a simple Python in Maya Demostration designed for those ## that are new to Python and scripting. Although it doesn't do ## much, it introduces some basic scripting concepts. ## ## Start Maya and create a cube, a sphere, and a cone. ## Then select them all and duplicate them. ## Open up the script editor and then load and execute this script. ## ############################################################################# import maya.cmds as cmds # This is necessary to use Maya Commands in Python selectedObjects = cmds.ls( sl=True ) # creates a list of selected objects for object in selectedObjects: # creates a loop that will do the same all objects in the list print object # prints the ojects name in the script editor if object[1] == 'S': # tests to see if the second letter on the script is a "s" - as in "sphere" print object, 'is a sphere.' # prints the results to the script editor else: print object, 'is not a sphere.' if object[-1] == '1': # tests the last letter to check to objects number. print object, 'is an original.' else: print object, 'is a duplicate.' print "I'm Done." # Use Double quotes when printing a single quote # When a loop is Done, return to the previous tab setting