Antenna toolkit example#

This example demonstrates how to use the ToolkitBackend class. It initiates AEDT through PyAEDT, sets up an empty HFSS design, and proceeds to create the antenna.

Perform required imports#

[1]:
import sys
import tempfile
[2]:
from ansys.aedt.core import generate_unique_project_name
from ansys.aedt.core.generic.farfield_visualization import FfdSolutionData
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[2], line 2
      1 from ansys.aedt.core import generate_unique_project_name
----> 2 from ansys.aedt.core.generic.farfield_visualization import FfdSolutionData

ModuleNotFoundError: No module named 'ansys.aedt.core.generic.farfield_visualization'
[3]:
from ansys.aedt.toolkits.antenna.backend.api import ToolkitBackend
from ansys.aedt.toolkits.antenna.backend.models import properties

Set AEDT version#

Set AEDT version.

[4]:
aedt_version = "2024.2"

Set non-graphical mode#

Set non-graphical mode.

[5]:
non_graphical = True

Create temporary directory#

[6]:
temp_dir = tempfile.TemporaryDirectory(suffix="_ansys")
project_name = generate_unique_project_name(root_name=temp_dir.name, project_name="antenna_toolkit")

Set default properties#

[7]:
properties.aedt_version = aedt_version
properties.non_graphical = non_graphical
properties.active_project = project_name

Initialize toolkit#

Initialize the toolkit.

[8]:
toolkit_api = ToolkitBackend()

Get available_antennas#

[9]:
print(toolkit_api.available_antennas)
['BowTieNormal', 'BowTieRounded', 'BowTieSlot', 'Archimedean', 'Log', 'Sinuous', 'AxialMode', 'Conical', 'Corrugated', 'EPlane', 'Elliptical', 'HPlane', 'Pyramidal', 'PyramidalRidged', 'QuadRidged', 'RectangularPatchEdge', 'RectangularPatchInset', 'RectangularPatchProbe']

Get default properties#

[10]:
backend_properties = toolkit_api.get_properties()
frequency = backend_properties["antenna"]["synthesis"]["frequency"]
frequency_units = backend_properties["antenna"]["synthesis"]["frequency_unit"]
length_unit = backend_properties["antenna"]["synthesis"]["length_unit"]

Modify default length units#

[11]:
properties.antenna.synthesis.length_unit = "cm"

Create antenna object only for synthesis#

Create antenna object.

[12]:
antenna_parameters_1 = toolkit_api.get_antenna("RectangularPatchProbe", synth_only=True)
INFO - AEDT is released.
[13]:
print(
    "Patch X length: {}{} at {}{}".format(
        str(antenna_parameters_1["patch_x"]),
        length_unit,
        frequency,
        frequency_units,
    )
)
Patch X length: 0.912871meter at 10.0GHz

Change synthesis frequency#

Modify resonance frequency and modify parameters with the set_properties() method.

[14]:
new_frequency1 = 12.0
new_properties = {"frequency": new_frequency1}
toolkit_api.set_properties(new_properties)
INFO - Updating internal properties.
DEBUG - Updating 'frequency' with value 12.0
DEBUG - Properties were updated successfully.
[14]:
(True, 'Properties were updated successfully.')
[15]:
antenna_parameters_2 = toolkit_api.get_antenna("RectangularPatchProbe", synth_only=True)
INFO - AEDT is released.
[16]:
print(
    "Patch X length: {}{} at {}{}".format(
        str(antenna_parameters_2["patch_x"]),
        length_unit,
        new_frequency1,
        frequency_units,
    )
)
Patch X length: 0.760726meter at 12.0GHz

Change synthesis frequency#

Modify resonance frequency with properties directly.

[17]:
new_frequency2 = 15.0
properties.antenna.synthesis.frequency = new_frequency2
[18]:
antenna_parameters_3 = toolkit_api.get_antenna("RectangularPatchProbe", synth_only=True)
INFO - AEDT is released.
[19]:
print(
    "Patch X length: {}{} at {}{}".format(
        str(antenna_parameters_3["patch_x"]),
        length_unit,
        new_frequency2,
        frequency_units,
    )
)
Patch X length: 0.608581meter at 15.0GHz

