MCPcopy Index your code
hub / github.com/CadQuery/cadquery / _chooseSelector

Method _chooseSelector

cadquery/selectors.py:713–750  ·  view source on GitHub ↗

Sets up the underlying filters accordingly

(self, pr)

Source from the content-addressed store, hash-verified

711 self.mySelector = self._chooseSelector(parseResults)
712
713 def _chooseSelector(self, pr):
714 """
715 Sets up the underlying filters accordingly
716 """
717 if "only_dir" in pr:
718 vec = self._getVector(pr)
719 return DirectionSelector(vec)
720
721 elif "type_op" in pr:
722 return TypeSelector(pr.cq_type)
723
724 elif "dir_op" in pr:
725 vec = self._getVector(pr)
726 minmax = self.operatorMinMax[pr.dir_op]
727
728 if "index" in pr:
729 return DirectionNthSelector(
730 vec, int("".join(pr.index.asList())), minmax
731 )
732 else:
733 return DirectionMinMaxSelector(vec, minmax)
734
735 elif "center_nth_op" in pr:
736 vec = self._getVector(pr)
737 minmax = self.operatorMinMax[pr.center_nth_op]
738
739 if "index" in pr:
740 return CenterNthSelector(vec, int("".join(pr.index.asList())), minmax)
741 else:
742 return CenterNthSelector(vec, -1, minmax)
743
744 elif "other_op" in pr:
745 vec = self._getVector(pr)
746 return self.operator[pr.other_op](vec)
747
748 else:
749 args = self.namedViews[pr.named_view]
750 return DirectionMinMaxSelector(*args)
751
752 def _getVector(self, pr):
753 """

Callers 1

__init__Method · 0.95

Calls 6

_getVectorMethod · 0.95
DirectionSelectorClass · 0.85
TypeSelectorClass · 0.85
CenterNthSelectorClass · 0.85

Tested by

no test coverage detected