Prune Empty Structures

Modern GDSII layout files can contain hundreds of thousands of structure definitions, millions of structure references and millions of boundaries. If you remove (using the layer filter) all the boundaries except for those belonging to a single layer, it is likely that you will end up with many empty structures as well as many references to empty structures.

Often these empty structures and their references serve no purpose and merely bloat up the filtered file.

A structure is empty if:

    1. It contains no geometric or text entities - i.e. boundaries, text or paths


    2. any SREFs or AREFs in it reference structures that are also empty.

So you can see that the definition is recursive ... before you can say a structure is empty you must first check all of the SREFs in it and determine that those point to empty structures ...

Pruning the Hierarchy Tree

From the GDSFilt Configuration dialog check the box: Trim Off Empty Trees.

  dialog box showing the checkbox to prune empty structures.

Command Line Syntax

If you use an operation such as include layers (-i) and you want to "prune" any empty branches of the hierarchy tree after the file has been filtered by layer then add the -prune option to the GDSFILT command line.


c:\wcad\gdsfilt\gdsfilte.exe          gdsfilt executable
    demo5.gds                         input GDSII file
      demo5_padring.gds               output file
        =                             auto detect and use top cell in input file
          -unixcmdline                needed for Windows (legacy)
             -i8                      include layer 8 in output
              -prune                  prune empty cells and references

original demo5 hierarchy   demo5_padring hierarchy after pruning

Left: Hierarchy of source file.


Right: Hierarchy of pruned file after filtering for layer 8