Howdy, Stranger!

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



I need verify if ALL layers into the gds file are present into the layer propriety file loaded and vice-versa.
Is possible do it using a script?

Many thanks in advance




  • edited September 2018

    My problem is that I have created a layer property file with some layer, and I loaded it with a gds file.
    If into the gds file is present a particular layer NOT defined into my property file, I cannot see it into the layout opened with klayout and there is NOT warning that help me to understand which is this layer.

    I need do this check automatically , loading gds file and dedicated layer property files.

    I hope this one clarify my question



  • edited September 2018

    Hi Luciano,

    Maybe you don't Need a separate check.

    If you want layer properties files to show all layers, you can add the following wildcard entry into the layer properties file:


    This entry will expand to every "unknown" layer and Show these in bright red.


  • Thanks Matthias, this works fine, but I need a second step.

    I need to know which is the layer NOT defined in my "layer property" file.

    To do it In this moment I need extract the layer's list from the gds file separately with this script

    and then check the output vs. the "layer property" file to know exactly this layer number.

    Is not possible add this check automatically, with some script?


  • Hi Luciano,

    if you want this, the following script may help. If will check whether all layers of the active layout are visible in the layer list and show a warning if that is not the case.


    # fetch the current layout view
    lv = RBA::LayoutView::current
    # fetch the active cellview (the layout)
    cv = lv.active_cellview
    cv_index = lv.active_cellview_index
    layout = cv.layout
    # iterate over the layers and collect the layer indexes
    # of all layers shown in the layer views
    in_lyp = []
    li = lv.begin_layers
    while !li.at_end?
      if li.current.cellview == cv_index && layout.is_valid_layer?(li.current.layer_index)
        in_lyp << li.current.layer_index
    # compress the list of layer indexes
    in_lyp = in_lyp.sort.uniq
    # obtain the layers not shown (a list of indexes)
    not_shown = layout.layer_indexes - in_lyp
    # print the list of layers not shown (as layer/datatype/names)
    if !not_shown.empty?
      info = "The following layers are invisible:\n"
      not_shown.each do |l|
        info += "  " + layout.get_info(l).to_s + "\n"
      info += "(#{not_shown.size} out of #{layout.layer_indexes.size} layers are not shown)"
      RBA::MessageBox::warning("WARNING: layers not shown", info, RBA::MessageBox::Ok)
  • Hi Matthias,

    many thanks for this script.

    How can run this script?

    klayout -r myscript.rbm ?

  • Any explanation regarding how run automatically the script?

    Many thanks in advance

  • Hi Luciano,

    this script is for pasting into the macro editor. You can configure it to appear in the menu, so you can run it from there.

    For more details about using macros see here:


  • Hi Matthias,

    li.current.cellview == cv_index

    hangs up. li is a LayerPropertiesIterator, li.current is a LayerPropertiesNodeRef, and that one doesn't like cellview. :-(


  • Hi Thomas,

    are you sure?

    LayerPropertiesNodeRef is finally derived from LayerProperties and this one has "cellview" which gives an int.

    What version are you using?


Sign In or Register to comment.