# subtract_elements¶

ipkiss.boolean_ops.boolean_ops_elements.subtract_elements(elements, elems_subt, layers=[])

Subtract elems_subt from elements. Only substract elements on the same layers, and only if they are listed in layers.

If layers is empty (default), subtract all elements on the same layer.

Parameters: elements: ElementList The elements on which the operation is performed. elems_subt: ElementList The elements that you want to subtract. layers: list[Layer] or Layer Layers to inspect when applying the subtraction. Default is [], all elems_subt will be subtracted from elements. output_elems: ElementList ElementList containing the resulting elements after applying a boolean subtraction on elements on the same layer.

Examples

import ipkiss3.all as i3

class SubtractElements(i3.PCell):
class Layout(i3.LayoutView):
def _generate_elements(self, elems):
rect1 = i3.Rectangle(
i3.Layer(0)
)
rect2 = i3.Rectangle(
i3.Layer(0),
center=(.5, .5)
)

return i3.subtract_elements([rect1], [rect2], [i3.Layer(0)])

SubtractElements().Layout().visualize()