Relative Area Check Using DRC

edited July 2019 in Ruby Scripting

Hello,

I'm attempting to create a DRC that calculates the area of all the polygons on a layer, and compares the largest area to the smallest area. Anyone know what functions or methods would work best for this?

Thank you!

Comments

  • Hi,

    there is no built-in function to get the min area, but you can script it:

    report("discussion_1278")
    
    layer = input(43, 0)
    
    # compute min area
    min_area = nil
    layer.data.each_merged do |poly|
      area_in_dbu = poly.area * dbu * dbu
      if min_area
        min_area = [ min_area, area_in_dbu ].min
      else
        min_area = area_in_dbu
      end
    end
    
    if min_area
      layer.with_area(min_area * 3, nil).output("Everything with more than 3x the min area")
    end
    

    However, this will be fairly slow.

    Matthias

  • That worked perfectly thank you!

Sign In or Register to comment.