You can now show and hide distribution ports of an element.

This commit is contained in:
Dion Moult
2022-01-29 08:52:37 +11:00
parent 92a1739d93
commit 9279aeccf6
17 changed files with 194 additions and 18 deletions
+47
View File
@@ -29,6 +29,17 @@ class TestImplementsTool(NewFile):
assert isinstance(subject(), blenderbim.core.tool.System)
class TestDeleteElementObjects(NewFile):
def test_run(self):
ifc = ifcopenshell.file()
tool.Ifc().set(ifc)
obj = bpy.data.objects.new("Object", None)
element = ifc.createIfcWall()
tool.Ifc.link(element, obj)
subject.delete_element_objects([element])
assert not bpy.data.objects.get("Object")
class TestDisableEditingSystem(NewFile):
def test_run(self):
bpy.context.scene.BIMSystemProperties.active_system_id = 10
@@ -60,6 +71,16 @@ class TestExportSystemAttributes(NewFile):
}
class TestGetPorts(NewFile):
def test_run(self):
ifc = ifcopenshell.file()
tool.Ifc().set(ifc)
element = ifc.createIfcDuctSegment()
port = ifc.createIfcDistributionPort()
ifcopenshell.api.run("system.assign_port", ifc, element=element, port=port)
subject.get_ports(element) == [port]
class TestImportSystemAttributes(NewFile):
def test_importing_a_system(self):
ifc = ifcopenshell.file()
@@ -129,6 +150,32 @@ class TestImportSystems(NewFile):
assert props.systems[0].ifc_class == "IfcDistributionSystem"
class TestLoadPorts(NewFile):
def test_run(self):
ifc = ifcopenshell.api.run("project.create_file")
ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcProject")
ifcopenshell.api.run("unit.assign_unit", ifc)
tool.Ifc().set(ifc)
port = ifc.createIfcDistributionPort()
subject.load_ports([port])
obj = tool.Ifc.get_object(port)
assert obj
assert obj.users_collection
assert list(obj.location) == [0, 0, 0]
class TestSelectElements(NewFile):
def test_run(self):
ifc = ifcopenshell.file()
tool.Ifc().set(ifc)
element = ifcopenshell.api.run("root.create_entity", ifc, ifc_class="IfcPump")
obj = bpy.data.objects.new("Object", None)
bpy.context.scene.collection.objects.link(obj)
tool.Ifc.link(element, obj)
subject.select_elements([element])
assert obj in bpy.context.selected_objects
class TestSelectSystemProducts(NewFile):
def test_run(self):
ifc = ifcopenshell.file()