Instance

class rips.Instance(port=50051, launched=False)

Bases: object

The ResInsight Instance class. Use to launch or find existing ResInsight instances

launched

Tells us whether the application was launched as a new process. If the application was launched we may need to close it when exiting the script.

Type

bool

commands

Command executor. Set when creating an instance.

Type

Commands

project

Current project in ResInsight. Set when creating an instance and updated when opening/closing projects.

Type

Project

Methods Summary

client_version_string()

Get a full version string, i.e. 2019.04.01.

exit()

Tell ResInsight instance to quit

find([start_port, end_port])

Search for an existing Instance of ResInsight by testing ports.

is_console()

Returns true if the connected ResInsight instance is a console app

is_gui()

Returns true if the connected ResInsight instance is a GUI app

launch([resinsight_executable, console, ...])

Launch a new Instance of ResInsight.

major_version()

Get an integer with the major version number

minor_version()

Get an integer with the minor version number

patch_version()

Get an integer with the patch version number

set_export_folder(export_type, path[, ...])

Set the export folder used for all export functions

set_main_window_size(width, height)

Set the main window size in pixels

set_plot_window_size(width, height)

Set the plot window size in pixels

set_start_dir(path)

Set current start directory

version_string()

Get a full version string, i.e. 2019.04.01.

Methods Documentation

client_version_string()

Get a full version string, i.e. 2019.04.01

exit()

Tell ResInsight instance to quit

static find(start_port=50051, end_port=50071)

Search for an existing Instance of ResInsight by testing ports.

By default we search from port 50051 to 50071 or if the environment variable RESINSIGHT_GRPC_PORT is set we search RESINSIGHT_GRPC_PORT to RESINSIGHT_GRPC_PORT+20

Parameters
  • start_port (int) -- start searching from this port

  • end_port (int) -- search up to but not including this port

is_console()

Returns true if the connected ResInsight instance is a console app

is_gui()

Returns true if the connected ResInsight instance is a GUI app

static launch(resinsight_executable='', console=False, launch_port=- 1, command_line_parameters=None)

Launch a new Instance of ResInsight. This requires the environment variable RESINSIGHT_EXECUTABLE to be set or the parameter resinsight_executable to be provided. The RESINSIGHT_GRPC_PORT environment variable can be set to an alternative port number.

Parameters
  • resinsight_executable (str) -- Path to a valid ResInsight executable. If set will take precedence over what is provided in the RESINSIGHT_EXECUTABLE environment variable.

  • console (bool) -- If True, launch as console application, without GUI.

  • launch_port (int) -- If -1 will use the default port 50051 or RESINSIGHT_GRPC_PORT if anything else, ResInsight will try to launch with this port

  • command_line_parameters (list) -- Additional parameters as string entries in the list.

Returns

an instance object if it worked. None if not.

Return type

Instance

major_version()

Get an integer with the major version number

minor_version()

Get an integer with the minor version number

patch_version()

Get an integer with the patch version number

set_export_folder(export_type, path, create_folder=False)

Set the export folder used for all export functions

Parameters:

Parameter        | Description                                  | Type
---------------- | -------------------------------------------- | -----
export_type      | String specifying what to export             | String
path             | Path to folder                               | String
create_folder    | Create folder if it doesn't exist?           | Boolean

Enum export_type:

Option          | Description
--------------- | ------------
"COMPLETIONS"   |
"SNAPSHOTS"     |
"PROPERTIES"    |
"STATISTICS"    |
set_main_window_size(width, height)

Set the main window size in pixels

Parameters:

Parameter | Description      | Type
--------- | ---------------- | -----
width     | Width in pixels  | Integer
height    | Height in pixels | Integer
set_plot_window_size(width, height)

Set the plot window size in pixels

Parameters:

Parameter | Description      | Type
--------- | ---------------- | -----
width     | Width in pixels  | Integer
height    | Height in pixels | Integer
set_start_dir(path)

Set current start directory

Parameters

path (str) -- path to directory

version_string()

Get a full version string, i.e. 2019.04.01