Skip to main content

Client library for interacting with RS3 through python

Project description

Introduction

This project is a library that can be used to interact with RS3 through python.

Release notes for the library are kept here: https://www.rocscience.com/support/rs3/release-notes

RS3 can be downloaded here: https://www.rocscience.com/support/program-downloads

The library itself is hosted on PyPi here: https://pypi.org/project/RS3Scripting/

Goal

Each function exposed corresponds to an equivalent operation you could have done through the UI.
Using this idea, the user should be able to edit models and get results without having to go through the UI at all. Although only a limited set of functionality is exposed for now, some basic workflows should still be possible. For a list of the functionality we have so far, see Exposed Functionality.

Python UI equivalents

Events and workflows done in the UI will have equivalents in the python library.
Wherever a dialog is shown in the UI, there will be an equivalent class with methods that mimick the dialog's behavior.
Wherever a warning or error dialog is displayed, an exception will be thrown, or a warning will be displayed in python instead.
Wherever you can select and manipulate an entity, identifiers can be used in the library to get references to those entities in python and objects will be constructed to help you interface with them.

How it works

Each function in the library is a wrapper to make an api call to the Application.
Objects retrieved through function calls will often not contain any data themselves, but will instead be proxies, allowing you to get information from the objects in the application.
For this reason, debugging will sometimes be tricky, as not all data will always be available for you to inspect unless you get it and assign it to a variable yourself.

Warnings

References can be invalidated whenever the corresponding object in the application is destroyed or reloaded. You will need to watch out for expired referenecs and renew them when needed as it can cause crashes or incorrect results if not managed properly. Functions that invalidate objects will always be marked with a warning and will indicate which objects should be re-loaded.

Exposed Functionality

The current set of functionality exposed is limited. With this version of the library, you can:

  • Model Operations: Open/save/close models, compute models
  • Project Settings: Define stages (names, number), set analysis type (stress, groundwater, dynamic), solver options, units configuration
  • Selection & Queries: Select volumes by name, point query, or bounding box (Cube, Cylinder, Sphere regions); filter results by entity
  • External Volumes: Assign materials to selected volumes, rename volumes, access volume properties
  • Material Properties: Define and modify constitutive models (Mohr-Coulomb, Hoek-Brown, Hardening Soil, Cam-Clay, etc.), hydraulic properties, initial conditions, stage factors, datum dependencies
  • Support Elements: Configure liners, bolts, beams, piles, joints, and composite lining systems with full property control and stage factors
  • Loading Conditions: Field stress (constant, gravity, advanced options), restraints
  • Mesh: Mesh Control
  • Results Extraction: Query nodal/element results for solids, liners, bolts, beams, piles, and joints; filter by region or entity name; switch between global and local coordinate systems (e.g., tunnel frames)
  • Result Types: Displacements (X, Y, Z, total, normal), stresses, strains, axial forces, moments, shear forces, failure types

Getting Started

Getting started guide
https://www.rocscience.com/help/rs3/tutorials/scripting/getting-started-with-rs3-python-scripting

Tutorials
https://www.rocscience.com/help/rs3/tutorials/scripting/scripting-tunnel-tutorial-part-1 https://www.rocscience.com/help/rs3/tutorials/scripting/scripting-tunnel-tutorial-part-2

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rs3scripting-4.42.0.tar.gz (243.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rs3scripting-4.42.0-py3-none-any.whl (469.6 kB view details)

Uploaded Python 3

File details

Details for the file rs3scripting-4.42.0.tar.gz.

File metadata

  • Download URL: rs3scripting-4.42.0.tar.gz
  • Upload date:
  • Size: 243.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for rs3scripting-4.42.0.tar.gz
Algorithm Hash digest
SHA256 81a5fdc21a53706151fb3bb797bb6ecb1ffa2dd1615c424593a8823c0d418e31
MD5 33c1f063b4b1e31e97d49f44e97ce311
BLAKE2b-256 238a5034d0a9283e2b50e237edb2ef6409d02edd76093966a5bc3b908b832f7f

See more details on using hashes here.

File details

Details for the file rs3scripting-4.42.0-py3-none-any.whl.

File metadata

  • Download URL: rs3scripting-4.42.0-py3-none-any.whl
  • Upload date:
  • Size: 469.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for rs3scripting-4.42.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a2d0fbd7ba32371d30d89ee970d859c908550a923fb10a0f76cd5d70a2fdb6c3
MD5 69e30d0621f7f27e56cd606aa01085fb
BLAKE2b-256 9747115185d4e037a142a25ab44c97a5142b8f26aa30df4953b62e4a0ef6aed9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page