admin@creocustomization.com

Interactively selecting objects from Creo Parametric using VB API

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

  1. Get a base session from the Async connection
  2. Create Select Options
  3. Set the maximum number of items to select
  4. Set objects to select
  5. 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

Leave a Reply

Contact Us