-
Notifications
You must be signed in to change notification settings - Fork 0
Maya and Python
Over the last few weeks I've been programming in Python in Maya and noticed the lack of online resources for maya + python. I've created a really easy to use list of common and not so common commands to help beginners users.
common use import methods that you use to call in built python methods
import maya.cmds as cmds import math, sys import random as r
When ever the run the script it's a good idea to remove all objects from the world
def deleteAllObjects(): cmds.select(all=True) cmds.delete()
deleteAllObjects()
def makeSphere(radius=1.0): result = cmds.polySphere(r=radius) return result[0]
def makeCube(size=1.0): result = cmds.polyCube(w=size, h=size, d=size) return result[0]
copy make copies (or instances) of a shape
def makeCopy(node): copy = cmds.duplicate(node) return copy[0]
def placeCube(x,y,z): shape = makeCube(1) translate(shape, x,y,z);