6.3. Set up a Basic Rocky Project

This example script provides an introduction to PrePost Scripting from the point of view of setting up a basic Rocky project.

This script should be used as a starting point for users who want to write their own scripts.

For a more complete reference to the classes available for PrePost Scripts, please refer to the PrePost Scripting Manual, which can be accessed from the Rocky Help | Manuals menu.

Script Details

This basic script includes all the following Rocky setup and processing steps:

  1. Create and save a new project.

  2. Enter the study description and customer information.

  3. Configure the physical settings (such as the gravity and which contact force model will be used).

  4. Set the material properties (such as density and Youngs’ modulus) Set the material interactions (such as the friction and restitution coefficients and adhesion properties).

  5. Create a conveyor geometry using the Rocky template.

  6. Import and set up a wall.

  7. Create a motion frame and assign it to imported wall.

  8. Create a surface.

  9. Create a particle group.

  10. Set the particle inlet.

  11. Configure the domain settings.

  12. Set up the solver (such as the simulation target - GPU or CPU and the simulation duration).

  13. Run the case.

Script Prerequisites

  • This script must run only on current release.

  • After downloading and extracting the attached .zip file, the included py file must be saved to your Scripts folder, which is inside your Rocky folder.

    • On Windows, this folder is located at C:\Users\YOURUSERNAME\Documents\Rocky\Scripts.

    • On Linux, this folder is located at /home/YOURUSERNAME/.Rocky/scripts.

  • The included tray.stl file (see attached .zip file) must be saved to your user folder.

    • On Windows, this folder is located at C:\Users\YOURUSERNAME.

    • On Linux, this folder is located at /home/YOURUSERNAME.


Note:  The project created after running this script will be saved in the Scripts Output folder, which is inside your Rocky folder. This project created after running this script will be saved in the Scripts Output folder, inside the Rocky folder:

  • On Windows, this folder is located at C:\Users\YOURUSERNAME\Documents\Rocky\Scripts Output.

  • On Linux, this folder is located at /home/YOURUSERNAME/.Rocky/scripts_output.



Tip:  

  • If you are using a different operating system or cannot locate your Scripts Output folder, type the following code into your Python Shell panel, which can be accessed from the Rocky Tools menu:

    • # Finding the Scripts output folder

      app.GetFilesDirectory()

  • For further instructions on how to save and apply this script, see How to Save and Run a Script.

  • To modify this script to better match your own project needs, open the .py file in a Python Editor, such as Visual Studio Code, and then use the information in the PrePost Scripting Manual to adjust the parameters and settings to your needs.