connect_to_or_start_server#
- ansys.sound.core.server_helpers._connect_to_or_start_server.connect_to_or_start_server(port=None, ip=None, ansys_path=None, use_license_context=False, license_increment_name='avrxp_snd_level1')#
Connect to or start a DPF server with the DPF Sound plugin loaded.
- Parameters:
- port
int, default:None Port that the DPF server is listening to.
- ip
str, default:None IP address for the DPF server.
- ansys_path
str, default:None Root path for the Ansys installation. For example, “C:/Program Files/ANSYS Inc/v242”. This parameter is ignored if either the port or IP address is set.
- use_license_contextbool, default:
False Whether to check out the DPF Sound license increment before using PyAnsys Sound (see parameter
license_increment_name). If set toTrue, the function returns aLicenseContextManagerobject (Noneotherwise) in addition to the server object.This improves performance if you are doing multiple calls to DPF Sound operators, as it allows a single check out of the license increment, rather than requiring a check out for each operator call. The license is checked back in (that is, released) when the
LicenseContextManagerobject is deleted.This parameter can also be used to force check out before running a script when only few DPF Sound license increments are available.
- license_increment_name
str, default: “avrxp_snd_level1” Name of the license increment to check out. Only taken into account if
use_license_contextisTrue. The default value is “avrxp_snd_level1”, which corresponds to the license required by Ansys Sound Pro.
- port
- Returns:
- Return type:
Notes
If a port or IP address is passed in arguments, or if the environment variable
ANSRV_DPF_SOUND_PORTis defined with a port number, this function attempts to connect to a remote server at the specified port and/or IP address. Otherwise, the function attempts to start a local server, located at the path passed inansys_pathif specified, or at the path specified in the environment variableANSYS_DPF_PATHif it is defined. Finally, if none of these arguments and environment variables is defined, the function attempts to start a local server from the latest Ansys installation folder. Note that, in any case, arguments are prioritized over environment variables.Examples
Start a local DPF server with DPF Sound plugin from the latest Ansys installation folder.
>>> from ansys.sound.core.server_helpers import connect_to_or_start_server >>> server, lic_context = connect_to_or_start_server( ... ansys_path="C:/Program Files/ANSYS Inc/v261", ... )
Connect to a remote DPF server with DPF Sound plugin, through a given communication port.
>>> from ansys.sound.core.server_helpers import connect_to_or_start_server >>> server, lic_context = connect_to_or_start_server(port=6780)
See also
- Initialize PyAnsys Sound and check out the license
Example demonstrating how to connect to or start a DPF server with the DPF Sound plugin.