read (open) in specific layers from a large .oam file with Python script

Hi Sir,

I have a very large .oam file with 20+ layers. I can open it in view mode in KLayout. Out of memory occurs if I open it in Editing mode. How can I just open a couple of specific layers using Python script and then save it to a new smaller file so that I can edit it layer by layer? BTW, the file is larger because of many (millions of) dummy filler features. Is there a simple way to remove these filler features?



  • edited May 23

    Hi @zhaoyj,

    ".oam" is OASIS.mask, right?

    A solution to split the file is:

    # extracts layer 1/0, 2/0 etc.
    strm2oas -im 1/0 -is in.oas l1_0.oas
    strm2oas -im 2/0 -is in.oas l2_0.oas

    To join the files back into one, use

    strm2oas l1_0.oas+l2_0.oas+... --blend_mode=0 combined.oas

    CAUTION: "--blend_mode=0" only works properly with flat data.

    For hierarchical data, a scripted approach is better suited, like the one described here:

    Best regards,


  • Thank you very much Matthias!
    They seem Linux commands. Unfortunately, I am using windows 10 and 11 systems. I'll go with "save as" for only visible layers for now before I learn more on the scripts.

  • edited May 27

    That is not specifically Linux .. "strm2oas" is a binary shipped with KLayout. There are more of these "buddy tools".

    This binary is also available on Windows, but you need some kind of shell to wrap that.


Sign In or Register to comment.