I was trying to follow up on some comments about how
this function could be used to make "asserted" objects
by "text tagging" a shape. But I can't find any mention of
this function in the DRC manual sections of the online

Now most of my interest has been in the context of
connectivity (replace complex "recognition logic" by
simple text-assertion logic) but I would employ it for
device-specific rules (and checking for un-asserted
devices) in DRC if I were able.

1) Is this function available to DRC scripts?
2) Where would I find documentation or examples?


  • Hi Jim,

    sorry, I went into the future already. I'm upgrading the DRC engine currently. "with_text" is a new enhancement as the DRC engine is going to support text layers as native objects.

    So far, texts are kind of "hidden" objects inside "normal" input layers. They can be extracted from original layers and turned into small, dot-like shapes which can be used in "interacting", like this:

    l1 = input(1, 0)
    l2 = input(2, 0)
    l2_a_labels = l2.texts("A")
    l1_with_a_labels = l1.interacting(l2_a_labels)
    l1_with_a_labels.output(100, 0)

    which gives (layer 100 is the bold-edged shape):

    It's worth noting that "texts" can only operate on original, unmodified layers. The documentation for "texts" is here: https://www.klayout.de/doc-qt5/about/drc_ref_layer.html#k_108

    Best regards,


  • Matthias,
    What would be the "modern" :) way to write it ?

  • Hi Laurent,

    The "modern" way is to use "text layers". To input a text layer, you use "labels" in the same way you would use "input". But "labels" generates a text layer instead of a polygon layer.

    A text layer can participate in a variety of operations with polygon and edge layers:

    • Boolean NOT and AND: "texts - polygons" or "texts & polygons" (will filter texts outside or inside the polygons)
    • "polygons.interacting(texts)" and "polygons.not_interacting(texts)": filters polygons interacting or not interacting with texts on the text layer
    • "texts" and "texts_not" which can be used select texts by their strings (see here for details: https://www.klayout.de/doc-qt5/about/drc_ref_layer.html#h2-2988)

    So the modern way simply is:

    l1 = input(1, 0)
    l2 = labels(2, 0)   # no longer "input"
    l2_a_labels = l2.texts("A")
    l1_with_a_labels = l1.interacting(l2_a_labels)
    l1_with_a_labels.output(100, 0) 



Sign In or Register to comment.