Skip to content

Commit

Permalink
FIX: bug in create pin group, replace logger.error with raise Value e… (
Browse files Browse the repository at this point in the history
#967)

* FIX: bug in create pin group, replace logger.error with raise Value error

* Update src/pyedb/configuration/cfg_pin_groups.py

Co-authored-by: Sébastien Morais <[email protected]>

* Update src/pyedb/configuration/cfg_pin_groups.py

Co-authored-by: Sébastien Morais <[email protected]>

* Update src/pyedb/dotnet/edb_core/siwave.py

Co-authored-by: Sébastien Morais <[email protected]>

---------

Co-authored-by: ring630 <@gmail.com>
Co-authored-by: Sébastien Morais <[email protected]>
  • Loading branch information
hui-zhou-a and SMoraisAnsys authored Jan 13, 2025
1 parent fc0c8fa commit 733701b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
15 changes: 7 additions & 8 deletions src/pyedb/configuration/cfg_pin_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,16 @@ def __init__(self, pedb, **kwargs):
def create(self):
"""Apply pin group on layout."""
if self.pins:
self._pedb.siwave.create_pin_group(self.reference_designator, list(self.pins), self.name)
pins = self.pins if isinstance(self.pins, list) else [self.pins]
self._pedb.siwave.create_pin_group(self.reference_designator, pins, self.name)
elif self.net:
if self.reference_designator in self._pedb.components.instances:
comp = self._pedb.components.instances[self.reference_designator]
else:
raise Exception(f"Component not found for creating pin group {self.name}.")
pins = [p for p, obj in comp.pins.items() if obj.net_name in self.net]
nets = self.net if isinstance(self.net, list) else [self.net]
comp = self._pedb.components.instances[self.reference_designator]
pins = [p for p, obj in comp.pins.items() if obj.net_name in nets]
if not self._pedb.siwave.create_pin_group(self.reference_designator, pins, self.name):
self._pedb.logger.error(f"Failed to create pin group {self.name}")
raise RuntimeError(f"Failed to create pin group {self.name}")
else:
self._pedb.logger.error(f"No net and pins defined for defining pin group {self.name}")
raise RuntimeError(f"No net and pins defined for defining pin group {self.name}")

def export_properties(self):
if self.pins:
Expand Down
3 changes: 1 addition & 2 deletions src/pyedb/dotnet/edb_core/siwave.py
Original file line number Diff line number Diff line change
Expand Up @@ -1242,8 +1242,7 @@ def create_pin_group(self, reference_designator, pin_numbers, group_name=None):
)

if edb_pingroup.IsNull(): # pragma: no cover
self._logger.error(f"Failed to create pin group {group_name}.")
return False
raise RuntimeError(f"Failed to create pin group {group_name}.")
else:
names = [i for i in pins if i.GetNet().GetName()]
edb_pingroup.SetNet(names[0].GetNet())
Expand Down

0 comments on commit 733701b

Please sign in to comment.