Composite Liner Script Examples#
Download the blankModel.rs3v3 for this example.
from rs3.RS3Modeler import RS3Modeler
from rs3.properties.PropertyEnums import *
from rs3.properties.liningComposition.LiningComposition import CompositeLinerLayer
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 = 60306
RS3Modeler.startApplication(port)
2026-03-13 17:18:17,260 - Rocscience.RS3 - INFO - Attempting to start the application at C:\Program Files\Rocscience\RS3\RS3 and binding server to port 60306...
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 Composite Liners#
compositeLiner1 = model.getAllLiningCompositionProperties()[0]
compositeLiner1.getCompositeName()
'Lining 1'
compositeLiner2Name = "Composite Liner 2"
model.createNewLiningCompositionProperty(compositeLiner2Name)
compositeLiner2 = model.getLiningCompositionPropertyByName(compositeLiner2Name)
compositeLiner2.getCompositeName()
'Composite Liner 2'
2. Set Composite Liner Properties#
Create more joint and liner properties for the later example.
model.createNewJointProperty("Joint 2")
model.createNewJointProperty("Joint 3")
model.createNewJointProperty("Joint 4")
model.createNewLinerProperty("Liner 2")
model.createNewLinerProperty("Liner 3")
2.1 Set Composite Liner through CompositeLinerLayer class#
Create the first CompositeLinerLayer with an upper joint.
lining1 = CompositeLinerLayer()
lining1.setLinerByName("Liner 1")
lining1.setUpperJoint(True, "Joint 1")
Create the second CompositeLinerLayer with an upper and a lower joint. This composite liner layer installs one stage after the lining installation and removes two stages after lining installation.
lining2 = CompositeLinerLayer()
lining2.setLinerByName("Liner 2")
lining2.setUpperJoint(True, "Joint 2")
lining2.setLowerJoint(True, "Joint 3")
lining2.setInstallationStage(1)
lining2.setRemovalStage(True, 2)
Create the third CompositeLinerLayer with a lower joint. The composite liner installs three stages after the lining installation.
lining3 = CompositeLinerLayer()
lining3.setLinerByName("Liner 3")
lining3.setLowerJoint(True, "Joint 4")
lining3.installationStage = 3
Set and get the composite liner.
liningComposition1 = [lining1, lining2, lining3]
compositeLiner1.setLayerComposition(liningComposition1)
compositeLiner1.getLayerComposition()
[CompositeLinerLayer(linerName='Liner 1', hasUpperJoint=True, hasLowerJoint=False, installationStage=0, isRemoved=False, removalStage=-1, upperJointName='Joint 1', lowerJointName=None),
CompositeLinerLayer(linerName='Liner 2', hasUpperJoint=True, hasLowerJoint=True, installationStage=1, isRemoved=True, removalStage=2, upperJointName='Joint 2', lowerJointName='Joint 3'),
CompositeLinerLayer(linerName='Liner 3', hasUpperJoint=False, hasLowerJoint=True, installationStage=3, isRemoved=False, removalStage=-1, upperJointName=None, lowerJointName='Joint 4')]
2.2 Set Composite Liner through Tuple#
You may also create composite liner layers as tuples. The order of the parameters are (linerName, hasUpperJoint, upperJointName, hasLowerJoint, lowerJointName, installationStage, isRemoved, removalStage).
liningComposition2 = [('Liner 1', True, 'Joint 1', False, None, 0, False, -1),
('Liner 2', True, 'Joint 2', True, 'Joint 3', 1, True, 2),
('Liner 3', False, None, True, 'Joint 4', 3, False, -1)]
Set and get the composite liner.
compositeLiner2.setLayerCompositionTuple(liningComposition2)
compositeLiner2.getLayerCompositionTuple()
[('Liner 1', True, 'Joint 1', False, None, 0, False, -1),
('Liner 2', True, 'Joint 2', True, 'Joint 3', 1, True, 2),
('Liner 3', False, None, True, 'Joint 4', 3, False, -1)]
3. Delete a Composite Liner#
model.deleteLiningCompositionProperty(compositeLiner2Name)
allCompositeLiners = model.getAllLiningCompositionProperties()
for compositeLiner in allCompositeLiners:
print(compositeLiner.getCompositeName())
Lining 1
Save and close the model.
model.close(True)
Close the program.
modeler.closeProgram()
Full Script#
# Composite Liner 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 *
from rs3.properties.liningComposition.LiningComposition import CompositeLinerLayer
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 = 60306
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 Composite Liners
compositeLiner1 = model.getAllLiningCompositionProperties()[0]
compositeLiner2Name = "Composite Liner 2"
model.createNewLiningCompositionProperty(compositeLiner2Name)
compositeLiner2 = model.getLiningCompositionPropertyByName(compositeLiner2Name)
# 2. Set Composite Liner Properties
# Create more joint and liner properties for the later example.
model.createNewJointProperty("Joint 2")
model.createNewJointProperty("Joint 3")
model.createNewJointProperty("Joint 4")
model.createNewLinerProperty("Liner 2")
model.createNewLinerProperty("Liner 3")
# 2.1 Set Composite Liner through CompositeLinerLayer class
# Create the first CompositeLinerLayer with an upper joint.
lining1 = CompositeLinerLayer()
lining1.setLinerByName("Liner 1")
lining1.setUpperJoint(True, "Joint 1")
# Create the second CompositeLinerLayer with an upper and a lower joint.
# This composite liner layer installs one stage after the lining installation
# and removes two stages after lining installation.
lining2 = CompositeLinerLayer()
lining2.setLinerByName("Liner 2")
lining2.setUpperJoint(True, "Joint 2")
lining2.setLowerJoint(True, "Joint 3")
lining2.setInstallationStage(1)
lining2.setRemovalStage(True, 2)
# Create the third CompositeLinerLayer with a lower joint. The composite
# liner installs three stages after the lining installation.
lining3 = CompositeLinerLayer()
lining3.setLinerByName("Liner 3")
lining3.setLowerJoint(True, "Joint 4")
lining3.installationStage = 3
# Set and get the composite liner.
liningComposition1 = [lining1, lining2, lining3]
compositeLiner1.setLayerComposition(liningComposition1)
# 2.2 Set Composite Liner through Tuple
# You may also create composite liner layers as tuples. The order of the parameters
# are (linerName, hasUpperJoint, upperJointName, hasLowerJoint, lowerJointName,
# installationStage, isRemoved, removalStage).
liningComposition2 = [('Liner 1', True, 'Joint 1', False, None, 0, False, -1),
('Liner 2', True, 'Joint 2', True, 'Joint 3', 1, True, 2),
('Liner 3', False, None, True, 'Joint 4', 3, False, -1)]
# Set and get the composite liner.
compositeLiner2.setLayerCompositionTuple(liningComposition2)
# 3. Delete a Composite Liner
model.deleteLiningCompositionProperty(compositeLiner2Name)
allCompositeLiners = model.getAllLiningCompositionProperties()
for compositeLiner in allCompositeLiners:
print(compositeLiner.getCompositeName())
# Save and close the model.
model.close(True)
2026-03-13 17:19:06,972 - Rocscience.RS3 - INFO - Attempting to start the application at C:\Program Files\Rocscience\RS3\RS3 and binding server to port 60306...
Lining 1