Skip to content

Cell

Source code in gdsr/_gdsr.pyi
class Cell:
    name: str
    @property
    def polygons(self) -> list[Polygon]: ...
    @property
    def paths(self) -> list[Path]: ...
    @property
    def references(self) -> list[Reference[Instance]]: ...
    @property
    def texts(self) -> list[Text]: ...
    def __init__(self, name: str) -> None:
        """Initialize the Cell with a name.

        :param str name: Cell name
        """
    @property
    def bounding_box(self) -> tuple[Point, Point]:
        """Return the bounding box of the cell."""
    def add(self, *elements: Element) -> None:
        """Add elements to the cell."""
    def remove(self, *elements: Element) -> None:
        """Remove elements from the cell."""
    def contains(self, element: Element) -> bool:
        """Return True if the cell contains the element."""
    def is_empty(self) -> bool:
        """Return True if the cell has no elements."""
    def move_to(self, point: PointLike) -> Self:
        """Move everything in the cell to a point.

        :param PointLike point: Point to move the cell to.
        """
    def move_by(self, vector: PointLike) -> Self:
        """Move everything in the cell by a vector.

        :param PointLike vector: Vector to move the cell by.
        """
    def rotate(self, angle: float, centre: PointLike = Point(0, 0)) -> Self:
        """Rotate everything in the cell by an angle around a centre point.

        :param float angle: Counter-clockwise rotation angle in degrees.
        :param PointLike centre: Centre point of rotation, defaults to Point(0, 0).
        """
    def scale(self, factor: float, centre: PointLike = Point(0, 0)) -> Self:
        """Scale everything in the cell by a factor around a centre point.

        :param float factor: Scaling factor.
        :param PointLike centre: Centre point of scaling, defaults to Point(0, 0).
        """
    def flatten(
        self, *layer_data_types: LayerDataType, depth: int | None = None
    ) -> Self:
        """Flatten the cell to a certain depth on the specified layer, data_type pairs.

        Each reference on the depth is replaced by the elements it references.
        If the depth is 0, nothing is flattened
        If the depth is 1, only the first level of references is flattened
        and so on.

        When depth is None, the cell is flattened to the deepest level.

        This method modifies the cell in place and returns itself.

        :param LayerDataType layer_data_types: the layer, data_type pairs to flatten on
        :param int depth: Depth of the flattening, defaults to None.
        """
    def get_elements(
        self, *layer_data_types: LayerDataType, depth: int | None = None
    ) -> list[Element]:
        """Return a list of elements in the cell.

        This method does not modify the cell. It simply returns the elements
        until the specified depth. If a reference is encountered before
        it reaches the specified depth, the reference is flattened to the
        level of depth relative to the cell.

        When depth is None, the cell is flattened to the deepest level.

        :param LayerDataType layer_data_types: the layer, data_type pairs to flatten on
        :param int depth: Depth of the flattening, defaults to None.
        """
    def copy(self) -> Self:
        """Return a copy of the cell."""
    def to_gds(
        self,
        file_name: PathLike | None = None,
        units: float = 1e-6,
        precision: float = 1e-10,
    ) -> str:
        """Write the Cell to a GDS file.

        :param PathLike file_name: Output GDS file name.
        :param float units: GDS file units in meters, defaults to 1e-6.
        :param float precision: GDS file precision, defaults to 1e-10.
        :return: GDS file name
        """
    def is_on(self, *layer_data_types: LayerDataType) -> bool:
        """Return True if the cell is on any of the layer, data_type pairs.

        This method returns True if all elements in the cell are on any of the
        layer, data_type pairs.
        """
    def __contains__(self, element: Element) -> bool:
        """Return True if the cell contains the element."""
    def __str__(self) -> str:
        """Return a string representation of the cell."""
    def __repr__(self) -> str:
        """Return a string representation of the cell."""
    def __eq__(self, value: object) -> bool:
        """Return True if the cell is equal to another object."""

name instance-attribute

name: str

polygons property

polygons: list[Polygon]

paths property

