Rocscience International Conference 2025 is going to take place in Sydney, Australia Read more

Search Results

Scripting

The Scripting menu is developed to equipped with RS2 Scripting and is available in both RS2 Modeler and RS2 Interpreter programs, as shown below. It allows users to manage the server, access the RocScript Editor and its environment, and view the reference manual.

scripting menu

Manage Scripting Server

This option opens the Scripting Server Manager dialog as shown below. You can set the server and its port number here.

Similar to other APIs, RS2 Scripting requires a server started. The server listens for incoming requests from clients (i.e., your python script) on a specific port number, and connects to the RS2 Modeler or RS2 Interpreter program.

scripting server manager_dlg

How to use

Users have the option to either manually configure settings in the dialog interface or programmatically initiate operations using the function provided in the RS2 Python API Library.

To start the server in the dialog:

  1. Select Available Port by entering a port number in the field or using the up/down buttons at the side.
    • The port availability will be displayed, as “Available” or “Unavailable”. “Unavailable” means the port is currently occupied by another server, you can click the Find Port button to search for the next available port.
  2. Port range must be between 49152 and 65535.
  3. To start the server on specified port, click the Start Server button.
    • The Server Status note describes whether this server is running or not.

Alternatively, you can incorporate the startApplication() function within your python script, which bypasses the manual steps outlined above.

For example:

It starts the RS2 Model application and a server connected to it at port number 60054.

# Start RS2 Modeler
RS2Modeler.startApplication(port=60054)

It starts the RS2 Interpret application and a server connected to it at port number 60055.

# Start RS2 Interpreter
RS2Interpreter.startApplication(port=60055)

See the Scripting Tutorials here for more examples.

Stop the Server

To stop a started server, you can click on Stop Server button in the dialog.

  • Using a script, you can concurrently run multiple projects by assigning them to different ports. This approach is time efficient.

Meanwhile, if you want to terminate one or more projects associated with a specific port, you can stop the server. This action cuts out the connection between the projects and the API, and frees up the port for other projects or tasks.

There is no associated function in the RS2 Python API Library. Closing the application (RS2 Modeler or RS2 Interpret) window will automatically terminate the server connected to it.

Open Scripting Editor

It opens RocScript Editor application as shown below, which is the pre-configured Python editor. You can alternative open the RocScript Editor from the Windows start menu.

RocScript editor welcome

Manage Python Environment

It opens the pre-configured Python editor environment – RocScript WinPython Command Prompt, as shown below.

RocScript cmd

This RocScript Command Prompt is used to manage the python environment within the RocScript Editor. For advanced users who prefer to use their own python environment, use the Windows Command Prompt instead.

For more information about the python environment, see the guide – Getting Started with RS2 Scripting.

Reference Manual

The RS2 Python Reference Guide lists out all object, method, class, and function in the RS2 Python API Library for client. Script examples are also provided in the guide. Refer to this guide to utilize RS2 Scripting.

The manual can also be found through the link here.

Rocscience logo, click here to return to the homepage Portal Account Portal Account Log In Log Out Home Shopping Cart icon Click here to search our site Click here to close Learning Tech Support Documentation Info Chevron Delete Back to Top View More" Previous Next PDF File Calendar Location Language Fees Video Click here to visit Rocscience's LinkedIn page Click here to visit Rocscience's YouTube page Click here to visit Rocscience's X page Click here to visit Rocscience's Facebook page Click here to visit Rocscience's Instagram page Click here to visit Rocscience's Reddit page Bookmark Network Scroll down for more Checkmark Download Print Back to top Single User Multiple Users RSLog RocFall3 CPillar Dips EX3 RocFall RocPlane RocSlope3 RocSupport RocTopple RS2 RS3 RSData RSPile Settle3 Slide2 Slide3 SWedge UnWedge RocTunnel RocSlope2 Commercial License Education License Trial License Shop safe & secure Money-back guarantee