copy & paste PCells

edited November 2016 in KLayout Support

Hi Matthias,

When I am merging layouts, or copying layouts from other files, I would like to retain the PCells rather than have them get flattened. This is useful when working with large projects and building up layouts from previous designs, other people, etc.

For example:

  • create an instance of MyLib.Circle (default settings), in a blank layout, in a top cell "a"
  • copy cell "a" (select Deep copy), and paste it in layout "b"
  • it shows up as "Circle" instead of MyLib.Circle (flattened, no longer PCell)

Shallow copy on the other hand works keeps the PCell. Unless it is in a hierarchy, in which it either misses some cells, or in one case gave an error "Internal error: /Users/sekigawa.../src/ topological_sort() was not true" and froze.

I also tried various styles of "Import" "Other File into Current" but again it flattens the library references. I experienced some crashes here as well.

(this is version 0.24.8).

thank you


  • edited 9:09PM

    Hi Lukas,

    Basically a PCell is not a special cell. It's a special Instance (one that is enhanced with PCell parameters). So basically you cannot copy a PCell by a cell copy. But you can copy a PCell by copy/pasting the instance of the PCell: click on the PCell instance in the layout and copy/paste it to the new layout.

    If you copy the cell it becomes an instance-less thing and that cannot be a PCell. Hence the cell is transformed into a normal cell.

    I would be interested to know how to reproduce the crashes, but I imagine it's dependent on the way your library is built. Can you supply a test case?



  • edited 9:09PM

    Thanks Mattias,

    I see that I can do a copy & paste one by one, as long as I select the individual PCell instance in the layout. But if the PCell resides in a hierarchy, and I try to copy that top cell in the layout, it pops up the dialog of Shallow vs. Deep.

    Perhaps as a feature request, you could extend the copy & paste functionality to not just work on one cell instance, but rather many within a hierarchy?

    re: crashes, I'll see if I can reproduce this on a clean installation with the default libraries.


  • edited 9:09PM

    Hi Lukas,

    I think I got your point. I'll try to add this.

    Thanks for bringing this up.

    Kind regards,


Sign In or Register to comment.