Hi,
I'm currently using the Python-preview (KLayout 0.24) and I'd like to create multiple array instances of a PCell with different parameters each time for both the array and the PCell itself using a Python script. I figured the CellInstArray-class would be a good starting point, but I have no idea where to specify the arguments for the PCell.
I also searched the documentation without results for:
- creating a new layout (Python script)
- working with cell hierarchy (Python script)
- working with layers (Python script)
Can someone enlighten me as to how I should approach this?
Thanks!
Comments
Hi,
There is some basic documentation in the "Resources" part of this site referring to the evaluation version: http://www.klayout.de/python_preview.html.
This gives some sample already for creating a layout.
Regarding the PCell instantation I think you refer to the other thread - I guess there is a general problem with a huge amount of cells.
I'll try to provide a Python version of that code, but I don't think it will be faster or take less memory. It's a good benchmark however.
Matthias
Hello,
Here is the Python code for the script in the other thread:
DISCLAIMER: I have not tested with the released eval version yet, but with a development snapshot of mine.
EDIT: I noticed that I messed up the threads - the other one is called "Creating letters" (http://klayout.de/forum/comments.php?DiscussionID=439&page=1#Item_12) and the basic problem there is the instantiation of many PCell variants. The code below is creating "fake" PCell instances to work around a performance issue with the PCell cache. This is not a recommendation for PCell instantiation code in general, since the sample below will only work for the TEXT PCell. But this code may serve as a sample of how to translate Ruby to Python (it's pretty mechanical in fact).
Matthias