It looks like you're new here. If you want to get involved, click one of these buttons!
Hello, when I am nestled in a loop, iterating over each shape, checking my design rule, I realize that when calling layer.output it outputs a specific error on all my shapes. I dont see a way getting around looping since my design rule is a bit tedious to enforce using common functions in the drc framework, and therefore I have resorted to conventional looping, but I am stuck with the following "problem". The DRC report is extensive, showing many of the same violations several times. In fact, for each iteration, I am able to get as many errors as there are components to verifiy. I believe this is due to layer.output() checking globally (n checks all at once), while my loop is local (1 check, n times). Any advice on how to get around this?
Comments
It would help if you show a little more of your code than just the end.
I understand that you loop over the shapes and probably do some shape-by-shape interact or something like this.
Apart from being super slow, you cannot call "output" multiple times. The way to collect the results is to add them to an error layer and output that layer at the end:
But as you are working against the core concepts of DRC, I cannot promise you will come quite far with that approach. A concept compatible with DRC is
PolygonNeighborhoodVisitor
(https://www.klayout.de/doc-qt5/code/class_PolygonNeighborhoodVisitor.html).This is a kind of callback that gives you a polygon and its neighbors. In your case, you could feed it the overlap regions as primary polygons and the vertical bars as neighbors. Inside the callback you will then see every overlap and the corresponding vertical bar. That allows you you compute the ratios from the polygon pairs and generate a result polygon (the error marker). So technically it is a loop, but one that is primarily executed inside the C++ core and it does the neighborhood collection for you.
You could also use the vertical bars as primary input and the overlap regions as neighbors - this would allow you to identify cases where a vertical bar overlaps multiple horizontal lines.
However, that feature is not integrated into DRC and it is very generic, so it's not straightforward to use. On the plus side it usually cooperates well with deep mode (not here, see below) and slow script execution will be confined to the core function - the overhead is fast C++.
Here is some code. The comments should help understanding what is going on:
And here is some example:
Matthias