1. Use Rocky Simulation Log file for information
Rocky software provides a simulation log file which contains simple information, such as hardware details, to more complex data about the simulation, such as particles, triangles, and contacts information; memory consumption and free memory; and other solver process information. These outputs can help you trace what your module is doing, which can be useful for debugging purposes.

2. Use Print Statements or Logging in your code
Sometimes, the simplest way to check if your code is running as expected is to insert print/log lines in strategic parts. Examples of code lines to print:3. Use Auxiliary Scalars to identify calculations errors
You can also create auxiliary scalars with intermediate values to help you identify possible calculation errors and later visualize them during the simulation in the 3D view.4. Check for compilation and Linking Errors
To prepare your system for building custom modules for Rocky software using the Solver SDK, you need to install and set up a few components, including environment variables.- Ensure that all components were added correctly using the Installation Guide Modules and Scripts within SDK and Modules (Full Package) in Ansys Customer Portal.
- Always clean and rebuild if you are unsure.
5. Use the VS Code to debug Ansys Rocky Custom Modules
Below is a workflow you can follow for building and debugging your code:- Download and install VS Code. Note: In this step-by-step, the version used was 1.67.2.
-
Launch VS Code and install the following extensions:
- C/C ++ Extension Pack (Microsoft)
- CMake (twxs)
- CMake Tools (Microsoft)
- Close and Launch VS Code again.
- Go to File, then Open folder, and open the Module Folder you are currently working on.
- Configure the compiling options as shown below:

This should compile the module with Debug info and also install the .dlls and python file in the module’s folder. If everything went right during compilation, your module can now be debugged.
In order to do that, we need to launch Rocky and attach the debugger in the Solver.

- Now we just need to supply the path for the Rocky Solver and the solver arguments.
- We just need to copy that information to the launch.json file. It should look like:
