mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-17 22:11:36 +00:00
You can now connect, disconnect, and set flow directions of distribution ports in Blender.
This commit is contained in:
@@ -113,3 +113,14 @@ class TestAddPort:
|
||||
system.run_root_assign_class(obj="obj", ifc_class="IfcDistributionPort").should_be_called().will_return("port")
|
||||
ifc.run("system.assign_port", element="element", port="port").should_be_called()
|
||||
subject.add_port(ifc, system, element="element")
|
||||
|
||||
|
||||
class TestSetFlowDirection:
|
||||
def test_run(self, ifc, system):
|
||||
system.get_connected_port("port").should_be_called().will_return("port2")
|
||||
ifc.run("system.connect_port", port1="port", port2="port2", direction="direction").should_be_called()
|
||||
subject.set_flow_direction(ifc, system, port="port", direction="direction")
|
||||
|
||||
def test_do_not_set_a_direction_if_port_is_not_connected(self, ifc, system):
|
||||
system.get_connected_port("port").should_be_called().will_return(None)
|
||||
subject.set_flow_direction(ifc, system, port="port", direction="direction")
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
@@ -36,9 +36,8 @@ class TestCreateEmptyAtCursorWithElementOrientation(NewFile):
|
||||
obj = bpy.data.objects.new("Object", None)
|
||||
element = ifc.createIfcWall()
|
||||
tool.Ifc.link(element, obj)
|
||||
bpy.context.scene.cursor.matrix.translation[0] = 5
|
||||
obj = subject.create_empty_at_cursor_with_element_orientation(element)
|
||||
assert obj.matrix_world.translation[0] == 5
|
||||
assert obj.matrix_world == bpy.context.scene.cursor.matrix
|
||||
|
||||
|
||||
class TestDeleteElementObjects(NewFile):
|
||||
@@ -83,6 +82,16 @@ class TestExportSystemAttributes(NewFile):
|
||||
}
|
||||
|
||||
|
||||
class TestGetConnectedPort(NewFile):
|
||||
def test_run(self):
|
||||
ifc = ifcopenshell.file()
|
||||
port1 = ifcopenshell.api.run("system.add_port", ifc)
|
||||
port2 = ifcopenshell.api.run("system.add_port", ifc)
|
||||
ifcopenshell.api.run("system.connect_port", ifc, port1=port1, port2=port2)
|
||||
assert subject.get_connected_port(port1) == port2
|
||||
assert subject.get_connected_port(port2) == port1
|
||||
|
||||
|
||||
class TestGetPorts(NewFile):
|
||||
def test_run(self):
|
||||
ifc = ifcopenshell.file()
|
||||
|
||||
Reference in New Issue
Block a user