Friendly PCell definitions

This library offers a klayout PCell decorator, which is much easier to use than the default PCell offered by the KLayout api. Moreover, the PCell decorator can be with a GDSFactory component function (or any function that produces a gdspy cell) as well!

To use FLayout PCells, first install flayout as a system python package (so that you can access it through the klayout gui):

cd /path/to/flayout
pip install --user .

Alternatively, you can also open the klayout gui from within the fl python environment (linux only)

Then within klayout add a simple macro to import the flayout example library

from flayout.example_lib import *

Note that running this macro takes a while in KLayout (about 10 seconds).

After running the macro, open a new gdsfile and find the Flayout PCells in the "F.E.L - Flayout Example Library", which supplies two gdsfactory-defined components: the mzi and euler bend. These components are now imported as PCells!

You can have a look at how the example library is implemented and try something similar for yourself!

pcell[source]

pcell(func=None, on_error='raise')

create a KLayout PCell from a native python function

Args:
    func: the function creating a KLayout cell

Returns:
    the Klayout PCell