Skip to content

Commit

Permalink
FIX: add types create_pingroup_from_pins (#391)
Browse files Browse the repository at this point in the history
* FEATURE: add types create_pingroup_from_pins

* Update components.py

* Update components.py
  • Loading branch information
gkorompi authored Apr 23, 2024
1 parent 85f7233 commit 9c4cebb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/pyedb/dotnet/edb_core/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ def create_port_on_component(
Type of port to create. ``CoaxPort`` generates solder balls.
``CircuitPort`` generates circuit ports on pins belonging to the net list.
do_pingroup : bool
True activate pingroup during port creation (only used with combination of CoaxPort),
True activate pingroup during port creation (only used with combination of CircPort),
False will take the closest reference pin and generate one port per signal pin.
refnet : string or list of string.
list of the reference net.
Expand Down Expand Up @@ -1335,18 +1335,21 @@ def add_rlc_boundary(self, component=None, circuit_type=True):
return True

@pyedb_function_handler()
def _create_pin_group_terminal(self, pingroup, isref=False, term_name=None):
def _create_pin_group_terminal(self, pingroup, isref=False, term_name=None, term_type="circuit"):
"""Creates an EDB pin group terminal from a given EDB pin group.
Parameters
----------
pingroup : Edb pin group.
isref : bool
Specify if this terminal a reference terminal.
term_name : Terminal name (Optional). If not provided default name is Component name, Pin name, Net name.
str.
term_type: Type of terminal, gap, circuit or auto.
str.
Returns
-------
Edb pin group terminal.
Expand All @@ -1360,6 +1363,10 @@ def _create_pin_group_terminal(self, pingroup, isref=False, term_name=None):
pingroup_term = self._edb.cell.terminal.PinGroupTerminal.Create(
self._active_layout, pingroup.GetNet(), term_name, pingroup, isref
)
if term_type == "circuit":
pingroup_term.SetIsCircuitPort(True)
elif term_type == "auto":
pingroup_term.SetIsAutoPort(True)
return pingroup_term

@pyedb_function_handler()
Expand Down
10 changes: 10 additions & 0 deletions tests/legacy/system/test_edb_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,3 +569,13 @@ def test_solder_ball_getter_setter(self):
diam1, diam2 = cmp.solder_ball_diameter
assert round(diam1, 6) == 100e-6
assert round(diam2, 6) == 100e-6

def test_create_pingroup_from_pins_types(self):
example_folder = os.path.join(local_path, "example_models", test_subfolder)
source_path_edb = os.path.join(example_folder, "ANSYS-HSD_V1.aedb")
target_path_edb = os.path.join(self.local_scratch.path, "test_component", "test.aedb")
self.local_scratch.copyfolder(source_path_edb, target_path_edb)
edbapp = Edb(target_path_edb, desktop_version)
assert edbapp.components.create_pingroup_from_pins([*edbapp.components.components["Q1"].pins.values()])
assert edbapp.components._create_pin_group_terminal(edbapp.padstacks.pingroups[0], term_type="circuit")
edbapp.close()

0 comments on commit 9c4cebb

Please sign in to comment.