Initialize AEDT#

Launch a new AEDT session in a thread.

[20]:
thread_msg = toolkit_api.launch_thread(toolkit_api.launch_aedt)
DEBUG - Starting thread: Toolkit_Thread
DEBUG - Toolkit is not connected to AEDT.
DEBUG - Launching AEDT.
PyAEDT INFO: Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
PyAEDT INFO: PyAEDT version 0.11.2.
PyAEDT INFO: Initializing new Desktop session.

Wait for the toolkit thread to be idle#

Wait for the toolkit thread to be idle and ready to accept a new task.

[21]:
idle = toolkit_api.wait_to_be_idle()
if not idle:
    print("AEDT not initialized.")
    sys.exit()
DEBUG - Toolkit is busy and processing a task.
DEBUG - Toolkit is busy and processing a task.
DEBUG - Toolkit is busy and processing a task.
DEBUG - Toolkit is busy and processing a task.
DEBUG - Toolkit is busy and processing a task.
DEBUG - Toolkit is idle and ready to accept a new task.

Connect to HFSS design#

Create an HFSS design.

[22]:
toolkit_api.connect_design("HFSS")
DEBUG - Toolkit is not connected to AEDT.
DEBUG - Connecting AEDT.
PyAEDT INFO: Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
PyAEDT INFO: PyAEDT version 0.11.2.
PyAEDT INFO: Initializing new Desktop session.
PyAEDT WARNING: Argument `specified_version` is deprecated for method `__init__`; use `version` instead.
PyAEDT WARNING: Argument `new_desktop_session` is deprecated for method `__init__`; use `new_desktop` instead.
PyAEDT INFO: Log on console is enabled.
PyAEDT INFO: Log on file C:\Users\ansys\AppData\Local\Temp\pyaedt_ansys_1e1f6c71-af64-4eea-9898-e2236527b89a.log is enabled.
PyAEDT INFO: Log on AEDT is disabled.
PyAEDT INFO: Debug logger is disabled. PyAEDT methods will not be logged.
PyAEDT INFO: Launching PyAEDT with gRPC plugin.
PyAEDT INFO: Connecting to AEDT session on gRPC port 64456
PyAEDT INFO: AEDT installation Path C:\Program Files\AnsysEM\v242\Win64
DEBUG - Toolkit is connected to AEDT.
PyAEDT WARNING: Argument `designname` is deprecated for method `__init__`; use `design` instead.
PyAEDT WARNING: Argument `projectname` is deprecated for method `__init__`; use `project` instead.
PyAEDT WARNING: Argument `specified_version` is deprecated for method `__init__`; use `version` instead.
PyAEDT WARNING: Argument `new_desktop_session` is deprecated for method `__init__`; use `new_desktop` instead.
PyAEDT INFO: Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
PyAEDT INFO: PyAEDT version 0.11.2.
PyAEDT INFO: Returning found Desktop session with PID 7028!
PyAEDT INFO: Project antenna_toolkit has been created.
PyAEDT INFO: Added design 'HFSS_71H55M' of type HFSS.
PyAEDT INFO: Aedt Objects correctly read
PyAEDT INFO: Project antenna_toolkit Saved correctly
DEBUG - Project name: antenna_toolkit
INFO - Updating internal properties.
DEBUG - Updating 'project_list' with value ['C:/Users/ansys/AppData/Local/Temp/tmp_4qsid0d_ansys/pyaedt_prj_IA2/antenna_toolkit.aedt']
DEBUG - Updating 'active_design' with value HFSS_71H55M
DEBUG - Updating 'active_project' with value C:/Users/ansys/AppData/Local/Temp/tmp_4qsid0d_ansys/pyaedt_prj_IA2/antenna_toolkit.aedt
DEBUG - Updating 'design_list' with value {'antenna_toolkit': ['HFSS_71H55M']}
DEBUG - Properties were updated successfully.
INFO - Toolkit is connected to AEDT design.
[22]:
True

Create setup when antenna is created#

Set create_setup property.

[23]:
properties.antenna.setup.create_setup = True
properties.antenna.synthesis.outer_boundary = "Radiation"

Create antenna in HFSS#

Create antenna and set up in HFSS.

[24]:
antenna_parameter = toolkit_api.get_antenna("RectangularPatchProbe")
PyAEDT INFO: Modeler class has been initialized! Elapsed time: 0m 3sec
PyAEDT INFO: Materials class has been initialized! Elapsed time: 0m 0sec
PyAEDT INFO: Open Region correctly created.
PyAEDT INFO: Project antenna_toolkit Saved correctly
PyAEDT WARNING: Argument `cs_plane` is deprecated for method `create_circle`; use `orientation` instead.
PyAEDT WARNING: Argument `cs_plane` is deprecated for method `create_circle`; use `orientation` instead.
PyAEDT INFO: Boundary Perfect E PerfE_N9SQZ5 has been correctly created.
PyAEDT INFO: Boundary Perfect E PerfE_6HLLNG has been correctly created.
PyAEDT INFO: Boundary Perfect E PerfE_L21WCO has been correctly created.
PyAEDT INFO: Boundary AutoIdentify port_Patch_5HSF7G_1 has been correctly created.
PyAEDT INFO: Project antenna_toolkit Saved correctly
PyAEDT INFO: Desktop has been released.
INFO - AEDT is released.

Try. to create antenna#

The AEDT Antenna Toolkit API does not allow the creation of more than one antenna. However, you can use the antenna model’s API to create more than one antenna.

[25]:
new_antenna = toolkit_api.get_antenna("BowTie")
DEBUG - Antenna is already created.
[26]:
print(new_antenna)
False

Set properties#

Move antenna X position

[27]:
toolkit_api.update_hfss_parameters("pos_x", "20")
DEBUG - Toolkit is not connected to AEDT.
DEBUG - Connecting AEDT.
PyAEDT INFO: Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
PyAEDT INFO: PyAEDT version 0.11.2.
PyAEDT INFO: Initializing new Desktop session.
PyAEDT WARNING: Argument `specified_version` is deprecated for method `__init__`; use `version` instead.
PyAEDT WARNING: Argument `new_desktop_session` is deprecated for method `__init__`; use `new_desktop` instead.
PyAEDT INFO: Log on console is enabled.
PyAEDT INFO: Log on file C:\Users\ansys\AppData\Local\Temp\pyaedt_ansys_1e1f6c71-af64-4eea-9898-e2236527b89a.log is enabled.
PyAEDT INFO: Log on AEDT is disabled.
PyAEDT INFO: Debug logger is disabled. PyAEDT methods will not be logged.
PyAEDT INFO: Launching PyAEDT with gRPC plugin.
PyAEDT INFO: Connecting to AEDT session on gRPC port 64456
PyAEDT INFO: AEDT installation Path C:\Program Files\AnsysEM\v242\Win64
DEBUG - Toolkit is connected to AEDT.
PyAEDT INFO: Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
PyAEDT INFO: PyAEDT version 0.11.2.
PyAEDT INFO: Returning found Desktop session with PID 7028!
PyAEDT INFO: Project antenna_toolkit set to active.
PyAEDT INFO: Aedt Objects correctly read
INFO - Toolkit is connected to AEDT design.
PyAEDT INFO: Desktop has been released.
INFO - AEDT is released.
[27]:
True

Fit all#

[28]:
toolkit_api.connect_design()
DEBUG - Toolkit is not connected to AEDT.
DEBUG - Connecting AEDT.
PyAEDT INFO: Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
PyAEDT INFO: PyAEDT version 0.11.2.
PyAEDT INFO: Initializing new Desktop session.
PyAEDT WARNING: Argument `specified_version` is deprecated for method `__init__`; use `version` instead.
PyAEDT WARNING: Argument `new_desktop_session` is deprecated for method `__init__`; use `new_desktop` instead.
PyAEDT INFO: Log on console is enabled.
PyAEDT INFO: Log on file C:\Users\ansys\AppData\Local\Temp\pyaedt_ansys_1e1f6c71-af64-4eea-9898-e2236527b89a.log is enabled.
PyAEDT INFO: Log on AEDT is disabled.
PyAEDT INFO: Debug logger is disabled. PyAEDT methods will not be logged.
PyAEDT INFO: Launching PyAEDT with gRPC plugin.
PyAEDT INFO: Connecting to AEDT session on gRPC port 64456
PyAEDT INFO: AEDT installation Path C:\Program Files\AnsysEM\v242\Win64
DEBUG - Toolkit is connected to AEDT.
PyAEDT INFO: Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
PyAEDT INFO: PyAEDT version 0.11.2.
PyAEDT INFO: Returning found Desktop session with PID 7028!
PyAEDT INFO: Project antenna_toolkit set to active.
PyAEDT INFO: Aedt Objects correctly read
INFO - Toolkit is connected to AEDT design.
[28]:
True
[29]:
toolkit_api.aedtapp.modeler.fit_all()
PyAEDT INFO: Modeler class has been initialized! Elapsed time: 0m 0sec
[30]:
toolkit_api.release_aedt(False, False)
PyAEDT INFO: Desktop has been released.
INFO - AEDT is released.
[30]:
True

Set properties#

Move antenna X position to origin

[31]:
toolkit_api.update_hfss_parameters("pos_x", "0")
DEBUG - Toolkit is not connected to AEDT.
DEBUG - Connecting AEDT.
PyAEDT INFO: Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
PyAEDT INFO: PyAEDT version 0.11.2.
PyAEDT INFO: Initializing new Desktop session.
PyAEDT WARNING: Argument `specified_version` is deprecated for method `__init__`; use `version` instead.
PyAEDT WARNING: Argument `new_desktop_session` is deprecated for method `__init__`; use `new_desktop` instead.
PyAEDT INFO: Log on console is enabled.
PyAEDT INFO: Log on file C:\Users\ansys\AppData\Local\Temp\pyaedt_ansys_1e1f6c71-af64-4eea-9898-e2236527b89a.log is enabled.
PyAEDT INFO: Log on AEDT is disabled.
PyAEDT INFO: Debug logger is disabled. PyAEDT methods will not be logged.
PyAEDT INFO: Launching PyAEDT with gRPC plugin.
PyAEDT INFO: Connecting to AEDT session on gRPC port 64456
PyAEDT INFO: AEDT installation Path C:\Program Files\AnsysEM\v242\Win64
DEBUG - Toolkit is connected to AEDT.
PyAEDT INFO: Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
PyAEDT INFO: PyAEDT version 0.11.2.
PyAEDT INFO: Returning found Desktop session with PID 7028!
PyAEDT INFO: Project antenna_toolkit set to active.
PyAEDT INFO: Aedt Objects correctly read
INFO - Toolkit is connected to AEDT design.
PyAEDT INFO: Desktop has been released.
INFO - AEDT is released.
[31]:
True

Analyze design in batch mode#

