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.visualization.advanced.farfield_visualization import FfdSolutionData
[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 = "2025.1"
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.15.3.
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 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.15.3.
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_bde54368-234f-483f-8202-b5a41f9b90d8.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 63623.
PyAEDT INFO: AEDT installation Path C:\Program Files\ANSYS Inc\v251\AnsysEM
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.15.3.
PyAEDT INFO: Returning found Desktop session with PID 5440!
PyAEDT INFO: Project antenna_toolkit has been created.
PyAEDT INFO: Added design 'HFSS_SOB59E' 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/tmpaaj7_alr_ansys/pyaedt_prj_5UD/antenna_toolkit.aedt']
DEBUG - Updating 'active_design' with value HFSS_SOB59E
DEBUG - Updating 'active_project' with value C:/Users/ansys/AppData/Local/Temp/tmpaaj7_alr_ansys/pyaedt_prj_5UD/antenna_toolkit.aedt
DEBUG - Updating 'design_list' with value {'antenna_toolkit': ['HFSS_SOB59E']}
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 0sec
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: Property Command is read-only.
PyAEDT WARNING: Property Command is read-only.
PyAEDT WARNING: Property Command is read-only.
PyAEDT WARNING: Argument `cs_plane` is deprecated for method `create_circle`; use `orientation` instead.
PyAEDT WARNING: Property Command is read-only.
PyAEDT WARNING: Property Command is read-only.
PyAEDT WARNING: Property Command is read-only.
PyAEDT WARNING: Property Command is read-only.
PyAEDT WARNING: Argument `cs_plane` is deprecated for method `create_circle`; use `orientation` instead.
PyAEDT WARNING: Property Command is read-only.
PyAEDT INFO: Parsing design objects. This operation can take time
PyAEDT INFO: Refreshing bodies from Object Info
PyAEDT INFO: Bodies Info Refreshed Elapsed time: 0m 0sec
PyAEDT INFO: 3D Modeler objects parsed. Elapsed time: 0m 0sec
PyAEDT INFO: Boundary Perfect E PerfE_PN9JGU has been created.
PyAEDT INFO: Boundary Perfect E PerfE_7YJE1T has been created.
PyAEDT INFO: Boundary Perfect E PerfE_56DY8A has been created.
PyAEDT INFO: Boundary AutoIdentify port_Patch_KYHV9Q_1 has been created.
PyAEDT INFO: Parsing C:/Users/ansys/AppData/Local/Temp/tmpaaj7_alr_ansys/pyaedt_prj_5UD/antenna_toolkit.aedt.
PyAEDT INFO: File C:/Users/ansys/AppData/Local/Temp/tmpaaj7_alr_ansys/pyaedt_prj_5UD/antenna_toolkit.aedt correctly loaded. Elapsed time: 0m 0sec
PyAEDT INFO: aedt file load time 0.01548910140991211
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.15.3.
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_bde54368-234f-483f-8202-b5a41f9b90d8.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 63623.
PyAEDT INFO: AEDT installation Path C:\Program Files\ANSYS Inc\v251\AnsysEM
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.15.3.
PyAEDT INFO: Returning found Desktop session with PID 5440!
PyAEDT INFO: Project antenna_toolkit set to active.
PyAEDT INFO: Active Design set to HFSS_SOB59E
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.15.3.
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_bde54368-234f-483f-8202-b5a41f9b90d8.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 63623.
PyAEDT INFO: AEDT installation Path C:\Program Files\ANSYS Inc\v251\AnsysEM
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.15.3.
PyAEDT INFO: Returning found Desktop session with PID 5440!
PyAEDT INFO: Project antenna_toolkit set to active.
PyAEDT INFO: Active Design set to HFSS_SOB59E
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.15.3.
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_bde54368-234f-483f-8202-b5a41f9b90d8.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 63623.
PyAEDT INFO: AEDT installation Path C:\Program Files\ANSYS Inc\v251\AnsysEM
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.15.3.
PyAEDT INFO: Returning found Desktop session with PID 5440!
PyAEDT INFO: Project antenna_toolkit set to active.
PyAEDT INFO: Active Design set to HFSS_SOB59E
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.15.3.
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_bde54368-234f-483f-8202-b5a41f9b90d8.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 63623.
PyAEDT INFO: AEDT installation Path C:\Program Files\ANSYS Inc\v251\AnsysEM
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.15.3.
PyAEDT INFO: Returning found Desktop session with PID 5440!
PyAEDT INFO: Project antenna_toolkit set to active.
PyAEDT INFO: Active Design set to HFSS_SOB59E
PyAEDT INFO: Aedt Objects correctly read
INFO - Toolkit is connected to AEDT design.
PyAEDT INFO: Project antenna_toolkit Saved correctly
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 7.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.15.3.
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_bde54368-234f-483f-8202-b5a41f9b90d8.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 63623.
PyAEDT INFO: AEDT installation Path C:\Program Files\ANSYS Inc\v251\AnsysEM
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.15.3.
PyAEDT INFO: Returning found Desktop session with PID 5440!
PyAEDT INFO: Project antenna_toolkit set to active.
PyAEDT INFO: Active Design set to HFSS_SOB59E
PyAEDT INFO: Aedt Objects correctly read
INFO - Toolkit is connected to AEDT design.
PyAEDT INFO: Parsing C:/Users/ansys/AppData/Local/Temp/tmpaaj7_alr_ansys/pyaedt_prj_5UD/antenna_toolkit.aedt.
PyAEDT INFO: File C:/Users/ansys/AppData/Local/Temp/tmpaaj7_alr_ansys/pyaedt_prj_5UD/antenna_toolkit.aedt correctly loaded. Elapsed time: 0m 0sec
PyAEDT INFO: aedt file load time 0.04687380790710449
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.15.3.
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_bde54368-234f-483f-8202-b5a41f9b90d8.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 63623.
PyAEDT INFO: AEDT installation Path C:\Program Files\ANSYS Inc\v251\AnsysEM
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.15.3.
PyAEDT INFO: Returning found Desktop session with PID 5440!
PyAEDT INFO: Project antenna_toolkit set to active.
PyAEDT INFO: Active Design set to HFSS_SOB59E
PyAEDT INFO: Aedt Objects correctly read
INFO - Toolkit is connected to AEDT design.
PyAEDT INFO: Project antenna_toolkit Saved correctly
PyAEDT INFO: Far field sphere 3D is assigned
PyAEDT INFO: Exporting antenna metadata...
PyAEDT INFO: Parsing C:/Users/ansys/AppData/Local/Temp/tmpaaj7_alr_ansys/pyaedt_prj_5UD/antenna_toolkit.aedt.
PyAEDT INFO: File C:/Users/ansys/AppData/Local/Temp/tmpaaj7_alr_ansys/pyaedt_prj_5UD/antenna_toolkit.aedt correctly loaded. Elapsed time: 0m 0sec
PyAEDT INFO: aedt file load time 0.03345346450805664
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: Modeler class has been initialized! Elapsed time: 0m 0sec
PyAEDT INFO: Exporting embedded element patterns.... Done: 2.1186435222625732 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.15.3.
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_bde54368-234f-483f-8202-b5a41f9b90d8.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 63623.
PyAEDT INFO: AEDT installation Path C:\Program Files\ANSYS Inc\v251\AnsysEM
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.15.3.
PyAEDT INFO: Returning found Desktop session with PID 5440!
PyAEDT INFO: Project antenna_toolkit set to active.
PyAEDT INFO: Active Design set to HFSS_SOB59E
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/tmpaaj7_alr_ansys/pyaedt_prj_5UD/antenna_toolkit.aedt.
PyAEDT INFO: File C:/Users/ansys/AppData/Local/Temp/tmpaaj7_alr_ansys/pyaedt_prj_5UD/antenna_toolkit.aedt correctly loaded. Elapsed time: 0m 0sec
PyAEDT INFO: aedt file load time 0.0491790771484375
PyAEDT INFO: PostProcessor class has been initialized! Elapsed time: 0m 0sec
PyAEDT INFO: Post class has been initialized! Elapsed time: 0m 0sec
PyAEDT WARNING: Argument `export_as_single_objects` is deprecated for method `export_model_obj`; use `export_as_multiple_objects` instead.
PyAEDT INFO: Modeler 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.15.3.
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_bde54368-234f-483f-8202-b5a41f9b90d8.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 63623.
PyAEDT INFO: AEDT installation Path C:\Program Files\ANSYS Inc\v251\AnsysEM
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.visualization.plot.pyvista import ModelPlotter
[38]:
model = ModelPlotter()
for file in files:
model.add_object(file[0], file[1], file[2])
[39]:
model.plot(show=False)
[39]:
True
Load far field#
[40]:
farfield_data = FfdSolutionData(farfield_metadata)
Plot far field#
[41]:
data = farfield_data.plot_3d(show=False)
Clean temporary directory#
[42]:
temp_dir.cleanup()