A simple layer processing scripting environment

edited June 2011 in General

Recently I have received a request regarding automation capabilities for the layer processing functions (boolean operations, sizing and others). To provide a preliminary solution I have supplied a ruby script for download here: http://www.klayout.de/resources/layer_proc.rbm.

The script installs a new menu entry which allows to load and execute a processing script. The script can be used for implement layer generation and manipulation rules. Right now, the implementation is pretty simple and uses a flat approach, i.e. creates shapes in the top cell only.

You will find usage instructions in the script itself. Here is a short example which extracts the gate regions:

active = input("2/0")
poly = input("3/0")
gates = active.and(poly)

Since, the "and" method is available as the "*" operator, this example can be simplified to

(input("2/0") * input("3/0")).output("10/0")

To use these generation rules, save the script above as a text file and run the script using "Tools/Processing Scripts/Processing Script" to execute the script. To easily execute the script again, a list of most recently used scripts is maintained.



  • Hi Matthias,

    I got an issue with shifting the layers in Klayout using the processing script. In the document I found the following command can be used to shift the layer by a given displacement.

    l.shift(dx, dy) - Shift the layer by the given displacement.

    But when I operate the following line in my code, it gave an error saying that "Ambiguous overload variants - multiple method declarations match arguments."

    The command line I was using is as below:

    Do you know what was the error ?


  • hello. I do not have access to the code link, could you please help?

  • This was 2011! The post is definitely outdated.

    Please consider using DRC functions for that purpose. It's basically doing the same, but on a much higher level.


Sign In or Register to comment.