[32]:
toolkit_api.analyze()
DEBUG - Toolkit is not connected to AEDT.
DEBUG - Connecting AEDT.
PyAEDT INFO: Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
PyAEDT INFO: PyAEDT version 0.11.2.
PyAEDT INFO: Initializing new Desktop session.
PyAEDT WARNING: Argument `specified_version` is deprecated for method `__init__`; use `version` instead.
PyAEDT WARNING: Argument `new_desktop_session` is deprecated for method `__init__`; use `new_desktop` instead.
PyAEDT INFO: Log on console is enabled.
PyAEDT INFO: Log on file C:\Users\ansys\AppData\Local\Temp\pyaedt_ansys_1e1f6c71-af64-4eea-9898-e2236527b89a.log is enabled.
PyAEDT INFO: Log on AEDT is disabled.
PyAEDT INFO: Debug logger is disabled. PyAEDT methods will not be logged.
PyAEDT INFO: Launching PyAEDT with gRPC plugin.
PyAEDT INFO: Connecting to AEDT session on gRPC port 64456
PyAEDT INFO: AEDT installation Path C:\Program Files\AnsysEM\v242\Win64
DEBUG - Toolkit is connected to AEDT.
PyAEDT INFO: Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
PyAEDT INFO: PyAEDT version 0.11.2.
PyAEDT INFO: Returning found Desktop session with PID 7028!
PyAEDT INFO: Project antenna_toolkit set to active.
PyAEDT INFO: Aedt Objects correctly read
INFO - Toolkit is connected to AEDT design.
PyAEDT INFO: Project antenna_toolkit Saved correctly
PyAEDT WARNING: Argument `num_cores` is deprecated for method `analyze`; use `cores` instead.
PyAEDT INFO: Key Desktop/ActiveDSOConfigurations/HFSS correctly changed.
PyAEDT INFO: Solving all design setups.
PyAEDT INFO: Key Desktop/ActiveDSOConfigurations/HFSS correctly changed.
PyAEDT INFO: Design setup None solved correctly in 0.0h 1.0m 5.0s
PyAEDT INFO: Desktop has been released.
INFO - AEDT is released.
[32]:
True

Get scattering results#

[33]:
scattering_data = toolkit_api.scattering_results()
DEBUG - Toolkit is not connected to AEDT.
DEBUG - Connecting AEDT.
PyAEDT INFO: Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
PyAEDT INFO: PyAEDT version 0.11.2.
PyAEDT INFO: Initializing new Desktop session.
PyAEDT WARNING: Argument `specified_version` is deprecated for method `__init__`; use `version` instead.
PyAEDT WARNING: Argument `new_desktop_session` is deprecated for method `__init__`; use `new_desktop` instead.
PyAEDT INFO: Log on console is enabled.
PyAEDT INFO: Log on file C:\Users\ansys\AppData\Local\Temp\pyaedt_ansys_1e1f6c71-af64-4eea-9898-e2236527b89a.log is enabled.
PyAEDT INFO: Log on AEDT is disabled.
PyAEDT INFO: Debug logger is disabled. PyAEDT methods will not be logged.
PyAEDT INFO: Launching PyAEDT with gRPC plugin.
PyAEDT INFO: Connecting to AEDT session on gRPC port 64456
PyAEDT INFO: AEDT installation Path C:\Program Files\AnsysEM\v242\Win64
DEBUG - Toolkit is connected to AEDT.
PyAEDT INFO: Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
PyAEDT INFO: PyAEDT version 0.11.2.
PyAEDT INFO: Returning found Desktop session with PID 7028!
PyAEDT INFO: Project antenna_toolkit set to active.
PyAEDT INFO: Aedt Objects correctly read
INFO - Toolkit is connected to AEDT design.
PyAEDT INFO: Parsing C:/Users/ansys/AppData/Local/Temp/tmp_4qsid0d_ansys/pyaedt_prj_IA2/antenna_toolkit.aedt.
PyAEDT INFO: File C:/Users/ansys/AppData/Local/Temp/tmp_4qsid0d_ansys/pyaedt_prj_IA2/antenna_toolkit.aedt correctly loaded. Elapsed time: 0m 0sec
PyAEDT INFO: aedt file load time 0.03258109092712402
PyAEDT INFO: Modeler class has been initialized! Elapsed time: 0m 0sec
PyAEDT INFO: PostProcessor class has been initialized! Elapsed time: 0m 0sec
PyAEDT INFO: Post class has been initialized! Elapsed time: 0m 0sec
PyAEDT INFO: Solution Data Correctly Loaded.
PyAEDT INFO: Desktop has been released.
INFO - AEDT is released.

Get farfield results#

