Ports

Port

Bases: _InstantiationTrackerMixin

Class representing a port in a microfluidic device.

Ports are used to connect components and define their interaction with the environment.

Each port has a type (IN, OUT, INOUT), a position in 3D space, a size, and a surface normal.

The surface normal defines the direction in which the port is oriented.

PortType

Bases: Enum

Enumeration for port types.

  • IN: Port for input.
  • OUT: Port for output.
  • INOUT: Port for input and/or output.

SurfaceNormal

Bases: Enum

Enumeration for surface normals.

  • POS_X: Positive X direction.
  • POS_Y: Positive Y direction.
  • POS_Z: Positive Z direction.
  • NEG_X: Negative X direction.
  • NEG_Y: Negative Y direction.
  • NEG_Z: Negative Z direction.

__init__

__init__(
    _type: PortType,
    position: tuple[int, int, int],
    size: tuple[int, int, int],
    surface_normal: SurfaceNormal,
)

Initialize a port.

Parameters:

  • _type (PortType): The type of the port (IN, OUT, INOUT).
  • position (tuple[int, int, int]): The position of the port in 3D space.
  • size (tuple[int, int, int]): The size of the port.
  • surface_normal (SurfaceNormal): The surface normal of the port, defining its orientation.

copy

copy() -> 'Port'

Create a copy of the port.

get_position

get_position(
    px_size: float = None, layer_size: float = None
) -> tuple[int, int, int]

Get the position of the port in 3D space.

Parameters: - px_size (float, optional): The pixel size in mm. If not provided, uses the component's pixel size. - layer_size (float, optional): The layer size in mm. If not provided, uses the component's layer size.

Returns: - A tuple of three integers representing the position of the port (x, y, z).

get_size

get_size(
    px_size: float = None, layer_size: float = None
) -> tuple[int, int, int]

Get the size of the port.

Parameters: - px_size (float, optional): The pixel size in mm. If not provided, uses the component's pixel size.

Returns: - A tuple of three integers representing the size of the port (width, height, depth).