Feature Request: layers_and_datatypes for Cell object
I would like to know if there is a faster way to get a list of layer:datatype tuples like:
https://heitzmann.github.io/gdstk/library/gdstk.Library.html#gdstk.Library.layers_and_datatypes
except on a particular Cell. Currently it seem I have no other option than to iterate over all get_polygons
Not really… this is a fundamental issue with the architecture of gdstk (storing layer information in polygons). The best we can do is write the required loop as a C function instead of in python.
that would certainly be an improvement, and would reflect the usage pattern for the Library object
The internal data structure of gdstk can be thought of as a very thin wrapper around GDSII/OASIS formats, with very few opinionated additions. And in GDSII, layer and datatype are simply properties of a polygon. So under the hood, Library.layers_and_datatypes() simply loops over each cell and each polygon of that cell anyway. Constructing any additional data structures to support Cell.layers_and_datatypes(), whether by gdstk or by yourself, is orthogonal to GDSII/OASIS parsing.