diff --git a/src/pyedb/dotnet/database/cell/connectable.py b/src/pyedb/dotnet/database/cell/connectable.py index 2d8066e1bc..0fd1f7639e 100644 --- a/src/pyedb/dotnet/database/cell/connectable.py +++ b/src/pyedb/dotnet/database/cell/connectable.py @@ -83,3 +83,12 @@ def component(self): return None else: return EDBComponent(self._pedb, edb_comp) + + def get_connected_objects(self): + """Get connected objects. + + Returns + ------- + list + """ + return self._pedb.get_connected_objects(self._layout_obj_instance) diff --git a/src/pyedb/dotnet/database/cell/primitive/primitive.py b/src/pyedb/dotnet/database/cell/primitive/primitive.py index b309a8b11b..2dc490eca2 100644 --- a/src/pyedb/dotnet/database/cell/primitive/primitive.py +++ b/src/pyedb/dotnet/database/cell/primitive/primitive.py @@ -21,6 +21,8 @@ # SOFTWARE. import re +from System import String + from pyedb.dotnet.database.cell.connectable import Connectable from pyedb.dotnet.database.general import convert_py_list_to_net_list from pyedb.dotnet.database.geometry.polygon_data import PolygonData @@ -147,15 +149,6 @@ def is_void(self): """ return self._edb_object.IsVoid() - def get_connected_objects(self): - """Get connected objects. - - Returns - ------- - list - """ - return self._pedb.get_connected_objects(self._layout_obj_instance) - def area(self, include_voids=True): """Return the total area. @@ -581,8 +574,6 @@ def aedt_name(self): str Name. """ - from System import String - val = String("") _, name = self._edb_object.GetProductProperty(self._pedb._edb.ProductId.Designer, 1, val) diff --git a/src/pyedb/dotnet/database/components.py b/src/pyedb/dotnet/database/components.py index 3a3702fa72..b47de3a5d2 100644 --- a/src/pyedb/dotnet/database/components.py +++ b/src/pyedb/dotnet/database/components.py @@ -811,12 +811,10 @@ def create_port_on_pins( refdes = EDBComponent(self._pedb, refdes) pins = self._get_pins_for_ports(pins, refdes) if not pins: - self._logger.error("No pins found during port creation. Port is not defined.") - return False + raise RuntimeError("No pins found during port creation. Port is not defined.") reference_pins = self._get_pins_for_ports(reference_pins, refdes) if not reference_pins: - self._logger.error("No reference pins found during port creation. Port is not defined.") - return False + raise RuntimeError("No reference pins found during port creation. Port is not defined.") if refdes and any(refdes.rlc_values): return self.deactivate_rlc_component(component=refdes, create_circuit_port=True) if not port_name: diff --git a/src/pyedb/dotnet/database/edb_data/padstacks_data.py b/src/pyedb/dotnet/database/edb_data/padstacks_data.py index a6dd7dbad4..e6570d5a83 100644 --- a/src/pyedb/dotnet/database/edb_data/padstacks_data.py +++ b/src/pyedb/dotnet/database/edb_data/padstacks_data.py @@ -25,7 +25,7 @@ import warnings from pyedb.dotnet.clr_module import String -from pyedb.dotnet.database.cell.primitive.primitive import Primitive +from pyedb.dotnet.database.cell.primitive.primitive import Connectable from pyedb.dotnet.database.dotnet.database import PolygonDataDotNet from pyedb.dotnet.database.edb_data.edbvalue import EdbValue from pyedb.dotnet.database.general import ( @@ -1164,7 +1164,7 @@ def _update_layer_names(self, old_name, updated_name): return True -class EDBPadstackInstance(Primitive): +class EDBPadstackInstance(Connectable): """Manages EDB functionalities for a padstack. Parameters @@ -1727,19 +1727,6 @@ def rotation(self): if out[0]: return round(out[2].ToDouble(), 6) - @property - def name(self): - """Padstack Instance Name. If it is a pin, the syntax will be like in AEDT ComponentName-PinName.""" - if self.is_pin: - return self.aedt_name - else: - return self.component_pin - - @name.setter - def name(self, value): - self._edb_padstackinstance.SetName(value) - self._edb_padstackinstance.SetProductProperty(self._pedb.edb_api.ProductId.Designer, 11, value) - @property def metal_volume(self): """Metal volume of the via hole instance in cubic units (m3). Metal plating ratio is accounted. @@ -1776,13 +1763,14 @@ def metal_volume(self): @property def pin_number(self): """Get pin number.""" - warnings.warn("`pin_number` is deprecated. Use `component_pin` method instead.", DeprecationWarning) + warnings.warn("`pin_number` is deprecated. Use `name` method instead.", DeprecationWarning) return self.component_pin @property def component_pin(self): """Get component pin.""" - return self._edb_padstackinstance.GetName() + warnings.warn("Use new property :func:`name` instead.", DeprecationWarning) + return self.name @property def aedt_name(self): diff --git a/tests/legacy/system/test_edb.py b/tests/legacy/system/test_edb.py index d76d19a7bb..375cf4a6ae 100644 --- a/tests/legacy/system/test_edb.py +++ b/tests/legacy/system/test_edb.py @@ -1362,7 +1362,7 @@ def test_create_edb_with_dxf(self): ] edb3.close() - @pytest.mark.skipif(is_linux, reason="Not supported in IPY") + @pytest.mark.skipif(reason="Not supported in IPY") def test_solve_siwave(self): """Solve EDB with Siwave.""" target_path = os.path.join(local_path, "example_models", "T40", "ANSYS-HSD_V1_DCIR.aedb") @@ -1571,9 +1571,9 @@ def test_voltage_regulator(self, edb_examples): assert vrm.component assert vrm.component.refdes == "U1" assert vrm.negative_remote_sense_pin - assert vrm.negative_remote_sense_pin.name == "U1-A3" + assert vrm.negative_remote_sense_pin.name == "A3" assert vrm.positive_remote_sense_pin - assert vrm.positive_remote_sense_pin.name == "U1-A2" + assert vrm.positive_remote_sense_pin.name == "A2" assert vrm.voltage == 1.5 assert vrm.is_active assert not vrm.is_null @@ -1771,50 +1771,22 @@ def test_create_circuit_port_on_component_pins_pins_mode(self, edb_examples, pin positive_pin_names = [f"{component_name}-{pin}" for pin in positive_pin_names] reference_pin_names = [f"{component_name}-{pin}" for pin in reference_pin_names] assert len(edbapp.excitations) == 0 - if edbapp.grpc: - assert edbapp.source_excitation.create_port_on_pins( - refdes=component_name if pins_mode == "str" else None, - pins=( - positive_pin_names - if pins_mode == "str" or pins_mode == "global_str" - else ( - positive_pin_numbers - if pins_mode == "int" - else [edbcomp.pins[pin] for pin in positive_pin_names] - ) - ), - reference_pins=( - reference_pin_names - if pins_mode == "str" or pins_mode == "global_str" - else ( - reference_pin_numbers - if pins_mode == "int" - else [edbcomp.pins[pin] for pin in reference_pin_names] - ) - ), - ) - else: - assert edbapp.components.create_port_on_pins( - refdes=component_name if pins_mode == "str" else None, - pins=( - positive_pin_names - if pins_mode == "str" or pins_mode == "global_str" - else ( - positive_pin_numbers - if pins_mode == "int" - else [edbcomp.pins[pin] for pin in positive_pin_names] - ) - ), - reference_pins=( - reference_pin_names - if pins_mode == "str" or pins_mode == "global_str" - else ( - reference_pin_numbers - if pins_mode == "int" - else [edbcomp.pins[pin] for pin in reference_pin_names] - ) - ), - ) + + assert edbapp.components.create_port_on_pins( + refdes=component_name if pins_mode == "str" else None, + pins=( + positive_pin_names + if pins_mode == "str" or pins_mode == "global_str" + else (positive_pin_numbers if pins_mode == "int" else [edbcomp.pins[pin] for pin in positive_pin_names]) + ), + reference_pins=( + reference_pin_names + if pins_mode == "str" or pins_mode == "global_str" + else ( + reference_pin_numbers if pins_mode == "int" else [edbcomp.pins[pin] for pin in reference_pin_names] + ) + ), + ) assert len(edbapp.excitations) == 2 def test_create_circuit_port_on_component_pins_pingroup_on_single_pin(self, edb_examples): diff --git a/tests/legacy/system/test_edb_components.py b/tests/legacy/system/test_edb_components.py index f99db6f270..d1571c3517 100644 --- a/tests/legacy/system/test_edb_components.py +++ b/tests/legacy/system/test_edb_components.py @@ -51,11 +51,7 @@ def test_components_get_pin_from_component(self, edb_examples): comp = edb.components.get_component_by_name("J1") assert comp is not None pin = edb.components.get_pin_from_component("J1", pin_name="1") - # TODO check if we agree to return aedt_name when it's a layout pin. - if edb.grpc: - assert pin[0].name == "1" - else: - assert pin[0].name == "J1-1" + assert pin[0].name == "1" edb.close() def test_components_create_coax_port_on_component(self, edb_examples):