stub_acute_angles

ipkiss3.all.stub_acute_angles(layout, stub_elements=None, layers=[], angle_threshold=0.0, stub_width=None, grow_amount=None, limit_stub_length=True)
Stub the acute angles in a layout for certain layers and merge every element

on the same specified layer together.

Parameters:
layout: Layout data of a PCell or ElementList

Layout data of a PCell or ElementList.

stub_elements: sequence of two ElementLists

Sequence of two ElementLists. The first ElementList is the list of elements you wish to add and the second is the list of elements you wish to subtract. Default is None and then these ElementLists will be calculated automatically using i3.get_stub_elements().

layers: list[Layer]

List of layers to inspect.

angle_threshold: float

An extra threshold for acute angles. For instance, if angle_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. Only applies if stub_elements is None.

stub_width: float

Width of the resulting stubs. When None (default), the value is set to TECH.TECH.MINIMUM_SPACE. Only applies if stub_elements is None.

grow_amount: float

The amount the resulting stub elements need to grow to prevent snapping errors. When None (default), the value is set to the grid size. For more info see i3.ShapeGrow. Only applies if stub_elements is None.

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:
elements: ElementList()

Returns all the elements in the layout, with the acute angles stubbed for the given layers.

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

elements = i3.stub_acute_angles(cell_lay, stub_width=2, angle_threshold=0.01, grow_amount=0.02)
i3.LayoutCell().Layout(elements=elements).visualize()

# Or if you want more control over which stubs get added or subtracted:
elems_add, elems_sub = i3.get_stub_elements(cell_lay, stub_width=2, angle_threshold=0.01, grow_amount=0.02)
elems_add = elems_add[1::2]

new_elements = i3.stub_acute_angles(cell_lay, stub_elements=[elems_add, elems_sub])
i3.LayoutCell().Layout(elements=new_elements).visualize()
../../../../_images/ipkiss3-all-stub_acute_angles-1_00.png
../../../../_images/ipkiss3-all-stub_acute_angles-1_01.png
../../../../_images/ipkiss3-all-stub_acute_angles-1_02.png