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

Method ancestors

cadquery/cq.py:994–1011  ·  view source on GitHub ↗

Select topological ancestors. :param kind: kind of ancestor, e.g. "Face" or "Edge" :param tag: if set, search the tagged object instead of self :return: a Workplane object whose stack contains selected ancestors.

(self: T, kind: Shapes, tag: Optional[str] = None)

Source from the content-addressed store, hash-verified

992 return self._selectObjects("Compounds", selector, tag)
993
994 def ancestors(self: T, kind: Shapes, tag: Optional[str] = None) -> T:
995 """
996 Select topological ancestors.
997
998 :param kind: kind of ancestor, e.g. "Face" or "Edge"
999 :param tag: if set, search the tagged object instead of self
1000 :return: a Workplane object whose stack contains selected ancestors.
1001
1002
1003 """
1004 ctx_solid = self.findSolid()
1005 objects = self._getTagged(tag).objects if tag else self.objects
1006
1007 results = [
1008 el.ancestors(ctx_solid, kind) for el in objects if isinstance(el, Shape)
1009 ]
1010
1011 return self.newObject(set(el for res in results for el in res))
1012
1013 def siblings(self: T, kind: Shapes, level: int = 1, tag: Optional[str] = None) -> T:
1014 """

Callers 1

test_iteratorsMethod · 0.45

Calls 3

findSolidMethod · 0.95
_getTaggedMethod · 0.95
newObjectMethod · 0.95

Tested by 1

test_iteratorsMethod · 0.36