It looks like you're new here. If you want to get involved, click one of these buttons!
I am very happy, that KLayout has such a powerful Python API! As it seems to be work in progress, though, it has some obvious features missing I guess. Is there a simpler (and perhaps more efficient) way to get number of polygons in a region than following?
len([p for p in reg.each()])
Comments
There is:
reg.size
https://www.klayout.de/doc-qt4/code/class_Region.html#method134
Nice! Thanks!
I did not notice it as there is the other function with the same name does something completely different. I expected something similar to
num_points
of Polygon object.Oh yes ... unlucky choice I admit. "size" is usually used for number of elements (like array#size in Ruby) ... but num_polygons would be better for sure.
Matthias