Remove single wire segments that directly short two pins of the same component. Only a segment whose *both* endpoints land exactly on pins of the same component is removed. This is the segment created when a component is placed or moved so that an existing wire passes direc
(self)
| 1172 | # ── junction sync ───────────────────────────────────────────────────────── |
| 1173 | |
| 1174 | def _remove_short_circuit_wires(self) -> None: |
| 1175 | """Remove single wire segments that directly short two pins of the same component. |
| 1176 | |
| 1177 | Only a segment whose *both* endpoints land exactly on pins of the same |
| 1178 | component is removed. This is the segment created when a component is |
| 1179 | placed or moved so that an existing wire passes directly between two of |
| 1180 | its pins; _split_through_wires() isolates that piece and this method |
| 1181 | cleans it up. |
| 1182 | |
| 1183 | Multi-hop paths (intentional connections such as a bulk–source tie |
| 1184 | routed with an elbow or through an intermediate node) are left intact. |
| 1185 | """ |
| 1186 | changed = True |
| 1187 | while changed: |
| 1188 | changed = False |
| 1189 | comps = [i for i in self.items() if isinstance(i, ComponentItem)] |
| 1190 | pin_to_comp: dict[tuple, ComponentItem] = {} |
| 1191 | for comp in comps: |
| 1192 | for p in comp.pin_scene_pos(): |
| 1193 | pin_to_comp[_pt_key(p)] = comp |
| 1194 | |
| 1195 | for w in list(self.items()): |
| 1196 | if not isinstance(w, WireItem): |
| 1197 | continue |
| 1198 | k0 = _pt_key(w.points[0]) |
| 1199 | kn = _pt_key(w.points[-1]) |
| 1200 | if k0 == kn: |
| 1201 | continue # zero-length wire, handled elsewhere |
| 1202 | c0 = pin_to_comp.get(k0) |
| 1203 | cn = pin_to_comp.get(kn) |
| 1204 | if c0 is not None and c0 is cn: |
| 1205 | self.removeItem(w) |
| 1206 | changed = True |
| 1207 | break # restart with a fresh scene snapshot |
| 1208 | |
| 1209 | def _merge_collinear_wires(self) -> None: |
| 1210 | """Remove duplicate wire segments and fuse collinear adjacent pairs. |
no test coverage detected