qcc_kplugin.design_ops

design.json edits behind the Edit menu’s rename / chip settings / junction / coupling / pad-edge actions.

Plain Python (no pya), so they are unit-tested outside KLayout; edits.py holds the dialogs and menu actions. Every function changes the design dict in place (and returns it, or a description) and raises ValueError with a message fit for the status bar.

Attributes

Functions

apply_pad_edge(design, names) → list[str]

place.edge = "auto" on these instances (absolute placements): the build slides each pad perpendicular to its

fix_junction_at_placement(design, inst, values) → str | None

A component placed with a junction gets its simulation / LOM values fixed in design.json

pad_edge_instances(drc) → list[str]

Instances named by the sidecar's pad_edge design warnings (a pad that is not at the PDK edge distance).

rename_instance(design, old, new) → dict

Rename instance old to new everywhere the design refers to it: routes' ends, snap placements, targets,

rename_route(design, old, new) → dict

Rename route old: hanger ends that hang off it, targets, sim groups, couplings follow.

set_chip(design[, name_chip, with_grid, size]) → list[str]

Chip settings: the label written on the die (chip.params.name_chip), the ground-plane grid

set_coupling(design, name, a, b[, kind, value, note]) → dict

A lumped element between two instances / routes the layout implies (couplings). kind C (fF), L (nH) or

set_junction(design, inst, lj_nh, cj_ff[, flux_phi0, asym]) → bool

The lumped junction values (LOM and simulation only, not fab values) of inst, merged into its existing

set_substrate(design, base_substrate, h, eps_r, tan_d) → str | None

The design's own substrate: design["pdk"] becomes "<pdk>+substrate(h=…,eps_r=…,tan_d=…)" with the

substrate_of(sidecar_pdk) → dict

{"h", "eps_r", "tan_d"} the design uses now (from the sidecar's pdk), PDK defaults when it has none.

Module Contents

qcc_kplugin.design_ops.apply_pad_edge(design: dict, names: list[str]) → list[str]

place.edge = "auto" on these instances (absolute placements): the build slides each pad perpendicular to its nearest die edge so its outer edge sits the PDK distance (100 µm) from it. Returns the names changed.

qcc_kplugin.design_ops.fix_junction_at_placement(design: dict, inst: str, values: dict | None) → str | None

A component placed with a junction gets its simulation / LOM values fixed in design.json (junction = {Lj_nH, Cj_fF}, from values: guiflow.placement_junction). An instance that has a junction already (a duplicate keeps its source’s) is left alone. Returns the status-bar note, or None.

qcc_kplugin.design_ops.pad_edge_instances(drc: list[dict]) → list[str]

Instances named by the sidecar’s pad_edge design warnings (a pad that is not at the PDK edge distance).

qcc_kplugin.design_ops.rename_instance(design: dict, old: str, new: str) → dict

Rename instance old to new everywhere the design refers to it: routes’ ends, snap placements, targets, sim groups, couplings. Order of instances is kept.

qcc_kplugin.design_ops.rename_route(design: dict, old: str, new: str) → dict

Rename route old: hanger ends that hang off it, targets, sim groups, couplings follow.

qcc_kplugin.design_ops.set_chip(design: dict, name_chip: str | None = None, with_grid: bool | None = None, size=None) → list[str]

Chip settings: the label written on the die (chip.params.name_chip), the ground-plane grid (with_grid), the die size = (width, height) µm (its lower left corner stays where it is). Returns what changed.

qcc_kplugin.design_ops.set_coupling(design: dict, name: str, a: str, b: str, kind: str = 'C', value: float | None = None, note: str = '') → dict

A lumped element between two instances / routes the layout implies (couplings). kind C (fF), L (nH) or wire (ports inst.port, no value).

qcc_kplugin.design_ops.set_junction(design: dict, inst: str, lj_nh: float | None, cj_ff: float | None, flux_phi0=KEEP, asym=KEEP) → bool

The lumped junction values (LOM and simulation only, not fab values) of inst, merged into its existing junction dict: Lj_nH (L_J0) and Cj_fF (None removes the key), and for a SQUID flux_phi0 (Φ/Φ0) and asym (d), which are written only when non-zero (zero removes the key; KEEP leaves the stored value). Keys this function does not know stay as they are. The junction entry goes when nothing is left in it. Returns True when design.json changed.

qcc_kplugin.design_ops.set_substrate(design: dict, base_substrate: dict, h: float, eps_r: float, tan_d: float) → str | None

The design’s own substrate: design["pdk"] becomes "<pdk>+substrate(h=…,eps_r=…,tan_d=…)" with the values that differ from the PDK’s base_substrate (all equal: the plain PDK name). Returns what changed, or None.

qcc_kplugin.design_ops.substrate_of(sidecar_pdk: dict) → dict

{“h”, “eps_r”, “tan_d”} the design uses now (from the sidecar’s pdk), PDK defaults when it has none.

qcc_kplugin.design_ops.KEEP
qcc_kplugin.design_ops.RESERVED = ('chip',)
qcc_kplugin.design_ops.SUBSTRATE_KEYS = ('h', 'eps_r', 'tan_d')