route

photonforge.parametric.route(*, port1, port2, radius=None, waypoints=(), technology=None, name='', straight_kwargs={}, bend_kwargs={}, s_bend_kwargs={}, circuit_model_kwargs={})

Route the connection between 2 compatible ports.

The route is built heuristically from straight(), bend(), and s_bend() sections, favoring Manhattan geometry.

Parameters:
  • port1 (Port | tuple[Reference, str] | tuple[Reference, str, int]) – First port to be connected. The port can be specfied as a photonforge.Port or as a tuple including a photonforge.Reference, the port name, and the repetition index (optinal, only for array references).

  • port2 (Port | tuple[Reference, str] | tuple[Reference, str, int]) – Second port to be connected.

  • radius (float | None) – Radius used for bends and S bends.

  • waypoints (Sequence) – 2D coordinates used to guide the route.

  • technology (Technology) – Component technology. If None, the default technology is used.

  • name (str) – Component name.

  • straight_kwargs (dict[str, Any]) – Dictionary of keyword arguments passed to the straight() function.

  • bend_kwargs (dict[str, Any]) – Dictionary of keyword arguments passed to the bend() function.

  • s_bend_kwargs (dict[str, Any]) – Dictionary of keyword arguments passed to the s_bend() function.

  • circuit_model_kwargs (dict[str, Any]) – Dictionary of keyword arguments passed to the component’s photonforge.CircuitModel.

Returns:

Component with the route, including ports and model.

Return type:

Component

Note

Each waypoint can also include the route direction at that point by including the angle (in degrees). Angles must be a multiple of 90°.

component1 = route(
    port1=Port((0, 0), 180, "Strip"),
    port2=Port((20, 5), 0, "Strip"),
    radius=5,
    bend_kwargs={"euler_fraction": 0.5},
    s_bend_kwargs={"euler_fraction": 0.5},
)

component2 = route(
    port1=Port((0, 0), 180, "Strip"),
    port2=Port((20, 20), 0, "Strip"),
    radius=5,
    bend_kwargs={"euler_fraction": 0.5},
    s_bend_kwargs={"euler_fraction": 0.5},
)

component3 = route(
    port1=Port((0, 0), 180, "Strip"),
    port2=Port((0, 35), 180, "Strip"),
    radius=5,
    bend_kwargs={"euler_fraction": 0.5},
    s_bend_kwargs={"euler_fraction": 0.5},
    waypoints=[(10, 10), (20, 20)],
)

component4 = route(
    port1=pf.Port((0, 0), -90, "Strip"),
    port2=pf.Port((0, 35), 90, "Strip", inverted=True),
    radius=5,
    bend_kwargs={"euler_fraction": 0.5},
    s_bend_kwargs={"euler_fraction": 0.5},
    waypoints=[(0, 15, 180)],
)
route