Title says it all actually. I have 2 layouts in 2 separate GDS files. When I XOR or Diff them, I essentially get copies of the same layouts I started with instead of a result layer with the difference.
The only way I've gotten XOR to sort of work is by doing the layer boolean XOR operation with both layers in the same file, but that yields a single polygon for an entire layout, and that isn't recognized by any other GDS software.
Is XOR/Diff a feature intended for a future release?
Thanks,
Yevoc
Comments
Hi Yevoc,
could you please be somewhat more specific? The title tells nothing, sorry. What did you do exactly? What version are you using?
This is how it works for me:
After that I get new layers, for example 1001 in layout B containing the differences between layer 1 of A and layer 1 of B. No copy, but the differences.
Regarding the XOR results from the single-layer operation: I don't know what "any other GDS software" you are referring to, but I'd consider setting the number of maximum vertexes to a lower value in the layout writer options when saving (maybe as low as 200). Your "any other software" might have trouble recognizing what is almost standard now. And maybe that software even tells somehow what it is not able to recognize. Another potentially useful information missing here.
Matthias
I'm using KLayout 0.21.19. The steps you just gave are exactly what I did. I then get two new layers in the second file which are exact duplicates of my input. For example, if I have one gds with a box, and I have a second gds with a box at the same coordinates with a slightly smaller height/width, then your operation described above will simply reproduce the input layouts instead of exporting a single layer that has a hole in the larger box.
The specific GDS software I'm using is JBXFILER. It has a visualizer step, and I've never had any trouble viewing GDS files of many kinds before. However, this software shows zero shapes when I try to view a KLayout generated GDS that was created via the Layer boolean XOR operation.
Thanks,
Yevoc
This may not occur for all possible layouts, but for example, it would happen for the XOR of a square within a square.
Hi Yevoc,
sorry, I can't follow.
I am using the XOR function myself almost daily on layouts which are far more complex that just two boxes. So far it always did the right thing, although the performance could be better.
I suspect that your input is on different layers. The XOR function compares same layers in both layouts. So if you have layout A with a rectangle on layer 1 and layout B with a rectangle on layer 2, this will give you two outputs with copies of 1(A) and 2(B). Missing layers are treated as empty in the spirit of the GDS format. 1(A) will be XOR'd with 1(B) - which is empty - and 2(A) - which is empty - will be XOR'd with 2(B), hence the output contains two layers, each if which was XOR's against an empty one.
To match both, you first have to map the layers to identical ones, i.e. layer 2 of B to layer 1 in that example. Use "Edit/Layer/Edit Layer Specification" for that purpose (select 2@2 in the layer list for layer 2 of layout B on chose "Edit/Layer/Edit Layer Specification", enter 1 into the layer number).
The reason for that is that usually a GDS file consists of many layers with a specific interpretation and without matching the layer number the XOR couldn't tell which layers to compare.
The same holds for the Diff utility, by the way.
The giant polygon is an effect of the XOR - when there is no counterpart, a layer will be simply merged because the other layer is regarded as empty and the merged way is how the regions are represented internally. When saving such a layout, the giant polygon is broken to reduce the number of vertices. The default maximum is 8000 points which is above the limit of original GDS specification, but can be read by most modern tools. You can reduce the number to a smaller value but that implies potential distortions of the layout because of the introduction of cut lines. 4000 should be a valid limit. Some older tools have an internal limit at 200 points.
Equal start and end points of polygons are common in GDS - that is a not a bug.
Matthias
You're right about your suspicion regarding layer 1 and layer 2, which fixed the XOR issue.
I also bet you're right about the vertices. I'll try the various limits out today.
Thanks!
Yevoc