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: get_pins_name_from_net #436

Merged
merged 5 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions src/pyedb/dotnet/edb_core/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -2408,20 +2408,20 @@ def get_pin_position(self, pin):
return [pin_xy.X.ToDouble(), pin_xy.Y.ToDouble()]

@pyedb_function_handler()
def get_pins_name_from_net(self, pin_list, net_name):
def get_pins_name_from_net(self, net_name, pin_list=None):
"""Retrieve pins belonging to a net.

Parameters
----------
pin_list : list
List of pins to check.
pin_list : list of EDBPadstackInstance, optional
List of pins to check. The default is ``None``, in which case all pins are checked
net_name : str
Name of the net.

Returns
-------
list
List of pins belong to the net.
list of str names:
Pins belonging to the net.

Examples
--------
Expand All @@ -2431,11 +2431,16 @@ def get_pins_name_from_net(self, pin_list, net_name):
>>> edbapp.components.get_pins_name_from_net(pin_list, net_name)

"""
pinlist = []
pin_names = []
if not pin_list:
pin_list = []
for i in [*self.components.values()]:
for j in [*i.pins.values()]:
pin_list.append(j)
for pin in pin_list:
if pin.GetNet().GetName() == net_name:
pinlist.append(pin.GetName())
return pinlist
pin_names.append(self.get_aedt_pin_name(pin))
return pin_names

@pyedb_function_handler()
def get_nets_from_pin_list(self, PinList):
Expand Down
4 changes: 2 additions & 2 deletions tests/legacy/system/test_edb_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ def test_components_get_pin_name_and_position(self):
def test_components_get_pins_name_from_net(self):
"""Retrieve pins belonging to a net."""
cmp_pinlist = self.edbapp.components.get_pin_from_component("U6")
assert len(self.edbapp.components.get_pins_name_from_net(cmp_pinlist, "GND")) > 0
assert len(self.edbapp.components.get_pins_name_from_net(cmp_pinlist, "5V")) == 0
assert len(self.edbapp.components.get_pins_name_from_net("GND", cmp_pinlist)) > 0
assert len(self.edbapp.components.get_pins_name_from_net("5V", cmp_pinlist)) == 0

def test_components_delete_single_pin_rlc(self):
"""Delete all RLC components with a single pin."""
Expand Down
Loading