It looks like you're new here. If you want to get involved, click one of these buttons!
Hi,
I would like to merge multiple GDS that contain the same cell name by running .tpl
file using Python.
But once I merged, the cell will have the same layer overlapped with number of the cells.
Can I avoid this? Even if you have the same cell name, merge them with only one cell not ovelapping.
I use this code for merging cells.
for cell in final_layout.top_cells():
if cell.name != "{{top_level[0]}}":
new_instance = pya.CellInstArray(cell.cell_index(), pya.Trans(x, y) * rotation)
top_cell.insert(new_instance)
Comments
Could you give some context ?
Any specific reason why you want to do that inside klayout using a script ?
This can also be done with klayout's buddy tools strm2gds/strm2oas, which will take care of uniquification.
I can't answer your original questions, but I'm pretty sure it can be done with python scripting too.
I believe that File>Import>Other_Files_Into_Current from
another GDS file" will "uniquify" duplicate names encountered
during the import, if you use the menu command.
Thank you guys,
I think Stefan's suggestion make sense, maybe I can use some python package for this function
In Python, the solution is simply
Cells with the same name in "file1.gds" and "file2.gds" will be merged into one cell. If that happens for the top level cell, this is usually fine and to my understanding this is what you need. If it happens for child cells however, the result is usually not useful. I would recommend this way only for flat layouts or when it is made sure by other ways that child cells carry different names in the different files.
Matthias