示例#1
0
def align_TE_on_via():

    cell = dl.Device("Align TE on VIA")

    circle = pg.circle(radius=50, layer=pt.LayoutDefault.layerVias)

    cross = pg.cross(width=30, length=250, layer=pt.LayoutDefault.layerVias)

    g = Group([circle, cross])

    g.align(alignment='x')
    g.align(alignment='y')
    circle.add(cross)

    viapattern = pg.union(circle, 'A+B', layer=pt.LayoutDefault.layerVias)

    TEpattern = pg.union(circle, 'A+B',
                         layer=pt.LayoutDefault.layerTop).copy('tmp',
                                                               scale=0.8)

    cell.add(viapattern)
    cell.add(TEpattern)

    cell.align(alignment='x')
    cell.align(alignment='y')

    cell.flatten()

    return cell
示例#2
0
def join(device: Device) -> Device:
    ''' returns a copy of device with all polygons joined.

    Parameters
    ----------
    device : phidl.Device.
    '''
    out_cell = pg.union(device,
                        by_layer=True,
                        precision=0.001,
                        join_first=False)

    return out_cell
示例#3
0
def _calculate_pre_post_area(cell_test, cell_ref):

    area_pre = cell_ref.area()

    c_flat = pg.union(cell_ref, by_layer=False, layer=100)

    if isinstance(cell_test, Device):

        c_flat.add_ref(cell_test)

    else:

        if isinstance(cell_test, DeviceReference):

            c_flat.add(cell_test)

    area_post = _get_cell_area(c_flat)

    return area_pre, area_post
# If you have several polygons which form a single compound shape and you want
# to join (union) them all together, you can do it with the pg.union() command:
# Note: Like all phidl.geometry functions, this will return NEW geometry! In
# particular, this function will return a new *flattened* geometry

D = Device()
D << pg.ellipse(layer=0)
D << pg.ellipse(layer=0).rotate(15 * 1)
D << pg.ellipse(layer=0).rotate(15 * 2)
D << pg.ellipse(layer=0).rotate(15 * 3)
D << pg.ellipse(layer=1).rotate(15 * 4)
D << pg.ellipse(layer=1).rotate(15 * 5)

# We have two options to unioning - take all polygons, regardless of
# layer, and join them together (in this case on layer 5) like so:
D_joined = pg.union(D, by_layer=False, layer=5)

# Or we can perform the union operate by-layer
D_joined_by_layer = pg.union(D, by_layer=True)

dj = D << D_joined
djl = D << D_joined_by_layer
dj.xmax += 25
djl.xmax += 50

qp(D)

#==============================================================================
# Comparing two Devices
#==============================================================================
# Sometimes you want to be able to test whether two Devices are identical or
示例#5
0
def _get_cell_area(cell):

    c_flat = pg.union(cell, by_layer=False, layer=100)

    return c_flat.area()