Python API Oasys.D3PLOT documentation
The Oasys.D3PLOT package allows Python scripts to control the Oasys software D3PLOT.
For full information and examples of the Python API visit: https://help.oasys-software.com/articles/py_api-23-0
Basic Information
The module uses gRPC to communicate with the D3PLOT executable using the Oasys.gRPC module.
Connection methods
- start(abspath, args=None, port=50054, memory=25, license=None, debug=False, batch=False, wait=5, prefix=None)
Start an instance of D3PLOT on this machine.
- Parameters:
abspath (string) – The absolute pathname of the D3PLOT executable
args (list) – Optional. Any extra arguments to pass onto D3PLOT
port (integer) – Optional. The gRPC port number used to communicate with D3PLOT
memory (integer) – Optional. The memory allocated for scripts in D3PLOT
license (string) – Optional. The location of the license file or server for D3PLOT
debug (boolean) – Optional. Output debugging messages
batch (boolean) – Optional. If D3PLOT should be started in batch mode without any main window
wait (integer) – Optional. Time to wait (in seconds) for D3PLOT to start
Added in version 21.0.1prefix (string) – Optional. A prefix command used to run D3PLOT (e.g. /opt/VirtualGL/bin/vglrun)
Added in version 22.0.2- Returns:
Connection object used to interact with D3PLOT
- Return type:
Connection
Example
To start D3PLOT (installed at C:\Oasys\d3plot_x64.exe):
import Oasys.D3PLOT connection = Oasys.D3PLOT.start(abspath="C:\\Oasys\\d3plot_x64.exe")
- connect(port=50054, memory=25, hostname='localhost', debug=False)
Connect to an instance of D3PLOT that is running.
- Parameters:
port (integer) – Optional. The gRPC port number used to communicate with D3PLOT
memory (integer) – Optional. The memory allocated for scripts in D3PLOT
hostname (string) – Optional. The hostname of the machine that D3PLOT is running on
debug (boolean) – Optional. Output debugging messages
- Returns:
Connection object used to interact with D3PLOT
- Return type:
Connection
Example
To connect to an instance of D3PLOT that is listening for gRPC messages on port 50054:
import Oasys.D3PLOT connection = Oasys.D3PLOT.connect(port=50054)
- disconnect(connection)
Disconnect from the instance of D3PLOT that we are connected to and leave D3PLOT running.
Example
To disconnect from D3PLOT:
Oasys.D3PLOT.disconnect(connection)
- terminate(connection)
Terminate the instance of D3PLOT that we are connected to, closing D3PLOT.
Example
To terminate D3PLOT:
Oasys.D3PLOT.terminate(connection)