Skip to content

FIX: component_pin #1262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/pyedb/dotnet/database/cell/connectable.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
13 changes: 2 additions & 11 deletions src/pyedb/dotnet/database/cell/primitive/primitive.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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)
Expand Down
6 changes: 2 additions & 4 deletions src/pyedb/dotnet/database/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
22 changes: 5 additions & 17 deletions src/pyedb/dotnet/database/edb_data/padstacks_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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):
Expand Down
66 changes: 19 additions & 47 deletions tests/legacy/system/test_edb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down
6 changes: 1 addition & 5 deletions tests/legacy/system/test_edb_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Loading