Source code for gdsfactory.components.copy_layers

from __future__ import annotations

import gdsfactory as gf
from gdsfactory import cell
from gdsfactory.component import Component
from gdsfactory.components.cross import cross
from gdsfactory.typings import ComponentSpec, LayerSpecs


[docs] @cell def copy_layers( factory: ComponentSpec = cross, layers: LayerSpecs = ((1, 0), (2, 0)), **kwargs ) -> Component: """Returns a component with the geometry copied in different layers. Args: factory: component spec. layers: iterable of layers. kwargs: keyword arguments. """ c = Component() for layer in layers: ci = gf.get_component(factory, layer=layer, **kwargs) _ = c << ci c.copy_child_info(ci) return c
if __name__ == "__main__": c = copy_layers(gf.components.rectangle) c.show()