as_component

photonforge.stencil.as_component(*, layer, stencil, technology=None, **stencil_kwargs)

Create a parametric component from a stencil.

Parameters:
  • layer (str | Sequence) – Layer to be used for the stencil. In the case of stencil functions that return multiple structure lists (like vernier_scale()), one layer per list is required.

  • stencil (Literal[dict_keys(['cross', 'focused_grating', 'grating', 'linear_taper', 'mmi', 'ruler', 'vernier_scale', 'text'])]) – Name of the stencil function.

  • technology (Technology) – Component technology. If None, the default technology is used.

  • stencil_kwargs – Keyword arguments for the stencil function.

Returns:

Parametric photonforge.Component

Note

The photonforge.text() function can also be used in this function as a stencil.

Examples

>>> grating_component = stencil.as_component(
...     layer="SLAB",
...     stencil="grating",
...     period=0.6,
...     num_periods=20,
...     width=10,
...     taper_length=30,
...     taper_width=0.5,
... )
>>> scale_component = stencil.as_component(
...     layer=("SLAB","WG_CORE"),
...     stencil_name="vernier_scale",
...     unit=15,
...     marker_length=20,
...     marker_width=2,
... )