How to return corresponding EdgePairs with function Region:corners()?

I need to do some processing according to the corner length. Is there any way to get the corresponding edgepairs of corners?

Comments

  • edited May 19

    I wrote a python function to do this, but I still want to see the edgepairs output in the original function, because a lot of the handling of the corners requires information about their two edges.thank you

    def corner_edge_pairs(region, angle_min, angle_max):
    '''
    :parma region: input db.Region
    :parma angle_min: min angle used in Region.corners.dots()
    :parma angle_max: max angle used in Region.corners_dots()
    :return edge_pairs: edge pairs of the corners of Region.corners_dots()
    '''
        polygon_edges = region.edges()
        corners_dots = region.corners_dots(angle_min, angle_max)
        corres_edges = polygon_edges.interacting(corners_dots)
        edge_pairs = db.EdgePairs()
        for dot in corners_dots:
            edges = corres_edges.interacting(dot)
            if len(edges) == 2:
               # print("We find a corner edgepair:", edges)
                edge_pairs.insert(edges[0], edges[1])
            else:
                print("We find a corner, but dont find corresponding edgepair:", edges)
        return edge_pairs
    
  • Hi @garry,

    there is no such function yet, but it should be easy to add. Thanks for this suggestion. I have created a ticket for this: https://github.com/KLayout/klayout/issues/808

    Matthias

  • Thank you very much! @Matthias

  • @garry I have release 0.27.1 with this feature:

    Python / Ruby:

    edge_pairs = region.corners_edge_pairs()
    

    DRC:

    edge_pairs = layer.corners(as_edge_pairs)
    

    Matthias

  • Thanks! @Matthias Klayout is a really wonderful layout editor tool.

  • @garry You're welcome! And thanks for this feedback! :)

Sign In or Register to comment.