It looks like you're new here. If you want to get involved, click one of these buttons!
Hey! I am a 3rd year university student who doesn’t have much actual coding experience outside of my classes. I have very limited python experience and would like to write a script for klayout. I need to create a script that takes in Excel files with all the parameters I need and draw the described shapes in klayout. I am a little overwhelmed on where to even start with this and would love any help. I can't get a shape to draw if that give you any sense of where I'm at hahaha. I would like this to be an opportunity to learn so keep that in mind for any responses, thanks!!
Comments
Hi @Lil_ner,
so you are very ambitious, are you?
To be honest, KLayout is not a good starting point if you're not familiar with Python. KLayout's API is not very Pythonic, as it reflects the C++ nature beneath. So it is somewhat likely you rather get on the wrong track.
Also, the application itself is kind of heavy and you do not get a lot of support like you get through a decent IDE. Specifically for beginners that is very important.
My suggestion is to start with installing PyCharm or some other cool IDE. Start playing around until you find yourself familiar with Python.
As a next step, I'd suggest not to use the application, but to use the klayout Python module (https://pypi.org/project/klayout/), which is good enough for generating some GDS file. You can later view that file in the application.
I tried to create some introduction-level documentation here: https://www.klayout.org/klayout-pypi/. There is also an example section (https://www.klayout.org/klayout-pypi/examples/) - I recommend the "gratings" example as an entry point for what you like to do.
As a general strategy, I'd suggest to start with a simple example and expand it until you achieve your current goal. In a professional environment, it is likely you will need to do something similar again. This is a good time to reflect on what you've done and maybe rewrite the code in a more generic or more universal form. If you do that properly, this is a great way to impress your boss
And finally, I'd like to advocate for Open Source: if you think your solution is useful - or even if you don't think so, consider publishing it under a license of your choice on one of the public platforms. By doing so, you help others and maybe also receive some help from others.
Regards,
Matthias
Thank you for the help and encouragement! This is exactly what I was looking for! I understand C++ much better than Python so maybe that will help haha.