parametric.route
route( *, port1: photonforge.Port | tuple[photonforge.Reference, str] | tuple[photonforge.Reference, str, int] | None = None, port2: photonforge.Port | tuple[photonforge.Reference, str] | tuple[photonforge.Reference, str, int] | None = None, radius: Annotated[float, exclusiveMinimum=0, units='μm'] | None = None, waypoints: collections.abc.Sequence[ Annotated[ collections.abc.Sequence[Annotated[float, units='μm']], maxItems=2, minItems=2, ] ] | None = None, target_length: Annotated[float, exclusiveMinimum=0, units='μm'] | None = None, length_tolerance: Annotated[float, exclusiveMinimum=0, units='μm'] | None = None, technology: photonforge.Technology | None = None, name: str | None = None, model: photonforge.Model | None = None, straight_kwargs: Annotated[dict[str, Any], _] | None = None, bend_kwargs: Annotated[dict[str, Any], _] | None = None, s_bend_kwargs: Annotated[dict[str, Any], _] | None = None,) -> photonforge.ComponentRoute the connection between 2 compatible ports.
The route is built heuristically from straight, bend,
and s_bend sections, favoring Manhattan geometry. Use
route_auto for obstacle-aware multi-net routing.
Args
- port1: First port to be connected. The port can be specified as a
Portor as a tuple including aReference, the port name, and the repetition index (optional, only for array references). - port2: Second port to be connected.
- radius: Radius used for bends.
- waypoints: 2D coordinates used to guide the route (see note).
- target_length: Desired route length. A displacement-neutral meander is inserted to achieve it.
- length_tolerance: Tolerance for
target_length. Defaults to 1e-3. - technology: Component technology. If
None, the default technology is used. - name: Component name.
- model: Model to be used with this component. If
NoneaCircuitModelis used. - straight_kwargs: Keyword arguments for
straight. - bend_kwargs: Keyword arguments for
bend. - s_bend_kwargs: Keyword arguments for
s_bend.
Returns
Component with the route, including ports and model.
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°.
Example
>>> 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)],... )>>> layout = pf.Component().add(... pf.Reference(component1),... pf.Reference(component2, (0, -30)),... pf.Reference(component3, (30, -30)),... pf.Reference(component4, (65, -30)),... )