Skip to content
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

FIX: Fix diff pair and polygon data bugs #459

Merged
merged 4 commits into from
Oct 24, 2024
Merged
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: 5 additions & 4 deletions src/ansys/edb/core/geometry/polygon_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def arc_data(self):
h, incr = 0, 1
p1, p2 = self.points[i], self.points[(i + incr) % n]
if p2.is_arc:
h, incr = p2.arc_height, 2
h, incr = p2.arc_height.double, 2
p2 = self.points[(i + incr) % n]
segments.append(ArcData(p1, p2, height=h))
i += incr
Expand Down Expand Up @@ -225,9 +225,9 @@ def has_self_intersections(self, tol=1e-9):
messages.polygon_data_with_tol_message(self, tol)
).value

@parser.to_polygon_data
@parser.to_polygon_data_list
drewm102 marked this conversation as resolved.
Show resolved Hide resolved
def remove_self_intersections(self, tol=1e-9):
"""Create a polygon with all self-intersections removed.
"""Remove self-intersections from this polygon.

Parameters
----------
Expand All @@ -236,7 +236,8 @@ def remove_self_intersections(self, tol=1e-9):

Returns
-------
PolygonData
list[.PolygonData]
A list of non self-intersecting polygons.
"""
return self.__stub.RemoveSelfIntersections(
messages.polygon_data_with_tol_message(self, tol)
Expand Down
35 changes: 15 additions & 20 deletions src/ansys/edb/core/inner/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def point_property_message(target, point):
def point_data_rotate_message(point, center, angle):
"""Convert to a ``PointRotateMessage`` object."""
return PointDataRotateMessage(
point=point_message(point), rotation_center=point_message(center), angle=angle
point=point_message(point), rotate_center=point_message(center), rotate_angle=angle
)


Expand Down Expand Up @@ -310,7 +310,7 @@ def polygon_data_with_points_message(pd, point=None, polygon=None):
elif polygon is not None:
payload["polygon"] = polygon_data_message(polygon)

return PolygonDataWithPointsMessage(polygon=polygon_data_message(pd), **payload)
return PolygonDataWithPointsMessage(target=polygon_data_message(pd), **payload)


def polygon_data_expand_message(pd, offset, tol, round_corner, max_corner_expansion):
Expand Down Expand Up @@ -502,9 +502,9 @@ def point3d_message(point3d):
return Point3DMessage(x=value_message(x), y=value_message(y), z=value_message(z))


def point_3d_property_message(target, value):
def point_3d_property_message(target, val):
"""Convert to a ``Point3DPropertyMessage`` object."""
return Point3DPropertyMessage(target=edb_obj_message(target), origin=point3d_message(value))
return Point3DPropertyMessage(target=edb_obj_message(target), value=point3d_message(val))


def layout_get_items_message(layout, item_type):
Expand Down Expand Up @@ -543,14 +543,14 @@ def temperature_settings_message(settings):
)


def hfss_extent_message(val):
def hfss_extent_message(hfss_val):
"""Convert to an ``ExtentMessage`` object."""
if type(val) == float or type(val) == int:
value = val
if type(hfss_val) == float or type(hfss_val) == int:
val = hfss_val
absolute = False
else:
value, absolute = val
return HfssExtentMessage(value=value, absolute=absolute)
val, absolute = hfss_val
return HfssExtentMessage(value=val, absolute=absolute)


def hfss_extent_info_message(hfss_info):
Expand Down Expand Up @@ -722,7 +722,7 @@ def primitive_edge_params_message(primitive, point):
def pad_edge_params_message(padstack_instance, layer, arc):
"""Convert to a ``PadEdgeParamsMessage`` object."""
return PadEdgeParamsMessage(
padstack_instance=padstack_instance.msg,
padstack=padstack_instance.msg,
layer=layer_ref_message(layer),
arc=arc_message(arc),
)
Expand Down Expand Up @@ -932,13 +932,6 @@ def net_ref_message(net):
return NetRefMessage(id=edb_obj_message(net.msg if net is not None else 0))


def adaptive_frequency_message(frequency: str, max_delta_s: float, max_passes: int):
"""Convert to an ``AdaptiveFrequencyDataMessage`` object."""
return AdaptiveFrequencyDataMessage(
adaptive_frequency=frequency, max_delta=str(max_delta_s), max_passes=max_passes
)


def _length_mesh_operation_message(mesh_op):
return LengthMeshOperationMessage(
max_length=mesh_op.max_length,
Expand Down Expand Up @@ -1097,15 +1090,17 @@ def differential_pair_creation_message(layout, name, pos_net, neg_net):
return DifferentialPairCreationMessage(
layout=edb_obj_message(layout),
name=name,
pos_net=net_ref_message(pos_net),
neg_net=net_ref_message(neg_net),
positive_net=net_ref_message(pos_net),
negative_net=net_ref_message(neg_net),
)


def differential_pair_net_refs_message(dp, pos_net, neg_net):
"""Convert to a ``DifferentialPairNetRefsMessage`` object."""
return DifferentialPairNetRefsMessage(
dp=edb_obj_message(dp), pos_net=net_ref_message(pos_net), neg_net=net_ref_message(neg_net)
dp=edb_obj_message(dp),
positive_net=net_ref_message(pos_net),
negative_net=net_ref_message(neg_net),
)


Expand Down
3 changes: 2 additions & 1 deletion src/ansys/edb/core/primitive/primitive.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,8 @@ def set_parameters(self, center_x, center_y, radius):
)
)

def get_polygon_data(self):
@property
def polygon_data(self):
""":class:`.PolygonData`: \
Polygon data object of the circle."""
return Circle.render(*self.get_parameters(), self.is_void)
Expand Down
Loading