MCPcopy Create free account
hub / github.com/IfcOpenShell/IfcOpenShell / traverse

Method traverse

src/ifcopenshell-python/ifcopenshell/file.py:882–900  ·  view source on GitHub ↗

Get a list of all referenced instances for a particular instance including itself :param inst: The entity instance to get all sub instances :param max_levels: How far deep to recursively fetch sub instances. None or -1 means infinite. :param breadth_first: Whether to use bre

(
        self, inst: ifcopenshell.entity_instance, max_levels: Optional[int] = None, breadth_first: bool = False
    )

Source from the content-addressed store, hash-verified

880 return [entity_instance(e, self) for e in self.wrapped_data.by_type_excl_subtypes(type)]
881
882 def traverse(
883 self, inst: ifcopenshell.entity_instance, max_levels: Optional[int] = None, breadth_first: bool = False
884 ) -> list[ifcopenshell.entity_instance]:
885 """Get a list of all referenced instances for a particular instance including itself
886
887 :param inst: The entity instance to get all sub instances
888 :param max_levels: How far deep to recursively fetch sub instances. None or -1 means infinite.
889 :param breadth_first: Whether to use breadth-first search, the default is depth-first.
890 :returns: A list of ifcopenshell.entity_instance objects
891 """
892 if max_levels is None:
893 max_levels = -1
894
895 if breadth_first:
896 fn = self.wrapped_data.traverse_breadth_first
897 else:
898 fn = self.wrapped_data.traverse
899
900 return [entity_instance(e, self) for e in fn(inst.wrapped_data, max_levels)]
901
902 @overload
903 def get_inverse(

Calls 2

entity_instanceClass · 0.90
fnFunction · 0.85