clearing a cellview?

edited June 2016 in Ruby Scripting
I have a ruby algorithm (ported over from another language) which generates a data structure.

During the generation of the data structure, I allow my user to generate stopping points within a source text file which generates the data. At that point, I take the data within the data structure and generate a layout for view within klayout. This is done independent of klayout's gui.

The view code is as follows:

def view_data
mw = RBA::Application.instance.main_window
mw.setVisible(true)
mw.enable_edits(false)
mw.create_view unless mw.current_view
layout_view = mw.current_view
layout_view.show_layout(@fb_layout, '', true, true)
end

This allows me to show the layout as I am stepping through it, however it is generating new cellviews. Is there a way to clear the previous views so that the only data shown in klayout is the most up to date layout and not have multiple cellviews?

Comments

  • edited June 2016
    Ok, so instead of calling layout_view.show_layout everytime, I've decided that I only call it the first time. The cell in question is deleted, then created again (thus giving me a new RBA::Cell). After the algorithm completes, I can click on the cell in the hierarchy browser, and view the updates.

    Is there a way to get the CellView index of a cell when I only have a pointer to the RBA::Cell?

    I want to set the newly re-created cell as the active_cellview using
    layout_view.set_active_cellview_index(new_cellview_index)
    but I don't know how to get the cellview_index of the RBA::Cell to do so.
  • edited November -1

    Hi,

    Maybe that needs some explanation:

    A view can show multiple layouts. Or more precisely: multiple specific cells (plus context) within multiple layouts. These parts are called "cellviews". The are referred to by "@1", "@2" etc. in the layer list for example. The "cellview index" indicates the cell view inside the list of cell views of a layout view. The "active cell view" is the one that most operations refer to - for example operations inside the cell list.

    If you show just one layout, you have only one cellview, so you cannot switch it. Instead, you have to reconfigure the only cellview to show your new cell. You can do this using LayoutView#select_cell(new_cell.cell_index, 0). Here, 0 is the cellview index - i.e. the first one.

    Matthias

  • edited November -1
    That was it. I couldn't figure out which function to use and where to grab the cellview index.

    Thanks!
Sign In or Register to comment.