Open and Close Model Script Example#
Download the blankModel.rs3v3 for this example.
from rs3.RS3Modeler import RS3Modeler
import os
Get the current folder directory.
current_dir = os.path.dirname(os.path.abspath(""))
Specify a port number that is not in use and start the RS3 program.
port = 60102
RS3Modeler.startApplication(port)
2026-03-13 16:58:39,565 - Rocscience.RS3 - INFO - Attempting to start the application at C:\Program Files\Rocscience\RS3\RS3 and binding server to port 60102...
Connect with the RS3 Modeler.
modeler = RS3Modeler(port)
Get the model path.
blankModelPath = rf"{current_dir}\example_models\blankModel.rs3v3"
Open the model file.
model = modeler.openFile(blankModelPath)
Save and close the model.
model.close(True)
Close the program.
modeler.closeProgram()
Full Script#
# Open and Close Model Script Example
# 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
import os
# Get the current folder directory.
current_dir = os.path.dirname(os.path.abspath(""))
# Specify a port number that is not in use and start the RS3 program.
port = 60102
RS3Modeler.startApplication(port)
# Connect with the RS3 Modeler.
modeler = RS3Modeler(port)
# Get the model path.
blankModelPath = rf"{current_dir}\example_models\blankModel.rs3v3"
# Open the model file.
model = modeler.openFile(blankModelPath)
# Save and close the model.
model.close(True)
2026-03-13 16:59:34,154 - Rocscience.RS3 - INFO - Attempting to start the application at C:\Program Files\Rocscience\RS3\RS3 and binding server to port 60102...