Polygon sizing/biasing

Hi,
I am trying to do resize existing polygon in the layer by some amount. Can anyone help how can I do it in python scripting. Thanks

Comments

  • edited August 2021

    I tried this - it does not give any error but also do not draw anything
    for ss in topcell.each_shape(layer_index_source):
    a=ss.is_box()
    aa=ss.polygon
    resize=10/du
    aaa=aa.sized(resize)
    topcell.shapes(layer_source_index).insert(pya.Polygon.new(aaa))

  • @sheikh_nir Well, this works for me:

    ly = pya.CellView.active().layout()
    topcell = ly.top_cell()
    # use layer 16/0
    layer_index_source = ly.layer(16, 0)
    
    for ss in topcell.each_shape(layer_index_source):
      a = ss.is_box()
      aa = ss.polygon
      resize = 10/ly.dbu
      aaa = aa.sized(resize)
      ss.polygon = aaa
    

    Please note two things:

    • The resulting polygons may look ugly. The reason is that sizing will give nice results for convex corners only after merging
    • The loop only runs over the top cell. It does not size shapes in subcells.

    Matthias

Sign In or Register to comment.