Not signed in (Sign In)

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.


    My question is quite simple and I may be missing some information while searching the forum. Since I couldn't find the answer I am posting this.

    Actually, I am a first year PhD student and I am trying to develop a layout file to be sent to the foundry. So I chose K layout for this task. But, I am seeing the GUI for layout designing. I would prefer if I could use scripts to design the layout. So I only found one discussion regarding this.
    my problem is, I couldn't go to edit script mode or something like that. All I see is a graphical designing window where I can drag/drop and design. I want to know how to switch my design into scripting mode?

    I am using KLayout 0.25 in Windows 10 (x64).


    • CommentAuthordavidnhutch
    • CommentTimeDec 29th 2017 edited

    Macros > Macro development (F5)

    In KLayout version 0.25.x there is another (slightly more complicated way) to do coding by creating standalone (or dependent) packages

    But I'd just start with pressing F5.

    Thank you for the reply. I will take a look at it.. :)
    • CommentAuthorejprinz
    • CommentTimeDec 30th 2017
    Hi Bishal, what currently works for me is as follows. I also don't like to do manual layout, it only makes sense in very space constrained situations and for highly regular designs (memories). For test structures scripts work better for me.
    So I am using Python, and for that PyCharm is the best environment I know of (I've been using Emacs but these days PyCharm rules).
    The little issue is that the Klayout pya module is not a conventional module under Python. So you have to define the interpreter as something like (a batch file in Windows or shell script in Linux):

    #! /bin/bash
    /usr/bin/klayout -b -r $@

    and then have PyCharm find this file as an interpreter. This way I can take advantage of the many features PyCharm provides. Since I am good with Python this is by far the fastest way for me to get stuff done. Compared to PyCharm the usual IC CAD scripting environments are stone age.

    You still need to run DRC either yourself or have the foundry do it.

    Good luck, Erwin
    Thank you ejprinz.
    • CommentAuthorlukasc
    • CommentTimeJan 6th 2018 edited

    Hi Bishal,

    Since you are working on photonics, I refer you to our photonics-specific add-ons for KLayout, SiEPIC-EBeam-PDK and SiEPIC-Tools. It is available in Tools | Package Manager, then find these packages.

    You may also be interested in a photonics course where you design your devices/circuits in KLayout, and we fabricate & test them for you:

    Thank you Professor Chrostowski !
    I have followed your book as well as tried the SiEPIC-EBeam PDK too but I do have my own optimized grating coupler, bends and other structure. So, I was looking for some way of connecting mine components directly as like as in your example file.
    I couldn't understand how the pins are mapped and how does it connect to the waveguides automatically?
    • CommentAuthorlukasc
    • CommentTimeJan 26th 2018

    Hi Bishal,

    I'll write up some documentation how to do this. The easiest would be to edit the existing library and put your own polygons in the cells. On the wiki there is a slightly out of date description of the requirements for pins so that snapping works correctly.

    Thank you, Professor!

    I will look forward to the release of your documentation.
    • CommentAuthorlukasc
    • CommentTimeFeb 16th 2018 edited


    Here are some notes on how to import your components into SiEPIC-Tools. Again, I suggest starting with an existing PDK (e.g., EBeam or GSiP), and creating new component following the convention described here:

    Thank You Professor Chrostowski!