Liner 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 = 60304
RS3Modeler.startApplication(port)
2026-03-13 17:21:54,111 - Rocscience.RS3 - INFO - Attempting to start the application at C:\Program Files\Rocscience\RS3\RS3 and binding server to port 60304...
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 Liner#
Get the first liner in the list.
liner1 = model.getAllLinerProperties()[0]
liner1.getLinerName()
'Liner 1'
Create a new liner and get the liner by name.
liner2Name = "Liner 2"
model.createNewLinerProperty(liner2Name)
liner2 = model.getLinerPropertyByName(liner2Name)
liner2.getLinerName()
'Liner 2'
2. Set Liner Properties#
liner1.setLinerType(LinerTypes.REINFORCED_CONCRETE)
liner1.getLinerType()
<LinerTypes.REINFORCED_CONCRETE: 'REINFORCED_CONCRETE'>
liner1.ReinforcedConcrete.getProperties()
{'Spacing': 0.6,
'SectionDepth': 0.162,
'Area': 0.00474,
'MomentOfInertia': 2.22e-05,
'YoungsModulusReinforcement': 200000000.0,
'PoissonsRatioReinforcement': 0.25,
'ShearStrengthReinforcement': 400000.0,
'CompressiveStrengthReinforcement': 400000.0,
'TensileStrengthReinforcement': 400000.0,
'UnitWeightReinforcement': 37.1,
'Thickness': 0.2,
'YoungsModulusConcrete': 30000000.0,
'PoissonsRatioConcrete': 0.15,
'ShearStrengthConcrete': 20000.0,
'CompressiveStrengthConcrete': 40000.0,
'TensileStrengthConcrete': 3000.0,
'UnitWeightConcrete': 24.0,
'ConcreteProperty': True,
'ReinforcementProperty': True,
'IncludeWeightInStressAnalysis': False}
liner1.ReinforcedConcrete.setMaterialType(MaterialType.PLASTIC)
liner1.ReinforcedConcrete.getMaterialType()
<MaterialType.PLASTIC: True>
liner1.ReinforcedConcrete.setProperties(ReinforcementProperty=True, ConcreteProperty=True, PoissonsRatioReinforcement=0.22, PoissonsRatioConcrete=0.28)
liner1Properties = liner1.ReinforcedConcrete.getProperties()
3. Copy Liner Properties#
liner2.setLinerType(LinerTypes.REINFORCED_CONCRETE)
liner2.getLinerType()
<LinerTypes.REINFORCED_CONCRETE: 'REINFORCED_CONCRETE'>
liner2.ReinforcedConcrete.getProperties()
{'Spacing': 0.6,
'SectionDepth': 0.162,
'Area': 0.00474,
'MomentOfInertia': 2.22e-05,
'YoungsModulusReinforcement': 200000000.0,
'PoissonsRatioReinforcement': 0.25,
'ShearStrengthReinforcement': 400000.0,
'CompressiveStrengthReinforcement': 400000.0,
'TensileStrengthReinforcement': 400000.0,
'UnitWeightReinforcement': 37.1,
'Thickness': 0.2,
'YoungsModulusConcrete': 30000000.0,
'PoissonsRatioConcrete': 0.15,
'ShearStrengthConcrete': 20000.0,
'CompressiveStrengthConcrete': 40000.0,
'TensileStrengthConcrete': 3000.0,
'UnitWeightConcrete': 24.0,
'ConcreteProperty': True,
'ReinforcementProperty': True,
'IncludeWeightInStressAnalysis': False}
liner2.ReinforcedConcrete.setProperties(**liner1Properties)
liner2.ReinforcedConcrete.getProperties()
{'Spacing': 0.6,
'SectionDepth': 0.162,
'Area': 0.00474,
'MomentOfInertia': 2.22e-05,
'YoungsModulusReinforcement': 200000000.0,
'PoissonsRatioReinforcement': 0.22,
'ShearStrengthReinforcement': 400000.0,
'CompressiveStrengthReinforcement': 400000.0,
'TensileStrengthReinforcement': 400000.0,
'UnitWeightReinforcement': 37.1,
'Thickness': 0.2,
'YoungsModulusConcrete': 30000000.0,
'PoissonsRatioConcrete': 0.28,
'ShearStrengthConcrete': 20000.0,
'CompressiveStrengthConcrete': 40000.0,
'TensileStrengthConcrete': 3000.0,
'UnitWeightConcrete': 24.0,
'ConcreteProperty': True,
'ReinforcementProperty': True,
'IncludeWeightInStressAnalysis': False}
4. Set Stage Factors#
Turn on the stage factors of liners.
liner1.setApplyStageFactors(True)
Now, create a stage factor for stage 2.
stageFactor_s2 = liner1.ReinforcedConcrete.StageFactorInterface.createStageFactor(2)
Get the current stage factor of concrete thickness.
stageFactor_s2.getThicknessFactor()
1.0
Set stage factor of concrete thickness.
stageFactor_s2.setThicknessFactor(1.5)
Get stage factors of all stages and check stage factor of concrete thickness at stage 2.
stageFactors_s2 = liner1.ReinforcedConcrete.StageFactorInterface.getStageFactor(2)
stageFactors_s2.getThicknessFactor()
1.5
Create another stage factor for stage 4 and set the stage factor of concrete thickness.
liner1.ReinforcedConcrete.StageFactorInterface.createStageFactor(4)
newLinerStageFactor_s4 = liner1.ReinforcedConcrete.StageFactorInterface.getDefinedStageFactors()[4]
newLinerStageFactor_s4.setThicknessFactor(2.1)
newLinerStageFactor_s4.getThicknessFactor()
2.1
Get the dictionary of all stage factors.
linerStageFactors = liner1.ReinforcedConcrete.StageFactorInterface.getDefinedStageFactors()
linerStageFactors
{2: <rs3.properties.liner.ReinforcedConcrete.ReinforcedConcreteDefinedStageFactor at 0x19031384640>,
4: <rs3.properties.liner.ReinforcedConcrete.ReinforcedConcreteDefinedStageFactor at 0x19031394830>}
4.1 Absolute Stage Factors#
liner1.ReinforcedConcrete.StageFactorInterface.setDefinedStageFactors(StageFactorMethodType.ABSOLUTE_STAGE_FACTOR, linerStageFactors)
4.2 Relative Stage Factors#
Turn on relative stage factor by setting stageFactorMethodType to RELATIVE_STAGE_FACTOR.
liner1.ReinforcedConcrete.StageFactorInterface.setDefinedStageFactors(StageFactorMethodType.RELATIVE_STAGE_FACTOR, linerStageFactors)
5. Delete Liner Stage Factor#
linerStageFactors = liner1.ReinforcedConcrete.StageFactorInterface.getDefinedStageFactors()
linerStageFactors
{0: <rs3.properties.liner.ReinforcedConcrete.ReinforcedConcreteDefinedStageFactor at 0x1901f216690>,
2: <rs3.properties.liner.ReinforcedConcrete.ReinforcedConcreteDefinedStageFactor at 0x1901f216ad0>,
4: <rs3.properties.liner.ReinforcedConcrete.ReinforcedConcreteDefinedStageFactor at 0x1901f280250>}
Remove stage factors at stage 4.
linerStageFactors.pop(4)
<rs3.properties.liner.ReinforcedConcrete.ReinforcedConcreteDefinedStageFactor at 0x1901f280250>
Set the dictionary back and check the defined stage factors. Now only stage 2 has stage factors defined.
liner1.ReinforcedConcrete.StageFactorInterface.setDefinedStageFactors(StageFactorMethodType.RELATIVE_STAGE_FACTOR, linerStageFactors)
liner1.ReinforcedConcrete.StageFactorInterface.getDefinedStageFactors()
{0: <rs3.properties.liner.ReinforcedConcrete.ReinforcedConcreteDefinedStageFactor at 0x1901f280e50>,
2: <rs3.properties.liner.ReinforcedConcrete.ReinforcedConcreteDefinedStageFactor at 0x1903129b7a0>}
6. Delete Liner#
Delete liner2.
model.deleteLinerProperty(liner2Name)
Check if liner2 still exist in the liner list.
allLiners = model.getAllLinerProperties()
for liner in allLiners:
print(liner.getLinerName())
Liner 1
Save and close the model.
model.close(True)
Close the program.
modeler.closeProgram()
Full Script#
# 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 *
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 = 60304
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 Liner
# Get the first liner in the list.
liner1 = model.getAllLinerProperties()[0]
# Create a new liner and get the liner by name.
liner2Name = "Liner 2"
model.createNewLinerProperty(liner2Name)
liner2 = model.getLinerPropertyByName(liner2Name)
# 2. Set Liner Properties
liner1.setLinerType(LinerTypes.REINFORCED_CONCRETE)
liner1.ReinforcedConcrete.setMaterialType(MaterialType.PLASTIC)
liner1.ReinforcedConcrete.setProperties(ReinforcementProperty=True, ConcreteProperty=True,
PoissonsRatioReinforcement=0.22, PoissonsRatioConcrete=0.28)
# 3. Copy Liner Properties
liner2.setLinerType(LinerTypes.REINFORCED_CONCRETE)
liner2.ReinforcedConcrete.setProperties(**liner1Properties)
# 4. Set Stage Factors
# Turn on the stage factors of liners.
liner1.setApplyStageFactors(True)
# Now, create a stage factor for stage 2.
stageFactor_s2 = liner1.ReinforcedConcrete.StageFactorInterface.createStageFactor(2)
# Set stage factor of concrete thickness.
stageFactor_s2.setThicknessFactor(1.5)
# Get stage factors of all stages and check stage factor of concrete thickness at stage 2.
stageFactors_s2 = liner1.ReinforcedConcrete.StageFactorInterface.getStageFactor(2)
# Create another stage factor for stage 4 and set the stage factor of concrete thickness.
liner1.ReinforcedConcrete.StageFactorInterface.createStageFactor(4)
newLinerStageFactor_s4 = liner1.ReinforcedConcrete.StageFactorInterface.getDefinedStageFactors()[4]
newLinerStageFactor_s4.setThicknessFactor(2.1)
# Get the dictionary of all stage factors.
linerStageFactors = liner1.ReinforcedConcrete.StageFactorInterface.getDefinedStageFactors()
# 4.1 Absolute Stage Factors
liner1.ReinforcedConcrete.StageFactorInterface.setDefinedStageFactors(StageFactorMethodType.ABSOLUTE_STAGE_FACTOR, linerStageFactors)
# 4.2 Relative Stage Factors
# Turn on relative stage factor by setting stageFactorMethodType to RELATIVE_STAGE_FACTOR.
liner1.ReinforcedConcrete.StageFactorInterface.setDefinedStageFactors(StageFactorMethodType.RELATIVE_STAGE_FACTOR, linerStageFactors)
# 5. Delete Liner Stage Factor
linerStageFactors = liner1.ReinforcedConcrete.StageFactorInterface.getDefinedStageFactors()
# Remove stage factors at stage 4.
linerStageFactors.pop(4)
# Set the dictionary back and check the defined stage factors. Now only stage 2 has stage factors defined.
liner1.ReinforcedConcrete.StageFactorInterface.setDefinedStageFactors(StageFactorMethodType.RELATIVE_STAGE_FACTOR, linerStageFactors)
liner1.ReinforcedConcrete.StageFactorInterface.getDefinedStageFactors()
# 6. Delete Liner
# Delete liner2.
model.deleteLinerProperty(liner2Name)
# Check if liner2 still exist in the liner list.
allLiners = model.getAllLinerProperties()
for liner in allLiners:
print(liner.getLinerName())
# Save and close the model.
model.close(True)
2026-03-13 17:22:46,240 - Rocscience.RS3 - INFO - Attempting to start the application at C:\Program Files\Rocscience\RS3\RS3 and binding server to port 60304...
Liner 1