Functions Introduced:
The function ProFilesList() provides a list of the contents of 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. Use the PRO_FILE_LIST_ALL option to include all versions of a file in the list; use PRO_FILE_LIST_LATEST to include only the latest version. In addition to an array of file names, the function returns an array of subdirectory
names, regardless of the filter used.
Starting with Pro/ENGINEER Wildfire 5.0, the function ProFilesList()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 ProFileListOpt enumerated type that can be passed as the listing_option argument to ProFilesList():
|
• |
PRO_FILE_LIST_ALL_INST—Same as the LIST_ALL option. It returns instances only for PDM locations. |
|
• |
PRO_FILE_LIST_LATEST_INST—Same as the LIST_LATEST option. It returns instances only for PDM locations. |
|
• |
PRO_FILE_LIST_ALL_SORTED_INST—Same as the LIST_ALL_SORTED option. It returns instances only for PDM locations. |
|
• |
PRO_FILE_LIST_LATEST_SORTED_INST—Same as the LIST_LATEST_SORTED option. It returns instances only for PDM locations. |
|
• |
PRO_FILE_LIST_LATEST_SORTED_INST—Same as the LIST_LATEST_SORTED option. It returns instances only for PDM locations. |
The function ProFileMdlnameOpen() opens the dialog box to browse directories and open files. The function lets you specify the title of the dialog box, a set
of shortcuts to other directories, and the name of a file to be preselected. This function uses the same filtering method
as ProFilesList(). You can set a filter in the dialog box to include files of a particular type. In the input argument filter_string specify all types of files extensions with wildcards separated by commas, for example, *.prt, *.asm, *.txt, *.avi, and so on.
You can also use the function ProFileMdlfiletypeOpen() to browse directories and open files. You can set a filter in the dialog box to include files of a particular type. In the
input argument file_types, you can specify an array of file types using the enumerated data type ProMdlfileType.
Note
The functions ProFileMdlnameOpen() and ProFileMdlfiletypeOpen() do not actually open the file, but return the file path of the selected file. For example, to open a text file, use the function
ProFileEdit() or ProInfoWindowDisplay().
The function ProFileOpenRegister() registers a new file type in the dialog box in Creo Parametric. This function takes the access function ProFileOpenAccessFunction() and the action function ProFileOpenOperationAction() as its input arguments.
The function ProFileOpenAccessFunction() is called to determine whether the new file type can be opened using the dialog box. The function ProFileOpenOperationAction() is called on clicking Open for the newly registered file type.
The function ProFileMdlnameSave() opens the save dialog box. This function has input arguments similar to ProFileMdlnameOpen().
You can also use the function ProFileMdlfiletypeSave() to open the save dialog box. You can set a filter in the dialog box to include files of a particular type. In the input argument
file_types, you can specify an array of file types using the enumerated data type ProMdlfileType.
Note
|
• |
The functions ProFileMdlnameSave() and ProFileMdlfiletypeSave() do not actually save the file, but return the file path of the selected file. |
|
• |
For multi-CAD models, in a linked session of Creo Parametric with Windchill, the functions ProFileMdlnameSave() and ProFileMdlfiletypeSave() do not support a file path location on local disk. |
The function ProFileSaveRegister() registers a new file type in the dialog box in Creo Parametric. This function takes the access function ProFileSaveAccessFunction() and the action function ProFileSaveOperationAction() as its input arguments.
The function ProFileSaveAccessFunction() is called to determine whether the new file type can be saved using the dialog box. The function ProFileSaveOperationAction() is called on clicking OK for the newly registered file type.
The function ProDirectoryChoose() prompts the user to select a directory using the Creo Parametric dialog box for browsing directories. Specify the title of the dialog box, a set of shortcuts to other directories, and the
default directory path to start browsing. If the default path is specified as null, the current directory is used. The function
returns the selected directory path as output.
In general, the file utility functions refer to files using a single wide character string, which contains four, distinct
pieces of information that uniquely identify the file: the directory path, file name, extension, and version. The function
ProFileMdlnameParse() takes such a string as input, and returns the four segments as separate arguments.
Note
The function ProFileMdlnameParse() returns the file version as -1, if the input argument file_name_w_path has the path specified as the path to a Windchill model. This function does not support fetching of model version of a Windchill model.
The function ProPathMdlnameCreate() performs the opposite operation—it builds the single wide string that identifies the file, given the path, file name, extension,
and version.
The function ProInfoWindowDisplay() creates a text information window. It reads the contents from a text file in the current directory whose name is an input
to the function. The function can also override the default size, shape, and location of the window. (These do not affect
the properties of the Creo Parametric Information Window.)
The function ProFileEdit() opens an edit window on a specified text file. The editor used is the current default editor for Creo Parametric.
The function ProTexturePathGet() looks for the full path to the specified texture, decal, or bump map files and loads them from the texture path.
Note
For textures embedded inside a Creo Parametric model, if the create_temp_file is set to true the ProTexturePathGet() function writes a temporary copy of the specified files.