gdsfactory.routing.route_bundle#
- gdsfactory.routing.route_bundle(component: gf.Component, ports1: Ports, ports2: Ports, cross_section: CrossSectionSpec | None = None, layer: LayerSpec | None = None, separation: float = 3.0, bend: ComponentSpec = 'bend_euler', sort_ports: bool = False, start_straight_length: float = 0, end_straight_length: float = 0, min_straight_taper: float = 100, taper: ComponentSpec | None = None, port_type: str | None = None, collision_check_layers: LayerSpecs | None = None, on_collision: Literal['error', 'show_error'] | None = 'show_error', bboxes: list[kf.kdb.Box] | None = None, allow_width_mismatch: bool = False, radius: float | None = None, route_width: float | None = None, straight: ComponentSpec = 'straight', auto_taper: bool = True, waypoints: Coordinates | None = None, steps: Sequence[Mapping[str, int | float]] | None = None, start_angles: int | list[int] | None = None, end_angles: int | list[int] | None = None, router: Literal['optical', 'electrical'] | None = None) list[ManhattanRoute] [source]#
Places a bundle of routes to connect two groups of ports.
Routes connect a bundle of ports with a river router. Chooses the correct routing function depending on port angles.
- Parameters:
component – component to add the routes to.
ports1 – list of starting ports.
ports2 – list of end ports.
cross_section – CrossSection or function that returns a cross_section.
layer – layer to use for the route.
separation – bundle separation (center to center). Defaults to cross_section.width + cross_section.gap
bend – function for the bend. Defaults to euler.
sort_ports – sort port coordinates.
start_straight_length – straight length at the beginning of the route. If None, uses default value for the routing CrossSection.
end_straight_length – end length at the beginning of the route. If None, uses default value for the routing CrossSection.
min_straight_taper – minimum length for tapering the straight sections.
taper – function for the taper. Defaults to None.
port_type – type of port to place. Defaults to optical.
collision_check_layers – list of layers to check for collisions.
on_collision – action to take on collision. Defaults to show_error.
bboxes – list of bounding boxes to avoid collisions.
allow_width_mismatch – allow different port widths.
radius – bend radius. If None, defaults to cross_section.radius.
route_width – width of the route. If None, defaults to cross_section.width.
straight – function for the straight. Defaults to straight.
auto_taper – if True, auto-tapers ports to the cross-section of the route.
waypoints – list of waypoints to add to the route.
steps – list of steps to add to the route.
start_angles – list of start angles for the routes. Only used for electrical ports.
end_angles – list of end angles for the routes. Only used for electrical ports.
router – Set the type of router to use, either the optical one or the electrical one. If None, the router is optical unless the port_type is “electrical”.
import gdsfactory as gf dy = 200.0 xs1 = [-500, -300, -100, -90, -80, -55, -35, 200, 210, 240, 500, 650] pitch = 10.0 N = len(xs1) xs2 = [-20 + i * pitch for i in range(N // 2)] xs2 += [400 + i * pitch for i in range(N // 2)] a1 = 90 a2 = a1 + 180 ports1 = [gf.Port(f"top_{i}", center=(xs1[i], +0), width=0.5, orientation=a1, layer=(1,0)) for i in range(N)] ports2 = [gf.Port(f"bot_{i}", center=(xs2[i], dy), width=0.5, orientation=a2, layer=(1,0)) for i in range(N)] c = gf.Component() gf.routing.route_bundle(c, ports1, ports2) c.plot()