gdsfactory.routing.route_sharp(component: Component, port1: Port, port2: Port, width: float | None = None, path_type: str = 'manhattan', manual_path=None, layer: LayerSpec | None = None, cross_section: CrossSectionSpec | None = None, port_names: tuple[str, str] = ('o1', 'o2'), **kwargs) None[source]#

Returns Component route between ports.

  • component – Component to add the route to.

  • port1 – start port.

  • port2 – end port.

  • width – None, int, float, array-like[2], or CrossSection. If None, the route linearly tapers between the widths the ports If set to a single number (e.g. width=1.7): makes a fixed-width route If set to a 2-element array (e.g. width=[1.8,2.5]): makes a route whose width varies linearly from width[0] to width[1] If set to a CrossSection: uses the CrossSection parameters for the route.

  • path_type – {‘manhattan’, ‘L’, ‘U’, ‘J’, ‘C’, ‘V’, ‘Z’, ‘straight’, ‘manual’}.

  • manual_path – array-like[N][2] or Path Waypoint for manual route.

  • layer – Layer to put route on.

  • cross_section – CrossSection to use for the route.

  • port_names – Tuple of port names for the start and end of the route.

  • kwargs – Keyword arguments passed to the waypoint path function.

Method of waypoint path creation. Should be one of:

  • manhattan: automatic manhattan routing (see path_manhattan() ).

  • L: L-shaped path for orthogonal ports that can be directly connected.

  • U: U-shaped path for parallel or facing ports.

  • J: J-shaped path for orthogonal ports that cannot be directly connected.

  • C: C-shaped path for ports that face away from each other.

  • Z: Z-shaped path with three segments for ports at any angles.

  • V: V-shaped path with two segments for ports at any angles.

  • straight: straight path for ports that face each other.

  • manual: use an explicit waypoint path provided in manual_path.

import gdsfactory as gf

c = gf.Component("pads")
c1 = c << gf.components.pad(port_orientation=None)
c2 = c << gf.components.pad(port_orientation=None)


route = c << gf.routing.route_sharp(c1.ports["e4"], c2.ports["e1"], path_type="L")

(Source code)