# Layout Operations¶

This reference gives a summary of functions that operate on elements, layers and layouts.

## Boolean operations¶

Boolean operations can be executed on three types of objects: Shapes, Elements and Layers. Standard Python operators can be used.

The following operations are supported:

Boolean Operator Description Supported objects
a AND b & Intersection (conjunction) Shape, Element, Layer
a OR b | Union (disjunction) Shape, Element, Layer
a XOR b ^ Exclusive disjunction Shape, Element, Layer
a NOT b - Difference Shape, Element, Layer
NOT a ~ (Unary) Negation Layer

Note

Boolean operations do exactly that: boolean operations. They do not guarantee that the result can be processed by other software tools or can be manufactured. E.g. booleans may generate polygons with coinciding vertices or touching edges, which are not valid in all tools or in all geometrical operations.

A full guide on boolean operations, including examples, can be found here.

## Element operations¶

Perform an operation on a list of elements.

 get_elements_for_generated_layers(elements, …) Returns a list of elements on specified generated layers, given a list of input elements merge_elements(elements, layers) Convenience wrapper around get_elements_for_generated_layers, to merge elements on the same layer together. subtract_elements(elements, elems_subt[, layers]) Subtract elems_subt from elements.

## Layout operations¶

Perform an operation on a LayoutView or the Layout data.

 get_layer_elements(layout[, layers]) Returns all the elements in a layout on a layer that’s in a given list of layers. get_acute_angle_points(layout[, layers, …]) Returns a dictionary of points that form an acute angle per given layer in a given layout. get_stub_elements(layout[, layers, …]) Returns elements to stub the acute angle corners of a given layout for given layers stub_acute_angles(layout[, stub_elements, …]) Stub the acute angles in a layout for certain layers and merge every element