Most of effective way of getting box coordinates for a given cell and a given layer.

edited August 2020 in Python scripting

Hello, I am trying to write a script which will have an input of layer name and a cell name, then I want it to return all cOordinates of boxes within the given layer and given cell.

Does anyone have any suggestions from where to start?
For instance I can get all coordinates of boxes for a given cell by using"select, path_trans * cell.bbox, path_trans.disp.x, path_trans.disp.y from instances of ...*")

     for q in my_layout_query.each(layout):  #iterate with cell names
       if box_info[0]==cell_to_iterate:

However I am not sure how to get the box/shape coordinates for a specific layer.

Thank you! I really appreciate your help!.


  • edited August 2020

    I think I found the answer. Hope this helps to any other people who need to do the same task. It is really nice that you can even do it for multiple layers simultaneously! This will give you the absolute coordinates of each shape for a given cell and given layer or layers

    cell=layout.cell('name_of_the_cell') ,cell,[layer_index1,layer_index2])
    while not iter.at_end():
      box_in_cell = iter.shape().box
      box_in_initial_cell = iter.trans() * iter.shape().box
  • Hi,

    thanks for sharing this solution!

    The code is correct, I just think you wanted to use "box_in_cell" in the following expression like this:

      box_in_cell = iter.shape().box
      box_in_initial_cell = iter.trans() * box_in_cell



Sign In or Register to comment.