Search Results

Scripting Tools

The Scripting menu includes various tools that allow users to manage the scripting server, access the RocScript Editor and its environment, and view the reference manual.

Manage Scripting Server

This option opens the Scripting Server Manager dialog. You can set the server's port number and view the server status here.

Similar to other APIs, RocSlope2 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 RocSlope2 program.

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 RocSlope2 Python API Library.

To start the server in the dialog:

  1. Select Script > Scripting Options > Manage Scripting Server manage scripting server
  2. Under Port settings, select Auto-assign port to use an available port, or select Specify port and enter the port number. 

    Port range must be between 49152 and 65535.
  3. Select the Connect button to connect to the server. The Server status section describes whether this server is Connected or Disconnected, and displays the port number of a connected server.
Scripting Server Disconnected
Scripting Server Connected
 Alternatively, you can incorporate the startApplication() function within your Python script, which bypasses the manual steps outlined above.

To start the server from the Python script: For example, start the RocSlope2 application and a server connected to it at port number 60084.

# Start RocSlope2
RocSlope2Modeler.startApplication(port=60084)
modeler = RocSlope2Modeler(port=60084) 

Stop the Server

To stop a started server, you can click on the Disconnect button in the Scripting Server Manager 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 RocSlope2 Python API Library. Closing the application window will automatically terminate the server connected to it.

The closeConnection() function only disconnects your Python script from the server. The server and the RocSlope2 application keep running, and the port remains in use.

To close the (previously launched) application from the Python script:

# Close RocSlope2
modeler.closeProgram() 

Launch RocScript Editor

The RocScript Editor application is a pre-configured Python editor.

To launch the RocScript Editor application:

  • Select Scripting > Scripting Options > Launch RocScript Editor Launch Rocscript Editor. You can alternatively open the RocScript Editor from the Windows start menu.

Manage Python Environment

The Manage Python Environment option opens the pre-configured Python editor environment – RocScript WinPython Command Prompt.

To open the RocScript WinPython Command Prompt:

  • Select Scripting > Scripting Options > Manage Python Environment Manage Python Environment icon
Manage Python Environment dialog

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 Getting Started with RocSlope2 Scripting tutorial.

Reference Manual

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

To access the Scripting Reference Manual:

  • Select Scripting > Scripting Options > Scripting Reference Manual Scripting Reference manual

The manual can also be found here.

Rocscience logo, click here to return to the homepage Portal Account Portal Account Portal Help Log In Log Out Home Shopping Cart icon Click here to search our site Click here to close Learning Tech Support RSInsight+ Logo Documentation Info Chevron Delete Back to Top View More" Previous Next Edit PDF File Calendar Location Language External Link Apply to ACC External Link 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 RSWall NovoTech Bundle RSSeismic Settle3 Slide2 Slide3 SWedge UnWedge RocTunnel3 RocSlope2 BlastMetrix ShapeMetriX FragMetriX RSGeo RSRunout TestLicense Commercial License Education License Trial License Shop safe & secure Money-back guarantee