Bolt Script Examples#

Download the blankModel.rs3v3 for this example.

from rs3.RS3Modeler import RS3Modeler
from rs3.properties.PropertyEnums import *
import os
import shutil

Get the current folder directory.

current_dir = os.path.abspath("")

Specify a port number that is not in use and start the RS3 program.

port = 60302
RS3Modeler.startApplication(port)
2026-03-13 17:16:34,928 - Rocscience.RS3 - INFO - Attempting to start the application at C:\Program Files\Rocscience\RS3\RS3 and binding server to port 60302...

Connect with the RS3 Modeler.

modeler = RS3Modeler(port)

For the demonstration purposes only, the model is copied for reuse. You may change the model path to your own model path.

blankModelPath = rf"{os.path.dirname(current_dir)}\example_models\blankModel.rs3v3"
copiedModelPath = rf"{os.path.dirname(current_dir)}\example_models\copiedModel.rs3v3"
_ = shutil.copy(blankModelPath, copiedModelPath)

Open the copied model file.

model = modeler.openFile(copiedModelPath)

1. Create and Get Bolt#

Get the first bolt in the list.

bolt1 = model.getAllBoltProperties()[0]
bolt1.getBoltName()
'NewBolt'

Create a new bolt and get the bolt by name.

bolt2Name = "Bolt 2"
model.createNewBoltProperty(bolt2Name)
bolt2 = model.getBoltPropertyByName(bolt2Name)
bolt2.getBoltName()
'Bolt 2'

2. Set Bolt Properties#

bolt1.setBoltType(BoltTypes.TIEBACK)
bolt1.getBoltType()
<BoltTypes.TIEBACK: 'TIEBACK_BOLT'>

Get all bolt properties.

bolt1.Tieback.getProperties()
{'BondStrength': 50000.0,
 'BondShearStiffness': 100000.0,
 'BoreholeDiameter': 0.019,
 'PullOutForce': 0.0,
 'TensileCapacity': 100.0,
 'ResidualTensileCapacity': 0.0,
 'PreTensioningForce': 0.0,
 'FacePlates': True,
 'BoltDiameter': 0.019,
 'DelayInstallAfterBolt': 0,
 'ConstantPretensioningForceInInstallStage': True,
 'JointShear': False,
 'UseBondPercentageLength': True,
 'AddPullOutForce': False,
 'UseSecondaryBondLength': False,
 'BondLength': 1.0,
 'SecondaryBondLength': 0.0,
 'BoltModulusE': 200000000.0,
 'PercentageBondLength': 20.0,
 'PercentOfSecondaryBondLength': 0.0}

Set and get individual bolt property.

bolt1.Tieback.setBoltDiameter(0.015)
bolt1.Tieback.getBoltDiameter()
0.015

Set multiple bolt properties.

bolt1.Tieback.setProperties(FacePlates=False, BoltModulusE=1.5e8)
bolt1Properties = bolt1.Tieback.getProperties()
bolt1Properties
{'BondStrength': 50000.0,
 'BondShearStiffness': 100000.0,
 'BoreholeDiameter': 0.019,
 'PullOutForce': 0.0,
 'TensileCapacity': 100.0,
 'ResidualTensileCapacity': 0.0,
 'PreTensioningForce': 0.0,
 'FacePlates': False,
 'BoltDiameter': 0.015,
 'DelayInstallAfterBolt': 0,
 'ConstantPretensioningForceInInstallStage': True,
 'JointShear': False,
 'UseBondPercentageLength': True,
 'AddPullOutForce': False,
 'UseSecondaryBondLength': False,
 'BondLength': 1.0,
 'SecondaryBondLength': 0.0,
 'BoltModulusE': 150000000.0,
 'PercentageBondLength': 20.0,
 'PercentOfSecondaryBondLength': 0.0}

Set bolt2 to a plain strand cable.

bolt2.setBoltType(BoltTypes.PLAIN_STRAND_CABLE)
bolt2.getBoltType()
<BoltTypes.PLAIN_STRAND_CABLE: 'PLAIN_STRAND_CABLE'>
bolt2.PlainStrandCable.setAddBulges(True)
bolt2.PlainStrandCable.setBulgeType(BulgeTypes.NUT_CASE_21MM)
bolt2.PlainStrandCable.setBulgeLocations([50, 100, 150, 200])
bolt2.PlainStrandCable.getBulgeType()
<BulgeTypes.NUT_CASE_21MM: 'twentyone_NUT_CASE'>
bolt2.PlainStrandCable.getBulgeLocations()
[50.0, 100.0, 150.0, 200.0]
bolt2.setBoltType(BoltTypes.TIEBACK)
bolt2.Tieback.setUseSecondaryBondLength(True)
bolt2.Tieback.setSecondaryBondLengthType(SecondaryBondLengthType.FULLY_BONDED)
bolt2.Tieback.setDelayInstallAfterBolt(1)

3. Copy Bolt Properties#

Set bolt2 to Tieback as well.

