DRC engine change _finish ?

Hello Matthias,
I hope your doing fine.

I compiled and installed the latest 27.3 release and overcome a strange issue.
I used (based in a discussion in a forum the following lines to run a quick drc check.

eng = DRC::DRCEngine::new
eng.instance_eval(myText)
eng._finish

Now klayout tells me that _ finish is an undefined method.
Was there a change ? It runs in 26.8 release quite well.
Best Regards,
Andy

Comments

  • Hi Andy,

    I'm doing fine, thanks :)

    "_finish" is actually still there, but there is a new method now: the counterpart of finish is "_start" and without calling this method, the object will behave strangely (I got "stop" undefined method ...).

    So the text is:

    eng = DRC::DRCEngine::new
    eng._start("DRC")    # Use any name you want to see in the logs
    eng.instance_eval(myText)
    eng._finish
    

    If you want to be backward compatible, use:

    eng = DRC::DRCEngine::new
    eng.respond_to?(:_start) && eng._start("DRC")    # Use any name you want to see in the logs
    eng.instance_eval(myText)
    eng._finish
    

    Basically, underscored names are "internal" and I do not guarantee the always stay the same way. But this is an easy case to solve.

    Matthias

  • Wow - works like before ... Thanks Matthias. We could run quick drc checks again (Checking for tiny holes =, etc ...).

    Thanks a lot for building Klayout - we build now a complete custom tool chain and the user feedback is great.
    Klayout is used on the daily basis, with the GUI or in a mask generation tool with the standalone python module.

    Best Regards,
    Andy

  • Hi Matthias,

    Where can I find info about the DRCEngine class? It doesn't show up in the "Search" box...

    Cheers,

    Tomas

  • DRCEngine is actually an implementation detail and not part of the public API.

    You can find this class in the sources here: src/drc/drc/built-in-macros/_drc_engine.rb.

    Matthias

  • Hi Matthias,

    Thank you for the source!

    As I had the same issue as listed above so I just removed the line "eng._finish" and it worked fine without errors. Are "eng._start" and "eng._finish" really necessary?

    cheers,

    Tomas

  • If you are using the DRCEngine class they may be required. But actually you're outside the documented API space. So things can change without notice.

    The API way of executing a DRC script is using the RBA::Macro object, configure it as a DRC script and with a file or text and run it:

    m = pya.Macro()
    m.interpreter = pya.Macro.DSLInterpreter
    m.dsl_interpreter = "drc-dsl"
    m.text = "source('input.gds')\nputs input(1, 0).area"
    m.run()
    

    Note that this is Python - actually, using pya.Macro (the Python equivalent of RBA::Macro) is a way to execute Ruby DRC scripts from Python!

    Matthias

  • Hello Matthias,
    I tried to use the exact piece of code you suggested. I got the following mistake:
    "No interpreter registered for DSL type 'drc-dsl' in Macro.run"
    I am running in pya version 0.28.10, under window with Python 3.9.13.
    Obviously I am missing some setup for this class.
    Any suggestion for this situation ?

    I literally just copy the code in a terminal to try it out.
    I was expecting to break because there is no layout loaded.
    Would you expect this behaviour if some minimal context is no set ?

    Alex

  • I think you're using the Python module. That is not supporting DRC as the actual DRC interpreter is using the Ruby language and that is not included in the Python package. The code is intended for the application, not the Python module.

    Matthias

  • Hello Matthias,

    Ok clear for me.
    Thanks.

Sign In or Register to comment.