gdsfactory / kfactory

gdsfactory with a klayout backend
https://gdsfactory.github.io/kfactory/
MIT License
28 stars 10 forks source link

allow None backbone in all angle router #352

Closed joamatab closed 1 month ago

joamatab commented 1 month ago

How could we allow No backbone for the all angle router?


    c = gf.Component("demo")

    mmi = gf.components.mmi2x2(width_mmi=10, gap_mmi=3)
    mmi1 = c << mmi
    mmi2 = c << mmi

    mmi2.dmove((100, 10))
    mmi2.drotate(30)

    routes = gf.routing.route_bundle_all_angle(
        c,
        mmi1.ports.filter(orientation=0),
        [mmi2.ports["o2"], mmi2.ports["o1"]],
    )
    c.show()
sebastian-goeldi commented 1 month ago

yeah, I can implement that relatively easy. It would just mean direct connection with no guarantee or check for separation

sebastian-goeldi commented 1 month ago

Your example will work now.

Be aware though since you use real components, this causes a laundry list of snapping issues

70.46756,54.43177,0.10832 image

Can be fixed with the virtual cell classes instead of standard ones:

from functools import partial

import gdsfactory as gf

c = gf.Component("demo")

mmi = gf.components.mmi2x2(width_mmi=10, gap_mmi=3)
mmi1 = c.create_vinst(mmi)
mmi2 = c.create_vinst(mmi)

mmi2.move((100, 10))
mmi2.rotate(30)

sf = partial(
    gf.kf.cells.virtual.straight.virtual_straight, width=0.5, layer=gf.kcl.layer(1, 0)
)
bf = partial(
    gf.kf.cells.virtual.euler.virtual_bend_euler,
    width=0.5,
    radius=10,
    layer=gf.kcl.layer(1, 0),
)
gf.kf.routing.aa.optical.route_bundle(
    c,
    start_ports=mmi1.ports.filter(orientation=0),
    end_ports=[mmi2.ports["o2"], mmi2.ports["o1"]],
    separation=0,
    backbone=[],
    straight_factory=sf,
    bend_factory=bf,
)
c.show()

image

image