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 PolygonData intersection_type API #465

Merged
merged 3 commits into from
Oct 28, 2024
Merged
Changes from 1 commit
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
21 changes: 16 additions & 5 deletions src/ansys/edb/core/geometry/polygon_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import itertools
import math

from ansys.api.edb.v1 import edb_defs_pb2, point_data_pb2, polygon_data_pb2_grpc
from ansys.api.edb.v1 import edb_defs_pb2, point_data_pb2, polygon_data_pb2, polygon_data_pb2_grpc

from ansys.edb.core import session
from ansys.edb.core.geometry.arc_data import ArcData
Expand All @@ -27,6 +27,16 @@ class ExtentType(Enum):
BOUNDING_BOX = edb_defs_pb2.BOUNDING_BOX


class IntersectionType(Enum):
"""Provides an enum representing intersection types for geometries."""

NO_INTERSECTION = polygon_data_pb2.NO_INTERSECTION
THIS_INSIDE_OTHER = polygon_data_pb2.THIS_INSIDE_OTHER
OTHER_INSIDE_THIS = polygon_data_pb2.OTHER_INSIDE_THIS
COMMON_INTERSECTION = polygon_data_pb2.COMMON_INTERSECTION
UNDEFINED_INTERSECTION = polygon_data_pb2.UNDEFINED_INTERSECTION


class PolygonData:
"""Represents a polygon data object."""

Expand Down Expand Up @@ -434,11 +444,12 @@ def intersection_type(self, other, tol=1e-9):

Returns
-------
bool
``True`` when successful, ``False`` when failed.
IntersectionType
"""
return self.__stub.GetIntersectionType(
messages.polygon_data_pair_with_tolerance_message(self, other, tol)
return IntersectionType(
self.__stub.GetIntersectionType(
messages.polygon_data_pair_with_tolerance_message(self, other, tol)
)
chenchienjacklin marked this conversation as resolved.
Show resolved Hide resolved
)

def circle_intersect(self, center, radius):
Expand Down
Loading