Python API Oasys.THIS documentation

The Oasys.THIS package allows Python scripts to control the Oasys LS-DYNA Environment software T/HIS.

For full information and examples of the Python API visit: https://help.oasys-software.com/articles/py_api-21-0

Basic Information

The module uses gRPC to communicate with the T/HIS executable using the Oasys.gRPC module.

Connection methods

start(abspath, args=None, port=50052, memory=25, license=None, debug=False, batch=False, wait=5)

Start an instance of T/HIS on this machine.

Parameters:
  • abspath (string) – The absolute pathname of the T/HIS executable

  • args (list) – Optional. Any extra arguments to pass onto T/HIS

  • port (integer) – Optional. The gRPC port number used to communicate with T/HIS

  • memory (integer) – Optional. The memory allocated for scripts in T/HIS

  • license (string) – Optional. The location of the license file or server for T/HIS

  • debug (boolean) – Optional. Output debugging messages

  • batch (boolean) – Optional. If T/HIS should be started in batch mode without any main window

  • wait (integer) – Optional. Time to wait (in seconds) for T/HIS to start
    Added in version 21.0.1

Returns:

Connection object used to interact with T/HIS

Return type:

Connection

Example

To start T/HIS (installed at C:\Oasys 21\this21_x64.exe):

import Oasys.THIS
connection = Oasys.THIS.start(abspath="C:\\Oasys 21\\this21_x64.exe")
connect(port=50052, memory=25, hostname='localhost', debug=False)

Connect to an instance of T/HIS that is running.

Parameters:
  • port (integer) – Optional. The gRPC port number used to communicate with T/HIS

  • memory (integer) – Optional. The memory allocated for scripts in T/HIS

  • hostname (string) – Optional. The hostname of the machine that T/HIS is running on

  • debug (boolean) – Optional. Output debugging messages

Returns:

Connection object used to interact with T/HIS

Return type:

Connection

Example

To connect to an instance of T/HIS that is listening for gRPC messages on port 50052:

import Oasys.THIS
connection = Oasys.THIS.connect(port=50052)
disconnect(connection)

Disconnect from the instance of T/HIS that we are connected to and leave T/HIS running.

Example

To disconnect from T/HIS:

Oasys.THIS.disconnect(connection)
terminate(connection)

Terminate the instance of T/HIS that we are connected to, closing T/HIS.

Example

To terminate T/HIS:

Oasys.THIS.terminate(connection)

Indices and tables