capturing text in drc script

edited November 2016 in General
I am trying to capture all shapes on a layer that have text over them. The text is on a different layer. But when using the input() construct, It does not pull in text.

m2 = input(1502,0) # works
m2text = input(1502,4) # does not pull in any shapes or text
# 1502/4 only contains text.

myfind = m2.interacting(m2text)

I've verified that m2text is not getting populated by
m2text.output("m2 text","shape")


  • edited November -1

    Hi baworth,

    Text handling is not part of the DRC engine yet. DRC is a pure mask geometry feature currently. That's why you don't see text object.

    But the DRC feature is based on a Ruby script. This allows extenting the language with new features to emulate the function you need:

    # Put this in front of your DRC script
    class DRC::DRCSource
      def texts(re, layer, datatype = 0)
        li = layout.layer(layer, datatype)
        iter = cell_obj.begin_shapes_rec(li)
        data = RBA::Region::new
        while !iter.at_end?
          if iter.shape.is_text? && iter.shape.text_string =~ re
            data.insert(iter.shape.bbox.enlarged(1, 1).transformed(iter.trans))

        DRCLayer::new(@engine, data)
    class DRC::DRCEngine
      def texts(*args)
    # Here is how you use it:
    # t will be a set of small boxes over each text on layer 6/1 that matches the
    # RE "^AB" (i.e. begins with AB)
    t = texts(/^AB/, 6, 1)
    # Now select all polygons on layer 6/0 overlapping such texts
    input(6, 0).interacting(t).output(100)

    The solution is not fast and does not cover all features of the DRC engine (such as cell tree pruning, area confinement, tiling etc). But for simple cases it should do the job.



  • edited November -1
    Did not work for me.
    I get an error message of "No overload with matching arguments in Region::insert", pointing to the line data.insert(iter.shape.bbox.enlarged(1, 1).transformed(iter.trans))

    I tried various values of the regular expression to no effect.

    Then I changed the line
    if iter.shape.is_text? && iter.shape.text_string =~ re
    if iter.shape.is_text?
    to remove the regular expression

    I get no error, but it does not create boxes around the text

    I noticed this line in the class DRC::DRCSource
    li = layout.layer(layer, datatype=0)

    doesn't that then ignore the datatype that my text is on? my text is on 1502/4 and I use
    t = texts(/./, 1502, 4) # I modified to ignore reg exp
  • edited November -1
    Not sure what is happening... I reverted to the original code you gave me. And I get no errors anymore. I Saved the drc script. Shut down and restarted. Still get no errors.

    But I get no output either

    t = texts(/^S/, 1502, 4)

    produces nothing
  • edited November 2016


    please paste your entire script. I can't help while getting only partial information and you seem to play with the code. Please also note that the forum supports Markdown. So please use it to format your code (put four blanks in front of each line to make it formatted like code).

    The boxes the script produces are very small (2x2 DBU). So maybe you just missed them?


Sign In or Register to comment.