Skip to content

draw_paste

draw_paste

Base class for creating components for aperture creation.

DrawPaste

Bases: DrawCommand

Description of aperture component.

Source code in src/pygerber/backend/abstract/draw_commands/draw_paste.py
class DrawPaste(DrawCommand):
    """Description of aperture component."""

    other: DrawingTarget
    center_position: Vector2D

    def __init__(
        self,
        backend: Backend,
        polarity: Polarity,
        other: DrawingTarget,
        center_position: Vector2D,
    ) -> None:
        """Initialize draw command."""
        super().__init__(backend, polarity)
        self.other = other
        self.center_position = center_position

    def get_bounding_box(self) -> BoundingBox:
        """Return bounding box of draw operation."""
        return self._bounding_box

    @cached_property
    def _bounding_box(self) -> BoundingBox:
        return self.other.bounding_box + self.center_position

__init__

__init__(
    backend: Backend,
    polarity: Polarity,
    other: DrawingTarget,
    center_position: Vector2D,
) -> None

Initialize draw command.

Source code in src/pygerber/backend/abstract/draw_commands/draw_paste.py
def __init__(
    self,
    backend: Backend,
    polarity: Polarity,
    other: DrawingTarget,
    center_position: Vector2D,
) -> None:
    """Initialize draw command."""
    super().__init__(backend, polarity)
    self.other = other
    self.center_position = center_position

get_bounding_box

get_bounding_box() -> BoundingBox

Return bounding box of draw operation.

Source code in src/pygerber/backend/abstract/draw_commands/draw_paste.py
def get_bounding_box(self) -> BoundingBox:
    """Return bounding box of draw operation."""
    return self._bounding_box