PathConfig Struct

new.gif NEW in 3ds Max 9: The PathConfig struct provides methods to access and manage Project paths, System paths, manipulate paths and convert between UNC, absolute and relative paths and so on.

Project Folder

pathConfig.doProjectSetupSteps()

Performs all steps necessary to set up a new Project, including browsing for project folder and creating all sub-folders. Returns true on success, false if cancelled.

pathConfig.doProjectSetupStepsUsingDirectory <ProjectPath>

Performs all steps necessary to set up a new Project using the supplied Project Path as the Root. Returns true on success, false if cancelled.

pathConfig.getCurrentProjectFolder()

Returns the current Project Folder.

pathConfig.getCurrentProjectFolderPath()

Returns the current Project Folder definition file (*.MXP).

pathConfig.getProjectFolderPath <ProjectPath>

Returns the Project Definition filename (<ProjectPath>\<ProjectName>.mxp) for the specified Project Folder.

pathConfig.getProjectSubDirectory <subdir_index>

Returns the indexed Project sub-directory.

For example:

--Print all Project Sub-Directories:

for i = 1 to pathConfig.getProjectSubDirectoryCount() do

format "%: %\n" i (pathConfig.getProjectSubDirectory i)

 

pathConfig.getProjectSubDirectoryCount()

Returns the number of Project sub-directories. See above example.

pathConfig.addProjectDirectoryCreateFilter <#directory_type>

Adds Project Directory Filter where directory_type is one of the following:

#font | #Scene | #export | #import | #help | #expression | #preview | #image | #Sound | #plugcfg | #maxstart | #vpost | #drivers | #autoback | #matlib | #scripts | #startupScripts | #defaults | #renderPresets | #ui | #maxroot | #renderoutput | #animations | #archives | #Photometric | #renderassets | #userScripts | #userMacros | #userStartupScripts | #temp | #userIcons | #maxData | #downloads | #proxies

pathConfig.removeAllProjectDirectoryCreateFilters()

Removes all filters added using pathConfig.addProjectDirectoryCreateFilter()

pathConfig.setCurrentProjectFolder <ProjectPath>

Sets the current project folder to the given path. The Project Folder is displayed in the title bar of 3ds Max and will be updated instantly.

Path Manipulation, Conversion and Resolving

pathConfig.appendPath <path1> <path2>

Appends the second argument filename to the first argument path, adding backslash if necessary.

For example,

pathConfig.appendPath "c:\\temp" "test.txt"

"c:\temp\test.txt"

pathConfig.appendPath "c:\\temp\\" "test"

"c:\temp\test"

 

pathConfig.convertPathToAbsolute <relative_path>

Converts the relative path argument to absolute project path using the Project Directory.

pathConfig.convertPathToAbsolute "meshes"

"C:\Documents and Settings\username\My Documents\3dsmax\meshes"

pathConfig.convertPathToLowerCase <path>

Converts the path argument to lower case and unifies the backslashes.

For example,

pathConfig.convertPathToLowerCase "C:\\Temp\Test/pATH"

"c:\temp\test\path"

 

pathConfig.convertPathToRelativeTo <path1> <path2>

Converts the first path argument to a relative path with respect to the second path argument.

For example,

pathConfig.convertPathToRelativeTo "C:\\Temp\\Test" "c:\\Program Files\\"

"..\Temp\Test"

 

pathConfig.convertPathToUnc <path>

Returns the UNC path from a mapped drive path.

For example,

--If drive letter T: is mapped to a server called MyServer, then

pathConfig.convertPathToUnc "t:\\project"

"\\MyServer\projects"

 

mapPaths.getFullFilePath <filename>

Resolves the filename using map paths, returns fully qualified filename if the file is found.

pathConfig.normalizePath <path>

Returns a normalized path name.

Example:

pathConfig.normalizePath "scenes/test.txt"

".\scenes\test.txt"

 

pathConfig.pathsResolveEquivalent <path1> <path2>

Returns true if the two paths resolve to the same location (in other words the two paths are equivalent), false if they are not equivalent.

Example:

pathConfig.pathsResolveEquivalent "scenes\\test.txt" "./scenes/test.txt"

true

 

pathConfig.resolvePathSymbols <path>

Resolves the path symbols.

pathConfig.resolveUNC SystemGlobal:resolveUNC false

This is the property toggle found in Preferences>Files which controls whether max automatically converts absolute paths to their UNC equivalents. (i.e. M:\file.txt to server1\\file.txt if M: is mapped to server1\\)

pathConfig.removePathLeaf <path>

Removes a leaf from the given path.

Example:

pathConfig.removePathLeaf "c:\\temp\\test"

"c:\temp"

 

pathConfig.removePathTopParent <path>

Removes the top parent from the given path.

Example:

pathConfig.removePathLeaf "c:\\temp\\test"

"temp\test"

 

pathConfig.stripPathToLeaf <path_or_filename>

Returns the last sub-directory name from the given path. If the path is a full file name, returns the file name. Equivalent to

Example:

pathConfig.stripPathToLeaf "C:\\temp\\test"

"test"

