Hello,
I'm new to klayout.
I need to draw a mask for a semiconductor.
I prefer coding than drawing and I know all the parameters of the mask (lengths, angles etc.).
Is it possible to draw all the mask only by coding it in Ruby?
it is in fact. But you should make yourself familiar with Ruby and the basics of the programming API.
Here is a very brief example. It creates one cell, one layer and one rectangle on that layer and writes the whole to a file called "x.gds":
layout = RBA::Layout::new
# database unit 1nm:
layout.dbu = 0.001
# create a top cell
top = layout.cell(layout.add_cell("TOP"))
# create a layer: layer number 1, datatype 0
layer = layout.insert_layer(RBA::LayerInfo::new(1, 0))
# create one rectangle with lower-left coordinates at 0,0
# and width of 1um and heigth of 2um (coordinates are in
# database units)
top.shapes(layer).insert(RBA::Box::new(0, 0, 1000, 2000))
# write to x.gds
layout.write("x.gds")
You can run the script using KLayout in batch mode with this command line:
I see two possible ways of scripting/programming the layout/geometry - using Ruby scripting (as you explained above in this thread), or generating an ASCII/text version of GDS file (using klayout text gds format - and using any scripting or programming language), and then converting it (through klayout GUI or through script) to binary GDS file.
Are these two approaches completely equivalent, in terms of functionality, or are there some some hidden differences?
Are there any other approaches possible, within klayout framework?
You comments on advantages or disadvantages of these approached would be highly appreciated.
Comments
Hi Sveta,
it is in fact. But you should make yourself familiar with Ruby and the basics of the programming API.
Here is a very brief example. It creates one cell, one layer and one rectangle on that layer and writes the whole to a file called "x.gds":
You can run the script using KLayout in batch mode with this command line:
Regards,
Matthias
I see two possible ways of scripting/programming the layout/geometry - using Ruby scripting (as you explained above in this thread), or generating an ASCII/text version of GDS file (using klayout text gds format - and using any scripting or programming language), and then converting it (through klayout GUI or through script) to binary GDS file.
Are these two approaches completely equivalent, in terms of functionality, or are there some some hidden differences?
Are there any other approaches possible, within klayout framework?
You comments on advantages or disadvantages of these approached would be highly appreciated.
Thanks,
Max
----------
Hi Max,
thank you for mentioning the text file approach. You're right, that is also a valid option.
I personally prefer the Ruby-based approach but maybe that is because I am quite familiar with it :-)
Let me list some advantages which come into my mind for every approach.
Ruby/KLayout:
Generation of text files + Conversion:
Matthias