heitzmann/gdstk

Polygonal coordinate problem

SouthChinaHuihuisauce opened this issue · 8 comments

Hello dear author, I encountered a problem when using gdstk to draw polygons. When obtaining coordinates, it seems that gdstk will also output the defined polygon coordinates. I would like to know how to close it?

CODE
RES

You seem to bee looping over all cells in the library. You probably want to select 1 cell and only display polygons from that cell. In the KLayout screenshot you are only displaying polygons from the NMOS cell (the get_polygons function will get polygons from references, so there's no need to loop over cells.)

You seem to bee looping over all cells in the library. You probably want to select 1 cell and only display polygons from that cell. In the KLayout screenshot you are only displaying polygons from the NMOS cell (the get_polygons function will get polygons from references, so there's no need to loop over cells.)

Thank you for your reply. I have resolved the issue through your reply. Thank you

@heitzmann Hello, I would like to ask if there is any GDSTK that can output cell information, similar to Klayout.
2023-12-18_090943

@heitzmann Dear author, hello. I have output all cell names, but I don't know how to distinguish the relationship between calls
gdstk

@SouthChinaHuihuisauce you have to look into the references array for each cell. The cells form a DAG structure that can be traversed if you go through each of the references.

@heitzmann Dear author, first of all, thank you for your reply. I have tried the references you mentioned, but I am not familiar with gdstk and gds files. Can you give me an example?

coding
log

You'll probably want to write this as a recursive function. Something like this (in python for brevity):

def print_references(cell, indent=""):
    print(indent + "- " + cell.name)
    for reference in cell.references:
        print_references(reference, "    " + indent)

@heitzmann Thank you very much for your sample code. We have found it