(shapes: Iterable[Shape], level: int)
| 1769 | exclude = TopTools_MapOfShape() |
| 1770 | |
| 1771 | def _siblings(shapes: Iterable[Shape], level: int) -> set[Shape]: |
| 1772 | |
| 1773 | rv: set[Shape] = set() |
| 1774 | |
| 1775 | for s in shapes: |
| 1776 | exclude.Add(s.wrapped) |
| 1777 | |
| 1778 | for s in shapes: |
| 1779 | |
| 1780 | rv.update( |
| 1781 | Shape.cast(el) |
| 1782 | for child in s._entities(kind) |
| 1783 | for el in shape_map.FindFromKey(child) |
| 1784 | if not exclude.Contains(el) |
| 1785 | ) |
| 1786 | |
| 1787 | return rv if level == 1 else _siblings(rv, level - 1) |
| 1788 | |
| 1789 | # simple query |
| 1790 | if isinstance(level, int): |