diff --git a/src/pyedb/grpc/edb_core/padstack.py b/src/pyedb/grpc/edb_core/padstack.py index 82657d023a..b39460bac8 100644 --- a/src/pyedb/grpc/edb_core/padstack.py +++ b/src/pyedb/grpc/edb_core/padstack.py @@ -569,7 +569,7 @@ def get_pinlist_from_component_and_net(self, refdes=None, netname=None): ) return self.get_pin_from_component_and_net(refdes=refdes, netname=netname) - def get_pad_parameters(self, pin, layername, pad_type=0): + def get_pad_parameters(self, pin, layername, pad_type="regular_pad"): """Get Padstack Parameters from Pin or Padstack Definition. Parameters @@ -578,16 +578,23 @@ def get_pad_parameters(self, pin, layername, pad_type=0): Pin or PadstackDef on which get values. layername : str Layer on which get properties. - pad_type : int - Pad Type. + pad_type : str + Pad Type, `"pad"`, `"anti_pad"`, `"thermal_pad"` Returns ------- tuple Tuple of (GeometryType, ParameterList, OffsetX, OffsetY, Rot). """ - - padparams = pin.padstack_def.data.get_pad_parameters(layername, self.int_to_pad_type(pad_type)) + if pad_type == "regular_pad": + pad_type = GrpcPadType.REGULAR_PAD + elif pad_type == "anti_pad": + pad_type = GrpcPadType.ANTI_PAD + elif pad_type == "thermal_pad": + pad_type = GrpcPadType.THERMAL_PAD + else: + pad_type = pad_type = GrpcPadType.REGULAR_PAD + padparams = pin.padstack_def.data.get_pad_parameters(layername, pad_type) if len(padparams) == 5: # non polygon via geometry_type = padparams[0] parameters = [i.value for i in padparams[1]] diff --git a/tests/grpc/system/test_edb_padstacks.py b/tests/grpc/system/test_edb_padstacks.py index 487a306787..26c07f2016 100644 --- a/tests/grpc/system/test_edb_padstacks.py +++ b/tests/grpc/system/test_edb_padstacks.py @@ -26,7 +26,7 @@ import pytest -from pyedb.dotnet.edb import Edb +from pyedb.grpc.edb import EdbGrpc as Edb from tests.conftest import desktop_version, local_path from tests.legacy.system.conftest import test_subfolder @@ -35,21 +35,21 @@ class TestClass: @pytest.fixture(autouse=True) - def init(self, legacy_edb_app, local_scratch, target_path, target_path3, target_path4): - self.edbapp = legacy_edb_app + def init(self, local_scratch, target_path, target_path3, target_path4): self.local_scratch = local_scratch self.target_path = target_path self.target_path3 = target_path3 self.target_path4 = target_path4 - def test_get_pad_parameters(self): + def test_get_pad_parameters(self, edb_examples): """Access to pad parameters.""" - pin = self.edbapp.components.get_pin_from_component("J1", pinName="1") - parameters = self.edbapp.padstacks.get_pad_parameters( - pin[0], "1_Top", self.edbapp.padstacks.pad_type.RegularPad - ) + # Done + edbapp = edb_examples.get_si_verse() + pin = edbapp.components.get_pin_from_component("J1", pin_name="1") + parameters = edbapp.padstacks.get_pad_parameters(pin=pin[0], layername="1_Top", pad_type="regular_pad") assert isinstance(parameters[1], list) - assert isinstance(parameters[0], int) + assert isinstance(parameters[0], str) + edbapp.close() def test_get_vias_from_nets(self): """Use padstacks' get_via_instance_from_net method."""