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.

Examples

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.

Examples

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

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