Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Fix delete port #5713

Merged
merged 12 commits into from
Feb 7, 2025
Merged
11 changes: 9 additions & 2 deletions src/ansys/aedt/core/hfss3dlayout.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,13 +689,15 @@
return False

@pyaedt_function_handler(portname="name")
def delete_port(self, name):
def delete_port(self, name, remove_geometry=True):
"""Delete a port.

Parameters
----------
name : str
Name of the port.
remove_geometry : bool, optional
Whether to remove geometry. The default is ``True``.

Returns
-------
Expand All @@ -705,8 +707,13 @@
References
----------
>>> oModule.Delete
>>> oModule.DeleteExcitations
"""
self.oexcitation.Delete(name)
if remove_geometry:
self.oexcitation.Delete(name)

Check warning on line 713 in src/ansys/aedt/core/hfss3dlayout.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/hfss3dlayout.py#L712-L713

Added lines #L712 - L713 were not covered by tests
else:
self.oexcitation.DeleteExcitation(name)

Check warning on line 715 in src/ansys/aedt/core/hfss3dlayout.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/hfss3dlayout.py#L715

Added line #L715 was not covered by tests

for bound in self.boundaries:
if bound.name == name:
self.boundaries.remove(bound)
Expand Down
6 changes: 6 additions & 0 deletions tests/system/general/test_41_3dlayout_modeler.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,12 @@ def test_14a_create_coaxial_port(self):
port = self.aedtapp.create_coax_port("port_via", 0.5, "Top", "Lower")
assert port.name == "Port2"
assert port.props["Radial Extent Factor"] == "0.5"
self.aedtapp.delete_port(name=port.name, remove_geometry=False)
assert len(self.aedtapp.port_list) == 0
self.aedtapp.odesign.Undo()
self.aedtapp.delete_port(name=port.name)
assert len(self.aedtapp.port_list) == 0
self.aedtapp.odesign.Undo()

def test_14_create_setup(self):
setup_name = "RFBoardSetup"
Expand Down