bolt2.setBoltType(BoltTypes.TIEBACK)
bolt2.getBoltType()
<BoltTypes.TIEBACK: 'TIEBACK_BOLT'>
bolt2.Tieback.getProperties()
{'BondStrength': 50000.0,
 'BondShearStiffness': 100000.0,
 'BoreholeDiameter': 0.019,
 'PullOutForce': 0.0,
 'TensileCapacity': 100.0,
 'ResidualTensileCapacity': 0.0,
 'PreTensioningForce': 0.0,
 'FacePlates': True,
 'BoltDiameter': 0.019,
 'DelayInstallAfterBolt': 1,
 'ConstantPretensioningForceInInstallStage': True,
 'JointShear': False,
 'UseBondPercentageLength': True,
 'AddPullOutForce': False,
 'UseSecondaryBondLength': True,
 'BondLength': 1.0,
 'SecondaryBondLength': 0.0,
 'BoltModulusE': 200000000.0,
 'PercentageBondLength': 20.0,
 'PercentOfSecondaryBondLength': 0.0}

Copy all bolt1 properties to bolt2.

bolt2.Tieback.setProperties(**bolt1Properties)
bolt2.Tieback.getProperties()
{'BondStrength': 50000.0,
 'BondShearStiffness': 100000.0,
 'BoreholeDiameter': 0.019,
 'PullOutForce': 0.0,
 'TensileCapacity': 100.0,
 'ResidualTensileCapacity': 0.0,
 'PreTensioningForce': 0.0,
 'FacePlates': False,
 'BoltDiameter': 0.015,
 'DelayInstallAfterBolt': 0,
 'ConstantPretensioningForceInInstallStage': True,
 'JointShear': False,
 'UseBondPercentageLength': True,
 'AddPullOutForce': False,
 'UseSecondaryBondLength': False,
 'BondLength': 1.0,
 'SecondaryBondLength': 0.0,
 'BoltModulusE': 150000000.0,
 'PercentageBondLength': 20.0,
 'PercentOfSecondaryBondLength': 0.0}

4. Delete Bolt#

Delete Bolt 2.

model.deleteBoltProperty(bolt2Name)

Check the rest of bolts and see if “Bolt 2” still exists.

allBolts = model.getAllBoltProperties()
for bolt in allBolts:
    print(bolt.getBoltName())
NewBolt

Save and close the model.

model.close(True)

Close the program.

modeler.closeProgram()

Full Script#

# Bolt Script Examples
# Download the [blankModel.rs3v3](https://github.com/Rocscience/rs3-scripting/tree/main/docs/example_code/example_models/blankModel.rs3v3) for this example.
from rs3.RS3Modeler import RS3Modeler
from rs3.properties.PropertyEnums import *
import os
import shutil
# Get the current folder directory.
current_dir = os.path.abspath("")
# Specify a port number that is not in use and start the RS3 program.
port = 60302
RS3Modeler.startApplication(port)
# Connect with the RS3 Modeler.
modeler = RS3Modeler(port)
# For the demonstration purposes only, the model is copied for reuse. You may change the model path to your own model path.
blankModelPath = rf"{os.path.dirname(current_dir)}\example_models\blankModel.rs3v3"
copiedModelPath = rf"{os.path.dirname(current_dir)}\example_models\copiedModel.rs3v3"
_ = shutil.copy(blankModelPath, copiedModelPath)
# Open the copied model file.
model = modeler.openFile(copiedModelPath)

# 1. Create and Get Bolt
# Get the first bolt in the list.
bolt1 = model.getAllBoltProperties()[0]
# Create a new bolt and get the bolt by name.
bolt2Name = "Bolt 2"
model.createNewBoltProperty(bolt2Name)
bolt2 = model.getBoltPropertyByName(bolt2Name)

# 2. Set Bolt Properties
bolt1.setBoltType(BoltTypes.TIEBACK)
# Set and get individual bolt property.
bolt1.Tieback.setBoltDiameter(0.015)
# Set multiple bolt properties.
bolt1.Tieback.setProperties(FacePlates=False, BoltModulusE=1.5e8)
bolt1Properties = bolt1.Tieback.getProperties()
# Set bolt2 to a plain strand cable.
bolt2.setBoltType(BoltTypes.PLAIN_STRAND_CABLE)
bolt2.PlainStrandCable.setAddBulges(True)
bolt2.PlainStrandCable.setBulgeType(BulgeTypes.NUT_CASE_21MM)
bolt2.PlainStrandCable.setBulgeLocations([50, 100, 150, 200])
bolt2.setBoltType(BoltTypes.TIEBACK)
bolt2.Tieback.setUseSecondaryBondLength(True)
bolt2.Tieback.setSecondaryBondLengthType(SecondaryBondLengthType.FULLY_BONDED)
bolt2.Tieback.setDelayInstallAfterBolt(1)

# 3. Copy Bolt Properties
# Set bolt2 to Tieback as well.
bolt2.setBoltType(BoltTypes.TIEBACK)
# Copy all bolt1 properties to bolt2.
bolt2.Tieback.setProperties(**bolt1Properties)

# 4. Delete Bolt
# Delete Bolt 2.
model.deleteBoltProperty(bolt2Name)
# Check the rest of bolts and see if "Bolt 2" still exists.
allBolts = model.getAllBoltProperties()
for bolt in allBolts:
    print(bolt.getBoltName())
    
# Save and close the model.
model.close(True)
2026-03-13 17:17:27,362 - Rocscience.RS3 - INFO - Attempting to start the application at C:\Program Files\Rocscience\RS3\RS3 and binding server to port 60302...
NewBolt