Exporting a GDSII/OASIS Layout

Any component can be exported directly to a GDSII or OASIS file using the write_gds and write_oas methods. Here’s a simple example using a parametric component.

We first configure the default technology:

[1]:
import photonforge as pf

pf.config.default_technology = pf.basic_technology()

Now we create a simple S bend and export it to both a GDSII and an OASIS layout files:

[2]:
s_bend = pf.parametric.s_bend(port_spec="Strip", length=10.0, offset=3.0, name="s_bend")
s_bend.write_gds()
s_bend.write_oas()
[2]:
../_images/guides_Layout_Export_3_0.svg

If we want to store several components in a single layout file, we can also use the write_layout function. Note that component dependencies are automatically included in either case, so there’s no need to list those separately.

In this case, we store both the previous S bend and a waveguide transition into “mixed.gds”:

[3]:
transition = pf.parametric.transition(port_spec1="Strip", port_spec2="Rib", length=10, name="transition")

pf.write_layout("mixed.gds", s_bend, transition)

If we import layout and check its top-level components, we’ll find both in there:

[4]:
components = pf.load_layout("mixed.gds")

top_level = pf.find_top_level(*components.values())

print("Top level: " + ", ".join(c.name for c in top_level))
Top level: s_bend, transition