MCPcopy
hub / github.com/CadQuery/cadquery / _get_wire_lists

Function _get_wire_lists

cadquery/occ_impl/shapes.py:5194–5229  ·  view source on GitHub ↗

Get lists of wires for sweeping or lofting.

(s: Sequence[Shape])

Source from the content-addressed store, hash-verified

5192
5193
5194def _get_wire_lists(s: Sequence[Shape]) -> list[list[Wire | Vertex]]:
5195 """
5196 Get lists of wires for sweeping or lofting.
5197 """
5198
5199 wire_lists: list[list[Wire | Vertex]] = []
5200
5201 ix_last = len(s) - 1
5202
5203 for i, el in enumerate(s):
5204 if i == 0:
5205
5206 try:
5207 wire_lists = [[w] for w in _get_wires(el)]
5208 except ValueError:
5209 # if no wires were detected, try vertices
5210 wire_lists = [[v] for v in el.Vertices()]
5211
5212 # if not faces and vertices were detected return an empty list
5213 if not wire_lists:
5214 break
5215
5216 elif i == ix_last:
5217
5218 try:
5219 for wire_list, w in zip(wire_lists, _get_wires(el)):
5220 wire_list.append(w)
5221 except ValueError:
5222 for wire_list, v in zip(wire_lists, el.Vertices()):
5223 wire_list.append(v)
5224
5225 else:
5226 for wire_list, w in zip(wire_lists, _get_wires(el)):
5227 wire_list.append(w)
5228
5229 return wire_lists
5230
5231
5232def _get_wire_lists_strict(s: Sequence[Shape]) -> list[list[Wire]]:

Callers 1

loftFunction · 0.85

Calls 3

_get_wiresFunction · 0.85
appendMethod · 0.80
VerticesMethod · 0.45

Tested by

no test coverage detected