Get Creo Connection ID using VB API

Get Creo Connection ID using VB API

Get Creo Connection ID

Creo VB API is limited to one Creo connection at the time. Sometimes user need to use more than one creo session. This cases can be handled by Creo Connection ID. Creo Connection ID is the Unique Id created by Every Creo Session.

VB API allows to connect the right Creo session by its ID and VB API application don’t need to connect until closing the application. Since VB API apps always working as sub process of creo it may slow down the creo operation depends on application content. Hence By using the Connection ID we can utilize the disconnect and reconnect functions of the Creo depends on the requirements

How to get Connection ID:

FunctionGetConnectionId()as IpfcConnectionId

Connection ID extracts the identification handle of the current Creo paramatric process

Format of identification string is the following. “host:H:address_version:A:address_type:T:rpcnum:R:rpcversion:V:netaddr:N” where H – host name where Creo Parametric runs A – address version T – address type R – RPC number V – RPC version N – net address.

The identification string can be used in subsequent attmepts to connect to this Creo Parametric session by this application or any other Creo Parametric TOOLKIT or PFC-based application. The connection identifier handle.

Sample Code:

Get Creo Connection ID – VB API

Public AConnection As IpfcAsyncConnection
    Public CConnection As New CCpfcAsyncConnection
        AConnection = CConnection.Connect(Nothing, Nothing, Nothing, 10)
        Dim ConnectionID As IpfcConnectionId
        ConnectionID = AConnection.GetConnectionId()
Dim strConnectionID = ConnectionID.ExternalRep.ToString()
        MessageBox.Show("Connection ID: " & strConnectionID, "Success")
    Catch ex As Exception
        MessageBox.Show(ex.ToString(), "Get Connection ID Failure")
    End Try

Here I converted the Session ID to string for User Reference. User can stop at ConnectionID and use it for reconnect the Creo

Leave a Reply

Contact Us