mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-18 11:20:21 +00:00
by_type now returns tuple - update annotations and fix failing tests
This commit is contained in:
@@ -678,7 +678,7 @@ class AddBoundary(bpy.types.Operator, tool.Ifc.Operator):
|
||||
|
||||
# Identify all potential building elements
|
||||
# TODO: don't select everything, use AABB culling in Blender
|
||||
building_elements = (
|
||||
building_elements = list(
|
||||
tool.Ifc.get().by_type("IfcWall")
|
||||
+ tool.Ifc.get().by_type("IfcSlab")
|
||||
+ tool.Ifc.get().by_type("IfcVirtualElement")
|
||||
|
||||
@@ -728,7 +728,7 @@ class file_mixin:
|
||||
[self.transaction.store_create(e) for e in reversed(added_elements)]
|
||||
return result
|
||||
|
||||
def by_type(self, type: str, include_subtypes=True) -> list[ifcopenshell.entity_instance]:
|
||||
def by_type(self, type: str, include_subtypes=True) -> tuple[ifcopenshell.entity_instance, ...]:
|
||||
"""Return IFC objects filtered by IFC Type and wrapped with the entity_instance class.
|
||||
|
||||
If an IFC type class has subclasses, all entities of those subclasses are also returned.
|
||||
@@ -746,7 +746,7 @@ class file_mixin:
|
||||
|
||||
def traverse(
|
||||
self, inst: ifcopenshell.entity_instance, max_levels: Optional[int] = None, breadth_first: bool = False
|
||||
) -> list[ifcopenshell.entity_instance]:
|
||||
) -> tuple[ifcopenshell.entity_instance, ...]:
|
||||
"""Get a list of all referenced instances for a particular instance including itself
|
||||
|
||||
:param inst: The entity instance to get all sub instances
|
||||
|
||||
@@ -75,7 +75,7 @@ class TestUnsharePsets(test.bootstrap.IFC4):
|
||||
rel.RelatedObjects = elements
|
||||
|
||||
ifcpatch.execute({"file": self.file, "recipe": "UnsharePsets", "arguments": ["IfcWall"]})
|
||||
assert len(psets := self.file.by_type("IfcPropertySet")) == 4
|
||||
assert len(psets := list(self.file.by_type("IfcPropertySet"))) == 4
|
||||
assert len(self.file.by_type("IfcRelDefinesByProperties")) == 4
|
||||
|
||||
psets.remove(shared_pset)
|
||||
|
||||
Reference in New Issue
Block a user