Skip to main content
Part of EnSight gRPC Interface » ensight_grpc Python binding for the EnSight client gRPC API. Inheritance diagram for ensight_grpc.EnSightGRPC:

Public Member Functions

Public Attributes

Protected Attributes

Detailed Description

Python binding for the EnSight client gRPC API. This class provides an asynchronous interface to the EnSight core gRPC interface. It can handle remote image and event streams, providing a much simpler interface to the EnSight application Definition at line 35 of file ensight_grpc.py.

Constructor & Destructor Documentation

__init__()

create an instance of the EnSight gRPC interface wrapper The default is to make a connection to an EnSight gRPC server on port 12345 on the loopback host. If requested to launch the server, it will be the current version. Parameters Definition at line 45 of file ensight_grpc.py.

Member Function Documentation

command()

send a Python command string to be executed in EnSight The string will be run or evaluated in the EnSight Python interpreter via the EnSightService::RunPython() gRPC all. If an exception or other error occurs, this function will throw a RuntimeError. If do_eval is False, the return value will be None, otherwise it will be the result of eval() of the string. Parameters Definition at line 254 of file ensight_grpc.py.

connect()

establish a connection to an EnSight gRPC server Attempt to connect to an EnSight gRPC server using the host and port established by the constructor. Note on failure, this function just returns, but is_connected() will return False. Parameters Definition at line 177 of file ensight_grpc.py.

dynamic_scene_graph_stream()

open up a dynamic scene graph stream Make a DynamicSceneGraphService::GetSceneStream() rpc call and return a ensightservice::SceneUpdateCommand stream instance. Parameters Returns a ensightservice::SceneUpdateCommand stream instance Definition at line 396 of file ensight_grpc.py.

event_stream_enable()

enable a simple gRPC-based event stream from EnSight This method makes a EnSightService::GetEventStream() gRPC call into EnSight, returning an ensightservice::EventReply stream. The method creates a thread to hold this stream open and read new events from it. The thread adds the event strings to a list of events stored on this instance. If callback is not None, the object will be called with the event string, otherwise they can be retrieved using get_event(). Definition at line 376 of file ensight_grpc.py.

event_stream_is_enabled()

check to see if the event stream is enabled If an event stream has been successfully established via event_stream_enable(), then this function returns True Returns True if a ensightservice::EventReply steam is active Definition at line 405 of file ensight_grpc.py.

geometry()

return the current scene geometry in glTF format Package up the geometry currently being viewed in the EnSight session as a glTF stream. Return this stream as an array of byte. Note: no interrmediate files are utilized. Definition at line 235 of file ensight_grpc.py.

get_event()

retrieve and remove the oldest ensightservice::EventReply string When any of the event streaming systems is enabled, Python threads will receive the event records and store them in this instance in an ordered fashion. This method retrieves the oldest ensightservice::EventReply string in the queue. Returns the even string or None if no events are available Definition at line 415 of file ensight_grpc.py.

get_image()

retrieve the current EnSight image When any of the image streaming systems is enabled, Python threads will receive the most recent image and store them in this instance. The frame stored in this instance can be accessed by calling this method Returns the image dict(pixels=bytearray, width=w, height=h) and the image frame number Definition at line 302 of file ensight_grpc.py.

host()

get the hostname for this connection Returns the current connection hostname. Definition at line 74 of file ensight_grpc.py.

image_stream_enable()

enable a simple gRPC-based image stream from EnSight This method makes a EnSightService::GetImageStream() gRPC call into EnSight, returning an ensightservice::ImageReply stream. The method creates a thread to hold this stream open and read new image frames from it. The thread places the read images in this object. An external application can retrieve the most recent one using get_image(). Parameters Definition at line 284 of file ensight_grpc.py.

image_stream_is_enabled()

check to see if the image stream is enabled If an image stream has been successfully established via image_stream_enable(), then this function returns True Returns True if a ensightservice::ImageReply steam is active Definition at line 354 of file ensight_grpc.py.

is_connected()

check if a gRPC connection has been established Returns True if a previous connect() call made a valid gRPC connection. Definition at line 168 of file ensight_grpc.py.

port()

get the port number for this connection Returns the current connection port number. Definition at line 80 of file ensight_grpc.py.

prefix()

