Skip to content

Commit ec8faac

Browse files
committed
Close desktop function added.
1 parent 979f6c2 commit ec8faac

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

src/ansys/aedt/core/filtersolutions.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ def __init__(self, version=None):
5959
self.transmission_zeros_bandwidth = TransmissionZeros(TableFormat.BANDWIDTH)
6060
self.export_to_aedt = ExportToAedt()
6161

62+
def close_desktop(self):
63+
"""Closes the desktop."""
64+
status = ansys.aedt.core.filtersolutions_core._dll_interface()._dll.closeProject()
65+
ansys.aedt.core.filtersolutions_core._dll_interface().raise_error(status)
66+
6267

6368
class LumpedDesign(FilterDesignBase):
6469
"""Provides the `FilterSolutions` application interface for lumped filter designs.

src/ansys/aedt/core/filtersolutions_core/dll_interface.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,3 +207,8 @@ def raise_error(self, error_status):
207207
if error_status != 0:
208208
error_message = self.get_string(self._dll.getErrorMessage, 4096)
209209
raise RuntimeError(error_message)
210+
211+
def close_dektop(self):
212+
"""Close the desktop."""
213+
status = self._dll.closeProject()
214+
self.raise_error(status)

tests/system/solvers/test_45_FilterSolutions/test_raise_error.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,8 @@ def test_raise_error(self, lumped_design):
3636
with pytest.raises(RuntimeError) as info:
3737
lumped_design.transmission_zeros_ratio.row(0)
3838
assert info.value.args[0] == test_transmission_zeros.TestClass.no_transmission_zero_msg
39+
40+
@pytest.mark.skipif(config["desktopVersion"] < "2025.2", reason="Skipped on versions earlier than 2025.2")
41+
def test_close_desktop(self, lumped_design):
42+
lumped_design.export_to_aedt.export_design()
43+
lumped_design.close_desktop()

0 commit comments

Comments
 (0)