It looks like you're new here. If you want to get involved, click one of these buttons!
Hi Matthias,
I would like to copy the specified cell A in the GDS file to another empty layout using Python.
(Finally, it is to create CellInstArray for cell A in new empty layout. I understood that in order to create CellInstArray, the cell to refer to must be in the same layout object. Please let me know If I am mistaken.)
So I found a similar question in the forum.
https://www.klayout.de/forum/discussion/274/how-to-copy-a-specified-cell-from-one-layout-to-another
However, I wonder if a new one-line copy method has been created, not a solution using a clip box.
Do I still have to use the clip box?
Comments
You can do this in two lines:
1. Save the cell A as OASIS file from the old layout
2. Read the OASIS file into the new layout
Note that this copies not only cell A but also all sub-cells of A. So if you do this into an empty layout there are no issues, but if you do it again for a cell B you would need to specify what to do if some sub-cells already exist in the new layout. E.g. overwrite, see the
Layout.read()
method with theLoadLayoutOptions
object, specificallycell_conflict_resolution
.@ejprinz Thank you for this explanation
@thor If you want to avoid the trip through a file, you can use an integrated script like this (without clip box):
Matthias
@Matthias Thank you very much. I solved the problem easily
I have an additional question. Maybe it's a little different from the topic.
When I create multiple CellInstArray for one cell (if the cell name is AAA),
"$" marks were added later, such as AAA$1 or AAA$2. Is there a solution to this?
Or is the creation of multiple CellInstArray for one cell fundamentally prohibited?
@thor No, "$" disambiguators are only added if you create two or more cells with the same name. So I assume your code is not just creating a cell instance ("place it"), but somehow creating new cells, all called "AAA".
Could you paste some example?
Matthias