Skip to content

Commit

Permalink
Merge pull request #228 from tvt173/dataprep-save-options
Browse files Browse the repository at this point in the history
add save_options argument when writing gds
  • Loading branch information
joamatab authored Nov 15, 2023
2 parents 1df0943 + 0fcffc0 commit 4d9459d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion gplugins/klayout/dataprep/regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,24 @@ def write_gds(
gdspath: PathType = GDSDIR_TEMP / "out.gds",
top_cell_name: str | None = None,
keep_original: bool = True,
save_options: kdb.SaveLayoutOptions | None = None,
) -> None:
"""Write gds.
Args:
gdspath: output gds path
top_cell_name: name to use for the top cell of the output library
keep_original: if True, keeps all original cells (and hierarchy, to the extent possible) in the output. If false, only explicitly defined layers are output.
save_options: if provided, specified KLayout SaveLayoutOptions are used when writing the GDS
"""
# use the working top cell name if not provided
if top_cell_name is None:
top_cell_name = self.layout.name
c = self.get_kcell(cellname=top_cell_name, keep_original=keep_original)
c.write(gdspath)
if save_options:
c.write(gdspath, save_options=save_options)
else:
c.write(gdspath)

def plot(self, **kwargs):
"""Plot regions."""
Expand Down

0 comments on commit 4d9459d

Please sign in to comment.