Submitted by Marcin on Mon, 01/11/2016 - 04:56
Forums:
How to show current directory path? I found information how to show current file name - see below
Dim theSession As Session = Session.GetSession()
Dim displayPart As Part = theSession.Parts.Display
'to show full path to current file name e.g. "C:\NX\MyFolder\block.prt"
Dim FullCurrentPath As String = displayPart.fullpath
' to show current file name e.g. "block.prt"
Dim CurrentFileName As String = Path.GetFileName(displayPart.FullPath)
' to show current file name without extension "block"
Dim CurrentFileName As String = Path.GetFileNameWithoutExtension(displayPart.FullPath)
But I cannot find information about current directory path e.g. "C:\NX\MyFolder"
Thanks
Marcin
re: parent path
The code below shows one way to get the parent folder name of a given path:
Dim directoryInfo As System.IO.DirectoryInfo
directoryInfo = System.IO.Directory.GetParent(thePath)
lw.WriteLine("parent directory: " & directoryInfo.FullName)
More information on the directoryInfo class can be found here:
https://msdn.microsoft.com/en-us/library/system.io.directoryinfo%28v=vs....