Polygon#

class pyedb.grpc.database.primitive.polygon.Polygon(pedb, edb_object=None)#

Bases: ansys.edb.core.primitive.polygon.Polygon, pyedb.grpc.database.primitive.primitive.Primitive

Represents a polygon object.

Overview#

create

Create a polygon in the specified layout, layer, and net using the provided polygon data.

delete

Delete polygon from layout.

fix_self_intersections

Remove self intersections if they exist.

clone

Duplicate polygon.

duplicate_across_layers

Duplicate across layer a primitive object.

move

Move polygon along a vector.

scale

Scales the polygon relative to a center point by a factor.

rotate

Rotate polygon around a center point by an angle.

move_layer

Move polygon to given layer.

in_polygon

Check if padstack Instance is in given polygon data.

add_void

Add a void to the primitive.

type

Primitive type.

has_self_intersections

Check if Polygon has self intersections.

Import detail#

from pyedb.grpc.database.primitive.polygon import Polygon

Property detail#

property Polygon.type: str#

Primitive type.

property Polygon.has_self_intersections: bool#

Check if Polygon has self intersections.

Returns:
bool

Method detail#

Polygon.create(layout: pyedb.grpc.database.layout.layout.Layout = None, layer: str | pyedb.grpc.database.layers.layer.Layer = None, net: str | Net = None, polygon_data=None)#

Create a polygon in the specified layout, layer, and net using the provided polygon data.

Parameters:
layoutLayout, optional

The layout in which the polygon will be created. If not provided, the active layout of the pedb instance will be used.

layerUnion[str, Layer], optional

The layer in which the polygon will be created. This parameter is required and must be specified.

netUnion[str, Net], optional

The net to which the polygon will belong. If not provided, the polygon will not be associated with a net.

polygon_datalist or GrpcPolygonData, optional

The data defining the polygon. This can be a list of points or an instance of GrpcPolygonData. This parameter is required and must be specified.

Returns:
Polygon

The created polygon object.

Raises:
ValueError

If the layer parameter is not provided.

ValueError

If the polygon_data parameter is not provided.

Notes

  • If polygon_data is provided as a list, it will be converted to a GrpcPolygonData object.

  • The created polygon is added to the modeler primitives of the pedb instance.

Polygon.delete()#

Delete polygon from layout.

Polygon.fix_self_intersections() list[any]#

Remove self intersections if they exist.

Returns:
List[Polygon]

All new polygons created from the removal operation.

Polygon.clone()#

Duplicate polygon.

Returns:
Polygon

Cloned polygon.

Polygon.duplicate_across_layers(layers) bool#

Duplicate across layer a primitive object.

Parameters:

layers: list

list of str, with layer names

Returns:
bool

True when successful, False when failed.

Polygon.move(vector) bool#

Move polygon along a vector.

Parameters:
vectorList of float or str [x,y].
Returns:
bool

True when successful, False when failed.

Examples

>>> edbapp = ansys.aedt.core.Edb("myproject.aedb")
>>> top_layer_polygon = [poly for poly in edbapp.modeler.polygons if poly.layer_name == "Top Layer"]
>>> for polygon in top_layer_polygon:
>>>     polygon.move(vector=["2mm", "100um"])
Polygon.scale(factor, center=None) bool#

Scales the polygon relative to a center point by a factor.

Parameters:
factorfloat

Scaling factor.

centerList of float or str [x,y], optional

If None scaling is done from polygon center.

Returns:
bool

True when successful, False when failed.

Polygon.rotate(angle, center=None) bool#

Rotate polygon around a center point by an angle.

Parameters:
anglefloat

Value of the rotation angle in degree.

centerList of float or str [x,y], optional

If None rotation is done from polygon center.

Returns:
bool

True when successful, False when failed.

Examples

>>> edbapp = ansys.aedt.core.Edb("myproject.aedb")
>>> top_layer_polygon = [poly for poly in edbapp.modeler.polygons if poly.layer_name == "Top Layer"]
>>> for polygon in top_layer_polygon:
>>>     polygon.rotate(angle=45)
Polygon.move_layer(layer) bool#

Move polygon to given layer.

Parameters:
layerstr

layer name.

Returns:
bool

True when successful, False when failed.

Polygon.in_polygon(point_data, include_partial=True) bool#

Check if padstack Instance is in given polygon data.

Parameters:
point_dataPointData Object or list of float
include_partialbool, optional

Whether to include partial intersecting instances. The default is True.

Returns:
bool

True when successful, False when failed.

Polygon.add_void(polygon)#

Add a void to the primitive.

Parameters:
holePrimitive

Void to add.