paths: list[Path]

references property

references: list[Reference[Instance]]

texts property

texts: list[Text]

bounding_box property

bounding_box: tuple[Point, Point]

Return the bounding box of the cell.

__init__

__init__(name: str) -> None

Initialize the Cell with a name.

Parameters:

  • name (str) –

    Cell name

Source code in gdsr/_gdsr.pyi
def __init__(self, name: str) -> None:
    """Initialize the Cell with a name.

    :param str name: Cell name
    """

add

add(*elements: Element) -> None

Add elements to the cell.

Source code in gdsr/_gdsr.pyi
def add(self, *elements: Element) -> None:
    """Add elements to the cell."""

remove

remove(*elements: Element) -> None

Remove elements from the cell.

Source code in gdsr/_gdsr.pyi
def remove(self, *elements: Element) -> None:
    """Remove elements from the cell."""

contains

contains(element: Element) -> bool

Return True if the cell contains the element.

Source code in gdsr/_gdsr.pyi
def contains(self, element: Element) -> bool:
    """Return True if the cell contains the element."""

is_empty

is_empty() -> bool

Return True if the cell has no elements.

Source code in gdsr/_gdsr.pyi
def is_empty(self) -> bool:
    """Return True if the cell has no elements."""

move_to

move_to(point: PointLike) -> Self

Move everything in the cell to a point.

Parameters:

  • point (PointLike) –

    Point to move the cell to.

Source code in gdsr/_gdsr.pyi
def move_to(self, point: PointLike) -> Self:
    """Move everything in the cell to a point.

    :param PointLike point: Point to move the cell to.
    """

move_by

move_by(vector: PointLike) -> Self

Move everything in the cell by a vector.

Parameters:

  • vector (PointLike) –

    Vector to move the cell by.

Source code in gdsr/_gdsr.pyi
def move_by(self, vector: PointLike) -> Self:
    """Move everything in the cell by a vector.

    :param PointLike vector: Vector to move the cell by.
    """

rotate

rotate(angle: float, centre: PointLike = Point(0, 0)) -> Self

Rotate everything in the cell by an angle around a centre point.

Parameters:

  • angle (float) –

    Counter-clockwise rotation angle in degrees.

  • centre (PointLike, default: Point(0, 0) ) –

    Centre point of rotation, defaults to Point(0, 0).

Source code in gdsr/_gdsr.pyi
def rotate(self, angle: float, centre: PointLike = Point(0, 0)) -> Self:
    """Rotate everything in the cell by an angle around a centre point.

    :param float angle: Counter-clockwise rotation angle in degrees.
    :param PointLike centre: Centre point of rotation, defaults to Point(0, 0).
    """

scale

scale(factor: float, centre: PointLike = Point(0, 0)) -> Self

Scale everything in the cell by a factor around a centre point.

Parameters:

  • factor (float) –

    Scaling factor.

  • centre (PointLike, default: Point(0, 0) ) –

    Centre point of scaling, defaults to Point(0, 0).

Source code in gdsr/_gdsr.pyi
def scale(self, factor: float, centre: PointLike = Point(0, 0)) -> Self:
    """Scale everything in the cell by a factor around a centre point.

    :param float factor: Scaling factor.
    :param PointLike centre: Centre point of scaling, defaults to Point(0, 0).
    """

flatten

flatten(*layer_data_types: LayerDataType, depth: int | None = None) -> Self

Flatten the cell to a certain depth on the specified layer, data_type pairs.

Each reference on the depth is replaced by the elements it references. If the depth is 0, nothing is flattened If the depth is 1, only the first level of references is flattened and so on.

When depth is None, the cell is flattened to the deepest level.

This method modifies the cell in place and returns itself.

Parameters:

  • layer_data_types (LayerDataType, default: () ) –

    the layer, data_type pairs to flatten on

  • depth (int, default: None ) –

    Depth of the flattening, defaults to None.

