merge_elements

ipkiss.boolean_ops.boolean_ops_elements.merge_elements(elements, layers)

Convenience wrapper around get_elements_for_generated_layers, to merge elements on the same layer together.

This is equivalent to

i3.get_elements_for_generated_layers(elements, {lay: lay for lay in layers})

Parameters:

elements: ElementList

List of input elements.

layers: list[Layer] or Layer

A list of layers to merge.

Returns:

ElementList containing the resulting elements after applying a boolean union on elements on the same layer.

Examples

import ipkiss3.all as i3

class MergeElements(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)
            )

            layers = [i3.Layer(0)]

            return i3.merge_elements([rect1, rect2], layers)

MergeElements().Layout().visualize()
../../../_images/ipkiss-boolean_ops-boolean_ops_elements-merge_elements-1.png