Skip to content

Commit

Permalink
FEATURE: Add GetConnectionPt SetConnectionPt API in PadstackDefData
Browse files Browse the repository at this point in the history
  • Loading branch information
chenchienjacklin committed Apr 24, 2024
1 parent fc72907 commit 29fb2c3
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ classifiers = [

# FIXME: add ansys-api-edb version
dependencies = [
"ansys-api-edb==1.0.2",
"ansys-api-edb==1.0.3",
"protobuf>=3.19.3,<4",
"grpcio>=1.44.0"
]
Expand Down
72 changes: 72 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, position, direction):
return pb.PadstackDefDataSetConnectionPtMessage(
target=target.msg,
layer=layer,
x=messages.value_message(position.x),
y=messages.value_message(position.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,45 @@ 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:`geometry.PointData`, :class:`ConnectionPtDirection`]
The tuple is in a ``(position, direction)`` format:
- ``position``: Position 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 parser.to_point_data(msg), ConnectionPtDirection(msg.direction)

def set_connection_pt(self, layer, position, direction):
"""
Set connection point position and direction.
Parameters
----------
layer : str
Layer name.
position : :class:`geometry.PointData`
Position.
direction : :class:`ConnectionPtDirection`
Direction.
"""
self.__stub.SetConnectionPt(
_PadstackDefDataQueryBuilder.padstack_def_data_set_connection_pt_message(
self, layer, position, direction
)
)

0 comments on commit 29fb2c3

Please sign in to comment.