pymel.core.system.Workspace

digraph inheritancecacf41a954 { rankdir=TB; ranksep=0.15; nodesep=0.15; size="8.0, 12.0"; "Workspace" [fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",URL="#pymel.core.system.Workspace",style="setlinewidth(0.5)",tooltip="This class is designed to lend more readability to the often confusing workspace command.",height=0.25,shape=box,fontsize=8]; }

class Workspace(*p, **k)

This class is designed to lend more readability to the often confusing workspace command. The four types of workspace entries (objectType, fileRule, renderType, and variable) each have a corresponding dictiony for setting and accessing these mappings.

>>> from pymel.all import *
>>> workspace.fileRules['mayaAscii']
u'scenes'
>>> workspace.fileRules.keys() 
[...u'mayaAscii', u'mayaBinary',...]
>>> 'mayaBinary' in workspace.fileRules
True
>>> workspace.fileRules['super'] = 'data'
>>> workspace.fileRules.get( 'foo', 'some_default' )
'some_default'

the workspace dir can be confusing because it works by maintaining a current working directory that is persistent between calls to the command. In other words, it works much like the unix ‘cd’ command, or python’s ‘os.chdir’. In order to clarify this distinction, the names of these flags have been changed in their class method counterparts to resemble similar commands from the os module.

old way (still exists for backward compatibility)
>>> proj = workspace(query=1, dir=1)
>>> proj  
u'...'
>>> workspace(create='mydir')
>>> workspace(dir='mydir') # move into new dir
>>> workspace(dir=proj) # change back to original dir
new way
>>> proj = workspace.getcwd()
>>> proj  
Path('...')
>>> workspace.mkdir('mydir')
>>> workspace.chdir('mydir')
>>> workspace.chdir(proj)
All paths are returned as an pymel.core.system.Path class, which makes it easy to alter or join them on the fly.
>>> workspace.path / workspace.fileRules['mayaAscii']  
Path('...')
__call__(*args, **kwargs)

provides backward compatibility with cmds.workspace by allowing an instance of this class to be called as if it were a function

_the_instance = <pymel.core.system.Workspace object at 0x000002755D65FBA8>
classmethod chdir(newdir)
expandName(path)
fileRules = WorkspaceEntryDict('fileRule')
classmethod getName()
classmethod getPath()
classmethod getcwd()
classmethod mkdir(newdir)
name
classmethod new(workspace)
objectTypes = WorkspaceEntryDict('objectType')
classmethod open(workspace)
path
renderTypes = WorkspaceEntryDict('renderType')
classmethod save()
classmethod update()
variables = WorkspaceEntryDict('variable')