It looks like you're new here. If you want to get involved, click one of these buttons!
Dear support,
I'm using KLayout (version 0.30.1 on Linux) for the DRC.
In photonics, some layers can have complex structures (many curves), and running a DRC on these structures can take many hours (>24 hours), and it is not uncommon that KLayout crashes in the end (because out of memory (>96 GB)).
Therefor, we want to exclude certain areas in a layer from the DRC.
(Even for simple structures, this is necessary because for finding overlaps of polygons within a single layer, it is sometimes allowed to have overlaps at specific locations. In photonics, 2 waveguides in the same layer may sometimes cross each other. So, we want to exclude these areas also from the DRC.)
So, I create a new layer, and place some polygons (the exclusion areas) in it. And I do the DRC check on
layer.not(exclusion_layer)
But this doesn't work, because after the boolean NOT operation, the layer is in 'clean' state, and this causes problems finding the overlaps.
Let me explain this with an example.
The left red cross in the layout are 2 straights (a horizontal and a vertical) in the same layer (layer 1).
I find the overlap with:
layer1 = input(1)
layer1.merged(2).output("Overlap layer1")
This gives the expected overlap.
The right purple 'double' cross in the layout are 2 horizontal straights, and these straights overlap with a vertical straight. These 3 straights are in layer 2. When I run the same check again (without using an exclusion layer), I get 2 overlaps (as expected) Call this the 'top-overlap' and the 'bottom-overlap'.
layer2 = input(2)
layer2.merged(2).output("Overlap layer2")
Now add the exclusion layer (layer 24, green).
exclusion_layer = input(24)
When I run the last overlap test again, I want to find the 'top-overlap', but not the 'bottom-overlap', because the exclusion layer has created a 'hole' at that spot.
layerEx = layer2.not(exclusion_layer)
layerEx.merged(2).output("Overlap layer2 with exclusion layer")
But this doesn't work. The 'bottom-overlap' is gone (good!), but the 'top-overlap' is also gone (bad!).
I discovered that the boolean NOT operation creates a layer in the CLEAN state (the merging has already been
done by the NOT operation). (Calling merged(2) on an already merged layer is pointless.)
layer2.not(exclusion_layer).is_merged? returns true.
I tried the following, but that didn't work:
layerExRawRaw = input(2).raw.not(input(24).raw)
layerExRawRaw.merged(2).output("Overlap layer2 (RawRaw) with exclusion layer")
How do I use an exclusion layer that only creates 'holes' in another layer, while leaving the rest of that layer unchanged (the layer remains in raw-state)?
(We also need this exclusion layer for other checks than the overlap check.)
Thanks, Remco
Remark: I also have the GDS file and the DRC file, but this forum blocks uploading these files. The "Attach file" only allows uploading images, which is the same as the "Attach image" button. Looks like a bug?

Comments
Many kits use blocking and identifying purpose
layers to steer DRC and extraction.
There needs to be the logical use of those
polygons of course. Every "real" layer of
interest would be "ANDNOT"ed with its
exclusion layer to make a meta-layer that
gets checked instead, rule by rule. Complex
or "fussy" technologies can have a lot of
that.
Examples of such things, that work in klayout
are worth collecting.
I've in the distant past done things using a
combo of layer and "getTexted()" (Brand X,
back in the Diva days) to make "super surgical"
blockages that somebody can't defeat by just
placing a polygon - tag with the rule# and
you can get really fine grained.