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

Method _select

cadquery/sketch.py:651–681  ·  view source on GitHub ↗
(
        self: T,
        s: Optional[Union[str, Selector]],
        kind: Literal["Faces", "Wires", "Edges", "Vertices"],
        tag: Optional[str] = None,
    )

Source from the content-addressed store, hash-verified

649 return list(tmp.values())
650
651 def _select(
652 self: T,
653 s: Optional[Union[str, Selector]],
654 kind: Literal["Faces", "Wires", "Edges", "Vertices"],
655 tag: Optional[str] = None,
656 ) -> T:
657
658 rv = []
659
660 if tag:
661 for el in self._tags[tag]:
662 rv.extend(getattr(el, kind)())
663 elif self._selection:
664 for el in self._selection:
665 if not isinstance(el, Location):
666 rv.extend(getattr(el, kind)())
667 else:
668 rv.extend(getattr(self._faces, kind)())
669 for el in self._edges:
670 rv.extend(getattr(el, kind)())
671
672 if s and isinstance(s, Selector):
673 filtered = s.filter(rv)
674 elif s and isinstance(s, str):
675 filtered = StringSyntaxSelector(s).filter(rv)
676 else:
677 filtered = rv
678
679 self._selection = self._unique(filtered)
680
681 return self
682
683 def tag(self: T, tag: str) -> T:
684 """

Callers 4

facesMethod · 0.95
wiresMethod · 0.95
edgesMethod · 0.95
verticesMethod · 0.95

Calls 4

_uniqueMethod · 0.95
extendMethod · 0.80
filterMethod · 0.45

Tested by

no test coverage detected