It looks like you're new here. If you want to get involved, click one of these buttons!
Hello,
I'm very new to Python language and KLayout. For a project, I need to generate a series of rectangles (each in the same or different layers) in KLayout using Macro development. This way, depending on the input/variable assignment from the user, say N, the program can generate N Rectangles and height and width can be adjusted for one rectangle and others will increase or decrease by a magnification factor. Pitch can be adjusted too. Please help me with this. A picture is added here.
Comments
This script does what you want. You need to edit the parameters to your liking:
Hi @soumeniit,
Thanks for your interesting post.
Your requirements do not seem simple to me, especially when all conditions are combined.
If I were you, I would divide the problem into two components (divide-and-conquer approach):
(1) design description captured in an Excel sheet or a similar (I prefer CSV)
(2) manipulation of the design description by KLayout (macro)
Please refer to the attached file set that conveys my idea.
To be honest, I borrowed the idea from this post.
I hope the Python code is self-explanatory.
However, you need to carefully read the KLayout document (the built-in Assistance tool is handy).
More specifically, the following Classes are crucial:
(1) Layout
(2) Cell
(3) DBox
(4) LayerInfo
(5) MainWindow
(6) LayoutView
You can easily find various information and tutorials on Pandas.
Good luck!
Kazzz-S
[Edit: 2022-12-20]
KazzzS-KL2208.xlsx
using Microsoft Excel (earlier, LibreOffice Calc)I have modified incomplete usage descriptions.
Sorry for the inconvenience caused.
Kazzz-S
Thanks @sekigawa and @ravn