It looks like you're new here. If you want to get involved, click one of these buttons!
Hi! I'm creating a layout by inserting some CellInstArrays (via python scripting) and at some point the GUI app crashes.
It look like it crashes only when using the zoom wheel and the hierarchy level is set to 2. In fact, if I flatten all cells from the layout object with prune = True, the problem seems to disappear.
The only stack trace I get is this (no prompt message):
Does this error sound familiar to you @Matthias ? could I run Klayout in a single thread perhaps?
This happens in both 0.28.6 and 0.29.10 versions, under Windows and under Linux (through WSL)
For more conext, this is how I'm adding library cells from python, am I doing it in the right way?
import pya
pya.MainWindow.instance().create_layout(1)
MAIN_LAYOUT = pya.CellView.active().layout()
TOP = MAIN_LAYOUT .create_cell("TOP")
pya.CellView.active().cell = MAIN_LAYOUT.cell("TOP")
# Adding library cell
lib = pya.Library.library_by_name("MyLib", "MyTech")
lib_layout = lib.layout()
my_cell = lib_layout.cell("MyCell")
added_cell = MAIN_LAYOUT.add_lib_cell(lib, my_cell.cell_index())
new_cell_inst = pya.CellInstArray(added_cell, pya.DCplxTrans())
TOP.insert(new_cell_inst)
# Adding library pcell
pcell_lib = pya.Library.library_by_name("MyLibOfPCells", "MyTech")
pcell_lib_layout = pcell_lib.layout()
pcell_dcl = pcell_lib_layout.pcell_declaration("MyPcell")
added_pcell= MAIN_LAYOUT.add_pcell_variant(pcell_lib, pcell_dcl.id(), {})
new_pcell_inst = pya.CellInstArray(added_pcell, pya.DCplxTrans())
TOP.insert(new_pcell_inst )
Comments
No, that does not sound familiar. The message can have manifold reasons. Usually that happens if shapes or instances get removed while some code is still accessing them.
I don't have the "MyLib" library you're using. If you're providing code, please provide complete examples. I assume your library internally instantiates other cells and that causes the issue. But without the code for "MyLib" I cannot assist in debugging.
I rewrote you sample to a simple PCell instantiation of the CIRCLE PCell from the Basic library. Please note the simplified version of the code. You don't need to use "add_pcell_variant" for example. "create_cell" does that for you:
I don't see any issues with the results of that setup.
Matthias
Thank you very much @Matthias for your help; your work and dedication are excellent. Unfortunately, I cannot share the full code as it is protected by industrial property, and we have also built a rather complex framework on top of your Python API/wrapper, which would be difficult to share here. I will try your suggestion and get back to you as soon as possible. Thank you again, and Happy New Year!