You can debug RBD command snippets Using Microsoft Visual Studio. This allows you to execute commands line by line and review variable values.
To begin, insert the following lines before the commands snippet you want to debug. (Note that if there are several commands snippet, they are executed in the order they appear in the Mechanical tree.)
from System import Diagnostics Diagnostics.Debug.Assert(0)
Begin the solve. When the solution begins, the following warning dialog appears. Do not close this dialog. The dialog will pause the solver and allow you to attach the Visual Studio debugger and set breakpoints.
In Visual Studio, select Select Code Type dialog, select , then click .
from the menu. In theIn the Attach to Process dialog, select the RBD solver process ( ), then click .
Once Visual Studio is attached to the RBD solver, open the script file in Visual Studio. To locate script files, in Mechanical, right-click the Solution object and select .
In the solver files directory, commands are written to two python files: filepre.py and filepost.py. filepre.py contains the commands that are executed before solve (all command snippets except those at solution level). filepost.py is executed after the solve (only command snippets at solution level).
Open the desired file in Visual Studio. You can insert breakpoints as desired and click
on the warning dialog to resume the solve.