Extract used layer from GDS into text file in Klayout

edited January 2023 in KLayout Support

Dear Support team,
May I know how can we extract the used layer in the GDS file into text file using Klayout. May I have your guidance

Rgds
KumaranS

Comments

  • I think you will need to explain more, about what this
    text format should contain / look like. Are you asking
    simply for a list of the layers used, or some text export
    of all the polygons on one (or all) layers, and would
    that be a full list-of-vertices-and-layer-for-each, ....

  • I agree - you should be a bit more specific about what you want to achieve.

    If you're just looking for the layers that are used inside your GDS file, this script sketch may give you some first idea:

    # if you want to run as a standalone script, use this initialization:
    #  ly = pya.Layout()
    #  ly.read(input)
    # and run KLayout with "klayout -b -r thisscript.py -rd input=yourfile.gds
    
    # Take the currently loaded layout:
    ly = pya.CellView.active().layout()
    
    # Print the layers inside the layout object
    # TODO: sorting, filtering non-GDS layers etc.
    for l in ly.layer_infos():
      print(str(l))
    

    Matthias

  • Dear Matthias,
    Thanks, it works, sure will be more specific to my questions. May I know if is there any documentation for the Python Klayout scripting, the module documentation for the usage of commands, and example scripting to have some reference?
    Rgds
    KumaranS

Sign In or Register to comment.