Support Forum

Create a new cell in an existing GDS (Python Script)

Eva

Thursday 30th June 2022
Good morning, I would like to create a new cell in an existing GDS. I don't find the python function to open it. Do you know how can I do that ? Best Regards, Eva
Jürgen
LayoutEditorFull
Thursday 30th June 2022
A *addCell* call will do that: ```python import LayoutScript from LayoutScript import * l=project.newLayout(); # open new instance of layout class dr=l.drawing # pointer to the main drawing newCell = dr.addCell().thisCell newCell.cellName="my new cell" dr.setCell(newCell) ```
Eva

Thursday 30th June 2022
Thank you for your response. I'm using the follow function to save the new cells in a existing GDS : ``` import os l.drawing.saveFile(os.path.expanduser('PATH')+"/testout.gds") ``` However, when I'm using it, the new cells overwrite on previous existing cells in testout.gds. Should I use a different function ? Maybe a append function ? Best Regards, Eva
Jürgen
LayoutEditorFull
Thursday 30th June 2022
*saveFile* will store the current opened GDS design to disk. The previous file will be overwritten. To merge two (GDS) designs open the first design and then attach the second design to it with a *importFile* call. All cells of both design files will be load afterwards and a *saveFile* call will save both.