Isolated check between polygons in the same layer

Hi Matthias:
Thanks for developing Klayout!

I want to find 0 distance pairs in one layer with DRC script.
For following example, the expect result is two regions.

layer.iso(0).output("iso violations")

But I found nothing.Is there any function avaliable?



  • For what little it's worth...

    If the objects are touching they aren't usually considered
    to be a spacing error, but rather pieces of a whole.

    I think you might want to do a minuscule shrink (like
    just one DBU) and then the gaps would get flagged
    by standard spacings checks.

    You might need to first do an unshrunk rule, that would
    catch the explicit existing gaps, and then "ANDNOT" the flag
    from the shrunk-check so that you only pick up gaps that
    arrived on account of the shrink, but not ones that were
    already there. The logic for that, might be more of a "doesn't
    touch" than a "ANDNOT" (might take some figuring out, how
    to downselect what you were really after?

  • Hi Freda,

    It's quite usual in layouts to have touching polygons forming bigger connected regions. These polygons don't act individually but form virtual bigger polygons. That's called "merged semantics" in KLayout (or "clean" mode):

    Jim (dick_freebird) is right, but because merged semantics also applies to size, you cannot shrink the objects individually by doing a "size".

    The solution to all of that is "raw" mode. It's actually very simple to use and in this mode all polygons are considered separate objects. Just use ".raw" to turn a layer into one in raw mode. In raw mode "iso(0)" will still not give you the desired result because 0 then is acutually the smallest allowed value. But "iso(1.dbu)" will do what you want:

    geo = input(1, 0)
    errors = geo.raw.iso(1.dbu)


  • Hi Matthias and Jim:

    Thanks for your replies.

    I use Klayout to read wire points from GDSII file and draw it into a face in other CAD software (e.g. Freecad). When I face a large GDSII file, I'll merge the layout first.However, If the vertices is larger than 8191,it won't be merge. In CAD software, there is no coincident edges or vertices in one face.

    E.g.:coincident vertices

    I'm wondering DRC script could check it at one time otherwise I should check it one by one with recursive method.

    I used "raw" mode to check two polygons and successfully found two blue triangles to cover the vertices.But I can't find polygon to get yellow region.Is there any suggestions?


  • Hi Freda,

    GDS can't represent holes and cannot write polygons with more than 8191 points. So maybe GDS isn't the right format to use at all?

    Have you tried DXF?


  • Hi Mattias:
    Thank you. I'll try to use DXF.

    By the way,
    If I want to set the max.vertices of writer options in DRC script, which function should I use since there is no output writer variables for ".output(spec)."
    Or can I use "tiles" to split the polygon?

  • Hi,

    there is no DRC feature for breaking polygons into smaller parts, but you can use a low-level feature for doing so.

    l = input(1, 0)
    l.output(10, 0)

    For the description of the "break" method see: The first argument is the desired maximum number of vertexes (don't go below 4 with this value, triangulation isn't the goal of this function).



Sign In or Register to comment.