The public_api.py module#

Summary#

launch_workbench

Launch PyWorkbench server on the local or a remote Windows machine.

connect_workbench

Create a PyWorkbench client that connects to an already running Workbench server.

Description#

Module for starting PyWorkbench.

Module detail#

public_api.launch_workbench(show_gui=True, version=None, client_workdir=None, server_workdir=None, host=None, username=None, password=None)#

Launch PyWorkbench server on the local or a remote Windows machine.

This method launch a Workbench server on the local or a remote Windows machine and creates a PyWorkbench client that connects to the server.

Parameters:
show_guibool, default: True

Weather to launch Workbench in UI mode.

versionstr, default: None

Workbench version to launch. It must be a 3-digit version that is “242” or later.

client_workdirstr, default: None

Path to a writable directory on the client computer. The default is None, in which case the system temp directory is used.

server_workdirstr, None

Path to a writable directory on the server computer. The default is None, in which case the user preference for the Workbench temporary file folder is used.

hoststr, None

Server computer’s name or IP address. The default is None for launching on the local computer.

usernamestr, None

User’s login name on the server computer. The default is None for launching on the local computer.

passwordstr, None

User’s password on the server computer. The default is None for launching on the local computer.

Returns:
WorkbenchClient

Instance of the PyWorkbench client that is connected to the launched server.

Examples

Launch a server on the local computer and use the wb variable to hold the returned client.

>>> from ansys.workbench.core import launch_workbench
>>> wb = launch_workbench()
public_api.connect_workbench(port, client_workdir=None, host=None)#

Create a PyWorkbench client that connects to an already running Workbench server.

Parameters:
portint

Port used by the server.

client_workdirstr, default: None

Path to a writable directory on the client computer. The default is None, in which case the system temp directory is used.

hoststr, default: None

Server computer’s name or IP address. The default is None for the local computer.

Returns:
WorkbenchClient

Instance of the PyWorkbench client that is connected to the server.

Examples

Connect to a server at port 32588 on localhost and use the wb variable to hold the returned client.

>>> from ansys.workbench.core import connect_workbench
>>> wb = connect_workbench(port = 32588)