PolygonData#

class pyedb.grpc.database.geometry.polygon_data.PolygonData(edb_object=None, create_from_points=None, create_from_circle=None, create_from_rectangle=None, create_from_bounding_box=None, **kwargs)#

Class managing Polygon Data.

Overview#

create_from_points

create_from_bounding_box

Create PolygonData from point list.

bounding_circle

Get the bounding circle of the polygon.

is_inside

Check if polygon is inside.

has_self_intersections

Check if the polygon has self-intersections.

expand

Expand the polygon shape by an absolute value in all direction.

unite

Create union of polygons.

area

Get area of polygon.

intersection_type

Get intersection type of polygon.

bounding_box

Bounding box.

arcs

Get the Primitive Arc Data.

is_closed

Check if polygon is closed.

sense

Get the polygon sense type.

holes

Get all holes in polygon.

points

Get all points in polygon.

points_raw

Get all points in polygon.

arc_data

Get all arc data in polygon.

Import detail#

from pyedb.grpc.database.geometry.polygon_data import PolygonData

Property detail#

property PolygonData.bounding_box: tuple[tuple[float, float], tuple[float, float]]#

Bounding box.

Returns:
tuple[tuple[float, float], tuple[float, float]]

Tuple of coordinates for the component’s bounding box, with the list of coordinates in this order: (X lower left corner, Y lower left corner), (X upper right corner, Y upper right corner).

property PolygonData.arcs: list[pyedb.grpc.database.geometry.arc_data.ArcData]#

Get the Primitive Arc Data.

Returns:
List[ArcData]
property PolygonData.is_closed: bool#

Check if polygon is closed.

Returns:
bool
property PolygonData.sense: any#

Get the polygon sense type.

Returns:
class:

PolygonSenseType ..

property PolygonData.holes#

Get all holes in polygon.

Returns:
list[PolygonData]
property PolygonData.points: list[tuple[float, float]]#

Get all points in polygon.

Returns:
list[tuple[float, float]]
property PolygonData.points_raw#

Get all points in polygon.

Returns:
list[PointData]
property PolygonData.arc_data#

Get all arc data in polygon.

Returns:
list[ArcData]

Method detail#

PolygonData.bounding_circle() tuple[tuple[float, float], float]#

Get the bounding circle of the polygon.

Returns:
Tuple[Tuple[float, float], float]

Center point (x, y) and radius of the bounding circle.

PolygonData.is_inside(point: tuple[float, float]) bool#

Check if polygon is inside.

Returns:
bool
classmethod PolygonData.create_from_points(points, closed=True)#
classmethod PolygonData.create_from_bounding_box(points) ansys.edb.core.geometry.polygon_data.PolygonData#

Create PolygonData from point list.

Returns:
PolygonData
PolygonData.has_self_intersections(tolerance=1e-12) bool#

Check if the polygon has self-intersections.

Parameters:
tolerancefloat, optional

Tolerance in meters.

Returns:
bool

True if the polygon has self-intersections, False otherwise.

PolygonData.expand(offset=0.001, tolerance=1e-12, round_corners=True, maximum_corner_extension=0.001) bool#

Expand the polygon shape by an absolute value in all direction. Offset can be negative for negative expansion.

Parameters:
offsetfloat, optional

Offset value in meters.

tolerancefloat, optional

Tolerance in meters.

round_cornersbool, optional

Whether to round corners or not. If True, use rounded corners in the expansion otherwise use straight edges (can be degenerate).

maximum_corner_extensionfloat, optional

The maximum corner extension (when round corners are not used) at which point the corner is clipped.

Returns:
bool
PolygonData.unite(polygons)#

Create union of polygons.

Parameters:
polygonslist[PolygonData]

List of PolygonData objects to unite with the current polygon.

Returns:
bool
PolygonData.area()#

Get area of polygon.

Returns:
float
PolygonData.intersection_type(polygon_data)#

Get intersection type of polygon.

Returns:
class:

PolygonIntersectionType ..

Returned value can be one of the following:
  • 0 : No Intersection

  • 1 : Current Polygon Inside Other

  • 2: Other polygon Inside Current

  • 3: Common intersection

  • 4: undifined intersection