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, interval: float = 0.5)[source]#

Poll a URL repeatedly until a successful response or a timeout is reached.

This function sends repeated GET requests to the given URL at a fixed interval, stopping when a success response is received or when the specified timeout is exceeded.

Parameters:
urlstr

The URL to poll.

timeoutint, optional

Maximum total time (in seconds) to continue polling before giving up. Default is 10.

intervalfloat, optional

Time (in seconds) to wait between each request attempt. Default is 0.5.

Returns:
tuple[bool, str | dict]

A 2-tuple containing a boolean and a dict or string. The first element is a boolean stating if the GET requests succeeded. The second element is either the response content (parsed as JSON if successful) or a string describing the failure reason.

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