The product_instance.py module#

Summary#

ProductInstance

ProductInstance class.

prepare_and_start_backend

Start the requested service locally using the ProductInstance class.

get_available_port

Return an available port to be used.

WINDOWS_GEOMETRY_SERVICE_FOLDER

Default Geometry Service’s folder name into the unified installer.

DISCOVERY_FOLDER

Default Discovery’s folder name into the unified installer.

SPACECLAIM_FOLDER

Default SpaceClaim’s folder name into the unified installer.

ADDINS_SUBFOLDER

Default global Addins’s folder name into the unified installer.

BACKEND_SUBFOLDER

Default backend’s folder name into the ADDINS_SUBFOLDER folder.

MANIFEST_FILENAME

Default backend’s add-in filename.

GEOMETRY_SERVICE_EXE

The Windows Geometry Service’s filename.

DISCOVERY_EXE

The Ansys Discovery’s filename.

SPACECLAIM_EXE

The Ansys SpaceClaim’s filename.

BACKEND_LOG_LEVEL_VARIABLE

The backend’s log level environment variable for local start.

BACKEND_TRACE_VARIABLE

The backend’s enable trace environment variable for local start.

BACKEND_HOST_VARIABLE

The backend’s ip address environment variable for local start.

BACKEND_PORT_VARIABLE

The backend’s port number environment variable for local start.

BACKEND_LOGS_FOLDER_VARIABLE

The backend’s logs folder path to be used.

BACKEND_API_VERSION_VARIABLE

The backend’s api version environment variable for local start.

BACKEND_SPACECLAIM_OPTIONS

The additional argument for local Ansys Discovery start.

BACKEND_ADDIN_MANIFEST_ARGUMENT

The argument to specify the backend’s add-in manifest file’s path.

BACKEND_SPACECLAIM_HIDDEN

The argument to hide SpaceClaim’s UI on the backend.

BACKEND_SPACECLAIM_HIDDEN_ENVVAR_KEY

SpaceClaim hidden backend’s environment variable key.

BACKEND_SPACECLAIM_HIDDEN_ENVVAR_VALUE

SpaceClaim hidden backend’s environment variable value.

BACKEND_DISCOVERY_HIDDEN

The argument to hide Discovery’s UI on the backend.

BACKEND_SPLASH_OFF

The argument to specify the backend’s add-in manifest file’s path.

Description#

Module containing the ProductInstance class.

Module detail#

product_instance.prepare_and_start_backend(backend_type: ansys.geometry.core.connection.backend.BackendType, product_version: int = None, host: str = 'localhost', port: int = None, enable_trace: bool = False, api_version: ansys.geometry.core.connection.backend.ApiVersions = ApiVersions.LATEST, timeout: int = 150, manifest_path: str = None, hidden: bool = False, server_log_level: int = 2, client_log_level: int = logging.INFO, server_logs_folder: str = None, client_log_file: str = None, log_level: int = None, logs_folder: str = None) ansys.geometry.core.modeler.Modeler#

Start the requested service locally using the ProductInstance class.

When calling this method, a standalone service or product session is started. By default, if an endpoint is specified (by defining host and port parameters) but the endpoint is not available, the startup will fail. Otherwise, it will try to launch its own service.

Parameters:
product_version: ``int``, optional

The product version to be started. Goes from v23.2.1 to the latest. Default is None. If a specific product version is requested but not installed locally, a SystemError will be raised.

host: str, optional

IP address at which the Geometry service will be deployed. By default, its value will be localhost.

portint, optional

Port at which the Geometry service will be deployed. By default, its value will be None.

enable_tracebool, optional

Boolean enabling the logs trace on the Geometry service console window. By default its value is False.

api_version: ``ApiVersions``, optional

The backend’s API version to be used at runtime. Goes from API v21 to the latest. Default is ApiVersions.LATEST.

timeoutint, optional

Timeout for starting the backend startup process. The default is 150.

manifest_pathstr, optional

Used to specify a manifest file path for the ApiServerAddin. This way, it is possible to run an ApiServerAddin from a version an older product version. Only applicable for Ansys Discovery and Ansys SpaceClaim.

hiddenstarts the product hiding its UI. Default is False.
server_log_levelint, optional
Backend’s log level from 0 to 3:

0: Chatterbox 1: Debug 2: Warning 3: Error

The default is 2 (Warning).

client_log_levelint, optional

Logging level to apply to the client. By default, INFO level is used. Use the logging module’s levels: DEBUG, INFO, WARNING, ERROR, CRITICAL.

