AEDT simple example#
This example shows how to use the AEDTCommon
class to launch a new AEDT session in a thread, create an HFSS design, and create a coaxial.
Perform required imports#
Perform the required imports.
[1]:
import sys
from ansys.aedt.toolkits.common.backend.api import AEDTCommon
Initialize toolkit#
Initialize the toolkit.
[2]:
toolkit = AEDTCommon()
Get toolkit properties#
Get the toolkit properties.
[3]:
properties_from_backend = toolkit.get_properties()
Set properties#
Set non-graphical mode.
[4]:
set_properties = {"non_graphical": True}
flag_set_properties, msg_set_properties = toolkit.set_properties(set_properties)
INFO - Updating internal properties.
Initialize AEDT#
Launch a new AEDT session in a thread.
[5]:
thread_msg = toolkit.launch_thread(toolkit.launch_aedt)
Wait for the toolkit thread to be idle#
Wait for the toolkit thread to be idle and ready to accept a new task.
[6]:
idle = toolkit.wait_to_be_idle()
if not idle:
print("AEDT not initialized.")
sys.exit()
Connect design#
Connect or create a new design.
[7]:
toolkit.connect_design("HFSS")
INFO - Updating internal properties.
INFO - Toolkit is connected to AEDT design.
[7]:
True
Get toolkit properties#
Get the toolkit properties, which contain the project information.
[8]:
new_properties = toolkit.get_properties()
Create a coaxial#
Create a coaxial in the design.
[9]:
coax = toolkit.aedtapp.modeler.create_coaxial([0, 0, 0], 1)
Release AEDT#
Release AEDT.
[10]:
toolkit.release_aedt(False, False)
INFO - AEDT is released.
[10]:
True
Export AEDT model#
Export the OBJ files.
[11]:
files = toolkit.export_aedt_model()
INFO - Toolkit is connected to AEDT design.
INFO - AEDT is released.
Release and close AEDT#
Release and close AEDT.
[12]:
toolkit.release_aedt(True, True)
INFO - AEDT is released.
[12]:
True