Connect Creo by It’s connection ID in VB API
To connect a specific Creo Session from multiple session, VB API provides the function ConnectById(). Here this article is for how to implement this function.
Function CCpfcAsyncConnection.ConnectById (Id as IpfcConnectionId, TextPath as String [optional], TimeoutSec as Long [optional]) as IpfcAsyncConnection
- Connects to a specific Creo Parametric session by passing the identification string.
- The ID string for a given session can be obtained from IpfcAsyncConnection.GetConnectionId().
- The application may only connect to one Creo Parametric session at any time.
The connection id string is which previously obtained for the Creo Parametric session you wish to connect to
The path under which the message and menu files are held. If no external messaging or menus are needed pass null.
The time, in seconds, to wait for Creo Parametric to respond to the connection request. Pass null to use the default timeout.
Object representing the asynchronous connection.
- Declare the required variables (IpfcAsyncConnection, CCpfcAsyncConnection)
- Get Connection ID
- Connect by ConnectionID
Connect Creo By Connection ID
Public AConnection As IpfcAsyncConnection Public CConnection As New CCpfcAsyncConnection Dim ConnectionID Try AConnection = CConnection.Connect(Nothing, Nothing, Nothing, 10) ConnectionID = AConnection.GetConnectionId CConnection.ConnectById(ConnectionID, ".", 10) Dim ConnectionString = AConnection.GetConnectionId.ExternalRep.ToString() MessageBox.Show("Connected by ID: " & ConnectionString & " Created", "Success") Catch ex As Exception MessageBox.Show(ex.ToString(), "Connect By ID Failure") End Try