Actions#

The FrontendGeneric class provides a generic UI for controlling the toolkit. A backend must be running previously.

class ansys.aedt.toolkits.common.ui.actions_generic.FrontendGeneric[source]#

This class provides a generic frontend for controlling the toolkit.

backend_busy()[source]#

Check if the backend is currently busy.

Returns:
bool

True if the backend is busy, False otherwise.

check_connection()[source]#

Check the backend connection.

Returns:
bool

True when successful, False when failed.

closeEvent(event)[source]#

Handle the close event of the application window.

find_process_ids(version, non_graphical)[source]#

Find AEDT sessions based on the selected version and graphical mode.

Parameters:
versionstr

AEDT version.

non_graphicalbool

Flag indicating graphical or non-graphical mode.

Returns:
list or False

A list of found AEDT sessions if successful, False otherwise.

get_aedt_data()[source]#

Get a list of AEDT projects.

Returns:
list

A list of AEDT project names. Returns [“No Project”] if no projects are available.

get_aedt_model(project_selected, design_selected, air_objects=True, encode=True, obj_list=None, export_path=None, export_as_single_objects=True)[source]#

Get AEDT model.

Parameters:
project_selectedstr

Project name.

design_selectedstr

Design name.

air_objectsbool, optional

Define if air and vacuum objects will be exported.

encodebool, optional

Whether to encode the file. The default is True.

obj_listlist, optional

List of objects to export. The default is None, in which case every model object except 3D, vacuum, and air objects are exported.

export_pathstr, optional

Full path of the exported OBJ file. The default is None, in which case the file is exported in the working directory.

export_as_single_objectsbool, optional

Whether to export the model as a single object. The default is True. If False, the model is exported as a list of objects for each object.

Returns:
bool

True when successful, False when failed.

static get_project_name(project_path)[source]#

Get project name from project path.

Returns:
str

Project name

get_properties()[source]#

Get properties from the backend.

Returns:
dict or False

A dictionary of properties if successful, False otherwise.

installed_versions()[source]#

Get the installed versions of AEDT.

Returns:
list or False

A list of installed AEDT versions if successful, False otherwise.

launch_aedt(selected_version, selected_process, non_graphical=False)[source]#

Launch AEDT.

Parameters:
selected_versionstr

The selected AEDT version.

selected_processstr

The selected AEDT process.

non_graphicalbool, optional

Flag indicating whether to run AEDT in non-graphical mode. The default is False.

log_and_update_progress(msg, log_level: str = 'debug', progress: int | None = None)[source]#

Log a message and update the progress bar.

This method logs the given message at the specified log level, and updates the progress bar to the given progress percentage if provided.

Parameters:
msgstr

The log message.

log_levelstr, optional

The log level (debug, info, warning, error, critical). The default is “debug”.

progressint, optional

The progress percentage. If provided, it updates the progress bar.

on_cancel_clicked()[source]#

Handle cancel button click.

open_project(selected_project)[source]#

Open an AEDT project.

Parameters:
selected_projectstr

The path to the selected AEDT project.

static poll_url(url: str, timeout: int = 10)[source]#

Perform GET requests on URL.

Continuously perform GET requests to the specified URL until a valid response is received.

Parameters:
urlstr

URL to poll.

timeoutint, optional

Time out in seconds. The default is 10 seconds.

Returns:
tuple

A 2-tuple containing a string and a boolean. The boolean states if the GET requests succeeded. The string represents the response or exception content.

release_and_close()[source]#

Release and close the AEDT desktop.

release_only()[source]#

Release the AEDT desktop without closing projects.

save_project()[source]#

Save the current AEDT project.

Opens a file dialog to select a location to save the AEDT project. The project is saved with a ‘.aedt’ extension.

Note:

This method relies on backend communication to save the project.

Returns:
None
set_properties(data)[source]#

Set properties in the backend.

Parameters:
datadict

Dictionary of properties to set.

update_design_names(active_project=None)[source]#

Update design names based on the active project.

Parameters:
active_projectstr, optional

The active AEDT project. If not provided, the current active project will be used.

Returns:
list

A list of design names.

wait_thread(timeout: int = 10)[source]#

Wait thread until backend is idle.

Parameters:
timeoutint, optional

Time out in seconds. The default is 10 seconds.

Returns:
bool

True when the backend is idle, False otherwise.

You can modify the default properties with the following script:

# Import API
from ansys.aedt.toolkits.common.ui.models import general_settings

general_settings.high_resolution = False