An example KLayout-base GUI

instance object at 0x7fd0b4999310>[source]

instance object at 0x7fd0b4999310>(name:str='instance', width:float=1.0, height:float=1.0, num_inputs:int=3, num_outputs:int=1, port_size:float=0.1)

a instance PCell.
instance()
Bokeh Application
@fl.pcell
def connection(
    name="connection",
    input="",
    output="",
):
    rect = np.array([(-width/2, -height/2), (width/2, -height/2), (width/2, height/2), (-width/2, height/2)])
    port = np.array([(-port_size/2, -port_size/2), (port_size/2, -port_size/2), (port_size/2, port_size/2), (-port_size/2, port_size/2)])
    input_ports = np.array([port + np.array([-width/2, y]) for i, y in enumerate(np.linspace(-width/2, width/2, num_inputs + 2)[1:-1])])
    output_ports = np.array([port + np.array([width/2, y]) for i, y in enumerate(np.linspace(-width/2, width/2, num_outputs + 2)[1:-1])])
    
    
    cell = fl.cell(
        name, 
        shapes={
            (1, 0): [rect],
            (1, 1): [*input_ports, *output_ports],
        }
    )
    return cell
example_lib = fl.library(
    "F. E. L.",
    pcells=[instance],
    cells=[],
    description="FLayout Example Library",
)