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(), ands_bend()sections, favoring Manhattan geometry.- Parameters:
port1 (Port | Annotated[tuple[Reference, str] | tuple[Reference, str, int], _] | None) – First port to be connected. The port can be specfied as a
photonforge.Portor as a tuple including aphotonforge.Reference, the port name, and the repetition index (optional, only for array references).port2 (Port | Annotated[tuple[Reference, str] | tuple[Reference, str, int], _] | None) – Second port to be connected.
radius (Annotated[float, exclusiveMinimum=0, units='μm'] | None) – Radius used for bends.
waypoints (Annotated[Sequence[Annotated[Sequence[Annotated[float, units='μm']], maxItems=2, minItems=2]], _] | None) – 2D coordinates used to guide the route (see note).
technology (Annotated[Technology, _] | None) – Component technology. If
None, the default technology is used.name (Annotated[str, _] | None) – Component name.
straight_kwargs (Annotated[dict[str, Any], _] | None) – Dictionary of keyword arguments passed to the
straight()function.bend_kwargs (Annotated[dict[str, Any], _] | None) – Dictionary of keyword arguments passed to the
bend()function.s_bend_kwargs (Annotated[dict[str, Any], _] | None) – Dictionary of keyword arguments passed to the
s_bend()function.circuit_model_kwargs (Annotated[dict[str, Any], _] | None) – Dictionary of keyword arguments passed to the component’s
photonforge.CircuitModel.
- Returns:
Component with the route, including ports and model.
- Return type:
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 = pf.parametric.route(
port1=pf.Port((0, 0), 180, "Strip"),
port2=pf.Port((20, 5), 0, "Strip"),
radius=5,
bend_kwargs={"euler_fraction": 0.5},
s_bend_kwargs={"euler_fraction": 0.5},
)
component2 = pf.parametric.route(
port1=pf.Port((0, 0), 180, "Strip"),
port2=pf.Port((20, 20), 0, "Strip"),
radius=5,
bend_kwargs={"euler_fraction": 0.5},
s_bend_kwargs={"euler_fraction": 0.5},
)
component3 = pf.parametric.route(
port1=pf.Port((0, 0), 180, "Strip"),
port2=pf.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 = pf.parametric.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)],
)