Rectangle#

class pyedb.grpc.database.primitive.rectangle.Rectangle(pedb, edb_object=None)#

Bases: ansys.edb.core.primitive.rectangle.Rectangle, pyedb.grpc.database.primitive.primitive.Primitive

Class representing a rectangle object.

Overview#

create

Create a rectangle primitive in the specified layout, layer, and net with the given parameters.

delete

Delete the rectangle primitive from the layout.

get_parameters

Get coordinates parameters.

set_parameters

Set coordinates parameters.

polygon_data

PolygonData.

representation_type

Representation type.

Import detail#

from pyedb.grpc.database.primitive.rectangle import Rectangle

Property detail#

property Rectangle.polygon_data#

PolygonData.

Returns:
PolygonData
property Rectangle.representation_type: str#

Representation type.

Returns:
str.

"center_width_height" or "lower_left_upper_right".

Method detail#

Rectangle.create(layout=None, layer: str | pyedb.grpc.database.layers.layer.Layer = None, net: str | Net = None, rep_type: str = 'center_width_height', param1: float = None, param2: float = None, param3: float = None, param4: float = None, corner_rad: float = 0.0, rotation: float = 0.0)#

Create a rectangle primitive in the specified layout, layer, and net with the given parameters.

Parameters:
layoutLayout, optional

The layout in which the rectangle 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 rectangle will be created. This parameter is required and must be specified.

netUnion[str, Net], optional

The net to which the rectangle will belong. This parameter is required and must be specified.

rep_typestr, optional

The representation type of the rectangle. Options are “center_width_height” or “lower_left_upper_right”. The default value is “center_width_height”.

param1float, optional

The first parameter defining the rectangle. Its meaning depends on the rep_type.

param2float, optional

The second parameter defining the rectangle. Its meaning depends on the rep_type.

param3float, optional

The third parameter defining the rectangle. Its meaning depends on the rep_type.

param4float, optional

The fourth parameter defining the rectangle. Its meaning depends on the rep_type.

corner_radfloat, optional

The corner radius of the rectangle. The default value is 0.0.

rotationfloat, optional

The rotation angle of the rectangle in degrees. The default value is 0.0.

Returns:
Rectangle

The created rectangle primitive.

Raises:
ValueError

If the layer parameter is not provided.

ValueError

If the net parameter is not provided.

Notes

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

  • The rep_type determines how the parameters are interpreted:
    • “center_width_height”: param1 and param2 represent the center coordinates, while param3 and

    param4 represent the width and height. - “lower_left_upper_right”: param1 and param2 represent the lower-left corner coordinates, while param3 and param4 represent the upper-right corner coordinates.

Rectangle.delete()#

Delete the rectangle primitive from the layout.

Rectangle.get_parameters()#

Get coordinates parameters.

Returns:
tuple[

str, float, float, float, float, float, float`

]

Returns a tuple of the following format:

(representation_type, parameter1, parameter2, parameter3, parameter4, corner_radius, rotation)

representation_type : Type that defines given parameters meaning.

parameter1 : X value of lower left point or center point.

parameter2 : Y value of lower left point or center point.

parameter3 : X value of upper right point or width.

parameter4 : Y value of upper right point or height.

corner_radius : Corner radius.

rotation : Rotation.

Rectangle.set_parameters(rep_type, param1, param2, param3, param4, corner_rad, rotation)#

Set coordinates parameters.

Parameters:
rep_typeRectangleRepresentationType

Type that defines given parameters meaning.

param1Value

X value of lower left point or center point.

param2Value

Y value of lower left point or center point.

param3Value

X value of upper right point or width.

param4Value

Y value of upper right point or height.

corner_radValue

Corner radius.

rotationValue

Rotation.