rs2.interpreter.RS2Interpreter module#

class rs2.interpreter.RS2Interpreter.RS2Interpreter(host='localhost', port=60055)#

Bases: object

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 without saving any models
modeler.closeProgram(False)