DRC selecting corners

edited August 2018 in Layout

Hi Matthias,

I have problem using "corners" function.

ep.merged.corners(89.0 .. 271.0).output("Violation!","Angles of EP should be within [90,270].")


As you can see, the program highlighted corners of 90, 270.., but missed some corners in between and over-picked a corner that is less than 90.

Do you know how can I select the corners correctly?

Best regards, and thanks for a great free software!


  • Hi,

    I just see one suspicious case which is the right one of the bottommost two spots .. but it's difficult to see the true angles from the screenshot. Do you have a chance to attach a real GDS file with these sample polygons?


  • Hi Matthias,

    I tried to upload gds directly here but it did not work.

    Please try this link to get the gds:

    Command with correct output:

     ep.merged.corners(89.0 .. 271.0).output("Select corner of 90-270 degree.")


  • Hi Hai,

    you can add GDS files as .zip archives. This forum software only accepts attachments it knows how to handle :-(

    Thanks for providing the test case. I can run it, but I think the output is correct. Maybe you can give me a coordinate where you'd expect a marker (or one where you don't expect one).

    Best regards,


  • Hi Matthias,

    I think the red corners should also be marked as well since they are within (90 degree, 270 degree) interval.

  • I missed one point:
    I think the aqua corner should not be selected.

  • edited September 2018

    Hi Hai,

    thanks again for the explanation. I think I owe some more elaborate description of the corner's angle constraints. Maybe that will make things clearer.

    Basically, the algorithms walks along the edge of the polygon in a way that "inside" is right of the track. Each time it encounters a vertex, it will determine the angle of the direction change relative to the original direction. It will measure it the mathematical sense: a positive value means a turn to the left, a negative one a turn to the right. For convenience, negative values are mapped to positive always as well by adding 360°.

    So, a small turn to the left is let's say +10°. The same turn to the right is -10° or +350°. A 90 degree turn to the left is +90°, one to the right is -90° or 270°. A sharp almost backward turn to the left is for example +150°, one to the right is -150° or +210°. An angle of 0° is no change in direction.

    So when you select 89 to 271 you select left and right turns which are 90 degree or sharper.

    The red dots are not "sharp enough" as they turn by less then 90 degree in either direction. The aqua dot is a sharp turn.

    Is that comprehensible?


  • Hi Matthias,

    Very clear. I thought the program will just calculate the external angles of polygons.
    This new command does what I expected:

    ep.merged.corners(-91.0 .. 91.0).output("Select external polygon corners of 90-270 degree.")

    Thank you for your kind support!

Sign In or Register to comment.