How to get a text list of layers in a cell

The Layers menu will show you what's used in a cell, by BOLD face
on the used layers of the larger set.

I would like to get the same info in a copy/paste-able text for use in documentation, but I haven't found any such utility. Klayout obviously is keeping track; how to make it say, rather than show?

Comments

  • Nothing can't be done with a script :)

    ly = RBA::CellView.active.layout
    cell = RBA::CellView.active.cell
    
    layers = ly.layer_indexes.collect { |li| info = ly.get_info(li); [ info.layer, info.datatype, li ] }.sort
    
    puts "Non-empty layers of cell #{cell.name} (including subcells):"
    layers.each do |layer,datatype,li|
      if ! cell.bbox_per_layer(li).empty?
        puts "  #{layer}/#{datatype}"
      end
    end
    

    (Create a new macro in the IDE under "Ruby", paste this code and run it. The printout gives the BOLD layers of the currently selected cell.

    Matthias

  • Hi Matthias,
    Can this be used to get the actual layer name as well ie:metal1 ... metal2 etc

  • @tagger5896

    if you have GDS, layer names are not available in the layout, so they cannot be retrieved from the layout database. You'll need some translation table which you can derive from the layer table in the layout view:

    ly = RBA::CellView.active.layout
    cell = RBA::CellView.active.cell
    
    layers = ly.layer_indexes.collect { |li| info = ly.get_info(li); [ info.layer, info.datatype, li ] }.sort
    
    # fetch display names
    names = {}
    RBA::LayoutView.current.each_layer do |lref|
      if lref.name != "" && lref.cellview == RBA::CellView.active.index
        names[lref.layer_index] = lref.name
      end
    end
    
    puts "Non-empty layers of cell #{cell.name} (including subcells):"
    layers.each do |layer,datatype,li|
      if ! cell.bbox_per_layer(li).empty?
        if names[li]
          puts "  #{layer}/#{datatype} [" + names[li] + "]"
        else
          puts "  #{layer}/#{datatype} (unnamed)"
        end
      end
    end
    

    Matthias

  • Matthias

    Exactly what I was looking for tyvm

Sign In or Register to comment.