Place Cell Instance in other cell

edited January 2015 in Ruby Scripting
Hi all,

I was looking around to find information on how to place a cell instance in a cell properly without success
and finally managed to do it. This might be usefull to someone so here is the code,
Could you correct it if it is not properly done?

module MyMacro

include RBA

# Enter your Ruby code here ..

app = Application.instance
# create a new view (mode 1) with an empty layout
main_window = RBA::Application::instance.main_window
#layout = main_window.create_layout(1).layout
layout_view = main_window.current_view
# get the current layout
layout = layout_view.active_cellview.layout
cell1 = layout.create_cell("TOP")
cell2 = layout.create_cell("BOTTOM")
layer_align = layout.layer(1,0)
cell2.shapes(layer_align).insert(RBA::Box::new(0, 0, 54, 200))
array1 = CellInstArray::new(cell2.cell_index,Trans::new(0,0), Point::new(54,0),Point::new(0,0),10,1)
cell1.insert(array1)
end

Comments

  • edited November -1

    Hi Pascal,

    The code is correct. I guess you are aware that you are creating an array of ten instances.

    I admit it's a bit lengthy. In the future it will be possible to shorten that a little (passing cell2 instead of cell2.cell_index), but the concept basically stays the same.

    I think the basic concepts are described in http://klayout.de/doc/programming/database_api.html#h2-481.

    Matthias

Sign In or Register to comment.