KLayout 0.29.8 (2024-11-26 926dac96c) [master]

Transforming Views And Property Selectors

The source specification described in the section before is much more powerful than just allowing to describe the data source. In addition to that, the layer can be geometrically transformed and the display can be confined to shapes that belong to a certain class described by a property selector.

A geometrical transformation is specified by appending a transformation in round brackets to the layer/datatype source specification. The format of this transformation is (in any order):

( [<dx>,<dy>] [r<angle> | m<angle>] [*<mag>] )

For example, "(r90)" specifies a rotation by 90 degree counter-clockwise. "(0,100.0 m45 *0.5)" will shrink the layout to half the size, flip at the 45 degree-axis (swap x and y axes) and finally shift the layout by 100 micron upwards.

A detailed explanation of the transformation syntax can be found in Transformations in KLayout.

Transformations accumulate over the layer hierarchy. This means, that if a layer is transformed and the layer is inside a group whose representative specifies a transformation as well, the resulting transformation is the combination of the layer's transformation (first applied) and the group representative's transformation.

Multiple transformations can be present. In this case, the layout is shown in multiple instances.

A particular application is to regroup layers by layout index and assign a transformation to the group representative belonging to a certain layout such that the layouts get aligned.

The property selector is specified in square brackets. A selector combines several expressions of the form "<property>==value>" or "<property>!=<value>" with operators "&&", "||", "!" and allows usage to round brackets to prioritize the evaluation of these operators:

[ <expr> ]

In GDS2 files, the property is always named with a integer value which is written with a single hash characters (i.e. "#43". The value of a GDS property is always a string. A string is either written as a text atom or can be enclosed in single or double quotes. The following is an example for a valid property selector for GDS files:

10/5 [#43==X]

With this source specification, the layer will show all shapes from layer 10, datatype 5 which have a user property with number 43 and value string "X". A more complex example is this:

10/5 [!(#43==X&&(#2==Y||#2==U))]

With OASIS files, the properties can be named with a string. In this case, the property selector can be "[prop==X]" for example. In addition, the value can be a an integer or a double value. This is reflected by the choice of the value: "[prop==#200]" will check, if the property named "prop" has an integer value which is 200. In the same fashion, "[prop==##0.5]" checks, if the property "prop" has a double value and this is 0.5.

Property selectors combine over a layer hierarchy. This means, that if a group representative specifies a property selector and a layer in this group specifies a selector as well, only those shapes will be shown that meet both criteria.

A general description for the source notation is found here: About Layer Sources.