gdsfactory.grid#
- gdsfactory.grid(components=('rectangle', 'triangle'), spacing=(5.0, 5.0), shape=None, align_x='center', align_y='center', rotation=0, mirror=False)[source]#
Returns Component with a 1D or 2D grid of components.
- Parameters:
components (Sequence[str | Callable[[...], Component] | dict[str, Any] | DKCell]) – Iterable to be placed onto a grid. (can be 1D or 2D).
spacing (tuple[float, float] | float) – between adjacent elements on the grid, can be a tuple for different distances in height and width or a single float.
shape (tuple[int, int] | None) – x, y shape of the grid (see np.reshape). If no shape and the list is 1D, if np.reshape were run with (1, -1).
align_x (Literal['origin', 'xmin', 'xmax', 'center']) – x alignment along (origin, xmin, xmax, center).
align_y (Literal['origin', 'ymin', 'ymax', 'center']) – y alignment along (origin, ymin, ymax, center).
rotation (int) – for each component in degrees.
mirror (bool) – horizontal mirror y axis (x, 1) (1, 0). most common mirror.
- Returns:
Component containing components grid.
- Return type:
import gdsfactory as gf components = [gf.components.triangle(x=i) for i in range(1, 10)] c = gf.grid( components, shape=(1, len(components)), rotation=0, mirror=False, spacing=(100, 100), ) c.plot()
(
Source code
,png
,hires.png
,pdf
)