Skip to content

Commit

Permalink
FEATURE: Add PadstackDefData.GetConnectionPt() PadstackDefData.SetCon…
Browse files Browse the repository at this point in the history
…nectionPt() API.
  • Loading branch information
chenchienjacklin committed Apr 9, 2024
1 parent f3a8dc5 commit 75466a7
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions src/ansys/edb/core/definition/padstack_def_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,20 @@ def padstack_def_data_set_solder_ball_param_message(target, d1, d2):
def padstack_def_data_set_solder_ball_material_message(target, material):
return pb.PadstackDefDataSetSolderBallMaterialMessage(target=target.msg, material=material)

@staticmethod
def padstack_def_data_get_connection_pt_message(target, layer):
return pb.PadstackDefDataGetConnectionPtMessage(target=target.msg, layer=layer)

@staticmethod
def padstack_def_data_set_connection_pt_message(target, layer, x, y, direction):
return pb.PadstackDefDataSetConnectionPtMessage(
target=target.msg,
layer=layer,
x=messages.value_message(x),
y=messages.value_message(y),
direction=direction.value,
)


class PadType(Enum):
"""Provides an enum representing pad types."""
Expand Down Expand Up @@ -202,6 +216,22 @@ class SolderballPlacement(Enum):
UNKNOWN_PLACEMENT = pb.UNKNOWN_PLACEMENT


class ConnectionPtDirection(Enum):
"""Provides an enum representing connection pt direction."""

PS_NO_DIRECTION = pb.PS_NO_DIRECTION
PS_ANY_DIRECTION = pb.PS_ANY_DIRECTION
PS_0_DIRECTION = pb.PS_0_DIRECTION
PS_45_DIRECTION = pb.PS_45_DIRECTION
PS_90_DIRECTION = pb.PS_90_DIRECTION
PS_135_DIRECTION = pb.PS_135_DIRECTION
PS_180_DIRECTION = pb.PS_180_DIRECTION
PS_225_DIRECTION = pb.PS_225_DIRECTION
PS_270_DIRECTION = pb.PS_270_DIRECTION
PS_315_DIRECTION = pb.PS_315_DIRECTION
PS_UNKNOWN_DIRECTION = pb.PS_UNKNOWN_DIRECTION


class PadstackDefData(ObjBase):
"""Represents a padstack data definition."""

Expand Down Expand Up @@ -473,3 +503,49 @@ def solder_ball_material(self, material):
self, material
)
)

def get_connection_pt(self, layer):
"""
Get connection point position and direction by layer name.
Parameters
----------
layer : str
Layer name.
Returns
-------
tuple[:class:`Value <ansys.edb.core.utility.Value>`, \
:class:`Value <ansys.edb.core.utility.Value>`, :class:`ConnectionPtDirection`]
The tuple is in a ``(x, y, direction)`` format:
- ``x``: X of the connection point.
- ``y``: Y of the connection point.
- ``direction``: Direction of the connection point.
"""
msg = self.__stub.GetConnectionPt(
_PadstackDefDataQueryBuilder.padstack_def_data_get_connection_pt_message(self, layer)
)
return Value(msg.x), Value(msg.y), ConnectionPtDirection(msg.direction)

def set_connection_pt(self, layer, x, y, direction):
"""
Set connection point position and direction.
Parameters
----------
layer : str
Layer name.
x : :class:`Value <ansys.edb.core.utility.Value>`
X.
y : :class:`Value <ansys.edb.core.utility.Value>`
Y.
direction : :class:`ConnectionPtDirection`
Direction.
"""
self.__stub.SetConnectionPt(
_PadstackDefDataQueryBuilder.padstack_def_data_set_connection_pt_message(
self, layer, x, y, direction
)
)

0 comments on commit 75466a7

Please sign in to comment.