Session Objects in Creo Parametric – VB API

Session objects are highest level objects in the VB API. User IpfcSession class to access Session objects of the Creo Parametric application.
The IpfcSession object contains methods to perform the following operations
- To access the models and windows
- To work with User Interface of the Creo Parametric
- To allow the user to select items through interaction via mouse or keyboard.
- To access and control the global settings such as lines styles, colours and configuration options.
Sample code to list files in the session
Imports pfcls Public BSession As IpfcBaseSession ' this function works with WPF application ' UI elements used ' 1. TextBox - To filter the version ' 2. TextBox - To set the file path ' 3. Button - To read the files Private Sub list_files(sender As Object, e As RoutedEventArgs) Handles btn_list_files.Click Try BSession = AConnection.Session Dim Filter As String = tb_CustomVersion.Text Dim Version As EpfcFileListOpt ' Checkbox given in the UI to get only latest version files If rb_LatestVersion.IsChecked Then Version = EpfcFileListOpt.EpfcFILE_LIST_LATEST Else Version = EpfcFileListOpt.EpfcFILE_LIST_ALL End If ' Textbox given in the UI to set the path where to retrive the files Dim Path = tb_ListFilePath.Text ' Set the list empty before adding items to it lst_Files.Items.Clear() ' Iterating all the files and adding to the list For Each items In BSession.ListFiles(Filter, Version, Path) lst_Files.Items.Add(items) Next Catch ex As Exception MessageBox.Show(ex.ToString, "Error Message") End Try End Sub