gdsfactory.routing.route_single_from_steps_electrical

gdsfactory.routing.route_single_from_steps_electrical#

gdsfactory.routing.route_single_from_steps_electrical(component: Component, port1: Port, port2: Port, steps: list[dict[str, float]] | None = None, *, bend: ComponentSpec = 'wire_corner', taper: ComponentSpec | None = None, cross_section: CrossSectionSpec | MultiCrossSectionAngleSpec = 'metal3', auto_widen: bool = False, port_type: str | None = None, allow_width_mismatch: bool = False, **kwargs) OpticalManhattanRoute#

Places a route formed by the given waypoints steps.

Uses smooth euler bends instead of corners and tapers in straight sections. Tapering to wider straights reduces the optical loss when auto_widen=True. route_single_from_steps is a manual version of route_single and a more concise and convenient version of route_single_from_waypoints

Parameters:
  • component – to add the route to.

  • port1 – start port.

  • port2 – end port.

  • steps – that define the route (x, y, dx, dy) [{‘dx’: 5}, {‘dy’: 10}].

  • bend – function that returns bends.

  • straight – straight spec.

  • taper – taper spec.

  • cross_section – cross_section spec.

  • auto_widen – if True, tapers to wider straights.

  • port_type – optical or electrical.

  • allow_width_mismatch – if True, allows width mismatch.

  • kwargs – cross_section settings.

import gdsfactory as gf

c = gf.Component("route_single_from_steps_sample")
w = gf.components.straight()
left = c << w
right = c << w
right.dmove((100, 80))

obstacle = gf.components.rectangle(size=(100, 10), port_type=None)
obstacle1 = c << obstacle
obstacle2 = c << obstacle
obstacle1.dymin = 40
obstacle2.dxmin = 25

p1 = left.ports['o2']
p2 = right.ports['o2']
gf.routing.route_single_from_steps(
    c,
    port1=p1,
    port2=p2,
    steps=[
        {"x": 20},
        {"y": 20},
        {"x": 120},
        {"y": 80},
    ],
)
c.plot()

(Source code)