ansys / pyaedt

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

Pyaedt HFSS : repeatedly create and delete the same dataset generates error. #4225

Closed Ouam74 closed 7 months ago

Ouam74 commented 8 months ago

Before submitting the issue

Description of the bug

The following Pyaedt HFSS code creates a dataset then delete it and then re-create it a second time and delete it again....

import pyaedt

version = '2023.2'
id = 11336
name = 'HFSSDesign3'

desktop = pyaedt.Desktop(specified_version=version, new_desktop_session=False, aedt_process_id=id)
h = pyaedt.Hfss(designname=name, close_on_exit=False, specified_version=version)

h.create_dataset('test1', [0,1,2,3,4], [0,1,2,3,4], is_project_dataset=False)
h.save_project()
h.odesign.DeleteDataset('test1')
h.save_project()

h.create_dataset('test1', [0,1,2,3,4], [0,1,2,3,4], is_project_dataset=False)
h.save_project()
print(h.dataset_exists('test1', is_project_dataset=False))
h.odesign.DeleteDataset('test1')
h.save_project()

i got following error :

image

Steps To Reproduce

Just open an empty HFSS project, check the PID and replace this variables name accordingly in the code :

id = 11336 name = 'HFSSDesign3'

Which Operating System are you using?

Windows

Which Python version are you using?

3.10

Installed packages

altgraph==0.17.4 ansys-pythonnet==3.1.0rc3 attrs==23.2.0 certifi==2023.11.17 cffi==1.16.0 charset-normalizer==3.3.2 click==8.1.7 click-plugins==1.1.1 cligj==0.7.2 clr-loader==0.2.6 colorama==0.4.6 contourpy==1.2.0 cx-Logging==3.1.0 cycler==0.12.1 defusedxml==0.7.1 et-xmlfile==1.1.0 fiona==1.9.5 fonttools==4.47.2 fpdf2==2.7.7 geopandas==0.14.2 idna==3.6 imageio==2.33.1 jsonschema==4.20.0 jsonschema-specifications==2023.12.1 kiwisolver==1.4.5 lief==0.14.0 matplotlib==3.8.0 networkx==3.2.1 numpy==1.26.0 openpyxl==3.1.2 osmnx==1.8.1 packaging==23.2 pandas==2.1.1 pefile==2023.2.7 pillow==10.2.0 platformdirs==4.1.0 plumbum==1.8.2 pooch==1.8.0 psutil==5.9.7 pyaedt==0.7.11 pycparser==2.21 pyinstaller==6.3.0 pyinstaller-hooks-contrib==2024.0 PyOpenGL==3.1.7 pyparsing==3.1.1 pypiwin32==223 pyproj==3.6.1 pyqtgraph==0.13.3 PySide6==6.6.1 scikit-rf==0.30.0 scipy==1.12.0 scooby==0.9.2 shapely==2.0.2 shiboken6==6.6.1 six==1.16.0 SRTM.py==0.3.7 tzdata==2023.4 urllib3==2.1.0 utm==0.7.0 vtk==9.2.6

Samuelopez-ansys commented 8 months ago

@Ouam74 Did you try to use the PyAEDT command to delete the dataset? If you delete the dataset using AEDT API, PyAEDT will not be updated. If you play with any PyAEDT object, you should not mix PyAEDT and AEDT syntax, you should use AEDT syntax only when it is not implemented in PyAEDT.

ds1 = h.create_dataset('test1', [0,1,2,3,4], [0,1,2,3,4], is_project_dataset=False)

ds1.delete()