gdsfactory.routing.route_ports_to_side#
- gdsfactory.routing.route_ports_to_side(component: Component, cross_section: CrossSectionSpec, ports: Ports | Sequence[Port] | InstancePorts | None = None, side: Literal['north', 'east', 'south', 'west'] = 'north', x: float | None = None, y: float | None = None) tuple[list[ManhattanRoute], list[Port]] [source]#
Routes ports to a given side.
- Parameters:
component – component to route.
cross_section – cross_section to use for routing.
ports – ports to route to a side.
side – ‘north’, ‘south’, ‘east’ or ‘west’.
x – position to route ports for east/west. None, uses most east/west value.
y – position to route ports for south/north. None, uses most north/south value.
kwargs – additional arguments to pass to the routing function.
- Keyword Arguments:
radius – in um.
separation – in um.
routing. (extend_left, extend_right for south/north)
routing.
- Returns:
with routing elements. List of ports: of the new ports.
- Return type:
List of routes
import gdsfactory as gf c = gf.Component() dummy = gf.components.nxn(north=2, south=2, west=2, east=2) sides = ["north", "south", "east", "west"] d = 100 positions = [(0, 0), (d, 0), (d, d), (0, d)] for pos, side in zip(positions, sides): dummy_ref = c << dummy dummy_ref.move(pos) routes, ports = gf.routing.route_ports_to_side( component=c, side=side, ports=dummy_ref.ports, cross_section="strip" ) for i, p in enumerate(ports): c.add_port(name=f"{side[0]}{i}", port=p) c.plot()
(
Source code
,png
,hires.png
,pdf
)