rs2.modeler package

rs2.modeler.Model module

class rs2.modeler.Model.Model(client, ID)

Bases: BaseModel

Code Snippet: Model Manipulation

getBoltPropertyByName(boltName: str) BoltProperty
Returns a Bolt Property object based on its name.
getLinerPropertyByName(linerName: str) LinerProperty
Returns a Liner Property object based on its name.
getJointPropertyByName(jointName: str) JointProperty
Returns a Joint Property object based on its name.
getPilePropertyByName(pileName: str) PileProperty
Returns a Pile Property object based on its name.
getStructuralInterfacePropertyByName(structuralName: str) StructuralInterfaceProperty
Returns a Structural Interface Property object based on its name.
getCompositeLinerPropertyByName(compositeName: str) CompositeProperty
Returns a Composite Liner Property object based on its name.
getMaterialPropertyByName(materialName: str) MaterialProperty
Returns a Material Property object based on its name.
getAllBoltProperties() list[BoltProperty]
Returns a list of all Bolt Property objects
getAllLinerProperties() list[LinerProperty]
Returns a list of all Liner Property objects
getAllJointProperties() list[JointProperty]
Returns a list of all Joint Property objects
getAllPileProperties() list[PileProperty]
Returns a list of all Pile Property objects
getAllStructuralInterfaceProperties() list[StructuralInterfaceProperty]
Returns a list of all Structural Interface Property objects
getAllCompositeLinerProperties() list[CompositeProperty]
Returns a list of all Composite Liner Property objects
getAllMaterialProperties() list[MaterialProperty]
Returns a list of all Material Property objects
getShearNormalFunctions() list[ShearNormalFunction]
Returns a list of all shear normal functions
getShearNormalFunctionByName(shearNormalFunctionName: str) ShearNormalFunction
Returns a shear normal function object based on its name.
createNewShearNormalFunction(functionName)
Creates a new shear normal function with the given name
deleteShearNormalFunction(functionName)
Deletes a shear normal function with the given name
renameShearNormalFunction(oldName, newName)
Renames a shear normal function with the given name
getUserDefinedPermeabilityAndWaterContentMode(name: str) UserDefinedWaterMode
Returns a User Defined Water Mode object based on its name.
createUserDefinedPermeabilityAndWaterContentMode(name: str) UserDefinedWaterMode
Creates a User Defined Water Mode object with the given name.
deleteUserDefinedPermeabilityAndWaterContentMode(name: str)
Deletes a User Defined Water Mode object with the given name.
renameUserDefinedPermeabilityAndWaterContentMode(oldName: str, newName: str)
Renames a User Defined Water Mode object with the given name.
AddHistoryQueryPoint(x: float, y: float, history_query_name: str)

Code Snippet: Manipulation of History Query and its results

Add a new History Query point to your model with the specified coordinates and label name
RemoveHistoryQueryPoint(history_query_name: str)

Code Snippet: Manipulation of History Query and its results

Remove a History Query point from your model by label name.
AddTimeQueryLine(points: list[list[float]], points_on_line: int) str

Code Snippet: Manipulation of Time Query and its results

Add a new Time Query Line to your model with the specified coordinates

Warning

points_on_line must be between 1 and 10 inclusive.

RemoveTimeQueryLine(IDs_toRemove: list[str])

Code Snippet: Manipulation of Time Query and its results

Removes Time Query Line(s) from your model using provided list of IDs.
AddTimeQueryPoint(x: float, y: float) str

Code Snippet: Manipulation of Time Query and its results

Add a new Time Query Point to your model with the specified x and y coordinates
RemoveTimeQueryPoint(IDs_toRemove: list[str])

Code Snippet: Manipulation of Time Query and its results

Removes Time Query Point(s) from your model using provided list of IDs.
compute()
Saves the file if modified and then runs compute. Replaces any existing results.

Warning

All objects retrieved from the interpreter for this file will be invalidated after this call. If you have an interpreter model open, you should close, compute, and then re-open the model.

interpreterModel.close()
model.compute()
interpreterModel = modeler.openFile('C:/previouslyOpened.fez')
computeGroundWater()
Saves the file if modified and then runs groundwater compute. Replaces any existing results.

Warning

All objects retrieved from the interpreter for this file will be invalidated after this call. If you have an interpreter model open, you should close, compute, and then re-open the model.

interpreterModel.close()
model.compute()
interpreterModel = modeler.openFile('C:/previouslyOpened.fez')
saveAs(fileName: str)
Saves the model using the given file name.

Example:

model.saveAs('C:/simple_3_stage.fez')
getDiscreteFunctions() list[DiscreteFunction]
Returns a list of all discrete functions
getDiscreteFunctionByName(discreteFunctionName: str) DiscreteFunction
Returns a discrete function object based on its name.
createNewDiscreteFunction(functionName)
Creates a new discrete function with the given name
deleteDiscreteFunction(functionName)
Deletes a discrete function with the given name
renameDiscreteFunction(oldName, newName)
Renames a discrete function with the given name
ResetProperties()

Code Snippet: Get Model Units

Reset all properties for your model

rs2.modeler.RS2Modeler module

class rs2.modeler.RS2Modeler.RS2Modeler(host='localhost', port=60054)

Bases: object

Code Snippet: Modeler Scripting Functionality

openFile(fileName: str) Model

Takes in the absolute path to an rs2 file to be opened in the modeler.

Example:

model = modeler.openFile('C:/simple_3_stage.fez')
classmethod startApplication(port: int, overridePathToExecutable: str = None, timeout: float = 30) None

Opens the most recently installed RS2 application. Starts the python server and binds it to the given port.

Parameters:
  • port (int) – the port to bind the python server to. Use this same port when initializing RS2Modeler

  • overridePathToExecutable (str, optional) – full path to the desired executable to be opened. If not provided, the latest installation of rs2 is used

  • timeout (float, optional) – the maximum amount of time to wait for the application and server to start.

Raises:
  • ValueError – Port range must be between 49152 and 65535, otherwise ValueError is raised

  • TimeoutError – if timeout is provided, raises TimeoutError if not able to connect to the server within that time.

closeProgram(saveModels=True, timeout=30)

Closes the modeler program. All unsaved models are saved by default.

Example:

#saves all models before closing
modeler.closeProgram(True)

#closes the program without saving
modeler.closeProgram(False)