get_stub_elements

ipkiss3.all.get_stub_elements(layout, layers=None, stub_width=<ipkiss3.technology.TechValue object>, angle_threshold=0.0, grow_amount=None, limit_stub_length=True)

Returns elements to stub the acute angle corners of a given layout for given layers

Parameters:
layout: Layout data of a PCell or ElementList

Layout data of a PCell or ElementList.

layers: list[Layer]

List of layers to inspect.

stub_width: float

Width of the resulting stubs.

angle_threshold: float

An extra threshold for acute angles. For instance, if threshold=0.5, angles that are smaller than 89.5 and bigger than 270.5 will be returned instead of the default <90 and >270.

grow_amount: float

The amount the resulting stub elements need to grow to prevent snapping errors. The default grow amount is the grid size. For more info see i3.ShapeGrow.

limit_stub_length: boolean

Limit the length of the stubs to half the length of the corner when the stub_width can not be reached. Default is True.

Returns:
elems_add, elems_subt: ElementList, ElementList

Elements that need to be added and elements that need to be removed, respectively, to remove acute angles.

Examples

import ipkiss3.all as i3

class SharpShape(i3.PCell):
    class Layout(i3.LayoutView):
        def _generate_elements(self, elems):
            elems += i3.Rectangle(i3.Layer(0), box_size=(10, 40)).transform(i3.Rotation(rotation=150))
            elems += i3.Rectangle(i3.Layer(0), box_size=(10, 40)).transform(i3.Rotation(rotation=90))
            elems += i3.Rectangle(i3.Layer(0), box_size=(10, 40)).transform(i3.Rotation(rotation=30))
            return elems

cell = SharpShape()
cell_lay = cell.Layout()
cell_lay.visualize()

elems_add, elems_subt = i3.get_stub_elements(cell_lay, stub_width=2, angle_threshold=0.01, grow_amount=0.02)

i3.LayoutCell().Layout(elements=elems_add + cell_lay.layout).visualize()
../../../../_images/ipkiss3-all-get_stub_elements-1_00.png
../../../../_images/ipkiss3-all-get_stub_elements-1_01.png
import ipkiss3.all as i3

class SharpShape(i3.PCell):
    class Layout(i3.LayoutView):
        def _generate_elements(self, elems):
            elems += i3.Boundary(
                layer=i3.Layer(1),
                shape=[(0, 0), (40, 30), (10, 30), (-10, 10), (20, 20), (0, 0)])
            return elems

cell = SharpShape()
cell_lay = cell.Layout()
cell_lay.visualize()

elems_add, elems_subt = i3.get_stub_elements(cell_lay, stub_width=2, angle_threshold=0.01, grow_amount=0.02)
i3.LayoutCell().Layout(elements=elems_subt + cell_lay.layout).visualize()

subtracted = i3.subtract_elements(cell_lay.layout, elems_subt, [i3.Layer(1)])
i3.LayoutCell().Layout(elements=subtracted).visualize()
../../../../_images/ipkiss3-all-get_stub_elements-2_00.png
../../../../_images/ipkiss3-all-get_stub_elements-2_01.png
../../../../_images/ipkiss3-all-get_stub_elements-2_02.png