Selected cell in drawing window Show As New Top

Hi Matthias,

Is it possible to "Show As New Top" a selected subcell from within the drawing area? From time to time I edit layouts done by others. If I want to edit a subcell I have to select it in the drawn layout and read the selected instance name on the bottom of the screen. I then have to find that instance in the cell list, highlight it and show it as new top.
Is it possible (or does it exist) to select a subcell in a layout (in the drawing window) and have a function key to set the selected subcell as new top? Ctrl+S doesn't do it.

As usual, many thanks for your great work with KLayout.
Richard

Comments

  • You can do this through the Cells subwindow, which can be set to either alphabetical or hierarchical sorting.

    Ctrl-S works for me on a selected instance. So does Display>Show As New Top menu action.

  • Hi,

    My favorite is Ctrl+D ("Descend"). If you select anything (shape, instance), this function will switch the context to the next child cell leading to this object. "context" means you will still see the original top cell, but you're editing the context cell. You can use "Descend" multiple times. The reverse is "Ascend" (Ctrl+A).

    If you really like to switch the cell entirely and without context, you can use this small script to achieve this. It will act like "Descend", but makes the next child cell along the path to the selected object the new top cell:

    lv = RBA::LayoutView::current
    lv || raise("No layout opened")
    
    sel_cv_index = nil
    sel_cell = nil
    lv.each_object_selected do |sel|
      sel_cv_index = sel.cv_index
      sel.each_inst { |i| sel_cell = i.inst.cell; break }
      break
    end
    
    lv.cancel
    
    if sel_cell
      cv = lv.cellview(sel_cv_index)
      cv.cell = sel_cell
      lv.zoom_fit
    end
    

    Matthias

  • Hi Matthias,

    Apologies for the delay in replying, I was taking a week off (in my back garden due to travel restrictions) last week and missed your reply. Ctrl+D works well and the script is perfect.
    My next task is to figure out how to assign a short cut key to it.

    Many thanks
    Richard

Sign In or Register to comment.