ansys / pyaedt

AEDT Python Client Package
https://aedt.docs.pyansys.com
MIT License
200 stars 116 forks source link

Bug located in h3d.get_setup #5034

Open ANSYS-KOREA opened 1 month ago

ANSYS-KOREA commented 1 month ago

Before submitting the issue

Description of the bug

When I tried to get Solution Setup data from existed HFSS 3D Layout, I missed "AdaptiveSettings" data.

Steps To Reproduce

  1. Open exist HFSS 3D Layout Project h3d = pyaedt.Hfss3dLayout(project=example_h3d_prj, version=aedt_version)

  2. Get Setup Data setup_list = h3d.get_setup(exist_setup_name)

  3. Check setup_list.props <- No "AdatvieSettings" key

Which Operating System are you using?

Windows

Which Python version are you using?

3.10

Installed packages

annotated-types==0.7.0 ansys-pythonnet==3.1.0rc3 attrs==24.2.0 cffi==1.17.0 clr-loader==0.2.6 defusedxml==0.7.1 fonttools==4.53.1 fpdf2==2.7.9 jsonschema==4.23.0 jsonschema-specifications==2023.12.1 numpy==1.26.4 pandas==2.2.2 pillow==10.4.0 plumbum==1.8.3 psutil==6.0.0 pyaedt==0.9.10 pycparser==2.22 pydantic==2.8.2 pydantic_core==2.20.1 pyedb==0.23.0 python-dateutil==2.9.0.post0 pytomlpp==1.0.13 pytz==2024.1 pywin32==306 referencing==0.35.1 rpds-py==0.20.0 rpyc==6.0.0 Rtree==1.3.0 scikit-rf==1.2.0 scipy==1.14.0 six==1.16.0 toml==0.10.2 typing_extensions==4.12.2 tzdata==2024.1

Samuelopez-ansys commented 1 month ago

Hi @ANSYS-KOREA ,

After investigation, I realized this information is not part of the .aedt file, for that reason PyAEDT is not able to grab it to populate the props dictionary. I discovered that this data is obtained from the EDB file, and AEDT internally is parsing the setup and finally it is shown in the UI.

So the workaround is play with PyEDB to get the data:

from pyaedt import Hfss3dLayout

from pyaedt import Edb import os

aedtapp = Hfss3dLayout(version="2024.2")

aedb_dir = aedtapp.project_file.replace(".aedt", ".aedb")

edbapp = Edb(aedb_dir, cellname=aedtapp.design_name, isreadonly=True, edbversion=aedtapp.desktop_class.aedt_version_id, isaedtowned=True, oproject=aedtapp.oproject, )

setup_props = edbapp.setups["HFSS Setup 1"].adaptive_settings

aedtapp.release_desktop(False, False)

If you need to SET the data, I suggest first to load the PyEDB file, set and save, and then open the EDB file in a HFSS 3DLayout.

For Layout pre/postprocessing I encourage you to use PyEDB: https://github.com/ansys/pyedb

For simulation, you can choose either SIwave or HFSS 3DLayout.

Regards, Samuel