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

t=pya.DTrans.new(pya.DTrans.R90) #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!

Comments

  • 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?

    Matthias

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

        transPoint=pya.Point(0,0)
                        trans = pya.Trans(transPoint)
                        Instance_cell_index=0
                        subInst = pya.CellInstArray(0, trans)  #first arg is the cell index of child
                        parent_cell.insert(subInst)
    
  • 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()".

    Regards,

    Matthias

Sign In or Register to comment.