From 9c4cebb6ef1157613c66f4447f88b497f900e633 Mon Sep 17 00:00:00 2001 From: gkorompi <156683163+gkorompi@users.noreply.github.com> Date: Tue, 23 Apr 2024 15:59:33 +0300 Subject: [PATCH] FIX: add types create_pingroup_from_pins (#391) * FEATURE: add types create_pingroup_from_pins * Update components.py * Update components.py --- src/pyedb/dotnet/edb_core/components.py | 11 +++++++++-- tests/legacy/system/test_edb_components.py | 10 ++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/pyedb/dotnet/edb_core/components.py b/src/pyedb/dotnet/edb_core/components.py index ac699c30fe..f5e9bde2eb 100644 --- a/src/pyedb/dotnet/edb_core/components.py +++ b/src/pyedb/dotnet/edb_core/components.py @@ -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. @@ -1335,7 +1335,7 @@ 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 @@ -1343,10 +1343,13 @@ def _create_pin_group_terminal(self, pingroup, isref=False, term_name=None): 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. @@ -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() diff --git a/tests/legacy/system/test_edb_components.py b/tests/legacy/system/test_edb_components.py index 0eb87f0f7a..71afbdb542 100644 --- a/tests/legacy/system/test_edb_components.py +++ b/tests/legacy/system/test_edb_components.py @@ -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()