heitzmann / gdstk

Gdstk (GDSII Tool Kit) is a C++/Python library for creation and manipulation of GDSII and OASIS files.
https://heitzmann.github.io/gdstk/
Boost Software License 1.0
333 stars 83 forks source link

GDS Hierarchy Traversing #264

Open Rishabhgoyal07 opened 1 month ago

Rishabhgoyal07 commented 1 month ago

Hii @heitzmann, can we### traverse hierarchy in gdstk and access cell present in that hierarchy. Example, I have 10 hierarchy in my GDS, can I access the bottom and top hierarchy and move from top to bottom or vice versa and access each cell present in that hierarchy.

heitzmann commented 1 month ago

Yes, just look at Cell.references. For each reference you can go to the corresponding cell with Reference.cell, and then traverse its references and so on. Note that you might traverse the same cell more than once, if it is referenced multiple times.