LayerMap

Hi all,
I want to combine several gds-files into one layout.
During reading I want preserve the layer/datatype structure of each file by adding a offset to the layer number via a LayerMap.
A very simplified example is:

module MyMacro
  include RBA

  $mw = Application::instance.main_window
  t_ly = $mw.create_layout(1).layout
  t_ly_view = $mw.current_view
  t_ly.dbu = 0.001

  lo = RBA::LoadLayoutOptions::new

  lo.layer_map.map("*/* : *+10/*", 0)
  t_ly.read("c1.GDS", lo);
  t_ly_view.add_missing_layers

  lo.layer_map.map("*/* : *+50/*", 100)
  t_ly.read("c2.GDS", lo)
  t_ly_view.add_missing_layers
end

The structures of c1 are mapped fine.
However all layers from the second file are mapped only, if the logical layer number in the second map line (100 in this example) is bigger as the number of the already created layers/datatype pairs by add_missing_layers.
How can I determine this number (of the first free logical layer)?
I found that if I use "*/* : */*" for the first mapping (== no offset), the second mapping does not work anymore.
Is there an example how to group layers via script?
(I want group all layers with the same layer number, but a different datatype.)
Best regards,
Frank

Comments

  • The answer to one of my questions I found in the manual:
    How can I determine this number (of the first free logical layer)?
    It is t_ly.layers.
    But I have a new more complex question
    How can I rename the layers created by add_missing_layers ?
    How can I access the Layerproperties of a layer with a special layer_index in the layout?

  • Very good :)

    If you want to end up with properly named layers, the easiest is to do this manually once and save the layer properties as a .lyp file (or generate a .lyp if you want. It's XML). Then, instead of simply calling "add_missing_layers", you load this file.

    If you don't know how many layers you actually will have, you can add a wildcard entry to the .lyp file which essentially is equivalent to "add_missing_layers". See here for a discussion about this feature: https://www.klayout.de/forum/discussion/comment/5071#Comment_5071

    Matthias

Sign In or Register to comment.