Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

export layers from a gds by hiding a cell?

Hi, recently I am thinking how to export the layer under certain situations, the codes below can show all the layer from this gds file

  • import pya
  • layout = pya.Layout()
  • layout.read('BDE.gds.gz')
  • for ly_id in layout.layer_indices():
  • ly_info = layout.get_info(ly_id)
  • print(ly_info.to_s())

However, if my gds file has two hierarchies and the second hierarchy has a cell name "abc" if I do not want the the layer information of abc shows in my code, how can I do it? I guess hide "abc"
but how to do it in python code?

Best wishes

Muheng

Comments

  • Hi Muheng,

    the concept of layers is orthogonal from the cells. So a layer is a property of the layout, not of the cell. By asking the layout for the layers, you cannot exclude cells from the information.

    You could analyse your cells for shapes in a given layer using "cell.shapes(layer_index).empty?". This will give you information about what cell has shapes in which layer.

    Matthias

  • Hi,Matthias,

    thanks for that. BTW, I attached a image, assume my gds file is ABC, I have 3 cells under my ABC, which are
    qqq
    www
    eee

    if I want to have a look qqq has layer No.1 or not, I guess I can type

    "cell.shapes(layer_1).empty?" to check, here "cell" is qqq, right?

    but how to get the qqq in python?

    • import pya
    • layout = pya.Layout()
    • cell=layout.cell_name("qqq")

    is that right?

  • Also, I am not sure about the "?" is OK for the python script

  • edited October 2018

    Hi Muheng,

    In Python this will be

    layout = pya.Layout()
    layout.read("yourfile.gds")
    cell = layout.cell("qqq")
    layer = layout.layer(1, 0)
    if cell.shapes(layer).is_empty():
      print("Cell qqq in empty with respect to layer 1/0")
    

    Matthias

Sign In or Register to comment.