gdsfactory.ComponentReference

gdsfactory.ComponentReference#

class gdsfactory.ComponentReference(component: Component, origin: Coordinate = (0, 0), rotation: float = 0, magnification: float = 1, x_reflection: bool = False, visual_label: str = '', columns: int = 1, rows: int = 1, spacing=None, name: str | None = None, v1: tuple[float, float] | None = None, v2: tuple[float, float] | None = None)[source]#

Pointer to a Component with x, y, rotation, mirror.

Parameters:
  • component – Component The referenced Component.

  • columns – Number of columns in the array.

  • rows – Number of rows in the array.

  • spacing – Distances between adjacent columns and adjacent rows.

  • origin – array-like[2] of int or float Position where the cell is inserted.

  • rotation – int or float Angle of rotation of the reference (in degrees).

  • magnification – int or float Magnification factor for the reference.

  • x_reflection – bool If True, the reference is reflected parallel to the x direction before being rotated.

  • name – str (optional) A name for the reference (if provided).

__init__(component: Component, origin: Coordinate = (0, 0), rotation: float = 0, magnification: float = 1, x_reflection: bool = False, visual_label: str = '', columns: int = 1, rows: int = 1, spacing=None, name: str | None = None, v1: tuple[float, float] | None = None, v2: tuple[float, float] | None = None) None[source]#

Initialize the ComponentReference object.

Methods

__init__(component[, origin, rotation, ...])

Initialize the ComponentReference object.

area([layer])

Returns the area of the component.

connect(port, destination[, overlap, ...])

Return ComponentReference where port connects to a destination.

get_bounding_box()

get_labels([depth, set_transform])

Return the list of labels created by this reference.

get_paths([depth])

Return the list of paths created by this reference.

get_polygon_bbox([default, top, bottom, ...])

Returns shapely Polygon with padding.

get_polygon_enclosure()

get_polygons([by_spec, depth, ...])

Return the list of polygons created by this reference.

get_ports_dict(**kwargs)

Return a dict of ports.

get_ports_list(**kwargs)

Return a list of ports.

get_ports_xsize(**kwargs)

Return xdistance from east to west ports.

get_ports_ysize(**kwargs)

Returns ydistance from east to west ports.

mirror([p1, p2])

Mirrors.

mirror_x([port_name, x0])

Perform horizontal mirror using x0 or port as axis (default, x0=0).

mirror_y([port_name, y0])

Perform vertical mirror using y0 as axis (default, y0=0).

move([origin, destination, axis])

Move the ComponentReference from origin point to destination.

movex([origin, destination])

Moves an object by a specified x-distance.

movey([origin, destination])

Moves an object by a specified y-distance.

port_by_orientation_ccw(key, **kwargs)

Return port by indexing them clockwise.

port_by_orientation_cw(key, **kwargs)

Return port by indexing them clockwise.

pprint_ports()

Pretty print component ports.

rotate([angle, center])

Return rotated ComponentReference.

to_dict()

translate(dx, dy)

validate(v, _info)

Check with pydantic ComponentReference valid type.

Attributes

bbox

Return the bounding box of the ComponentReference.

center

Returns the center of the bounding box.

columns

info

layers

magnification

metadata_child

name

origin

owner

parent

ports

This property allows you to access myref.ports, and receive a copy.

ports_layer

portName.

ref_cell

rotation

rows

settings

size

Returns the (x, y) size of the bounding box.

size_info

spacing

v1

v2

x

Returns the x-coordinate of the center of the bounding box.

x_reflection

xmax

Returns the maximum x-value of the bounding box.

xmin

Returns the minimum x-value of the bounding box.

xsize

Returns the horizontal size of the bounding box.

y

Returns the y-coordinate of the center of the bounding box.

ymax

Returns the maximum y-value of the bounding box.

ymin

Returns the minimum y-value of the bounding box.

ysize

Returns the vertical size of the bounding box.