How to get all the cell / polygon object in special area.

Hi Sir ,
in Ruby , how to get cell / polygon pattern / object in a special area?
such as ...
cell : DIE
BBox (500,500) , (-500,-500)
that means I want to get the sub cells in the top cell "DIE" , and get cell within BBox area only.
in Ruby / Python , how to do that?

Comments

  • edited June 18

    @jiunnweiyeh You can use the RecursiveShapeIterator for this purpose.

    ly = ... your layout ..
    top = ly.top_cell
    layer = ly.layer(1, 0)   # TODO: takes layer 1/0
    iter = top.begin_shapes_rec_touching(layer, RBA::Box::new(-500, -500, 500, 500))  # TODO: adjust box
    while !iter.at_end
      if iter.shape.is_polygon?
        poly = iter.shape.polygon.transformed(iter.trans)
        # TODO: do something with poly ...
      else
        # TODO: other shape types
      end
      iter.next
    end
    

    Matthias

  • Hi Matthias,
    for the code ly=.......your layout ,
    Is it means that like this code?

    LayoutView = RBA::Application::instance.main_window.current_view.active_cellview.layout

    Another new question is ... how to draw a box in current cell?
    It may like this one....
    layer = ly.layer(1, 0)
    iter = top.create_shapes_rec(layer, RBA::Box::new(-500, -500, 500, 500))

  • @jiunnweiyeh Yes, you somehow need to address the layout you're taking the shapes from. To get the current layout, use "RBA::CellView.active.layout".

    I can't say how you want your box to be defined. I just used the coordinates you have given.

    Matthias

Sign In or Register to comment.