-
To show the debug option, enable the following environment
variable:
set DELMIA_OLP_TRANSLATOR_DEBUG=1
-
Open the VSTA macro in the Visual Studio editor (Alt+8).
-
Launch a command (Create Robot Program,
Import Robot Program, etc.).
-
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.
-
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.
-
Set your translator project as the
Startup project in Visual Studio.
-
Verify that you have set the CATMain debug code for your translator.
-
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
-
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
-
Set breakpoints, and click
Start (F5).
-
After the macro finishes, click
OK in the
Wait to Start Debug dialog box.
Recommendation: Use Visual Studio 2015 for debugging.
Result:
|