Methods Introduced:
The method pfcSession.Session.UIOpenFile opens the dialog box to browse directories and open files. The method lets you specify options for the file open dialog box
using the objects pfcUI.FileOpenOptions and pfcUI.FileUIOptions.
Use the method pfcUI.pfcUI.FileOpenOptions_Create to create a new instance of the pfcUI.FileOpenOptions object. This object contains the following options:
Use the method pfcUI.pfcUI.FileOpenOptions_Create to create a new instance of the pfcUI.FileOpenOptions object. You can specify a filter string to include only files of a particular type. The filter string is specified using
file extension. In the input argument FilterString you can specify all types of files extensions with wildcards separated by commas, for example, *.prt, *.asm, *.txt, *.avi, and so on. Use the methods pfcUI.FileOpenOptions.GetFilterString and pfcUI.FileOpenOptions.SetFilterString to get and set the types of file extensions.
Use the methods pfcUI.FileOpenOptions.GetPreselectedItem and pfcUI.FileOpenOptions.SetPreselectedItem to get and set the name of an item that must be preselected in the dialog box.
The pfcUI.FileUIOptions object contains the following options:
|
• |
DefaultPath—Specifies the name of the path to be opened by default in the dialog box. Use the method pfcUI.FileUIOptions.SetDefaultPath to set this option. |
|
• |
DialogLabel—Specifies the title of the dialog box. Use the method pfcUI.FileUIOptions.SetDialogLabel to set this option. |
|
• |
Shortcuts—Specifies an array of file shortcuts of the type pfcUI.FileOpenShortcut. Create this object using the method pfcUI.FileOpenShortcut_Create. This object contains the following attributes:
|
○
|
ShortcutName—Specifies the name of shortcut path to be made available in the dialog box. |
|
○
|
ShortcutPath—Specifies the string for the shortcut path. |
Use the method pfcUI.FileUIOptions.SetShortcuts to set the array of file shortcuts.
|
The method wfcSession.WSession.UIOpenFileType opens the dialog box to browse directories and open files. The method lets you specify options for the file open dialog box
using the objects wfcSession.FiletypeOpenOptions and pfcUI.FileUIOptions.
Use the method wfcSession.wfcSession.FiletypeOpenOptions_Create to create a new instance of wfcSession.FiletypeOpenOptions object. You can specify a filter string to include only files of a particular type in the dialog box. In the input argument
ModelFiletypes, you can specify an array of file types using the enumerated data type wfcModel.MdlfileType. Use the methods wfcSession.FiletypeOpenOptions.GetModelFiletypes and wfcSession.FiletypeOpenOptions.SetModelFiletypes to read and set the file types. Use the methods wfcSession.FiletypeOpenOptions.GetPreselectedItem and wfcSession.FiletypeOpenOptions.SetPreselectedItem to get and set the name of an item that must be preselected in the dialog box.
Note
The methods pfcSession.Session.UIOpenFile and wfcSession.WSession.UIOpenFileType, do not actually open the file, but return the file path of the selected file.
The method pfcSession.Session.UISaveFile opens the save dialog box. The method accepts options similar to pfcSession.Session.UIOpenFile through the pfcUI.FileSaveOptions and pfcUI.FileUIOptions objects. Use the method pfcUI.pfcUI.FileSaveOptions_Create to create a new instance of the pfcUI.FileSaveOptions object. When using the Save dialog box, you can set the name to a non-existent file.
The method wfcSession.WSession.UISaveFileType opens the save dialog box. The method accepts options similar to wfcSession.WSession.UIOpenFileType. The method lets you specify options for the save dialog box using the objects wfcSession.FiletypeSaveOptions and pfcUI.FileUIOptions. Use the method wfcSession.wfcSession.FiletypeSaveOptions_Create to create a new instance of the wfcSession.FiletypeSaveOptions object. You can specify a filter string to include only files of a particular type. In the input argument ModelFiletypes, you can use the specify an array of file types using the enumerated data type wfcModel.MdlfileType. Use the methods wfcSession.FiletypeSaveOptions.GetModelFiletypes and wfcSession.FiletypeSaveOptions.SetModelFiletypes to read and set the file types. Use the methods wfcSession.FiletypeSaveOptions.GetPreselectedItem and wfcSession.FiletypeSaveOptions.SetPreselectedItem to get and set the name of an item that must be preselected in the dialog box.
Note
|
• |
The methods pfcSession.Session.UISaveFile and wfcSession.WSession.UISaveFileType, 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 methods pfcSession.Session.UISaveFile and wfcSession.WSession.UISaveFileType do not support a file path location on local disk. |
The method pfcSession.Session.UISelectDirectory prompts the user to select a directory using the Creo dialog box for browsing directories. The method accepts options through the pfcUI.DirectorySelectionOptions object which is similar to the pfcUI.FileUIOptions object (described for the method pfcSession.Session.UIOpenFile). Specify the default directory path, the title of the dialog box, and a set of shortcuts to other directories to start browsing.
If the default path is specified as NULL, the current directory is used. Use the method pfcUI.pfcUI.DirectorySelectionOptions_Create to create a new instance of the pfcUI.DirectorySelectionOptions object. The method pfcSession.Session.UISelectDirectory returns the selected directory path; the application must use other methods or techniques to perform other relevant tasks
with this selected path.
The method pfcSession.BaseSession.UIRegisterFileOpen registers a new file type in the dialog box in Creo application. This method takes the pfcUI.FileOpenRegisterOptions and pfcUI.FileOpenRegisterListener objects as its input arguments. These objects are as follows:
|
• |
pfcUI.FileOpenRegisterOptions—This object contains the options for registering an open operation. Use the method pfcUI.pfcUI.FileOpenRegisterOptions_Create to create a new instance of the object. It contains the following options:
|
○
|
FileDescription—Specifies the short description of the file type to be opened. This description appears for the file type in the dialog box. Use the method pfcUI.FileOpenRegisterOptions.SetFileDescription to modify this option. |
|
○
|
FileType—Specifies the file type to be opened. The file type appears as the file extension in the dialog box. Use the method pfcUI.FileOpenRegisterOptions.SetFileType to modify this option. |
|
|
• |
pfcUI.FileOpenRegisterListener—This object provides the action listener methods for the new file type to be registered. The method pfcUI.FileOpenRegisterListener.FileOpenAccess is called to determine whether the new file type can be opened using the dialog box. The method pfcUI.FileOpenRegisterListener.OnFileOpenRegister is called on clicking Open for the newly registered file type. |
The method pfcSession.BaseSession.UIRegisterFileSave registers a new file type in the Save a Copy dialog box in Creo application. This method takes the pfcUI.FileSaveRegisterOptions and pfcUI.FileSaveRegisterListener objects as its input arguments. These objects are described as follows:
|
• |
pfcUI.FileSaveRegisterOptions—This object contains the options for registering a save operation. Use the method pfcUI.pfcUI.FileSaveRegisterOptions_Create to create a new instance of the object. It contains the following options:
|
○
|
FileDescription—Specifies the short description of the file type to be saved. This description appears for the file type in the Save a Copy dialog box. Use the method pfcUI.FileSaveRegisterOptions.SetFileDescription to modify this option. |
|
○
|
FileType—Specifies the file type to be saved. The file type appears as the file extension in the Save a Copy dialog box. Use the method pfcUI.FileSaveRegisterOptions.SetFileType to modify this option. |
|
|
• |
pfcUI.FileSaveRegisterListener—This object provides the action listener methods for the new file type to be registered. The method pfcUI.FileSaveRegisterListener.FileSaveAccess is called to determine whether the new file type can be saved using the Save a Copy dialog box. The method pfcUI.FileSaveRegisterListener.OnFileSaveRegister is called on clicking OK for the newly registered file type. |