KLayout / klayout

KLayout Main Sources
http://www.klayout.org
GNU General Public License v3.0
808 stars 206 forks source link

Single PCell file cannot be read #1835

Closed klayoutmatthias closed 2 months ago

klayoutmatthias commented 3 months ago

The following file is a single PCell instance:

https://github.com/IHP-GmbH/IHP-Open-DesignLib/blob/main/ElemRV/design_data/src/macros/sealring/sealring_2015x2014.gds.gz

Formally this is not legal as a PCell only exists through an instance. However it appears to be possible to save a PCell variant and receive such a file. This file behaves weirdly. It does not show any layout and when trying to add a new cell, KLayout complains that no layout is opened.

The expected behavior is that in such a case, the cell is loaded and converted to a static cell.

In addition, saving a PCell variant to a file should give a warning at least and if intended, the cell should be saved without context to make it a static cell.

The workaround is to save the cell without context (use "Save As" and disable context in the writer options) or to convert it to a static cell before saving.

klayoutmatthias commented 2 months ago

The implemented solution will show the cell in the mentioned case, but it is kind of volatile. You can create a new top cell and add the original cell as a child cell. This will make it a valid PCell instance again. You can also convert the PCell into a static cell.

However, as soon as you create other cells and instances, at some point the PCell will be cleaned up, like all PCells are when they are not used.