KLayout 0.29.8 (2024-10-28 63dd591e5) [master]

Flatten Cells

A "flat" cell is a cell without hierarchy. This means that the cell contains only shapes, but no instances of child cells. Flat cells are disconnected from other cells, hence flattening is a way to "freeze" the contents of a cell: when a cell is flat, changing any other cell does not have an effect on this cell or in other places of the cell. On the other hand, flat cells store each shape individually, hence cannot make use of data compression be reuse of geometry.

A hierarchical cell can be flattened by choosing "Edit/Cell/Flatten Cell" or "Flatten Cell" from the cell list context menu. The flatten operation offers some options, i.e. the number of hierarchy levels to flatten and how to deal with child cells which become obsolete through this operation ("orphan cells"). By enabling this "prune" option, all child cells are removed when they are no longer needed. Otherwise, new top level cells will appear in that case - these are the cells which are not longer instantiated.

"Flatten" can also be applied to instances. In that case, the cell instance is removed and replaced by the objects inside this cell. So instance flattening is a way to pull the contents of a cell into the parent cell. One reason for doing so is to make the cell contents accessible for editing, without having to change the child cell itself. This prevents potential side effects when editing a cell would make the edits visible in other places.

Instance-wise flattening is available by choosing "Edit/Selection/Flatten Instances". Again, options are available to choose the number of hierarchy levels to flatten and how to treat orphan cells.