pathConfig.stripPathToLeaf "C:\\temp\\test\\"

""

pathConfig.stripPathToLeaf "C:\\temp\\test\\somefile.tga"

"somefile.tga"

--COMPARE:

filenamefrompath "C:\\temp\\test"

"test"

filenamefrompath "C:\\temp\\test\\"

""

filenamefrompath "C:\\temp\\test\\somefile.tga"

"somefile.tga"

 

pathConfig.stripPathToTopParent

Returns the root of the given path.

Example:

pathConfig.stripPathToTopParent "C:\\temp\\test\\test.tga"

"C:\"

pathConfig.stripPathToTopParent "\\\\SomeServer\\Projects\\Test"

"\\SomeServer"

 

Is... Query Methods

pathConfig.isAbsolutePath <path_string>

Returns true if the argument is an absolute path, false if it is a relative path. The path does not have to exist for this method to operate on it.

pathConfig.isLegalPath <path_string>

Returns true if the argument is a legal path definition, false if it is an illegal path. The path does not have to exist for this method to operate on it, it is only being parsed for correctness.

For example:

pathConfig.isLegalPath "c:\\" --legal path, existing

true

pathConfig.isLegalPath "z:\\path" --legal path, not existing

true

pathConfig.isLegalPath "zz:\\path" --illegal double drive letter!

false

 

pathConfig.isPathRootedAtBackslash <path>

Returns true if the argument starts with a backslash, false if it does not.

For example:

--starts with backslash:

pathConfig.isPathRootedAtBackslash "\\machine\\c$"

true

--does not start with backslash:

pathConfig.isPathRootedAtBackslash "c:\\temp"

false

 

pathConfig.isPathRootedAtDriveLetter <path>

Returns false if the argument starts with a backslash, true if it starts with a drive letter. The inverse of pathConfig.isPathRootedAtBackslash()

pathConfig.isProjectFolder <path>

Returns true if the argument path is a valid Project Folder root, false otherwise.

pathConfig.isRootPath <path>

Returns true if the argument path is a Root path, false otherwise

For example:

pathConfig.isRootPath "C:\\"

true

pathConfig.isRootPath "C:\\temp"

false

pathConfig.isUncPath <path>

Returns true if the argument path is a UNC path, false otherwise

For example:

pathConfig.isUncPath "T:\\Projects" --mapped drive, not UNC

false

pathConfig. isUncPath "\\\\MyServer\\Projects" --UNC path

true

pathConfig.isUncSharePath <path>

Returns true if the argument path is a UNC share path, false otherwise.

pathConfig.isUsingProfileDirectories()

Returns true if the system is using Profile directories, false otherwise.

pathConfig.isUsingRoamingProfiles()

Returns true if the system is using Roaming Profiles, false otherwise. When using roaming profiles on somebody else's machine, your profile is being accessed over the network from your own machine. This mode is not officially supported.

Other Path-Related Methods and Structs

pathConfig.GetDir <#directory_type>

Points at the GetDir() method documented here.

Returns the system directory where directory_type is one of the following:

#font | #Scene | #export | #import | #help | #expression | #preview | #image | #Sound | #plugcfg | #maxstart | #vpost | #drivers | #autoback | #matlib | #scripts | #startupScripts | #defaults | #renderPresets | #ui | #maxroot | #renderoutput | #animations | #archives | #Photometric | #renderassets | #userScripts | #userMacros | #userStartupScripts | #temp | #userIcons | #maxData | #downloads | #proxies

pathConfig.mapPaths #Struct:mapPaths

Points at the mapPaths struct definition.

Example:

--the two method calls are equivalent:

mapPaths.getFullFilePath "fir.tga"

pathConfig.mapPaths.getFullFilePath "fir.tga"

 

pathConfig.pluginPaths #Struct:pluginPaths

Points at the pluginPaths struct.

Example:

count = pathConfig.pluginPaths.count()

for j = 1 to count do

format " % : %\n" j (pathConfig.pluginPaths.get j)

 

pathConfig.sessionPaths #Struct:sessionPaths

Points at the sessionPaths struct.

pathConfig.SetDir

Points at the SetDir() method documented here.

pathConfig.xrefPaths #Struct:xrefPaths

Points at the xrefPaths struct.

Example:

--the two method calls are equivalent:

xrefPaths.getFullFilePath "delme.max"

pathConfig.xrefPaths.getFullFilePath "delme.max"

Configurate User Paths Dialog - Path Settings Loading, Saving and Merging

pathConfig.SaveTo <filename>

Saves the path configuration to the given filename. Returns true on success, false otherwise. Corresponds to the Save To... button in the Customize>Configure User Paths dialog.

pathConfig.load <filename>

Loads the path configuration from the specified path configuration file. Returns true on success, false otherwise. Corresponds to the Load button in the Customize>Configure User Paths dialog.

pathConfig.merge <filename>

Merges the settings from the given path configuration file. Returns true on success, false otherwise. Loads the path configuration from the specified path configuration file. Returns true on success, false otherwise. Corresponds to the Merge button in the Customize>Configure User Paths dialog.

See also

3ds Max System Directories