-
Notifications
You must be signed in to change notification settings - Fork 38
Maya Port Switch
Kumaran edited this page May 21, 2014
·
2 revisions
import maya.cmds as cmds
def openPort(portNumber=None):
if portNumber is None:
portNumber = ":7002"
if cmds.commandPort(portNumber, q=True):
print "Port {0} is open, attempting to close".format(portNumber)
cmds.commandPort(name=portNumber, cl=True)
print "Port {0} now closed!".format(portNumber)
else:
print "Port {0} is closed, attempting to reopen".format(portNumber)
cmds.commandPort(name=portNumber, sourceType="python")
print "Port {0} now open!".format(portNumber)
openPort()