Rotating and translating shapes in a particular cell

Hello, I know this is a very simple question but I couldn't figure it out.

I have a cell and I am trying to rotate by 90 degrees and then translate it in x direction. But I couldn't understand how can I do it for a particular cell from python script.

cell = layout.cell('TopCell')
layer = layout.layer(1, 0)
cell.shapes(layer).insert(pya.Box(1111, 2222,4000, 3000))  # LOWLX, LOWLY, UPRX, UPRY #define the transformation

#How to rotate the shapes in the cell? I want to produce the rotated copy of the cell with the name 'rotatedCell'

Thank you!


  • Hi,

    I wonder why you need this - because the idea of a cell is to be able to place it different ways. So instead of creating two copies, you could place the cell once without rotation and once with.

    Is this what you're looking for?


  • Hello matthias, I found the solution but thanks anyways!

                        trans = pya.Trans(transPoint)
                        subInst = pya.CellInstArray(0, trans)  #first arg is the cell index of child
  • This is actually what I meant :)

    One hint: you should not hardcode the "0" for the cell index as the numbering of cells is an implementation detail which might change. If you create a cell, you can get the cell index from the cell object using "cell_object.cell_index()".



Sign In or Register to comment.