For example, I already have enough number of GDS cells (my own and other designs)
Now I want to merge some of them together, to create new layout.
But I don't know, how I may do such work with KLayout :-(
I can open and edit each cell, but I couldn't understand, how I can add saved cell (from file) to actual layout.
Also I couldn't find "Library Builder/Browser" or similar tool.
Could anybody help me?
Thanks!
Comments
Not a dumb question! The short answer is to use Layout#read method.
Here is some code. It takes an array of folder names (in 'paths' variable) and looks inside these folders. For every gds and oas file it finds, it instances this once at 0,0. You may instead want to instance them as top cells rather than as children of an existing top cell, so you would just delete the whole "top_cells.each" block.
I've been meaning to write a nicer version of that with a multi-file chooser dialog and an option for recalling transformation setpoints for each file (rather than always having it instance at 0,0). When that's done I'll add it to The Red Toolbox.
I try this script tomorrow and will write results.
Thanks again for fast responce.
Hi all,
@David: thanks again for providing the script :-)
The manual way is to use File/Import/Other File into Current. There are multiple options available and the feature is documented here: http://klayout.de/doc/manual/import_layout.html.
The scripted solution using
Layout#read
is very efficient and easy to use but it bears a certain risk: if the layouts you import contain cells with the same name they will be merged into a single cell. If the cell names are guaranteed to be different (including child cells), there won't be any issue.The safe option is to read the individual layouts into a new layout object and copy the contents over into the master layout using
Cell#copy_tree
.Matthias
Sorry for delay.
I already had imported files manually, but I definitely will try your script.
Overall, as topological editor - your KLayout, by my opinion, even more comfortable, than the Tanner L-edit 15. Thanks, Matias, it's The Great tool!
But now I have another problem with hierarchical design.
For example, I have some layout, which contained an array of one cell, named, say, ACell.
I need replace all instances of ACell on BCell, with exactly same coordinates and angles.
How I can do it easy?
Also, is any other "tips and hints" about "right" creation library of cells ?
Thanks again!
Edit > Search and Replace, Instance cell name ~ ACell, Replace with BCell (note: BCell must already exist in the layout, and I don't think you can't use library cells using this function. If you want to replace with lib cells you will need to do a scripted solution). ACell will become a new top-level cell in this case.
Second option: You can also right-click on "ACell" in the cell tree on the left, choose "Replace Cell", then type "BCell". All ACell instances will be replaced with BCell instances. Except, then your ACells will be deleted entirely from the layout (no matter which of Shallow/Deep/All Replace option you choose. But, it is sometimes what you want.
Last advice - is exactly that, what i need. And it works OK.