Skip to content

Commit

Permalink
FIX: Fix PolygonData intersection_type API (#465)
Browse files Browse the repository at this point in the history
  • Loading branch information
drewm102 authored Oct 28, 2024
1 parent 81df63a commit 9be9f47
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions doc/source/api/geometry.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ Enums

polygon_data.ExtentType
polygon_data.PolygonSenseType
polygon_data.IntersectionType
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.
:class:`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)
).intersection_type
)

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

0 comments on commit 9be9f47

Please sign in to comment.