PCell Instances
This sample shows show to create PCell instances. It uses “TEXT” from the
“Basic” library which needs to be enabled by using import klayout.lib
.
Note: The PCell parameters are specific for the kind of PCell.
Code to list the parameters for all PCells from the “Basic” library can be downloaded here: list_pcell_parameters.py
.
Code:
import klayout.db as db
# This will enable the Basic library
import klayout.lib
ly = db.Layout()
top_cell = ly.create_cell("TOP")
layer = ly.layer(1, 0)
# The parameter names are specific for the
parameters = {
"layer": db.LayerInfo(1, 0),
"text": "KLAYOUT",
"mag": 10.0
}
cell = ly.create_cell("TEXT", "Basic", parameters)
top_cell.insert(db.CellInstArray(cell.cell_index(), db.DTrans()))
ly.write("pcell_instances.gds")
Result: