gdsfactory.routing.get_route_from_steps#
- gdsfactory.routing.get_route_from_steps(port1: Port, port2: Port, steps: Iterable[dict[str, float]] | None = None, bend: ComponentSpec = <function bend_euler>, straight: ComponentSpec = <function straight>, taper: ComponentSpec | None = <function taper>, cross_section: CrossSectionSpec | MultiCrossSectionAngleSpec = 'xs_sc', with_sbend: bool = True, auto_widen: bool = False, auto_widen_minimum_length: float = 100, taper_length: float = 10, width_wide: float = 2, **kwargs) Route [source]#
Returns 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. get_route_from_steps is a manual version of get_route and a more concise and convenient version of get_route_from_waypoints
- Parameters:
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.
with_sbend – whether to add sbend for impossible manhattan routes.
auto_widen – whether to add tapers to wider straights.
auto_widen_minimum_length – minimum length to auto widen.
taper_length – length of taper.
width_wide – width of the wider straight.
kwargs – cross_section settings.
import gdsfactory as gf c = gf.Component("get_route_from_steps_sample") w = gf.components.straight() left = c << w right = c << w right.move((100, 80)) obstacle = gf.components.rectangle(size=(100, 10), port_type=None) obstacle1 = c << obstacle obstacle2 = c << obstacle obstacle1.ymin = 40 obstacle2.xmin = 25 p1 = left.ports['o2'] p2 = right.ports['o2'] route = gf.routing.get_route_from_steps( port1=p1, port2=p2, steps=[ {"x": 20}, {"y": 20}, {"x": 120}, {"y": 80}, ], ) c.add(route.references) c.plot()
(
Source code
,png
,hires.png
,pdf
)