Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Setting properties for PCells


I am slightly lost in user properties. I understand, that Shape, Cell and CellInstance can all have their properties. I would like to pass some information about a PCell via the properties, but if I use self.cell.set_property(name, value) in produce_impl of a PCellDeclarationHelper, the property does not appear for either PCell variant (one in the Cell view on the left) nor for cell instance (one in the design). How could I set properties for the instances of PCell in the PCell definition code?


  • Hi,

    you cannot. A PCell shall deliver layout and not modify the external attributes of a cell (such as name, placement, etc.). The user properties are among the external attributes. Instances cannot be accessed from within the PCell because KLayout will optimize the PCell generation such that different instances with the same parameter set will share the same PCellVariant.

    You can use hidden PCell parameters to keep information you don't what to show up in the user interface, if that is the intention should have.



  • edited February 4

    My specific goal was to export Sonnet project files and use properties to define port locations. Then, a script could export all cells irrespective if they are PCell variants or manually created.

    I think I can use the properties of the shapes in the Cell for now.

    Initially I thought, that instances would inherit user properties from a PCell variant. But it seems that even PCell variant does not get the properties of the produced PCell.

  • Hello,

    Yes, shape properties are possible. You could also use texts to label the ports, if that is an option.

    Instance properties cannot be used because the PCell is the target of the instance, not the instance itself. Multiple instances can share the same PCell variant (variant in terms of PCell parameters). Hence there is no connection back from the PCell variant to the instance.

    If you really, really want to have an instance with properties you can create a cell inside the PCell and produce in instance of this cell inside ... but I'd only do this is absolutely necessary.



Sign In or Register to comment.