I was trying to get to the coordinates of certain shapes in the hierarchy.
I generally do this by transforming shapes, for every level of hierarchy as I come back up to top. It works.
An alternate approach, I have been using is to flatten the GDS by writing a on-the-fly flatten rule deck for DRC tool, specifying layers of interest. Then process the flattened data back with scripts.
Here I was hoping to be able to write flattened data in text format and then process with perl or something to fit my requirement.
Suggestions are welcome.
Comments
Hi Jay,
the following is a piece of ruby code that adds a new "Tools" menu entry (Dump flat shapes).
It asks for a file name and prints the shapes as they appear in the current top cell for all
visible layers. The format is XML like that:
Please note that the coordinates are given in database units. The script can be easily adjusted to
produce micrometer units if required.
BTW: a better solution would be to use the RecursiveShapeIterator object, but I just discovered some
issues with array instances ...
Best regards,
Matthias
Here is the script:
Matthias,
First of all, thanks for all the great effort. It's very helpful.
In the code above, I have tried to debug, why the following crashes the tool:
layers.each do |l|
file.puts(" ")
dump_shapes(file, cv.layout, cv.cell, l, RBA::CplxTrans.new)
file.puts(" ")
end
Value of 'l' seems to show up as -1 in all cases. There is no other message besides segfault.
Couple questions:
1. Iterating over lnodes, I am also getting non existing layers in layers[]
2. UI seems to freeze, 'strace' shows following messages with no other activity.
rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0
Thanks
~J
Changing from
if !lnode.current.has_children? && lnode.current.visible?(true)
to
if !lnode.current.has_children? && lnode.current.layer_index >=0 && lnode.current.visible?(true)
seems to solve the problem. I no longer have -1 in layers[].
For a layout with 50 shapes, it seems to take a long time between file open dialog and writing the text file.
Never-the-less it does solve the problem
Thanks
~J
Hi Jay,
you're right. The -1 layer index may appear if a layer is specified in the layer list but is not in the layout (i.e. when the layer list is loaded from a file). I did not take into account that case correctly. Some of the ruby methods are mapped to low-level C++ methods which do not do much consistency checking which makes the application crash. I admit that is not user-friendly. I'll try to provide more checks.
I changed the code above accordingly.
Thanks for the hint.
Best regards,
Matthias
Code you put up there is a good example of traversing layers and shapes in layout.
Thanks for your help.
~J