Layer and/or cell chooser widget

edited December 2015 in General

I would like to script a chooser to allow selection of a layer/datatype pair, and a cell when running a macro.

Is there an example someone can point me to?


  • edited November -1

    Hi jmhutchi,

    I interpret this to mean that you want a dialog box, with two dropdown menus. The first is populated with the layer/datatypes in the current layout, and the second is populated with the list of cells.

    If so, download and install TRT, then look at: TRT menu > Cells > Get PCell parameters. That script has a dialog box with two dropdowns. All that remains is to populate those dropdowns differently.

    To get a list of the layer/datatypes, use something like

    include RBA
    app = Application.instance
    mw = app.main_window
    lv = mw.current_view
    lv || raise("No view selected")
    ly = lv.active_cellview.layout
    li = ly.layer_indices
    layers = { |i| ly.get_info(i) }
    puts layers

    To get a list of the cells beneath the current one in the current layout, use something like

    cells = []
    ci = ly.each_cell { |c| cells << c }
    puts cells

    Did this answer your question?


Sign In or Register to comment.