-
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.).
-
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.
-
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 the CATMain debug code has been set for your
translator.
-
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
-
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.
Note:
Visual Studio 2015 is the recommended version to use for
debugging.
|