Interactively selecting objects from Creo Parametric using VB API
Creo VB API allows selecting objects from Creo Parametric interactively. The object may be a point, axis, datum, part, assembly, or any creo parametric objects. Here the procedure to call it in program
- Get a base session from the Async connection
- Create Select Options
- Set the maximum number of items to select
- Set objects to select
- Execute selection
Sample code for reference
' Import Libraries Public AConnection As IpfcAsyncConnection Public BSession As IpfcBaseSession Private Sub btn_SelectItem_Click(sender As Object, e As RoutedEventArgs) Handles btn_SelectItem.Click Try BSession = AConnection.Session Dim CSelectionOptions As New CCpfcSelectionOptions Dim ISelectionOptions As IpfcSelectionOptions = CSelectionOptions.Create("") ' Lets allow user to select 5 items ISelectionOptions.MaxNumSels = -1 ' Set the items that user can select ISelectionOptions.OptionKeywords = "point, axis, part_or_asm" BSession.Select(ISelectionOptions, Nothing) Catch ex As Exception MessageBox.Show(ex.ToString(), "Failure") End Try End Sub
Check the VB UG manual for various options to selection