route

photonforge.parametric.route(*, port1=None, port2=None, radius=None, waypoints=None, technology=None, name=None, straight_kwargs=None, bend_kwargs=None, s_bend_kwargs=None, circuit_model_kwargs=None)[source]

Route the connection between 2 compatible ports.

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

Parameters:
  • port1 (Annotated[Port | tuple[Reference, str] | tuple[Reference, str, int], _Metadata(type=Port, title=None, description=None, units=None, required=False, minimum=None, maximum=None, exclusive_minimum=None, exclusive_maximum=None, min_items=None, max_items=None)] | None) – 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 (optional, only for array references).

  • port2 (Annotated[Port | tuple[Reference, str] | tuple[Reference, str, int], _Metadata(type=Port, title=None, description=None, units=None, required=False, minimum=None, maximum=None, exclusive_minimum=None, exclusive_maximum=None, min_items=None, max_items=None)] | None) – Second port to be connected.

  • radius (Annotated[float, _Metadata(type=None, title=None, description=None, units=μm, required=False, minimum=None, maximum=None, exclusive_minimum=0, exclusive_maximum=None, min_items=None, max_items=None)] | None) – Radius used for bends.

  • waypoints (Annotated[Sequence[Annotated[Sequence[Annotated[float, _Metadata(type=None, title=None, description=None, units=μm, required=False, minimum=None, maximum=None, exclusive_minimum=None, exclusive_maximum=None, min_items=None, max_items=None)]], _Metadata(type=None, title=None, description=None, units=None, required=False, minimum=None, maximum=None, exclusive_minimum=None, exclusive_maximum=None, min_items=2, max_items=2)]], _Metadata(type=None, title=None, description=None, units=None, required=False, minimum=None, maximum=None, exclusive_minimum=None, exclusive_maximum=None, min_items=None, max_items=None)] | None) – 2D coordinates used to guide the route (see note).

  • technology (Annotated[Technology, _Metadata(type=None, title=None, description=None, units=None, required=False, minimum=None, maximum=None, exclusive_minimum=None, exclusive_maximum=None, min_items=None, max_items=None)] | None) – Component technology. If None, the default technology is used.

  • name (Annotated[str, _Metadata(type=None, title=None, description=None, units=None, required=False, minimum=None, maximum=None, exclusive_minimum=None, exclusive_maximum=None, min_items=None, max_items=None)] | None) – Component name.

  • straight_kwargs (Annotated[dict[str, Any], _Metadata(type=required, title=False, description=None, units=None, required=False, minimum=None, maximum=None, exclusive_minimum=None, exclusive_maximum=None, min_items=None, max_items=None)] | None) – Dictionary of keyword arguments passed to the straight() function.

  • bend_kwargs (Annotated[dict[str, Any], _Metadata(type=required, title=False, description=None, units=None, required=False, minimum=None, maximum=None, exclusive_minimum=None, exclusive_maximum=None, min_items=None, max_items=None)] | None) – Dictionary of keyword arguments passed to the bend() function.

  • s_bend_kwargs (Annotated[dict[str, Any], _Metadata(type=required, title=False, description=None, units=None, required=False, minimum=None, maximum=None, exclusive_minimum=None, exclusive_maximum=None, min_items=None, max_items=None)] | None) – Dictionary of keyword arguments passed to the s_bend() function.

  • circuit_model_kwargs (Annotated[dict[str, Any], _Metadata(type=required, title=False, description=None, units=None, required=False, minimum=None, maximum=None, exclusive_minimum=None, exclusive_maximum=None, min_items=None, max_items=None)] | None) – 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