return the unique prefix for this instance Many of the EnSight gRPC APIs require a unique prefix so that EnSight can handle multiple, simultaneous remote connections. This method will generate a GUID-based prefix. Returns A unique prefix string of the form: grpc://{uuid}/ Definition at line 363 of file ensight_grpc.py.

render()

render the current EnSight screen and return the image Render the current scene at some resolution independent of the current EnSight scene view. Parameters Definition at line 215 of file ensight_grpc.py.

security_token()

return the security token for the gRPC connection. Returns the current connection security token Definition at line 98 of file ensight_grpc.py.

set_security_token()

set the security token for the gRPC connection. EnSight supports a security token in either numeric (-security {int}) or string (ENSIGHT_SECURITY_TOKEN environmental variable) form. If EnSight is using a security token, all gRPC calls must include this token. This call sets the token for all rGPC calls made by this class. Note: for this module, the security token must be a in bytes() format. For example: str(1000).encode(“utf-8”) Parameters Definition at line 92 of file ensight_grpc.py.

shutdown()

shut down all gRPC connections If this class launched the EnSight client instance, it will send the gRPC exit() call and then shut down all connections. Definition at line 105 of file ensight_grpc.py.

start_server()

Start an EnSight gRPC server instance. If the host application wishes to launch an EnSight instance, start_server() will launch a batch mode EnSight application with the security token and a gRPC server started on the port passed in the constructor. Definition at line 128 of file ensight_grpc.py.

stop_server()

shut down any gPRC connection made by this class First, if this class launched the EnSight instance, via start_server(), the exit() gRPC command will be sent. Second, the local gRPC connection is dropped. Definition at line 153 of file ensight_grpc.py.

subscribe_events()

subscribe to an event stream using a locally launched gRPC server This methond makes a EnSightService::SubscribeEvents() gRPC call, causing EnSight to make a reverse gRPC connection over with gRPC calls with the various events will be made. Definition at line 471 of file ensight_grpc.py.

subscribe_images()

subscribe to an image stream This methond makes a EnSightService::SubscribeImages() gRPC call. If use_shmem is False, the transport system will be made over gRPC. It causes EnSight to make a reverse gRPC connection over with gRPC calls with the various images will be made. If use_shmem is True (the default), the EnSight gRPC Shared Memory Image Transport API will be used. Parameters Definition at line 488 of file ensight_grpc.py.

unsubscribe()

unsubscribe from any image or event streams that have been subscribed to This method makes a EnSightService::Unsubscribe() gRPC call. It will cancel any subscribe_events() or subscribe_images() calls. Definition at line 527 of file ensight_grpc.py.

Member Data Documentation

_channel

protected Definition at line 49 of file ensight_grpc.py.

_dsg_stub

protected Definition at line 51 of file ensight_grpc.py.

_event_callback

protected Definition at line 68 of file ensight_grpc.py.

_event_stream

protected Definition at line 63 of file ensight_grpc.py.

_event_thread [1/2]

protected Definition at line 64 of file ensight_grpc.py.

_event_thread [2/2]

Definition at line 386 of file ensight_grpc.py.

_events

protected Definition at line 65 of file ensight_grpc.py.

_host

protected Definition at line 46 of file ensight_grpc.py.

_image [1/2]

protected Definition at line 58 of file ensight_grpc.py.

_image [2/2]

Definition at line 312 of file ensight_grpc.py.

_image_number

protected Definition at line 59 of file ensight_grpc.py.

_image_stream

protected Definition at line 56 of file ensight_grpc.py.

_image_thread [1/2]

protected Definition at line 57 of file ensight_grpc.py.

_image_thread [2/2]

Definition at line 291 of file ensight_grpc.py.

_pid

protected Definition at line 48 of file ensight_grpc.py.

_port

protected Definition at line 47 of file ensight_grpc.py.

_prefix

protected Definition at line 66 of file ensight_grpc.py.

_security_token

protected Definition at line 53 of file ensight_grpc.py.

_shmem_client

protected Definition at line 60 of file ensight_grpc.py.

_shmem_filename

protected Definition at line 61 of file ensight_grpc.py.

_stub

protected Definition at line 50 of file ensight_grpc.py.

_sub_service

protected Definition at line 67 of file ensight_grpc.py.

_version

protected Definition at line 52 of file ensight_grpc.py. The documentation for this class was generated from the following file: