Hi Mathias, first of all thank you so much for such an amazing tool.
I am learning to write scripts to do simple operations to layers. However, everything I output goes to the top layer.
The simplest thing I would like to do is so trivial, just copy a layer and paste it in a different layer. I can easily do it from the menu, selecting the "cell by cell" option.
However, when I do it with script using "input" and "output", everything goes to the top layer, spoiling my hierarchy.
I know that for boolean operations, it makes sense that the software flattens everything before doing anything. But the simple operations I want to do should not have inter-cell overlapping problems. For example, if I could go cell by cell exploring at all depths, and finding only cells that have a certain layer as an element not as a child, my problem would be solved. Something like a "shallow select" or shallow "input". Is there anything like that?
Thanks!
Comments
Hello,
Thanks for your feedback.
Regarding your question about preservation of hierarchy: I guess you are referring to the DRC scripting. That is just one way of script things. The other way is more versatile, more powerful and slightly more difficult to use: the pure scripting API.
Using that API you can do a simple shape-by-shape, hierarchy-preserving copy this way:
There is much more to discover here. That scripting feature allows you to work on the lowest shapewise level up to the more abstract level that the DRC feature employs.
A starting point for learning to code Ruby scripts is http://www.klayout.de/doc/programming/index.html.
Matthias