admin@creocustomization.com

Troubleshooting VB API Application during Creo Start & Connect

Troubleshooting VB API Application during Creo Start & Connect

troubleshooting creo vb api while Creo connect and disconnect

Here the general guide to troubleshooting VB API application while starting and connecting Creo Parametric. The common error during Creo Start and Creo Connect command is as follows.

XToolkitNotFound

  • Make sure the command is correct.
  • Make sure the executable or script path $PATH is set correctly.
  • Try full path of Creo Parametric in the command.
  • In the case of connecting to Creo, ensure only one Creo is running. Creo VB API won’t connect while more than one active connections.

XToolkitCommError

  • Make sure the environment variable PRO_COMM_MSG_EXE is set to the full path to pro_comm_msg including the file name
  • Make sure the environment variable PRO_DIRECTORY is set to the Creo parametric installation directory
  • Make sure the name service (nmsd) running on the taskbar process

Sample Code for Start Creo with Troubleshooting information in Message Box

Public CConnection As New CCpfcAsyncConnection

Public Async Function CreoStart() As Task
    Try
      CConnection.Start("C:\PTC\Creo2-amd64-M120\Creo 2.0\Parametric\bin\parametric.exe", ".")
    Catch ex As Exception
        If ex.ToString.Contains("pfcExceptions::XToolkitNotFound") Then
            Dim index = MessageBox.Show("Check PATH is correct for Creo Parametric Application", "Creo Path Error", MessageBoxButton.YesNo, MessageBoxImage.Error)
            If index = Forms.DialogResult.Yes Then
                CreoConnect()
            End If
        ElseIf ex.ToString.Contains("pfcExceptions::XToolkitCommError") Then
          MessageBox.Show("Make sure PRO_COMM_MSG_EXE properly set. & Ensure PRO_DIRECTORY is set to Creo Parametric installation director")
        ElseIf ex.ToString.Contains("0x800706BE") Then ' RPC REMOTE SERVER NOT FOUND
            CreoConnect()
        Else
            MsgBox("Exception New" & vbNewLine & ex.ToString)
        End If
    End Try

Sample Code to Connect Creo Session with Troubleshooting information in Creo Parametric MessageBox

Public CConnection As New CCpfcAsyncConnection


Public Async Function CreoConnect() As Task
  Try
      AConnection = CConnection.Connect(Nothing, Nothing, Nothing, 10)
  Catch ex As Exception
      If ex.ToString.Contains("pfcExceptions::XToolkitNotFound") Then
          Dim index = MessageBox.Show("No Creo Session Found" & vbNewLine &
                                        "Start Creo then tries again" & vbNewLine & vbNewLine & "Do you want to retry?",
                                      "Creo Not Found", MessageBoxButton.YesNo, MessageBoxImage.Error)
          If index = Forms.DialogResult.Yes Then
              CreoConnect()
          End If
      ElseIf ex.ToString.Contains("XToolkitAmbiguous") Then
          MessageBox.Show("It seems more than 1 creo found, I can't connect more than a CREO Session" & vbNewLine &
                  "Kindly close one of the Creo sessions then try again", "Not enough input", MessageBoxButton.OK, MessageBoxImage.Information)
      ElseIf ex.ToString.Contains("pfcExceptions::XToolkitCommError") Then
         MessageBox.Show("Make sure PRO_COMM_MSG_EXE properly set. & Ensure PRO_DIRECTORY is set to Creo Parametric installation director")
      Else
          MsgBox("Exception New" & vbNewLine & ex.ToString)
      End If
  End Try

Some cases it will throw some Error codes 0x800706BE for RPC Remote Connection Error. Just end the nmsd process in Taskbar and try again to solve it.

Leave a Reply

Contact Us