MCPcopy Create free account
hub / github.com/SLiCAP/SLiCAP_python / _split_wire_at

Method _split_wire_at

SLiCAP/schematic/canvas.py:1053–1068  ·  view source on GitHub ↗

Split wire at an interior position, creating two sub-segments.

(self, wire, pt_key: tuple)

Source from the content-addressed store, hash-verified

1051 return None
1052
1053 def _split_wire_at(self, wire, pt_key: tuple) -> None:
1054 """Split wire at an interior position, creating two sub-segments."""
1055 pt = QPointF(pt_key[0], pt_key[1])
1056 pts = wire.points
1057 # Check intermediate elbow vertices first
1058 for idx in range(1, len(pts) - 1):
1059 if _pt_key(pts[idx]) == pt_key:
1060 self._do_wire_split(wire, list(pts[:idx + 1]), list(pts[idx:]))
1061 return
1062 # Split a segment interior
1063 for i in range(len(pts) - 1):
1064 if _pt_on_segment(pt_key[0], pt_key[1], pts[i], pts[i + 1]):
1065 self._do_wire_split(wire,
1066 list(pts[:i + 1]) + [pt],
1067 [pt] + list(pts[i + 1:]))
1068 return
1069
1070 def _do_wire_split(self, wire, pts1: list, pts2: list) -> None:
1071 net_name = wire.net_name

Callers 1

_split_through_wiresMethod · 0.95

Calls 3

_do_wire_splitMethod · 0.95
_pt_on_segmentFunction · 0.85
_pt_keyFunction · 0.70

Tested by

no test coverage detected