[34]:
frequency_str = str(properties.antenna.synthesis.frequency) + properties.antenna.synthesis.frequency_unit
farfield_metadata, farfield_frequency = toolkit_api.export_farfield(
    frequencies=frequency_str, sphere="3D", encode=False
)
DEBUG - Toolkit is not connected to AEDT.
DEBUG - Connecting AEDT.
PyAEDT INFO: Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
PyAEDT INFO: PyAEDT version 0.11.2.
PyAEDT INFO: Initializing new Desktop session.
PyAEDT WARNING: Argument `specified_version` is deprecated for method `__init__`; use `version` instead.
PyAEDT WARNING: Argument `new_desktop_session` is deprecated for method `__init__`; use `new_desktop` instead.
PyAEDT INFO: Log on console is enabled.
PyAEDT INFO: Log on file C:\Users\ansys\AppData\Local\Temp\pyaedt_ansys_1e1f6c71-af64-4eea-9898-e2236527b89a.log is enabled.
PyAEDT INFO: Log on AEDT is disabled.
PyAEDT INFO: Debug logger is disabled. PyAEDT methods will not be logged.
PyAEDT INFO: Launching PyAEDT with gRPC plugin.
PyAEDT INFO: Connecting to AEDT session on gRPC port 64456
PyAEDT INFO: AEDT installation Path C:\Program Files\AnsysEM\v242\Win64
DEBUG - Toolkit is connected to AEDT.
PyAEDT INFO: Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
PyAEDT INFO: PyAEDT version 0.11.2.
PyAEDT INFO: Returning found Desktop session with PID 7028!
PyAEDT INFO: Project antenna_toolkit set to active.
PyAEDT INFO: Aedt Objects correctly read
INFO - Toolkit is connected to AEDT design.
PyAEDT INFO: Project antenna_toolkit Saved correctly
PyAEDT INFO: Parsing C:/Users/ansys/AppData/Local/Temp/tmp_4qsid0d_ansys/pyaedt_prj_IA2/antenna_toolkit.aedt.
PyAEDT INFO: File C:/Users/ansys/AppData/Local/Temp/tmp_4qsid0d_ansys/pyaedt_prj_IA2/antenna_toolkit.aedt correctly loaded. Elapsed time: 0m 0sec
PyAEDT INFO: aedt file load time 0.03238964080810547
PyAEDT INFO: Far field sphere 3D is assigned
PyAEDT INFO: Exporting antenna metadata...
PyAEDT INFO: Modeler class has been initialized! Elapsed time: 0m 0sec
PyAEDT INFO: PostProcessor class has been initialized! Elapsed time: 0m 0sec
PyAEDT INFO: Post class has been initialized! Elapsed time: 0m 0sec
PyAEDT INFO: Antenna metadata exported.
PyAEDT INFO: Exporting geometry...
PyAEDT INFO: Exporting embedded element patterns.... Done: 1.974158763885498 seconds
PyAEDT INFO: Desktop has been released.
INFO - AEDT is released.

Get antenna model#

