File Handling
Methods Introduced:
The method pfcSession.BaseSession.ListFiles returns a list of files in a directory, given the directory path. You can filter the list to include only files of a particular type, as specified by the file extension.
Starting with Pro/ENGINEER Wildfire 5.0 M040, the Windchillmethod pfcSession.BaseSession.ListFiles can also list instance objects when accessing Windchill workspaces or folders. A PDM location (for workspace or commonspace) must be passed as the directory path. The following options have been added in the FileListOpt enumerated type:
FILE_LIST_ALL—Lists all the files. It may also include multiple versions of the same file.
FILE_LIST_LATEST—Lists only the latest version of each file.
FILE_LIST_ALL_INST—Same as the FILE_LIST_ALL option. It returns instances only for PDM locations.
FILE_LIST_LATEST_INST—Same as the FILE_LIST_LATEST option. It returns instances only for PDM locations.
The method pfcSession.BaseSession.ListSubdirectories returns the subdirectories in a given directory location.
The method wfcSession.WSession.UIEditFile opens an edit window for the specified text file. The editor used is the default editor for Creo. The method returns a boolean value to indicate if the file was edited.
The file utility methods refer to files using a single wide character string, which composes of the directory path, file name, extension, and version. The method wfcSession.WSession.ParseFileName takes such a string as input, and returns the four segments as a wfcParsedFileNameData object.
The method wfcSession.ParsedFileNameData.GetDirectoryPath returns the directory path for the file.
The method wfcSession.ParsedFileNameData.GetName returns the name of the file.
The method wfcSession.ParsedFileNameData.GetExtension returns the extension of the file.
The method wfcSession.ParsedFileNameData.GetVersion returns the version of the file.
The method wfcSession.WSession.DisplayInformationWindow creates a window and displays the content of the specified file. The input arguments are:
FilePath—Specifies the name of the file.
XOffest—Specifies the location of the window along the X-direction with reference to the Creo main window. The valid range is from 0.0 to 1.0.
YOffest—Specifies the location of the window along the Y-direction with reference to the Creo main window. The valid range is from 0.0 to 1.0.
Rows—Specifies the size of the window in terms of rows. The valid range is from 6 to 33.
Columns—Specifies the size of the window in terms of columns. The valid range is from 8 to 80.
Was this helpful?