Debugging Translators

When customizing a translator, it is helpful to debug the VSTA macro library. Debug the macro as it calls from Create Robot Program and Import Robot Program. To accomplish this, enable the debug mode by setting an environment variable, selecting the macro to download, and running that macro through the Visual Studio IDE as described in the following.

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. From the Macro Debug list, select a macro function call string (other than None) 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 required.
  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 you have set the CATMain debug code for your translator.
    1. In ThisApplication.vb, define CATMain as shown. (CATMain is the function that calls 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.

    Recommendation: Use Visual Studio 2015 for debugging.

Result: