DRC engine without display connection

edited July 2019 in Ruby Scripting

I'm trying to call the DRC engine from a Ruby macro; and run this script on a linux box without a display connection. instance_eval throws an error as it appears instance_eval relies on the layout being loaded in the UI.

For example, the macro:

layout = RBA::Layout::new()
drc_script = "script here"
engine = DRC::DRCEngine::new
engine.instance_eval(drc_script, '')

run without a display adapter:

klayout -zz -r mymacro.rb

throws error "/drc.lym:4065: No layout loaded - no default layout. Use 'layout' or 'source' to explicitly specify a layout."

Is there another way to run DRC without a display connection?


  • Hi alleva,

    You don't need a script, you can just run a DRC script using

    klayout -b -r myscript.drc

    But as there is no layout loaded, you need to explicitly specify the source layout in the script. You don't need to edit the script every time you have a new input file. I do it by setting a variable for the input file name:

    # klayout call:
    klayout -rd layout_file=mylayout.gds -b -r myscript.drc
    # at the beginning of myscript.drc:


  • Hi Matthias,

    Thanks for the suggestion. I'm aware of the method you outline above. I'm interested to know if the method I describe above - where the drc is embedded in ruby - can be modified to work without a display connection, as this approach is already implemented in production, and I want to avoid refactoring this particular code.

    Thank you

  • Hi Andrew,

    without knowing the details of your production environment: you can basically use:

    engine = DRC::DRCEngine::new
    engine.instance_eval(drc_script, '')  # the script without "source"

    because "engine" is the object providing all the DRC functions as methods.


Sign In or Register to comment.