Debugging Translators

When customizing a translator, it is helpful to debug the VSTA macro library. The macro must be debugged as it is called from Create Robot Program and Import Robot Program. To accomplish this, you must enable the debug mode by setting an environment variable, selecting the macro you which to download, and running that macro through the Visual Studio IDE as described below.

See Also
Installing VSTA
Running Multiple Versions of 3DEXPERIENCE
  1. To show the debug option, enable the following environment variable:
    set DELMIA_OLP_TRANSLATOR_DEBUG=1
  2. Open the VSTA macro in the Visual Studio editor (Alt+8).
  3. Launch a command (Create Robot Program, Import Robot Program, etc.).
  4. Select a macro function call string (other than None) from the Macro Debug list to enable debugging.
    Debugging becomes active for the entire session in all Robot Programming commands. Instead of macros being launched automatically, you are prompted to run them from Visual Studio as needed.
  5. Advance the command to the point that you want to debug (select tasks, set options, etc.).
    The Wait to Start Debug dialog box appears, and prompts you to start the debugging session in Visual Studio.
  6. Set your translator project as the Startup project in Visual Studio.
  7. Verify that the CATMain debug code has been set for your translator.
    1. In ThisApplication.vb, define CATMain as shown. (CATMain is the function that is called when you run the project (F5).)

      Public Shared Sub CATMain()
          MainObj.SetApplication(CATIA)
          MainObj.LaunchDebug()
      End Sub

    2. In Main.vb, LaunchDebug calls the appropriate function based on the value of the DebugMacroCallString property.

      Public Sub LaunchDebug()
          _Helper = _CATIA.GetSessionService("OlpTranslatorHelper")
          Dim TransHelperLA As OlpObjectAccess = CType(_Helper, OlpObjectAccess)
          If (TransHelperLA IsNot Nothing) Then
              Dim MacroToCall As String = TransHelperLA.GetProperty("DebugMacroCallString", Nothing)(0)
              'Call MacroDownload | MacroUpload | MacroSetConfigs etc program
              CallByName(Me, MacroToCall, CallType.Method)
          End If
      End Sub

  8. Set breakpoints, and click Start (F5).
  9. After the macro finishes, click OK in the Wait to Start Debug dialog box.

    Note: Visual Studio 2015 is the recommended version to use for debugging.