:class:`Rectangle` ================== .. py:class:: pyedb.grpc.database.primitive.rectangle.Rectangle(pedb, edb_object=None) Bases: :py:obj:`ansys.edb.core.primitive.rectangle.Rectangle`, :py:obj:`pyedb.grpc.database.primitive.primitive.Primitive` Class representing a rectangle object. .. !! processed by numpydoc !! .. py:currentmodule:: Rectangle Overview -------- .. tab-set:: .. tab-item:: Methods .. list-table:: :header-rows: 0 :widths: auto * - :py:attr:`~create` - Create a rectangle primitive in the specified layout, layer, and net with the given parameters. * - :py:attr:`~delete` - Delete the rectangle primitive from the layout. * - :py:attr:`~get_parameters` - Get coordinates parameters. * - :py:attr:`~set_parameters` - Set coordinates parameters. .. tab-item:: Properties .. list-table:: :header-rows: 0 :widths: auto * - :py:attr:`~polygon_data` - PolygonData. * - :py:attr:`~representation_type` - Representation type. Import detail ------------- .. code-block:: python from pyedb.grpc.database.primitive.rectangle import Rectangle Property detail --------------- .. py:property:: polygon_data PolygonData. :Returns: :class:`PolygonData ` .. .. !! processed by numpydoc !! .. py:property:: representation_type :type: str Representation type. :Returns: str. ``"center_width_height"`` or ``"lower_left_upper_right"``. .. !! processed by numpydoc !! Method detail ------------- .. py:method:: create(layout=None, layer: Union[str, pyedb.grpc.database.layers.layer.Layer] = None, net: Union[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: **layout** : :obj:`Layout`, :obj:`optional` The layout in which the rectangle will be created. If not provided, the active layout of the `pedb` instance will be used. **layer** : :obj:`Union`\[:class:`python:str`, :obj:`Layer`], :obj:`optional` The layer in which the rectangle will be created. This parameter is required and must be specified. **net** : :obj:`Union`\[:class:`python:str`, :obj:`Net`], :obj:`optional` The net to which the rectangle will belong. This parameter is required and must be specified. **rep_type** : :class:`python:str`, :obj:`optional` The representation type of the rectangle. Options are `"center_width_height"` or `"lower_left_upper_right"`. The default value is `"center_width_height"`. **param1** : :class:`python:float`, :obj:`optional` The first parameter defining the rectangle. Its meaning depends on the `rep_type`. **param2** : :class:`python:float`, :obj:`optional` The second parameter defining the rectangle. Its meaning depends on the `rep_type`. **param3** : :class:`python:float`, :obj:`optional` The third parameter defining the rectangle. Its meaning depends on the `rep_type`. **param4** : :class:`python:float`, :obj:`optional` The fourth parameter defining the rectangle. Its meaning depends on the `rep_type`. **corner_rad** : :class:`python:float`, :obj:`optional` The corner radius of the rectangle. The default value is `0.0`. **rotation** : :class:`python:float`, :obj:`optional` The rotation angle of the rectangle in degrees. The default value is `0.0`. :Returns: :obj:`Rectangle` The created rectangle primitive. :Raises: :obj:`ValueError` If the `layer` parameter is not provided. :obj:`ValueError` If the `net` parameter is not provided. .. rubric:: 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. .. !! processed by numpydoc !! .. py:method:: delete() Delete the rectangle primitive from the layout. .. !! processed by numpydoc !! .. py:method:: get_parameters() Get coordinates parameters. :Returns: :class:`python: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. .. !! processed by numpydoc !! .. py:method:: set_parameters(rep_type, param1, param2, param3, param4, corner_rad, rotation) Set coordinates parameters. :Parameters: **rep_type** : :class:`RectangleRepresentationType` Type that defines given parameters meaning. **param1** : :class:`Value ` X value of lower left point or center point. **param2** : :class:`Value ` Y value of lower left point or center point. **param3** : :class:`Value ` X value of upper right point or width. **param4** : :class:`Value ` Y value of upper right point or height. **corner_rad** : :class:`Value ` Corner radius. **rotation** : :class:`Value ` Rotation. .. !! processed by numpydoc !!