mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-09 13:52:23 +00:00
You can now show and hide distribution ports of an element.
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user