Creating layout using scripts..

sidsid
edited February 2010 in KLayout Support
Hi,

Thanks for creating Klayout and making it scriptable.

I am a PhD student and trying to write some simple layouts, and would prefer to do it with a script rather than manually. Something like what is shown in Sokoban or Koch curve examples in RBA examples page. When I try to save the output from those programs I get a file, which on opening again in klayout shows nothing (apart from Cell heirarchy). I have tried adding a layout.write statement in the scripts, but it hasn't helped. I guess the problem is that those scripts are not assigning the layer names properly when they create them.

Could you please tell me the problem and how to fix it?

My purpose is to write two small fingers with big pads at their ends, and to attach a text identifier with each such structure. I can put such structures on different layers and then expose them in EBL. The structures are 200 um in size and so I can't put them all in one writefield (stitching is not available) and I want to write about 8x8 array of such structures.

thanks again.
Sid.

Comments

  • edited February 2010

    Hi Sid,

    You have already pointed out the root cause of your problem. The samples were not intended for being saved and they are lacking the correct statement for assigning layer and datatype. Without that information, the layers cannot be saved.

    The important statements are these ones:

    linfo = RBA::LayerInfo.new
    layer_id = layout.insert_layer( linfo )
    

    Tehy should be like that:

    linfo = RBA::LayerInfo.new
    # save this layer to 16/0 in this example:
    linfo.layer = 16
    linfo.datatype = 0
    layer_id = layout.insert_layer( linfo )
    

    Each layer that is created must be assigned a layer and datatype if it should be saved. It is handy to create temporary layers, for example when boolean operations are used. These can be left without layer and datatype and won't appear in the output.

    Best regards,

    Matthias

  • edited November -1
    Hi Mathias,
    I just bumped into the website and found out that KLAYOUT is amazingly capable of so many tasks. Thank you for the great job! By the way, can I save the created layout using a script command?

    Thanks a again.
  • edited March 2010

    Hi,

    thanks :-)

    The method to save a layout is "write":

    layout = RBA::Layout.new 
    # create cells, layers, etc ...
    filename = "output.gds"
    gzip = false
    options = RBA::SaveLayoutOptions.new
    # optionally specify options, i.e. options.dbu = 0.0025
    layout.write(filename, gzip, options)
    

    Best regards,

    Matthias

Sign In or Register to comment.