Using Klayout in non-interactive mode

edited December 2010 in General
I wish to use the features and tools provided in klayout to modify the gds in a non-interactive automated fashion.
For eg. through some ruby script with input as a gds file output is another gds with modifications.
This way i can use klayout as part of my bigger automated script.
Is there a possible workaround available ?


  • edited December 2010


    basically you can use KLayout non-interactively.

    If you run KLayout this way:

    klayout -e -z -r script.rb ...

    you can run the script without bringing up a GUI. You can pass arguments to the script by defining Ruby variables, i.e.

    klayout -e -z -r script.rb -rd input=in.gds -rd output=out.gds 

    In that case, the input and output file names will be accessible as "$input" and "$output" in the Ruby script. Please note, that you need to start KLayout in editable mode ("-e") in order to be able to apply modifications.

    Please note, that the Ruby interface is somewhat leaner and does not expose all internals. Thus, not all functionality may be available. The modification of layout files is currently limited to running boolean operations and to perform simple modifications on the layout. Right now, it is not a layout processing engine. The reason is basically, that the data structures are optimized for fast and efficient read access. Writing and modifying the database is subject to some subtle limitations. That is a very basic difference, if you compare the API to OpenAccess of the Skill layer of DFII.

    Best regards,


  • edited November -1
    This is very useful to me. I'll try it out definitely !!


Sign In or Register to comment.