qcc_kplugin.joins

How a route ends on another line: a hanger coupler beside it, or merged into it with a T-junction.

merge splits the line at a point into two routes joined by a KQC WaveguideCoplanarSplitter (a T: ports a / b along the line, c the stem) and returns the stem port for the new route to end on. unmerge undoes it: the two halves become one route again and the stem route ends as a hanger coupler at the T’s place. hanger_to_merge / merge_to_hanger convert an existing route end. The LOM model of the splitter is one conductor, so a capacitor or a resonator on the stem is galvanically on the line.

Plain Python (no pya): unit-tested outside KLayout. Functions change the design dict in place and raise ValueError with a message fit for the status bar.

Attributes

Functions

arclength(pts, p) → tuple[float, int, tuple]

(arclength of the point of polyline pts nearest p, its segment (1-based), that point).

hanger_to_merge(design, route, polyline_of, r[, ...]) → str

Route route ends as a hanger coupler: merge it into that line with a T instead. Returns the T's name.

merge(design, host, polyline, point, side, r[, ...]) → dict

Split route host (built polyline, bend radius r) at the point nearest point with a T whose stem

merge_to_hanger(design, route, polyline_of[, coupler, ...]) → str

Route route ends on a merge T's stem: remove the T and end the route as a hanger coupler there instead.

point_at(pts, s) → tuple

The point at arclength s along polyline pts.

side_normal(pts, segment, side) → tuple

Unit normal of segment segment (1-based) of pts on side ("left" / "right" of the travel).

tee_of(design, route) → str | None

The merge T at an end of route (an instance of TEE_CELL whose stem c the route ends on).

unmerge(design, tee) → tuple[str, tuple]

Remove merge T tee: its two halves become one route again (named as the first). Returns (that route,

Module Contents

qcc_kplugin.joins.arclength(pts, p) → tuple[float, int, tuple]

(arclength of the point of polyline pts nearest p, its segment (1-based), that point).

qcc_kplugin.joins.hanger_to_merge(design: dict, route: str, polyline_of, r: float, tee_params: dict | None = None) → str

Route route ends as a hanger coupler: merge it into that line with a T instead. Returns the T’s name.

qcc_kplugin.joins.merge(design: dict, host: str, polyline, point, side: str, r: float, tee_params: dict | None = None, tee: str | None = None) → dict

Split route host (built polyline, bend radius r) at the point nearest point with a T whose stem points to side of the line. Returns {"tee", "stem", "stem_pos", "stem_dir", "second"}: the T’s name, its stem port ("T1.c"), the stem port’s position and direction, and the name of the second half.

qcc_kplugin.joins.merge_to_hanger(design: dict, route: str, polyline_of, coupler: float = 300.0, ground_gap: float = 6.0, end: str = 'short') → str

Route route ends on a merge T’s stem: remove the T and end the route as a hanger coupler there instead. polyline_of(name) gives a built route’s polyline (the sidecar). Returns the line it now hangs from.

qcc_kplugin.joins.point_at(pts, s: float) → tuple

The point at arclength s along polyline pts.

qcc_kplugin.joins.side_normal(pts, segment: int, side: str) → tuple

Unit normal of segment segment (1-based) of pts on side (“left” / “right” of the travel).

qcc_kplugin.joins.tee_of(design: dict, route: str) → str | None

The merge T at an end of route (an instance of TEE_CELL whose stem c the route ends on).

qcc_kplugin.joins.unmerge(design: dict, tee: str) → tuple[str, tuple]

Remove merge T tee: its two halves become one route again (named as the first). Returns (that route, the T’s position).

qcc_kplugin.joins.TEE_ARM = 11.0
qcc_kplugin.joins.TEE_CELL = 'WaveguideCoplanarSplitter'