It looks like you're new here. If you want to get involved, click one of these buttons!
I have a cell, call it 'top'. In top is an instance of CellInstArray, call it 'array_inst'.
How does one conveniently get information about each element placed by array_inst?
I would like to get an array of bounding boxes for the elements in array_inst, but don't see the methods that I might use to do it. I can do the math if necessary, but it seems like something that would already exist.
Any pointers?
Any help is greatly appreciated.
Thanks,
Dave
Comments
I did the math. The following code returns the origins of each
instance and from that I get the bounding boxes:
Hi Dave,
in fact KLayout offers the functionality you require itself. The equivalent of the matrix is the "transformation":
Transformations can be combined using the "*" operator which means you can simply combine a translation formed from the array element vector and the basic transformation.
There is no particular "vector" object (yet) - the "point serves as the container for a x/y coordinate pair:
Points can be multiplied with scalars and added/subtracted.
Here is some code that puts together these pieces. It will print the expanded instantiations of the array:
Matthias
Thank you Matthias for your incite and assistance. You are always
remarkably helpful.
It might be handy to have iterator methods in CellInstArray. This
allows each element of the array to be presented to another tool.
In my case, I needed three things: origin, bbox, and center of
instance bbox information.
Though one can write such things, it cost me hours to write the code
and tests.
Thanks,
Dave
Hi Dave,
you're right about the iterator. In fact, internally there is such a thing. I just did not consider it important to be exported to the script environment.
BTW: if you plan to work with the shapes inside the instances, you can use the "RecursiveShapeIterator" concept which will provide deep iteration over the layout's shapes. This will also include expansion of cell arrays.
Regards,
Matthias
Good to know.
Thanks,
Dave