Source code in gdsr/_gdsr.pyi
def flatten(
    self, *layer_data_types: LayerDataType, depth: int | None = None
) -> Self:
    """Flatten the cell to a certain depth on the specified layer, data_type pairs.

    Each reference on the depth is replaced by the elements it references.
    If the depth is 0, nothing is flattened
    If the depth is 1, only the first level of references is flattened
    and so on.

    When depth is None, the cell is flattened to the deepest level.

    This method modifies the cell in place and returns itself.

    :param LayerDataType layer_data_types: the layer, data_type pairs to flatten on
    :param int depth: Depth of the flattening, defaults to None.
    """

get_elements

get_elements(*layer_data_types: LayerDataType, depth: int | None = None) -> list[Element]

Return a list of elements in the cell.

This method does not modify the cell. It simply returns the elements until the specified depth. If a reference is encountered before it reaches the specified depth, the reference is flattened to the level of depth relative to the cell.

When depth is None, the cell is flattened to the deepest level.

Parameters:

  • layer_data_types (LayerDataType, default: () ) –

    the layer, data_type pairs to flatten on

  • depth (int, default: None ) –

    Depth of the flattening, defaults to None.

Source code in gdsr/_gdsr.pyi
def get_elements(
    self, *layer_data_types: LayerDataType, depth: int | None = None
) -> list[Element]:
    """Return a list of elements in the cell.

    This method does not modify the cell. It simply returns the elements
    until the specified depth. If a reference is encountered before
    it reaches the specified depth, the reference is flattened to the
    level of depth relative to the cell.

    When depth is None, the cell is flattened to the deepest level.

    :param LayerDataType layer_data_types: the layer, data_type pairs to flatten on
    :param int depth: Depth of the flattening, defaults to None.
    """

copy

copy() -> Self

Return a copy of the cell.

Source code in gdsr/_gdsr.pyi
def copy(self) -> Self:
    """Return a copy of the cell."""

to_gds

to_gds(file_name: PathLike | None = None, units: float = 1e-06, precision: float = 1e-10) -> str

Write the Cell to a GDS file.

Parameters:

  • file_name (PathLike, default: None ) –

    Output GDS file name.

  • units (float, default: 1e-06 ) –

    GDS file units in meters, defaults to 1e-6.

  • precision (float, default: 1e-10 ) –

    GDS file precision, defaults to 1e-10.

Returns:

  • str

    GDS file name

Source code in gdsr/_gdsr.pyi
def to_gds(
    self,
    file_name: PathLike | None = None,
    units: float = 1e-6,
    precision: float = 1e-10,
) -> str:
    """Write the Cell to a GDS file.

    :param PathLike file_name: Output GDS file name.
    :param float units: GDS file units in meters, defaults to 1e-6.
    :param float precision: GDS file precision, defaults to 1e-10.
    :return: GDS file name
    """

is_on

is_on(*layer_data_types: LayerDataType) -> bool

Return True if the cell is on any of the layer, data_type pairs.

This method returns True if all elements in the cell are on any of the layer, data_type pairs.

Source code in gdsr/_gdsr.pyi
def is_on(self, *layer_data_types: LayerDataType) -> bool:
    """Return True if the cell is on any of the layer, data_type pairs.

    This method returns True if all elements in the cell are on any of the
    layer, data_type pairs.
    """

__contains__

__contains__(element: Element) -> bool

Return True if the cell contains the element.

Source code in gdsr/_gdsr.pyi
def __contains__(self, element: Element) -> bool:
    """Return True if the cell contains the element."""

__str__

__str__() -> str

Return a string representation of the cell.

Source code in gdsr/_gdsr.pyi
def __str__(self) -> str:
    """Return a string representation of the cell."""

__repr__

__repr__() -> str

Return a string representation of the cell.

Source code in gdsr/_gdsr.pyi
def __repr__(self) -> str:
    """Return a string representation of the cell."""

__eq__

__eq__(value: object) -> bool

Return True if the cell is equal to another object.

Source code in gdsr/_gdsr.pyi
def __eq__(self, value: object) -> bool:
    """Return True if the cell is equal to another object."""