Fix #2274. You can now purge unused types.

This commit is contained in:
Dion Moult
2023-02-13 15:20:56 +11:00
parent 7d979e5a04
commit 007d984baf
11 changed files with 109 additions and 9 deletions
+25
View File
@@ -114,6 +114,14 @@ class TestGetIfcRepresentationClass(NewFile):
assert subject.get_ifc_representation_class(ifc.createIfcColumn()) is None
class TestGetModelTypes(NewFile):
def test_run(self):
ifc = ifcopenshell.file()
tool.Ifc.set(ifc)
wall_type = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWallType")
assert subject.get_model_types() == [wall_type]
class TestGetObjectData(NewFile):
def test_run(self):
data = bpy.data.meshes.new("Mesh")
@@ -139,6 +147,16 @@ class TestGetRepresentationContext(NewFile):
assert subject.get_representation_context(representation) == context
class TestGetTypeOccurrences(NewFile):
def test_run(self):
ifc = ifcopenshell.file()
tool.Ifc.set(ifc)
wall_type = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWallType")
wall = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcWall")
ifcopenshell.api.run("type.assign_type", ifc, related_object=wall, relating_type=wall_type)
assert subject.get_type_occurrences(wall_type) == (wall,)
class TestHasMaterialUsage(NewFile):
def test_getting_a_profile_set_usage(self):
ifc = ifcopenshell.file()
@@ -149,6 +167,13 @@ class TestHasMaterialUsage(NewFile):
assert subject.has_material_usage(element) is True
class TestRemoveObject(NewFile):
def test_run(self):
obj = bpy.data.objects.new("Object", None)
subject.remove_object(obj)
assert not bpy.data.objects.get("Object")
class TestRunGeometryAddRepresentation(NewFile):
def test_nothing(self):
pass