[35]:
files = toolkit_api.export_aedt_model(encode=False)
DEBUG - Toolkit is not connected to AEDT.
DEBUG - Connecting AEDT.
PyAEDT INFO: Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
PyAEDT INFO: PyAEDT version 0.11.2.
PyAEDT INFO: Initializing new Desktop session.
PyAEDT WARNING: Argument `specified_version` is deprecated for method `__init__`; use `version` instead.
PyAEDT WARNING: Argument `new_desktop_session` is deprecated for method `__init__`; use `new_desktop` instead.
PyAEDT INFO: Log on console is enabled.
PyAEDT INFO: Log on file C:\Users\ansys\AppData\Local\Temp\pyaedt_ansys_1e1f6c71-af64-4eea-9898-e2236527b89a.log is enabled.
PyAEDT INFO: Log on AEDT is disabled.
PyAEDT INFO: Debug logger is disabled. PyAEDT methods will not be logged.
PyAEDT INFO: Launching PyAEDT with gRPC plugin.
PyAEDT INFO: Connecting to AEDT session on gRPC port 64456
PyAEDT INFO: AEDT installation Path C:\Program Files\AnsysEM\v242\Win64
DEBUG - Toolkit is connected to AEDT.
PyAEDT INFO: Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
PyAEDT INFO: PyAEDT version 0.11.2.
PyAEDT INFO: Returning found Desktop session with PID 7028!
PyAEDT INFO: Project antenna_toolkit set to active.
PyAEDT INFO: Aedt Objects correctly read
INFO - Toolkit is connected to AEDT design.
PyAEDT INFO: Project antenna_toolkit Saved correctly
PyAEDT INFO: Parsing C:/Users/ansys/AppData/Local/Temp/tmp_4qsid0d_ansys/pyaedt_prj_IA2/antenna_toolkit.aedt.
PyAEDT INFO: File C:/Users/ansys/AppData/Local/Temp/tmp_4qsid0d_ansys/pyaedt_prj_IA2/antenna_toolkit.aedt correctly loaded. Elapsed time: 0m 0sec
PyAEDT INFO: aedt file load time 0.04695415496826172
PyAEDT INFO: Modeler class has been initialized! Elapsed time: 0m 0sec
PyAEDT INFO: PostProcessor class has been initialized! Elapsed time: 0m 0sec
PyAEDT INFO: Post class has been initialized! Elapsed time: 0m 0sec
PyAEDT INFO: Desktop has been released.
INFO - AEDT is released.

Release AEDT#

Release AEDT.

[36]:
toolkit_api.release_aedt(True, True)
DEBUG - Toolkit is not connected to AEDT.
DEBUG - Connecting AEDT.
PyAEDT INFO: Python version 3.10.11 (tags/v3.10.11:7d4cc5a, Apr  5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)]
PyAEDT INFO: PyAEDT version 0.11.2.
PyAEDT INFO: Initializing new Desktop session.
PyAEDT WARNING: Argument `specified_version` is deprecated for method `__init__`; use `version` instead.
PyAEDT WARNING: Argument `new_desktop_session` is deprecated for method `__init__`; use `new_desktop` instead.
PyAEDT INFO: Log on console is enabled.
PyAEDT INFO: Log on file C:\Users\ansys\AppData\Local\Temp\pyaedt_ansys_1e1f6c71-af64-4eea-9898-e2236527b89a.log is enabled.
PyAEDT INFO: Log on AEDT is disabled.
PyAEDT INFO: Debug logger is disabled. PyAEDT methods will not be logged.
PyAEDT INFO: Launching PyAEDT with gRPC plugin.
PyAEDT INFO: Connecting to AEDT session on gRPC port 64456
PyAEDT INFO: AEDT installation Path C:\Program Files\AnsysEM\v242\Win64
DEBUG - Toolkit is connected to AEDT.
PyAEDT INFO: Desktop has been released and closed.
INFO - AEDT is released.
[36]:
True

Plot results#

Plot exported files

[37]:
from ansys.aedt.core.generic.plot import ModelPlotter
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[37], line 1
----> 1 from ansys.aedt.core.generic.plot import ModelPlotter

ModuleNotFoundError: No module named 'ansys.aedt.core.generic.plot'
[38]:
model = ModelPlotter()
for file in files:
    model.add_object(file[0], file[1], file[2])
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[38], line 1
----> 1 model = ModelPlotter()
      2 for file in files:
      3     model.add_object(file[0], file[1], file[2])

NameError: name 'ModelPlotter' is not defined
[39]:
model.plot(show=False)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[39], line 1
----> 1 model.plot(show=False)

NameError: name 'model' is not defined

Load far field#

[40]:
farfield_data = FfdSolutionData(farfield_metadata)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[40], line 1
----> 1 farfield_data = FfdSolutionData(farfield_metadata)

NameError: name 'FfdSolutionData' is not defined

Plot far field#

[41]:
data = farfield_data.plot_3d(show=False)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[41], line 1
----> 1 data = farfield_data.plot_3d(show=False)

NameError: name 'farfield_data' is not defined

Clean temporary directory#

[42]:
temp_dir.cleanup()