Skip to content

Commit

Permalink
FIX: Fix delete port (#5713)
Browse files Browse the repository at this point in the history
Co-authored-by: Sébastien Morais <[email protected]>
Co-authored-by: Massimo Capodiferro <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
4 people authored Feb 7, 2025
1 parent 632a454 commit 6f36565
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
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 @@ def create_pin_port(self, name, x=0, y=0, rotation=0, top_layer=None, bottom_lay
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 @@ def delete_port(self, name):
References
----------
>>> oModule.Delete
>>> oModule.DeleteExcitations
"""
self.oexcitation.Delete(name)
if remove_geometry:
self.oexcitation.Delete(name)
else:
self.oexcitation.DeleteExcitation(name)

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

0 comments on commit 6f36565

Please sign in to comment.