I am trying to merge multiple GDS files into one parent cell with given XY offset. I am having trouble with my "cell.insert" i get an error "No overload with matching arguments in CellInstArray::initialize" . Any help would be greatly appreciated.
Thanks,
Keil
<code>
module MyMacro
include RBA
ly = RBA::Layout::new
ly.read("firstFile.gds")
ly.read("secondFile.gds")
ly.read("thirdFile.gds")
X = [0,100,1000]
Y = [0,100,1000]
i = 0
# create new cell TOP
cell_index = ly.add_cell("TOP")
cell = ly.cell(cell_index)
#Get top cell of file
top_cell_name = ""
ly.top_cells.each { |curCell|
p "topcell: " + curCell.name + " and index:" + curCell.cell_index.to_s + " " + cell.name
if top_cell_name == "TOP"
next
else
#Add top cell to main layout
x = (0.5 + X[i] / ly.dbu).to_i
y = (0.5 + Y[i] / ly.dbu).to_i
p "x:" + x.to_s + " y:" + y.to_s
cell.insert(RBA::CellInstArray::new(ly.cell(curCell.cell_index), RBA::Trans::new(RBA::Point::new(x, y))))
ly.delete_cell_rec(cur_cell)
i = i + 1
end
}
ly.write("my_layout.gds")
end
</code>
Comments
Hi Keil,
The message says there are multiple versions and none is accepting the arguments that you provide. It refers to "RBA::CellInstArray::new" (it says "initialize" instead of "new" - that's Ruby slang for the constructor).
The version you require is the one that accepts a cell index(!) and a transformation. You converted to the index to a cell reference using ly.cell(..) already and since the constructor takes a cell index, it does not accept these arguments.
The right way is:
Matthias
Thanks again,
Keil
This forum uses Markdown. Precede each line of code with at least four spaces.
Thanks guys. This is what i ended up using.
Line:
ly.write("my_layout.gds")
Error:
"Internal error: /usr/src/packages/BUILD/klayout-0.24.9/src/dbLayout.cc:1289 topological_sort () was not true in Layout::write (Class RuntimeError)"
Can you give me some suggestion?
Thanks,
Hai
Hi Hai,
this exception is thrown when you managed to create a recursive hierarchy.
I assume there already is a TOP cell in your layout. In this case, the new top cell created will be called "TOP$1", not "TOP", and the code fails.
Here is a somewhat enhanced version of the above code (note a few enhancements)
Please note that the "read multiple layout into one object" bears the risk of cell collisions: if two cells of different layout files carry the same name, their contents will be merged. This will usually spoil the layout.
Matthias
Caught the following exception :
Unable to open file: MYFILE.oas (errno=2) in Layout::read (Class RuntimeError)
But if I open MYFILE.oas interactively, it works fine.
Where is the limit to open oasis file ?
Thanks, BRgds,
Laurent
Laurent
Right ... common issue on Windows :-)
You can also use forward slashes. Works too and avoids the backslash escaping issue.
Matthias