Dataprep#
When building a reticle sometimes you want to do boolean operations. This is usually known as dataprep.
You can do this at the component level or at the top reticle assembled level.
This tutorial is focusing on cleaning DRC on masks that have already been created.
import gdsfactory as gf
from gdsfactory.generic_tech.layer_map import LAYER
import gplugins.klayout.dataprep as dp
You can manipulate layers using the klayout LayerProcessor to create a RegionCollection
to operate on different layers.
The advantage is that this can easily clean up routing, proximity effects, acute angles.
c = gf.Component()
ring = c << gf.components.coupler_ring(radius=20)
c.write_gds("input.gds")
d = dp.RegionCollection(gdspath="input.gds")
c.plot()
Copy layers#
You can access each layer as a dict.
Remove layers#
Size#
You can size layers, positive numbers grow and negative shrink.
Over / Under#
To avoid acute angle DRC errors you can grow and shrink polygons. This will remove regions smaller
Smooth#
You can smooth using RDP
Booleans#
You can derive layers and do boolean operations.
Fill#
import gdsfactory as gf
import kfactory as kf
from kfactory.utils.fill import fill_tiled
c = kf.KCell("ToFill")
c.shapes(kf.kcl.layer(1, 0)).insert(
kf.kdb.DPolygon.ellipse(kf.kdb.DBox(5000, 3000), 512)
)
c.shapes(kf.kcl.layer(10, 0)).insert(
kf.kdb.DPolygon(
[kf.kdb.DPoint(0, 0), kf.kdb.DPoint(5000, 0), kf.kdb.DPoint(5000, 3000)]
)
)
fc = kf.KCell("fill")
fc.shapes(fc.kcl.layer(2, 0)).insert(kf.kdb.DBox(20, 40))
fc.shapes(fc.kcl.layer(3, 0)).insert(kf.kdb.DBox(30, 15))
# fill.fill_tiled(c, fc, [(kf.kcl.layer(1,0), 0)], exclude_layers = [(kf.kcl.layer(10,0), 100), (kf.kcl.layer(2,0), 0), (kf.kcl.layer(3,0),0)], x_space=5, y_space=5)
fill_tiled(
c,
fc,
[(kf.kcl.layer(1, 0), 0)],
exclude_layers=[
(kf.kcl.layer(10, 0), 100),
(kf.kcl.layer(2, 0), 0),
(kf.kcl.layer(3, 0), 0),
],
x_space=5,
y_space=5,
)
gdspath = "mzi_fill.gds"
c.write(gdspath)
c.plot()