It looks like you're new here. If you want to get involved, click one of these buttons!
Hi Everyone,
I've been trying to find a good way to calculate the bounding boxes for various layouts. This is the simplest and works well for small layouts:
allLayers = input("1-999/0-5")
puts "Bounding box of this layout is (x_ll,y_ll,x_ur,y_ur)"
puts allLayers.bbox.to_s
But this doesn't work for large layouts (it takes forever and doesn't indicate whether progress is being made)
One option I tried and haven't really gotten to work is to extract the layers in Python like this (after I used pip to install klayout):
from klayout import db
import sys,os
layout = db.Layout()
layout.read('test.gds')
for ly_id in layout.layer_indices():
lyList[ly_id] = layout.get_info(ly_id).to_s().split('/')
The issue here is that I don't know how to feed the layer list into BBOX.
This way would be preferential for me since I would like to do some other DRC manipulations on a layer-by-layer basis and this would get me halfway there.
Any help is appreciated!
Comments
This would be interesting to see fitted up to the other related
boundary advice I received in this thread:
https://www.klayout.de/forum/discussion/1423/boolean-operators#latest
I would prefer to let the layout "declare its own size", as it were,
rather than adding a boundary layer to the foundry's set or
having to manually assert and size one in a customized run-set.
It would also be nice to have DRC script print out what it
thinks the extents are, for its run.
Hi rajan,
The bounding box is a cell property, so the easiest way is this script:
This script should be fast - essentially it's just the read time.
Within a DRC script you can use "extent" to give you the bounding box of all layers:
@Jim Of course, the best was if the layout could indicate it's dimensions. But GDS does not provide this information. A GDS file will only give you the layers, that's it. So having a boundary layer is the only way to embed the layout extension into GDS.
There is one more reason to have a layer for the boundary. Sometimes, the boundary might not be a box. I know cases, where the corners of the chips are reserved for inspection alignment marks. In this case, the boundary is a box minus small corners. And inversion correctly avoids these corners if you implement it as "boundary - layer".
Matthias
Thanks for the tips, the layout object is pretty feature-rich so I will have to play around with that more. The dbbox function is indeed very fast!
duplicate comment
How to see the boundary box size after running below scripts in DRC environment?
source("test.gds")
puts extent.data.bbox
You mean, where to see it?
"puts" will print to the "console" which you find in the "macro IDE": Macros/Macro Development.
You can also use "log", "info", "warning" or "error". This will go to the log file (if you specify one) or the log viewer (File/Log Viewer). "log" will be shown only in verbose mode. The other three are formatted according to the severity level (warnings blue, errors red, info black).
Matthias
I've been using the "Compute the bounding box of a cell" script of the "Useful Ruby Modules" section for a long time now. Nice to have it as a menu entry if you have to check it frequently... Code is in the link below...
https://www.klayout.org/svn-public/klayout-resources/trunk/scripts/cell_bbox.lym
Cheers,
Tomas