server_logs_folderstr, optional

Sets the backend’s logs folder path. If nothing is defined, the backend will use its default path.

client_log_filestr, optional

Sets the client’s log file path. If nothing is defined, the client will log to the console.

log_levelint, optional

DEPRECATED. Use server_log_level instead.

logs_folderstr, optional

DEPRECATED. Use server_logs_folder instead.

Returns:
Modeler

Instance of the Geometry service.

Raises:
ConnectionError

If the specified endpoint is already in use, a connection error will be raised.

SystemError

If there is not an Ansys product 23.2 version or later installed or if a specific product’s version is requested but not installed locally then a SystemError will be raised.

product_instance.get_available_port() int#

Return an available port to be used.

Returns:
int

The available port.

product_instance.WINDOWS_GEOMETRY_SERVICE_FOLDER = 'GeometryService'#

Default Geometry Service’s folder name into the unified installer.

product_instance.DISCOVERY_FOLDER = 'Discovery'#

Default Discovery’s folder name into the unified installer.

product_instance.SPACECLAIM_FOLDER = 'scdm'#

Default SpaceClaim’s folder name into the unified installer.

product_instance.ADDINS_SUBFOLDER = 'Addins'#

Default global Addins’s folder name into the unified installer.

product_instance.BACKEND_SUBFOLDER = 'ApiServer'#

Default backend’s folder name into the ADDINS_SUBFOLDER folder.

product_instance.MANIFEST_FILENAME = 'Presentation.ApiServerAddIn.Manifest.xml'#

Default backend’s add-in filename.

To be used only for local start of Ansys Discovery or Ansys SpaceClaim.

product_instance.GEOMETRY_SERVICE_EXE = 'Presentation.ApiServerDMS.exe'#

The Windows Geometry Service’s filename.

product_instance.DISCOVERY_EXE = 'Discovery.exe'#

The Ansys Discovery’s filename.

product_instance.SPACECLAIM_EXE = 'SpaceClaim.exe'#

The Ansys SpaceClaim’s filename.

product_instance.BACKEND_LOG_LEVEL_VARIABLE = 'LOG_LEVEL'#

The backend’s log level environment variable for local start.

product_instance.BACKEND_TRACE_VARIABLE = 'ENABLE_TRACE'#

The backend’s enable trace environment variable for local start.

product_instance.BACKEND_HOST_VARIABLE = 'API_ADDRESS'#

The backend’s ip address environment variable for local start.

product_instance.BACKEND_PORT_VARIABLE = 'API_PORT'#

The backend’s port number environment variable for local start.

product_instance.BACKEND_LOGS_FOLDER_VARIABLE = 'ANS_DSCO_REMOTE_LOGS_FOLDER'#

The backend’s logs folder path to be used.

product_instance.BACKEND_API_VERSION_VARIABLE = 'API_VERSION'#

The backend’s api version environment variable for local start.

To be used only with Ansys Discovery and Ansys SpaceClaim.

product_instance.BACKEND_SPACECLAIM_OPTIONS = '--spaceclaim-options'#

The additional argument for local Ansys Discovery start.

To be used only with Ansys Discovery.

product_instance.BACKEND_ADDIN_MANIFEST_ARGUMENT = '/ADDINMANIFESTFILE='#

The argument to specify the backend’s add-in manifest file’s path.

To be used only with Ansys Discovery and Ansys SpaceClaim.

product_instance.BACKEND_SPACECLAIM_HIDDEN = '/Headless=True'#

The argument to hide SpaceClaim’s UI on the backend.

To be used only with Ansys SpaceClaim.

product_instance.BACKEND_SPACECLAIM_HIDDEN_ENVVAR_KEY = 'SPACECLAIM_MODE'#

SpaceClaim hidden backend’s environment variable key.

To be used only with Ansys SpaceClaim.

product_instance.BACKEND_SPACECLAIM_HIDDEN_ENVVAR_VALUE = '2'#

SpaceClaim hidden backend’s environment variable value.

To be used only with Ansys SpaceClaim.

product_instance.BACKEND_DISCOVERY_HIDDEN = '--hidden'#

The argument to hide Discovery’s UI on the backend.

To be used only with Ansys Discovery.

product_instance.BACKEND_SPLASH_OFF = '/Splash=False'#

The argument to specify the backend’s add-in manifest file’s path.

To be used only with Ansys Discovery and Ansys SpaceClaim.