Save visible layers with PCells

I tried saving my layout layers into different files. I tried several different approach. For example, I hid unwanted layers, and in "save as" dialog for OASIS I chose to save visible layers only and not to save PCell information.

However, then I opened the new file, other layers were still there. Even if I deleted them from before saveing the file. Also, the result was the same with GDS. I was a bit confused.

Then I tried converting all PCells to static using the function Edit->Layer menu. Now, the saved file only had the visible layers.

This might be a bug or just a confusing use case. Anyway, I thought I should report it.

Could you please give some tips, how to easily save layers into different files in a script? Should I again first convert to static? How to do that in a script?



  • Hi,

    I tried to reproduce the issue, but I cannot fully confirm your observations.

    What I see is (0.25.8):

    • when I unselect "write PCell information" and only write "visible layers", only these layers will appear in the file.
    • when I select "write PCell information" and only write "visible layers", the file actually does not contain the hidden layers (confirmed by a GDS dump), but when you load it again, the PCell code is executed again and the original PCell layout is restored. This is an intended behaviour.

    Or in other words: the problem does not seem to be saving, the problem seems loading.

    So in my case, saving "visible layers" and "without PCell information" should do the job.

    With a script you do it like this:

    ly = ... # your layout
    # create an options object
    opt = RBA::SaveLayoutOptions::new
    # don't write PCell information
    opt.write_context_info = false
    # write layer 1/0:
    layer_to_write = RBA::LayerInfo::new(1, 0)
    # select only this layer
    opt.add_layer(ly.layer(layer_to_write), layer_to_write)
    ly.write("/home/matthias/x_script.gds", opt)


  • edited June 2019

    So you are saying, that during loading the PCells will be generated again? Is there a command-line flag perhaps which would leave my macro unloaded, such that I could easily open the file and see the same thing as a person without my libraries?

  • Yes, that's what I am saying. Not synchronizing PCells with their implementation would show PCells not the way they are actually, which wouldn't be nice either. What if you had changed the PCell code? Wouldn't you expect that loading would give you the new generated shapes?

    But you're basically right. I see that this is some source of confusion. I'm afraid that currently there is no option to really disable this. I'd just not strip layers or use "save without context information" to sanitize the layout.


  • This is what I am saying: "save without context information" does not act as I expect. What kind of debugging data can I provide?

  • I'm a bit confused now ...

    What I can reproduce is:

    • If I save a layout with PCell context information and visible layers only, the hidden layers will not be inside the layout, but will appear again when I load the layout and the PCell code is executed again.
    • If I save a layout without PCell context information and visible layers only, the hidden layers will not be inside the layout and will not be generated again when loading the layout. All PCells are flat and are no longer PCells.

    If you have a different case, maybe you can send me a sample to the mail address given on the "Contacts" page.



Sign In or Register to comment.