Making a PCell from an existing PCell

Actually, this topic is not new, I found a solution to that on the Klayout website. But, unfortunately, even with that solution, I could not successfully do the task.

The problem: I have a PCell called ParrTnPatch which is successfully registered in a library and usable via Instance toolbar button. Then I created a new PCell called PSAW01 to create an instance of the former ParrTnPatch PCell. The code gives no error. But when I use the instance toolbar button to put the PCell in the layout, and select PSAW01 from the library, nothing becomes attached to the mouse curser, but the PCell becomes added to the TOP cell in the tree.
I have attached the files of the two PCells to this message.

Would you please direct me how to solve this issue? Thanks.

Comments

  • Is that ChatGPG hallucinating?

    You cannot create a Layout object simply ("lto") and hope the cell you are creating there ("top_cell") will magically be transferred into your drawing. That's not how things work.

    Here is an example of how to place a PCell (here "Basic.TEXT") in another PCell: https://www.klayout.de/forum/discussion/1578/place-basictext-into-pcell

    Matthias

  • Hello Matthias,
    thanks for accepting me in the forum and thanks for the reply and sorry for the delay in response.
    I corrected my code according to your example and there was improvement, but still I can see only one rectangle of an array of rectangles that are in the referenced PCell, if I am not hallucinating again.
    I think I have to go over my code again.

  • edited June 6

    Hi @Armo - good to know there is a human at the end of the line :)

    Actually your latest code is way better and you correctly captured the concept.

    There is just a tiny bug: If I replace

        param = {"lyr": self.layer, "digitW": 1500, "digitL": 70000}       
    

    by this:

        param = {"lyr": self.lyr, "digitW": 1500, "digitL": 70000}       
    

    in PSAW#produce_impl, it seems to be working for me.

    That is because the parameter is called "lyr", not "layer". "lyr_layer" is a derived parameter that KLayout provides for convenience and which holds the layer index in the current layout corresponding to the layer specified in the parameter (which is a layer/datatype/name combination, aka LayerProperties).

    Matthias

Sign In or Register to comment.